Loading
#openttdcoop - Paste
Archives
Trending
Docs
Login
ABAP
ActionScript
ActionScript 3
Ada
AIMMS3
ALGOL 68
Apache configuration
AppleScript
Apt sources
ARM ASSEMBLER
ASM
ASP
asymptote
Autoconf
Autohotkey
AutoIt
AviSynth
awk
BASCOM AVR
Bash
Basic4GL
BibTeX
BlitzBasic
bnf
Boo
Brainfuck
C
C#
C (LoadRunner)
C (Mac)
C (WinAPI)
C++
C++ (Qt)
C++ (WinAPI)
CAD DCL
CAD Lisp
CFDG
ChaiScript
Chapel
CIL
Clojure
CMake
COBOL
CoffeeScript
ColdFusion
CSS
Cuesheet
D
Dart
DCL
DCPU-16 Assembly
DCS
Delphi
Diff
DIV
DOS
dot
E
ECMAScript
Eiffel
eMail (mbox)
EPC
Erlang
Euphoria
EZT
F#
Falcon
FO (abas-ERP)
Formula One
Fortran
FreeBasic
FreeSWITCH
GADV 4CS
GAMBAS
GDB
genero
Genie
glSlang
GML
GNU/Octave
GNU Gettext
GNU make
Gnuplot
Go
Groovy
GwBasic
Haskell
Haxe
HicEst
HQ9+
HTML
HTML5
Icon
INI
Inno
INTERCAL
Io
ISPF Panel
J
Java
Java(TM) 2 Platform Standard Edition 5.0
Javascript
JCL
jQuery
KiXtart
KLone C
KLone C++
LaTeX
LDIF
Liberty BASIC
Lisp
LLVM Intermediate Representation
Locomotive Basic
Logtalk
LOLcode
Lotus Notes @Formulas
LotusScript
LScript
LSL2
Lua
MagikSF
MapBasic
Matlab M
Microchip Assembler
Microsoft Registry
mIRC Scripting
MMIX
Modula-2
Modula-3
MOS 6502 (6510) ACME Cross Assembler format
MOS 6502 (6510) Kick Assembler format
MOS 6502 (6510) TASM/64TASS 1.46 Assembler format
Motorola 68000 - HiSoft Devpac ST 2 Assembler format
Motorola 68000 Assembler
MXML
MySQL
Nagios
NetRexx
newlisp
nginx
Nimrod
NML NewGRF Meta Language
NSIS
Oberon-2
Objeck Programming Language
Objective-C
OCaml
OCaml (brief)
ooRexx
OpenBSD Packet Filter
OpenOffice.org Basic
Oracle 8 SQL
Oracle 11 SQL
Oxygene
OZ
ParaSail
PARI/GP
Pascal
PCRE
per
Perl
Perl 6
PHP
PHP (brief)
PIC16
Pike
Pixel Bender 1.0
PL/I
PL/SQL
PostgreSQL
PostScript
POVRAY
PowerBuilder
PowerShell
ProFTPd configuration
Progress
Prolog
PROPERTIES
ProvideX
Puppet
PureBasic
Python
Python for S60
q/kdb+
QBasic/QuickBASIC
QML
R / S+
Racket
Rails
RBScript
REBOL
rexx
robots.txt
RPM Specification File
Ruby
Rust
SAS
Scala
Scheme
SciLab
SCL
sdlBasic
Smalltalk
Smarty
SPARK
SPARQL
SQL
Squirrel Script
Squirrel Script with OpenTTD AI/GS
StandardML
StoneScript
SystemVerilog
T-SQL
TCL
Tera Term Macro
Text
thinBasic
TypoScript
Unicon (Unified Extended Dialect of Icon)
Uno Idl
Unreal Script
UPC
Urbi
Vala
vb.net
VBScript
Vedit macro language
Verilog
VHDL
Vim Script
Visual Basic
Visual Fox Pro
Visual Prolog
Whitespace
Whois (RPSL format)
Winbatch
X++
XBasic
XML
Xorg configuration
YAML
ZiLOG Z80 Assembler
ZXBasic
diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index 57ba0ae..e661fdb 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -227,6 +227,7 @@ public: BottomToolbarWindow(); Point32 OnInitialPosition() override; + Point32 OnReposition() override; void SetWidgetStringParameters(WidgetNumber wid_num) const override; void OnChange(ChangeCode code, uint32 parameter) override; void UpdateWidgetSize(WidgetNumber wid_num, BaseWidget *wid) override; @@ -238,16 +239,15 @@ public: * @ingroup gui_group */ enum BottomToolbarGuiWidgets { - BTB_STATUS, ///< Status panel containing cash and rating readout. + BTB_MONEY, ///< Status panel containing the amount of cash. BTB_WEATHER, ///< Weather sprite. - BTB_TEMPERATURE, ///< Temperature in the park. - BTB_SPACING, ///< Status panel containing nothing (yet). + BTB_NEWS, ///< Status panel containing nothing (yet). BTB_VIEW_DIRECTION, ///< Status panel containing viewing direction. BTB_DATE, ///< Status panel containing date. + BTB_TEMPERATURE, ///< Temperature in the park. }; -static const uint32 BOTTOM_BAR_HEIGHT = 35; ///< Minimum Y-coord size of the bottom toolbar (BTB) panel. -static const uint32 BOTTOM_BAR_POSITION_X = 75; ///< Separation of the toolbar from the edge of the window. +static const uint32 BOTTOM_BAR_HEIGHT = 50; ///< Minimum Y-coord size of the bottom toolbar (BTB) panel. /** * Widget parts of the bottom toolbar GUI. @@ -256,17 +256,22 @@ static const uint32 BOTTOM_BAR_POSITION_X = 75; ///< Separation of the toolbar f * @todo Implement non-minimal default window size to prevent the need to compute remaining space manually. */ static const WidgetPart _bottom_toolbar_widgets[] = { - Intermediate(0, 1), + Intermediate(1, 0), + Widget(WT_PANEL, INVALID_WIDGET_INDEX, COL_RANGE_ORANGE_BROWN), + Intermediate(0, 1), // Money, guests, rating + Widget(WT_CENTERED_TEXT, BTB_MONEY, COL_RANGE_ORANGE_BROWN), SetPadding(3, 5, 3, 0), SetData(STR_ARG1, STR_NULL), + EndContainer(), Widget(WT_PANEL, INVALID_WIDGET_INDEX, COL_RANGE_ORANGE_BROWN), - Intermediate(1, 0), SetPadding(0, 3, 0, 3), - Widget(WT_LEFT_TEXT, BTB_STATUS, COL_RANGE_ORANGE_BROWN), SetPadding(3, 5, 30, 0), SetData(STR_ARG1, STR_NULL), - SetMinimalSize(1, BOTTOM_BAR_HEIGHT), // Temp X value - Widget(WT_EMPTY, BTB_WEATHER, COL_RANGE_ORANGE_BROWN), SetPadding(3, 3, 3, 3), SetFill(0, 1), - Widget(WT_RIGHT_TEXT, BTB_TEMPERATURE, COL_RANGE_ORANGE_BROWN), SetFill(1, 0), SetData(STR_ARG1, STR_NULL), - Widget(WT_EMPTY, BTB_SPACING, COL_RANGE_ORANGE_BROWN), SetMinimalSize(1, BOTTOM_BAR_HEIGHT), // Temp X value - Widget(WT_EMPTY, BTB_VIEW_DIRECTION, COL_RANGE_ORANGE_BROWN), SetMinimalSize(1, BOTTOM_BAR_HEIGHT), // Temp X value - Widget(WT_RIGHT_TEXT, BTB_DATE, COL_RANGE_ORANGE_BROWN), SetPadding(3, 0, 30, 0), SetData(STR_ARG1, STR_NULL), - SetMinimalSize(1, BOTTOM_BAR_HEIGHT), // Temp X value + Intermediate(0, 1), // News + Widget(WT_EMPTY, BTB_NEWS, COL_RANGE_ORANGE_BROWN), SetFill(1, 1), SetResize(1, 0), + EndContainer(), + Widget(WT_PANEL, INVALID_WIDGET_INDEX, COL_RANGE_ORANGE_BROWN), + Intermediate(2, 1), // Weather, date, draw direction + Widget(WT_RIGHT_TEXT, BTB_DATE, COL_RANGE_ORANGE_BROWN), SetPadding(3, 0, 3, 0), SetData(STR_ARG1, STR_NULL), + Intermediate(1, 3), + Widget(WT_EMPTY, BTB_VIEW_DIRECTION, COL_RANGE_ORANGE_BROWN), + Widget(WT_RIGHT_TEXT, BTB_TEMPERATURE, COL_RANGE_ORANGE_BROWN), SetFill(1, 0), SetData(STR_ARG1, STR_NULL), + Widget(WT_EMPTY, BTB_WEATHER, COL_RANGE_ORANGE_BROWN), SetPadding(3, 3, 3, 3), SetFill(0, 1), EndContainer(), EndContainer(), }; @@ -278,16 +283,19 @@ BottomToolbarWindow::BottomToolbarWindow() : GuiWindow(WC_BOTTOM_TOOLBAR, ALL_WI Point32 BottomToolbarWindow::OnInitialPosition() { - static Point32 pt; - pt.x = BOTTOM_BAR_POSITION_X; - pt.y = _video.GetYSize() - BOTTOM_BAR_HEIGHT; - return pt; + return Point32(0, _video.GetYSize() - BOTTOM_BAR_HEIGHT); +} + +Point32 BottomToolbarWindow::OnReposition() +{ + this->ResetSize(); + return this->OnInitialPosition(); } void BottomToolbarWindow::SetWidgetStringParameters(WidgetNumber wid_num) const { switch (wid_num) { - case BTB_STATUS: + case BTB_MONEY: _finances_manager.CashToStrParams(); break; @@ -314,7 +322,7 @@ void BottomToolbarWindow::UpdateWidgetSize(WidgetNumber wid_num, BaseWidget *wid Point32 p(0, 0); switch (wid_num) { - case BTB_STATUS: + case BTB_MONEY: p = GetMoneyStringSize(LARGE_MONEY_AMOUNT); break; @@ -335,17 +343,17 @@ void BottomToolbarWindow::UpdateWidgetSize(WidgetNumber wid_num, BaseWidget *wid GetTextSize(STR_ARG1, &p.x, &p.y); break; - case BTB_SPACING: { + case BTB_NEWS: { _str_params.SetNumber(1, LARGE_TEMPERATURE); Point32 temp_size; GetTextSize(STR_ARG1, &temp_size.x, &temp_size.y); - int32 remaining = _video.GetXSize() - (2 * BOTTOM_BAR_POSITION_X); - remaining -= temp_size.x; - remaining -= _sprite_manager.GetTableSpriteSize(SPR_GUI_WEATHER_START).width; + int32 remaining = _video.GetXSize(); remaining -= GetMoneyStringSize(LARGE_MONEY_AMOUNT).x; - remaining -= GetMaxDateSize().x; - remaining -= _sprite_manager.GetTableSpriteSize(SPR_GUI_COMPASS_START).base.x; // It's the same size for all compass sprites. + /* Temperature + weather sprite are below date */ + remaining -= std::max(temp_size.x + _sprite_manager.GetTableSpriteSize(SPR_GUI_WEATHER_START).width + + _sprite_manager.GetTableSpriteSize(SPR_GUI_COMPASS_START).width, + GetMaxDateSize().x); p = {remaining, (int32)BOTTOM_BAR_HEIGHT}; break; } diff --git a/src/window.cpp b/src/window.cpp index ae89188..09bd396 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -221,6 +221,11 @@ Point32 Window::OnInitialPosition() return compute_pos.FindPosition(this); } +Point32 Window::OnReposition() +{ + return this->OnInitialPosition(); +} + /** * Mark windows as being dirty (needing a repaint). * @todo Marking the whole display as needing a repaint is too crude. @@ -678,6 +683,8 @@ void WindowManager::ResetAllWindows() w->ResetSize(); w->SetSize(x_size, y_size); } + + this->RepositionAllWindows(); _video.MarkDisplayDirty(); } @@ -690,12 +697,24 @@ void WindowManager::RepositionAllWindows() Viewport *vp = GetViewport(); if (vp == nullptr) return; Rectangle32 vp_rect = vp->rect; + for (Window *w = this->top; w != nullptr; w = w->lower) { - if (w->wtype == WC_MAINDISPLAY) continue; - /* Add an arbitrary amount for closebox/titlebar, - * so the window is still actually accessible. */ - if (!vp_rect.IsPointInside(Point32(w->rect.base.x + 20, w->rect.base.y + 20)) || w->wtype == WC_BOTTOM_TOOLBAR) { - w->SetPosition(w->OnInitialPosition()); + switch(w->wtype) { + case WC_MAINDISPLAY: + break; + + case WC_TOOLBAR: + case WC_BOTTOM_TOOLBAR: + w->SetPosition(w->OnReposition()); + break; + + default: + /* Add an arbitrary amount for closebox/titlebar, + * so the window is still actually accessible. */ + if (!vp_rect.IsPointInside(Point32(w->rect.base.x + 20, w->rect.base.y + 20))) { + w->SetPosition(w->OnReposition()); + } + break; } } } diff --git a/src/window.h b/src/window.h index ee91933..3350bf0 100644 --- a/src/window.h +++ b/src/window.h @@ -137,6 +137,7 @@ public: void SetPosition(int x, int y); void SetPosition(Point32 pos); virtual Point32 OnInitialPosition(); + virtual Point32 OnReposition(); void MarkDirty();
Mark as private
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
forever