diff options
-rw-r--r-- | src/lang/dutch.txt | 6 | ||||
-rw-r--r-- | src/lang/english.txt | 15 | ||||
-rw-r--r-- | src/lang/finnish.txt | 6 | ||||
-rw-r--r-- | src/lang/german.txt | 6 | ||||
-rw-r--r-- | src/lang/greek.txt | 6 | ||||
-rw-r--r-- | src/lang/italian.txt | 6 | ||||
-rw-r--r-- | src/lang/polish.txt | 6 | ||||
-rw-r--r-- | src/lang/portuguese.txt | 6 | ||||
-rw-r--r-- | src/lang/serbian.txt | 6 | ||||
-rw-r--r-- | src/lang/spanish.txt | 6 | ||||
-rw-r--r-- | src/timetable_gui.cpp | 34 |
11 files changed, 23 insertions, 80 deletions
diff --git a/src/lang/dutch.txt b/src/lang/dutch.txt index e0f9201d2..8fafc8b73 100644 --- a/src/lang/dutch.txt +++ b/src/lang/dutch.txt @@ -3162,15 +3162,9 @@ STR_TIMETABLE_SCHEDULED :{BLACK}Schema STR_TIMETABLE_EXPECTED_TOOLTIP :{BLACK}Wissel tussen verwacht and schema ### Do not separate or reorder ### -STR_TIMETABLE_ARRIVAL :A:{SETX 30}{STRING} -STR_TIMETABLE_ARRIVAL_EARLY :A:{SETX 30}{GREEN}{STRING} -STR_TIMETABLE_ARRIVAL_LATE :A:{SETX 30}{RED}{STRING} ##### ### Do not separate or reorder ### -STR_TIMETABLE_DEPARTURE :D:{SETX 30}{STRING} -STR_TIMETABLE_DEPARTURE_EARLY :D:{SETX 30}{GREEN}{STRING} -STR_TIMETABLE_DEPARTURE_LATE :D:{SETX 30}{RED}{STRING} ##### diff --git a/src/lang/english.txt b/src/lang/english.txt index fa83699fd..68f7cad15 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -3161,17 +3161,8 @@ STR_TIMETABLE_EXPECTED :{BLACK}Expected STR_TIMETABLE_SCHEDULED :{BLACK}Scheduled STR_TIMETABLE_EXPECTED_TOOLTIP :{BLACK}Switch between expected and schedule -### Do not separate or reorder ### -STR_TIMETABLE_ARRIVAL :A:{SETX 30}{STRING1} -STR_TIMETABLE_ARRIVAL_EARLY :A:{SETX 30}{GREEN}{STRING1} -STR_TIMETABLE_ARRIVAL_LATE :A:{SETX 30}{RED}{STRING1} -##### - -### Do not separate or reorder ### -STR_TIMETABLE_DEPARTURE :D:{SETX 30}{STRING1} -STR_TIMETABLE_DEPARTURE_EARLY :D:{SETX 30}{GREEN}{STRING1} -STR_TIMETABLE_DEPARTURE_LATE :D:{SETX 30}{RED}{STRING1} -##### +STR_TIMETABLE_ARRIVAL_ABBREVIATION :A: +STR_TIMETABLE_DEPARTURE_ABBREVIATION :D: # Date window (for timetable) @@ -4047,6 +4038,8 @@ STR_WHITE_SIGN :{WHITE}{SIGN} STR_TINY_BLACK_STATION :{TINYFONT}{BLACK}{STATION} STR_BLACK_STRING :{BLACK}{STRING} STR_BLACK_RAW_STRING :{BLACK}{RAW_STRING} +STR_GREEN_STRING :{GREEN}{STRING} +STR_RED_STRING :{RED}{STRING} STR_WHITE_STRING :{WHITE}{STRING} STR_TINY_BLACK_VEHICLE :{TINYFONT}{BLACK}{VEHICLE} STR_TINY_RIGHT_ARROW :{TINYFONT}{RIGHTARROW} diff --git a/src/lang/finnish.txt b/src/lang/finnish.txt index f2472cbff..629679c64 100644 --- a/src/lang/finnish.txt +++ b/src/lang/finnish.txt @@ -3162,15 +3162,9 @@ STR_TIMETABLE_SCHEDULED :{BLACK}Aikataul STR_TIMETABLE_EXPECTED_TOOLTIP :{BLACK}Vaihda odotetun ja aikataulun välillä ### Do not separate or reorder ### -STR_TIMETABLE_ARRIVAL :S:{SETX 30}{STRING} -STR_TIMETABLE_ARRIVAL_EARLY :S:{SETX 30}{GREEN}{STRING} -STR_TIMETABLE_ARRIVAL_LATE :S:{SETX 30}{RED}{STRING} ##### ### Do not separate or reorder ### -STR_TIMETABLE_DEPARTURE :L:{SETX 30}{STRING} -STR_TIMETABLE_DEPARTURE_EARLY :L:{SETX 30}{GREEN}{STRING} -STR_TIMETABLE_DEPARTURE_LATE :L:{SETX 30}{RED}{STRING} ##### diff --git a/src/lang/german.txt b/src/lang/german.txt index cd78df4eb..445d0ef0c 100644 --- a/src/lang/german.txt +++ b/src/lang/german.txt @@ -3163,15 +3163,9 @@ STR_TIMETABLE_SCHEDULED :{BLACK}Geplant STR_TIMETABLE_EXPECTED_TOOLTIP :{BLACK}Umschalten zwischen erwarteter Ankunftszeit und Fahrplan ### Do not separate or reorder ### -STR_TIMETABLE_ARRIVAL :Ankunft:{SETX 30}{STRING} -STR_TIMETABLE_ARRIVAL_EARLY :Ankunft:{SETX 30}{GREEN}{STRING} -STR_TIMETABLE_ARRIVAL_LATE :Ankunft:{SETX 30}{RED}{STRING} ##### ### Do not separate or reorder ### -STR_TIMETABLE_DEPARTURE :Abfahrt:{SETX 30}{STRING} -STR_TIMETABLE_DEPARTURE_EARLY :Abfahrt:{SETX 30}{GREEN}{STRING} -STR_TIMETABLE_DEPARTURE_LATE :Abfahrt:{SETX 30}{RED}{STRING} ##### diff --git a/src/lang/greek.txt b/src/lang/greek.txt index 80cfb618b..8245212d3 100644 --- a/src/lang/greek.txt +++ b/src/lang/greek.txt @@ -3259,15 +3259,9 @@ STR_TIMETABLE_SCHEDULED :{BLACK}Προγ STR_TIMETABLE_EXPECTED_TOOLTIP :{BLACK}Εναλλάγη μεταξύ αναμένομενης και προγραμματισμένης ### Do not separate or reorder ### -STR_TIMETABLE_ARRIVAL :ΑΦΙΞ:{SETX 30}{STRING} -STR_TIMETABLE_ARRIVAL_EARLY :ΑΦΙΞ:{SETX 30}{GREEN}{STRING} -STR_TIMETABLE_ARRIVAL_LATE :ΑΦΙΞ:{SETX 30}{RED}{STRING} ##### ### Do not separate or reorder ### -STR_TIMETABLE_DEPARTURE :ΑΝΑΧ:{SETX 30}{STRING} -STR_TIMETABLE_DEPARTURE_EARLY :ΑΝΑΧ:{SETX 30}{GREEN}{STRING} -STR_TIMETABLE_DEPARTURE_LATE :ΑΝΑΧ:{SETX 30}{RED}{STRING} ##### diff --git a/src/lang/italian.txt b/src/lang/italian.txt index 264d8936a..7c968ea1c 100644 --- a/src/lang/italian.txt +++ b/src/lang/italian.txt @@ -3160,15 +3160,9 @@ STR_TIMETABLE_SCHEDULED :{BLACK}Programm STR_TIMETABLE_EXPECTED_TOOLTIP :{BLACK}Alterna fra la visualizzazione degli orari attesi e degli orari programmati ### Do not separate or reorder ### -STR_TIMETABLE_ARRIVAL :A:{SETX 30}{STRING} -STR_TIMETABLE_ARRIVAL_EARLY :A:{SETX 30}{GREEN}{STRING} -STR_TIMETABLE_ARRIVAL_LATE :A:{SETX 30}{RED}{STRING} ##### ### Do not separate or reorder ### -STR_TIMETABLE_DEPARTURE :P:{SETX 30}{STRING} -STR_TIMETABLE_DEPARTURE_EARLY :P:{SETX 30}{GREEN}{STRING} -STR_TIMETABLE_DEPARTURE_LATE :P:{SETX 30}{RED}{STRING} ##### diff --git a/src/lang/polish.txt b/src/lang/polish.txt index bbdc63c31..44b9bbc36 100644 --- a/src/lang/polish.txt +++ b/src/lang/polish.txt @@ -3543,15 +3543,9 @@ STR_TIMETABLE_SCHEDULED :{BLACK}Schedule STR_TIMETABLE_EXPECTED_TOOLTIP :{BLACK}Switch between expected and schedule ### Do not separate or reorder ### -STR_TIMETABLE_ARRIVAL :A:{SETX 30}{STRING} -STR_TIMETABLE_ARRIVAL_EARLY :A:{SETX 30}{GREEN}{STRING} -STR_TIMETABLE_ARRIVAL_LATE :A:{SETX 30}{RED}{STRING} ##### ### Do not separate or reorder ### -STR_TIMETABLE_DEPARTURE :D:{SETX 30}{STRING} -STR_TIMETABLE_DEPARTURE_EARLY :D:{SETX 30}{GREEN}{STRING} -STR_TIMETABLE_DEPARTURE_LATE :D:{SETX 30}{RED}{STRING} ##### # AI debug window diff --git a/src/lang/portuguese.txt b/src/lang/portuguese.txt index 5d78a6352..67a8071fa 100644 --- a/src/lang/portuguese.txt +++ b/src/lang/portuguese.txt @@ -3161,15 +3161,9 @@ STR_TIMETABLE_SCHEDULED :{BLACK}Marcado STR_TIMETABLE_EXPECTED_TOOLTIP :{BLACK}Alterne entre tempo esperado e marcado ### Do not separate or reorder ### -STR_TIMETABLE_ARRIVAL :C:{SETX 30}{STRING} -STR_TIMETABLE_ARRIVAL_EARLY :C:{SETX 30}{GREEN}{STRING} -STR_TIMETABLE_ARRIVAL_LATE :C:{SETX 30}{RED}{STRING} ##### ### Do not separate or reorder ### -STR_TIMETABLE_DEPARTURE :P:{SETX 30}{STRING} -STR_TIMETABLE_DEPARTURE_EARLY :P:{SETX 30}{GREEN}{STRING} -STR_TIMETABLE_DEPARTURE_LATE :P:{SETX 30}{RED}{STRING} ##### diff --git a/src/lang/serbian.txt b/src/lang/serbian.txt index b20270d15..8a281867c 100644 --- a/src/lang/serbian.txt +++ b/src/lang/serbian.txt @@ -3357,15 +3357,9 @@ STR_TIMETABLE_SCHEDULED :{BLACK}Po planu STR_TIMETABLE_EXPECTED_TOOLTIP :{BLACK}Prebacivanje između prikaza očekivanog i po planu ### Do not separate or reorder ### -STR_TIMETABLE_ARRIVAL :D:{SETX 30}{STRING} -STR_TIMETABLE_ARRIVAL_EARLY :D:{SETX 30}{GREEN}{STRING} -STR_TIMETABLE_ARRIVAL_LATE :D:{SETX 30}{RED}{STRING} ##### ### Do not separate or reorder ### -STR_TIMETABLE_DEPARTURE :P:{SETX 30}{STRING} -STR_TIMETABLE_DEPARTURE_EARLY :P:{SETX 30}{GREEN}{STRING} -STR_TIMETABLE_DEPARTURE_LATE :P:{SETX 30}{RED}{STRING} ##### diff --git a/src/lang/spanish.txt b/src/lang/spanish.txt index a84a477e9..6e7986bb4 100644 --- a/src/lang/spanish.txt +++ b/src/lang/spanish.txt @@ -3159,15 +3159,9 @@ STR_TIMETABLE_SCHEDULED :{BLACK}Programa STR_TIMETABLE_EXPECTED_TOOLTIP :{BLACK}Alternar entre esperado y programado ### Do not separate or reorder ### -STR_TIMETABLE_ARRIVAL :Ll:{SETX 30}{STRING} -STR_TIMETABLE_ARRIVAL_EARLY :Ll:{SETX 30}{GREEN}{STRING} -STR_TIMETABLE_ARRIVAL_LATE :Ll:{SETX 30}{RED}{STRING} ##### ### Do not separate or reorder ### -STR_TIMETABLE_DEPARTURE :S:{SETX 30}{STRING} -STR_TIMETABLE_DEPARTURE_EARLY :S:{SETX 30}{GREEN}{STRING} -STR_TIMETABLE_DEPARTURE_LATE :S:{SETX 30}{RED}{STRING} ##### diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp index 7ad659f50..ce983b855 100644 --- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -170,6 +170,8 @@ struct TimetableWindow : Window { int sel_index; const Vehicle *vehicle; ///< Vehicle monitored by the window. bool show_expected; ///< Whether we show expected arrival or scheduled + uint deparr_time_width; ///< The width of the departure/arrival time + uint deparr_abbr_width; ///< The width of the departure/arrival abbreviation TimetableWindow(const WindowDesc *desc, WindowNumber window_number) : Window(), @@ -206,9 +208,10 @@ struct TimetableWindow : Window { { switch (widget) { case TTV_ARRIVAL_DEPARTURE_PANEL: - SetDParam(0, STR_JUST_DATE_TINY); - SetDParam(1, MAX_YEAR * DAYS_IN_YEAR); - size->width = GetStringBoundingBox(STR_TIMETABLE_ARRIVAL).width + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT; + SetDParam(0, MAX_YEAR * DAYS_IN_YEAR); + this->deparr_time_width = GetStringBoundingBox(STR_JUST_DATE_TINY).width; + this->deparr_abbr_width = max(GetStringBoundingBox(STR_TIMETABLE_ARRIVAL_ABBREVIATION).width, GetStringBoundingBox(STR_TIMETABLE_DEPARTURE_ABBREVIATION).width); + this->width = WD_FRAMERECT_LEFT + this->deparr_abbr_width + 10 + this->deparr_time_width + WD_FRAMERECT_RIGHT; /* fall through */ case TTV_ARRIVAL_DEPARTURE_SELECTION: case TTV_TIMETABLE_PANEL: @@ -410,15 +413,14 @@ struct TimetableWindow : Window { int y = r.top + WD_FRAMERECT_TOP; - Ticks offset; - StringID str_offset; - if (this->show_expected && v->lateness_counter > DAY_TICKS) { - offset = 0; - str_offset = STR_TIMETABLE_ARRIVAL_LATE - STR_TIMETABLE_ARRIVAL; - } else { - offset = -v->lateness_counter; - str_offset = 0; - } + bool show_late = this->show_expected && v->lateness_counter > DAY_TICKS; + Ticks offset = show_late ? 0 : -v->lateness_counter; + + bool rtl = _dynlang.text_dir == TD_RTL; + int abbr_left = rtl ? r.right - WD_FRAMERECT_RIGHT - this->deparr_abbr_width : r.left + WD_FRAMERECT_LEFT; + int abbr_right = rtl ? r.right - WD_FRAMERECT_RIGHT : r.left + WD_FRAMERECT_LEFT + this->deparr_abbr_width; + int time_left = rtl ? r.left + WD_FRAMERECT_LEFT : r.right - WD_FRAMERECT_RIGHT - this->deparr_time_width; + int time_right = rtl ? r.left + WD_FRAMERECT_LEFT + this->deparr_time_width : r.right - WD_FRAMERECT_RIGHT; for (int i = this->vscroll.GetPosition(); i / 2 < v->GetNumOrders(); ++i) { // note: i is also incremented in the loop /* Don't draw anything if it extends past the end of the window. */ @@ -426,18 +428,20 @@ struct TimetableWindow : Window { if (i % 2 == 0) { if (arr_dep[i / 2].arrival != INVALID_TICKS) { + DrawString(abbr_left, abbr_right, y, STR_TIMETABLE_ARRIVAL_ABBREVIATION, i == selected ? TC_WHITE : TC_BLACK); if (this->show_expected && i / 2 == earlyID) { SetArrivalDepartParams(0, 1, arr_dep[i / 2].arrival); - DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_TIMETABLE_ARRIVAL_EARLY, i == selected ? TC_WHITE : TC_BLACK); + DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_GREEN_STRING, i == selected ? TC_WHITE : TC_BLACK); } else { SetArrivalDepartParams(0, 1, arr_dep[i / 2].arrival + offset); - DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_TIMETABLE_ARRIVAL + str_offset, i == selected ? TC_WHITE : TC_BLACK); + DrawString(time_left, time_right, y, show_late ? STR_RED_STRING : STR_JUST_STRING, i == selected ? TC_WHITE : TC_BLACK); } } } else { if (arr_dep[i / 2].departure != INVALID_TICKS) { + DrawString(abbr_left, abbr_right, y, STR_TIMETABLE_DEPARTURE_ABBREVIATION, i == selected ? TC_WHITE : TC_BLACK); SetArrivalDepartParams(0, 1, arr_dep[i/2].departure + offset); - DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_TIMETABLE_DEPARTURE + str_offset, i == selected ? TC_WHITE : TC_BLACK); + DrawString(time_left, time_right, y, show_late ? STR_RED_STRING : STR_JUST_STRING, i == selected ? TC_WHITE : TC_BLACK); } } y += FONT_HEIGHT_NORMAL; |