Merge branch 'master' into jgrpp

# Conflicts:
#	src/blitter/32bpp_anim.cpp
#	src/blitter/8bpp_optimized.cpp
#	src/gfx.cpp
#	src/gfx_func.h
#	src/gfxinit.cpp
#	src/network/core/os_abstraction.cpp
#	src/spritecache.cpp
This commit is contained in:
Jonathan G Rennison
2023-12-28 16:01:08 +00:00
48 changed files with 852 additions and 371 deletions

View File

@@ -22,6 +22,7 @@
#include "../string_func.h"
#include "../settings_type.h"
#include "../command_func.h"
#include "../core/backup_type.hpp"
#include "script_gui.h"
#include "script_log.hpp"
@@ -817,8 +818,9 @@ struct ScriptDebugWindow : public Window {
SetWidgetsDisabledState(!this->show_break_box, WID_SCRD_BREAK_STR_ON_OFF_BTN, WID_SCRD_BREAK_STR_EDIT_BOX, WID_SCRD_MATCH_CASE_BTN);
this->hscroll->SetStepSize(10); // Speed up horizontal scrollbar
/* Restore the break string value from static variable */
/* Restore the break string value from static variable, and enable the filter. */
this->break_editbox.text.Assign(this->filter.break_string);
this->break_string_filter.SetFilterTerm(this->filter.break_string);
if (show_company == INVALID_COMPANY) {
this->SelectValidDebugCompany();
@@ -915,8 +917,19 @@ struct ScriptDebugWindow : public Window {
ScriptLogTypes::LogData &log = this->GetLogData();
if (log.empty()) return;
Rect br = r.Shrink(WidgetDimensions::scaled.bevel);
Rect tr = r.Shrink(WidgetDimensions::scaled.framerect);
Rect fr = r.Shrink(WidgetDimensions::scaled.framerect);
/* Setup a clipping rectangle... */
DrawPixelInfo tmp_dpi;
if (!FillDrawPixelInfo(&tmp_dpi, fr)) return;
/* ...but keep coordinates relative to the window. */
tmp_dpi.left += fr.left;
tmp_dpi.top += fr.top;
AutoRestoreBackup dpi_backup(_cur_dpi, &tmp_dpi);
fr.left -= this->hscroll->GetPosition();
for (int i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && (size_t)i < log.size(); i++) {
const ScriptLogTypes::LogLine &line = log[i];
@@ -932,12 +945,13 @@ struct ScriptDebugWindow : public Window {
/* Check if the current line should be highlighted */
if (i == this->highlight_row) {
GfxFillRect(br.left, tr.top, br.right, tr.top + this->resize.step_height - 1, PC_BLACK);
fr.bottom = fr.top + this->resize.step_height - 1;
GfxFillRect(fr, PC_BLACK);
if (colour == TC_BLACK) colour = TC_WHITE; // Make black text readable by inverting it to white.
}
DrawString(-this->hscroll->GetPosition(), tr.right, tr.top, line.text, colour, SA_LEFT | SA_FORCE);
tr.top += this->resize.step_height;
DrawString(fr, line.text, colour, SA_LEFT | SA_FORCE);
fr.top += this->resize.step_height;
}
}