mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2026-07-22 18:49:40 +00:00
Codechange: Replace Alignment enum with struct
Alignment struct contains separate horizontal and vertical alignment members.
This commit is contained in:
committed by
Peter Nelson
parent
8e637cefed
commit
b4d16d319f
+4
-4
@@ -200,23 +200,23 @@ struct IConsoleWindow : Window
|
||||
int ypos = this->height - this->line_height - WidgetDimensions::scaled.hsep_normal;
|
||||
for (size_t line_index = IConsoleWindow::scroll; line_index < _iconsole_buffer.size(); line_index++) {
|
||||
const IConsoleLine &print = _iconsole_buffer[line_index];
|
||||
ypos = DrawStringMultiLine(WidgetDimensions::scaled.frametext.left, right, -this->line_height, ypos, GetString(STR_JUST_RAW_STRING, print.buffer), print.colour, SA_LEFT | SA_BOTTOM | SA_FORCE) - WidgetDimensions::scaled.hsep_normal;
|
||||
ypos = DrawStringMultiLine(WidgetDimensions::scaled.frametext.left, right, -this->line_height, ypos, GetString(STR_JUST_RAW_STRING, print.buffer), print.colour, {AlignmentH::ForceLeft, AlignmentV::Bottom}) - WidgetDimensions::scaled.hsep_normal;
|
||||
if (ypos < 0) break;
|
||||
}
|
||||
/* If the text is longer than the window, don't show the starting ']' */
|
||||
int delta = this->width - WidgetDimensions::scaled.frametext.right - cursor_width - this->line_offset - _iconsole_cmdline.pixels - ICON_RIGHT_BORDERWIDTH;
|
||||
if (delta > 0) {
|
||||
DrawString(WidgetDimensions::scaled.frametext.left, right, this->height - this->line_height, "]", CC_COMMAND, SA_LEFT | SA_FORCE);
|
||||
DrawString(WidgetDimensions::scaled.frametext.left, right, this->height - this->line_height, "]", CC_COMMAND, AlignmentH::ForceLeft);
|
||||
delta = 0;
|
||||
}
|
||||
|
||||
/* If we have a marked area, draw a background highlight. */
|
||||
if (_iconsole_cmdline.marklength != 0) GfxFillRect(this->line_offset + delta + _iconsole_cmdline.markxoffs, this->height - this->line_height, this->line_offset + delta + _iconsole_cmdline.markxoffs + _iconsole_cmdline.marklength, this->height - 1, PC_DARK_RED);
|
||||
|
||||
DrawString(this->line_offset + delta, right, this->height - this->line_height, _iconsole_cmdline.GetText(), CC_COMMAND, SA_LEFT | SA_FORCE);
|
||||
DrawString(this->line_offset + delta, right, this->height - this->line_height, _iconsole_cmdline.GetText(), CC_COMMAND, AlignmentH::ForceLeft);
|
||||
|
||||
if (_focused_window == this && _iconsole_cmdline.caret) {
|
||||
DrawString(this->line_offset + delta + _iconsole_cmdline.caretxoffs, right, this->height - this->line_height, "_", TextColour::White, SA_LEFT | SA_FORCE);
|
||||
DrawString(this->line_offset + delta + _iconsole_cmdline.caretxoffs, right, this->height - this->line_height, "_", TextColour::White, AlignmentH::ForceLeft);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user