Merge branch 'master' into jgrpp

# Conflicts:
#	cmake/SourceList.cmake
#	src/build_vehicle_gui.cpp
#	src/company_gui.cpp
#	src/console_cmds.cpp
#	src/depot_base.h
#	src/elrail.cpp
#	src/network/core/udp.cpp
#	src/network/network_admin.cpp
#	src/network/network_chat_gui.cpp
#	src/network/network_gui.cpp
#	src/network/network_server.cpp
#	src/newgrf.cpp
#	src/newgrf_engine.cpp
#	src/newgrf_railtype.cpp
#	src/newgrf_railtype.h
#	src/newgrf_storage.h
#	src/os/unix/crashlog_unix.cpp
#	src/rail.h
#	src/rail_cmd.cpp
#	src/rail_gui.cpp
#	src/road_cmd.cpp
#	src/road_map.h
#	src/saveload/labelmaps_sl.cpp
#	src/settings_gui.cpp
#	src/settings_type.h
#	src/sl/oldloader_sl.cpp
#	src/station_cmd.cpp
#	src/station_gui.cpp
#	src/table/settings/world_settings.ini
#	src/tests/test_script_admin.cpp
#	src/textfile_gui.cpp
#	src/toolbar_gui.cpp
#	src/train_cmd.cpp
#	src/tunnelbridge_cmd.cpp
#	src/vehicle_gui.cpp
#	src/widget.cpp
#	src/window.cpp
#	src/window_gui.h
#	src/window_type.h
This commit is contained in:
Jonathan G Rennison
2023-11-19 12:19:17 +00:00
230 changed files with 2458 additions and 1106 deletions

View File

@@ -102,14 +102,14 @@ std::string _windows_file;
/** Window description constructor. */
WindowDesc::WindowDesc(WindowPosition def_pos, const char *ini_key, int16 def_width_trad, int16 def_height_trad,
WindowClass window_class, WindowClass parent_class, uint32 flags,
const NWidgetPart *nwid_parts, int16 nwid_length, HotkeyList *hotkeys, WindowDesc *ini_parent) :
const NWidgetPart *nwid_begin, const NWidgetPart *nwid_end, HotkeyList *hotkeys, WindowDesc *ini_parent) :
default_pos(def_pos),
cls(window_class),
parent_cls(parent_class),
ini_key(ini_key),
flags(flags),
nwid_parts(nwid_parts),
nwid_length(nwid_length),
nwid_begin(nwid_begin),
nwid_end(nwid_end),
hotkeys(hotkeys),
ini_parent(ini_parent),
prefs({ false, 0, 0 }),
@@ -369,40 +369,13 @@ void Window::UpdateQueryStringSize()
}
/**
* Get the current input text if an edit box has the focus.
* @return The currently focused input text or nullptr if no input focused.
* Get the current input text buffer.
* @return The currently focused input text buffer or nullptr if no input focused.
*/
/* virtual */ const char *Window::GetFocusedText() const
/* virtual */ const Textbuf *Window::GetFocusedTextbuf() const
{
if (this->nested_focus != nullptr && this->nested_focus->type == WWT_EDITBOX) {
return this->GetQueryString(this->nested_focus->index)->GetText();
}
return nullptr;
}
/**
* Get the string at the caret if an edit box has the focus.
* @return The text at the caret or nullptr if no edit box is focused.
*/
/* virtual */ const char *Window::GetCaret() const
{
if (this->nested_focus != nullptr && this->nested_focus->type == WWT_EDITBOX) {
return this->GetQueryString(this->nested_focus->index)->GetCaret();
}
return nullptr;
}
/**
* Get the range of the currently marked input text.
* @param[out] length Length of the marked text.
* @return Pointer to the start of the marked text or nullptr if no text is marked.
*/
/* virtual */ const char *Window::GetMarkedText(size_t *length) const
{
if (this->nested_focus != nullptr && this->nested_focus->type == WWT_EDITBOX) {
return this->GetQueryString(this->nested_focus->index)->GetMarkedText(length);
return &this->GetQueryString(this->nested_focus->index)->text;
}
return nullptr;
@@ -1917,7 +1890,7 @@ static Point LocalGetWindowPlacement(const WindowDesc *desc, int16 sm_width, int
void Window::CreateNestedTree(bool fill_nested)
{
int biggest_index = -1;
this->nested_root = MakeWindowNWidgetTree(this->window_desc->nwid_parts, this->window_desc->nwid_length, &biggest_index, &this->shade_select);
this->nested_root = MakeWindowNWidgetTree(this->window_desc->nwid_begin, this->window_desc->nwid_end, &biggest_index, &this->shade_select);
this->nested_array_size = (uint)(biggest_index + 1);
if (fill_nested) {