mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r18192) -Codechange: make the music window RTL aware
This commit is contained in:
parent
0658ce739a
commit
16f270467f
Binary file not shown.
Binary file not shown.
|
@ -24,7 +24,7 @@ TRGI.GRF = da6a6c9dcc451eec88d79211437b76a8
|
||||||
TRGC.GRF = ed446637e034104c5559b32c18afe78d
|
TRGC.GRF = ed446637e034104c5559b32c18afe78d
|
||||||
TRGH.GRF = ee6616fb0e6ef6b24892c58c93d86fc9
|
TRGH.GRF = ee6616fb0e6ef6b24892c58c93d86fc9
|
||||||
TRGT.GRF = e30e8a398ae86c03dc534a8ac7dfb3b6
|
TRGT.GRF = e30e8a398ae86c03dc534a8ac7dfb3b6
|
||||||
OPENTTDD.GRF = bc1a26a490560e7ff9ba32e83c84f616
|
OPENTTDD.GRF = edccb7157beadc2e46585b5619b6c6af
|
||||||
|
|
||||||
[origin]
|
[origin]
|
||||||
default = You can find it on your Transport Tycoon Deluxe CD-ROM.
|
default = You can find it on your Transport Tycoon Deluxe CD-ROM.
|
||||||
|
|
|
@ -24,7 +24,7 @@ TRGI.GRF = da6a6c9dcc451eec88d79211437b76a8
|
||||||
TRGC.GRF = ed446637e034104c5559b32c18afe78d
|
TRGC.GRF = ed446637e034104c5559b32c18afe78d
|
||||||
TRGH.GRF = ee6616fb0e6ef6b24892c58c93d86fc9
|
TRGH.GRF = ee6616fb0e6ef6b24892c58c93d86fc9
|
||||||
TRGT.GRF = fcde1d7e8a74197d72a62695884b909e
|
TRGT.GRF = fcde1d7e8a74197d72a62695884b909e
|
||||||
OPENTTDD.GRF = bc1a26a490560e7ff9ba32e83c84f616
|
OPENTTDD.GRF = edccb7157beadc2e46585b5619b6c6af
|
||||||
|
|
||||||
[origin]
|
[origin]
|
||||||
default = You can find it on your Transport Tycoon Deluxe CD-ROM.
|
default = You can find it on your Transport Tycoon Deluxe CD-ROM.
|
||||||
|
|
|
@ -24,7 +24,7 @@ TRGIR.GRF = 0c2484ff6be49fc63a83be6ab5c38f32
|
||||||
TRGCR.GRF = 3668f410c761a050b5e7095a2b14879b
|
TRGCR.GRF = 3668f410c761a050b5e7095a2b14879b
|
||||||
TRGHR.GRF = 06bf2b7a31766f048baac2ebe43457b1
|
TRGHR.GRF = 06bf2b7a31766f048baac2ebe43457b1
|
||||||
TRGTR.GRF = de53650517fe661ceaa3138c6edb0eb8
|
TRGTR.GRF = de53650517fe661ceaa3138c6edb0eb8
|
||||||
OPENTTDW.GRF = 8966b8cf28818f1ccf3a40bdbc942172
|
OPENTTDW.GRF = e00cfc29af35890da813d74f104a4eb4
|
||||||
|
|
||||||
[origin]
|
[origin]
|
||||||
default = You can find it on your Transport Tycoon Deluxe CD-ROM.
|
default = You can find it on your Transport Tycoon Deluxe CD-ROM.
|
||||||
|
|
|
@ -493,6 +493,12 @@ struct MusicWindow : public Window {
|
||||||
d.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
|
d.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
|
||||||
*size = maxdim(*size, d);
|
*size = maxdim(*size, d);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
/* Hack-ish: set the proper widget data; only needs to be done once
|
||||||
|
* per (Re)Init as that's the only time the language changes. */
|
||||||
|
case MW_PREV: this->GetWidget<NWidgetCore>(MW_PREV)->widget_data = _dynlang.text_dir == TD_RTL ? SPR_IMG_SKIP_TO_NEXT : SPR_IMG_SKIP_TO_PREV; break;
|
||||||
|
case MW_NEXT: this->GetWidget<NWidgetCore>(MW_NEXT)->widget_data = _dynlang.text_dir == TD_RTL ? SPR_IMG_SKIP_TO_PREV : SPR_IMG_SKIP_TO_NEXT; break;
|
||||||
|
case MW_PLAY: this->GetWidget<NWidgetCore>(MW_PLAY)->widget_data = _dynlang.text_dir == TD_RTL ? SPR_IMG_PLAY_MUSIC_RTL : SPR_IMG_PLAY_MUSIC; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -543,7 +549,12 @@ struct MusicWindow : public Window {
|
||||||
DrawString(r.left, r.right, r.bottom - FONT_HEIGHT_SMALL, STR_MUSIC_MIN_MAX_RULER, TC_FROMSTRING, SA_CENTER);
|
DrawString(r.left, r.right, r.bottom - FONT_HEIGHT_SMALL, STR_MUSIC_MIN_MAX_RULER, TC_FROMSTRING, SA_CENTER);
|
||||||
y = (r.top + r.bottom - slider_height) / 2;
|
y = (r.top + r.bottom - slider_height) / 2;
|
||||||
byte volume = (widget == MW_MUSIC_VOL) ? msf.music_vol : msf.effect_vol;
|
byte volume = (widget == MW_MUSIC_VOL) ? msf.music_vol : msf.effect_vol;
|
||||||
int x = r.left + (volume * (r.right - r.left) / 127);
|
int x = (volume * (r.right - r.left) / 127);
|
||||||
|
if (_dynlang.text_dir == TD_RTL) {
|
||||||
|
x = r.right - x;
|
||||||
|
} else {
|
||||||
|
x += r.left;
|
||||||
|
}
|
||||||
DrawFrameRect(x, y, x + slider_width, y + slider_height, COLOUR_GREY, FR_NONE);
|
DrawFrameRect(x, y, x + slider_width, y + slider_height, COLOUR_GREY, FR_NONE);
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
@ -591,6 +602,7 @@ struct MusicWindow : public Window {
|
||||||
byte *vol = (widget == MW_MUSIC_VOL) ? &msf.music_vol : &msf.effect_vol;
|
byte *vol = (widget == MW_MUSIC_VOL) ? &msf.music_vol : &msf.effect_vol;
|
||||||
|
|
||||||
byte new_vol = x * 127 / this->GetWidget<NWidgetBase>(widget)->current_x;
|
byte new_vol = x * 127 / this->GetWidget<NWidgetBase>(widget)->current_x;
|
||||||
|
if (_dynlang.text_dir == TD_RTL) new_vol = 127 - new_vol;
|
||||||
if (new_vol != *vol) {
|
if (new_vol != *vol) {
|
||||||
*vol = new_vol;
|
*vol = new_vol;
|
||||||
if (widget == MW_MUSIC_VOL) MusicVolumeChanged(new_vol);
|
if (widget == MW_MUSIC_VOL) MusicVolumeChanged(new_vol);
|
||||||
|
|
|
@ -56,7 +56,7 @@ enum Sprites {
|
||||||
|
|
||||||
/* Extra graphic spritenumbers */
|
/* Extra graphic spritenumbers */
|
||||||
SPR_OPENTTD_BASE = 4896,
|
SPR_OPENTTD_BASE = 4896,
|
||||||
OPENTTD_SPRITE_COUNT = 150,
|
OPENTTD_SPRITE_COUNT = 151,
|
||||||
|
|
||||||
/* Halftile-selection sprites */
|
/* Halftile-selection sprites */
|
||||||
SPR_HALFTILE_SELECTION_FLAT = SPR_OPENTTD_BASE,
|
SPR_HALFTILE_SELECTION_FLAT = SPR_OPENTTD_BASE,
|
||||||
|
@ -71,6 +71,7 @@ enum Sprites {
|
||||||
SPR_WARNING_SIGN = SPR_OPENTTD_BASE + 43, // warning sign (shown if there are any newgrf errors)
|
SPR_WARNING_SIGN = SPR_OPENTTD_BASE + 43, // warning sign (shown if there are any newgrf errors)
|
||||||
SPR_WINDOW_RESIZE_RIGHT= SPR_OPENTTD_BASE + 44, // resize icon to the right
|
SPR_WINDOW_RESIZE_RIGHT= SPR_OPENTTD_BASE + 44, // resize icon to the right
|
||||||
SPR_WINDOW_RESIZE_LEFT = SPR_OPENTTD_BASE + 149, // resize icon to the left
|
SPR_WINDOW_RESIZE_LEFT = SPR_OPENTTD_BASE + 149, // resize icon to the left
|
||||||
|
SPR_IMG_PLAY_MUSIC_RTL = SPR_OPENTTD_BASE + 150, // play music button, but then for RTL users
|
||||||
/* Arrow icons pointing in all 4 directions */
|
/* Arrow icons pointing in all 4 directions */
|
||||||
SPR_ARROW_DOWN = SPR_OPENTTD_BASE + 45,
|
SPR_ARROW_DOWN = SPR_OPENTTD_BASE + 45,
|
||||||
SPR_ARROW_UP = SPR_OPENTTD_BASE + 46,
|
SPR_ARROW_UP = SPR_OPENTTD_BASE + 46,
|
||||||
|
|
Loading…
Reference in New Issue