KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_shim.cpp File Reference
#include <app_monitor.h>
#include <dialog_shim.h>
#include <settings/common_settings.h>
#include <settings/common_settings_internals.h>
#include <core/ignore.h>
#include <kiway_player.h>
#include <kiway.h>
#include <pgm_base.h>
#include <project/project_local_settings.h>
#include <property_holder.h>
#include <settings/settings_manager.h>
#include <tool/tool_manager.h>
#include <kiplatform/ui.h>
#include <widgets/unit_binder.h>
#include <wx/display.h>
#include <wx/evtloop.h>
#include <wx/app.h>
#include <wx/event.h>
#include <wx/grid.h>
#include <widgets/wx_grid.h>
#include <wx/propgrid/propgrid.h>
#include <wx/checklst.h>
#include <wx/dataview.h>
#include <wx/bmpbuttn.h>
#include <wx/textctrl.h>
#include <wx/stc/stc.h>
#include <wx/combobox.h>
#include <wx/odcombo.h>
#include <wx/choice.h>
#include <wx/checkbox.h>
#include <wx/spinctrl.h>
#include <wx/splitter.h>
#include <wx/radiobox.h>
#include <wx/radiobut.h>
#include <wx/datectrl.h>
#include <wx/variant.h>
#include <algorithm>
#include <functional>
#include <nlohmann/json.hpp>
#include <typeinfo>
#include <hashtables.h>
#include <grid_tricks.h>

Go to the source code of this file.

Functions

static std::string getDialogKeyFromTitle (const wxString &aTitle)
 Strip parenthetical suffixes from dialog titles to create stable persistence keys.
 
static bool isCompoundDateTimePicker (const wxWindow *aWin)
 Return true when the given window is a compound date/time picker whose internal children should be opaque to the dialog-wide state save/load and undo/redo helpers.
 
wxRect ClampRectToDisplay (const wxRect &aRect, const wxRect &aClientArea)
 Constrain a window rectangle so it fits entirely within a display's client area.
 
static void recursiveDescent (wxSizer *aSizer, std::map< int, wxString > &aLabels)
 

Function Documentation

◆ ClampRectToDisplay()

wxRect ClampRectToDisplay ( const wxRect & aRect,
const wxRect & aClientArea )

Constrain a window rectangle so it fits entirely within a display's client area.

The size is capped to the client area, then the top-left corner is pulled back so the whole rectangle is visible (the corner is preferred over the bottom-right edge so the title bar stays reachable). Used to tame geometry restored from a different, possibly higher-DPI, monitor that would otherwise land off-screen or oversized.

Parameters
aRectThe window rectangle to constrain, in screen coordinates.
aClientAreaThe target display's client (work) area, in screen coordinates.
Returns
The constrained rectangle.

Definition at line 352 of file dialog_shim.cpp.

Referenced by DIALOG_SHIM::clampToWorkArea().

◆ getDialogKeyFromTitle()

static std::string getDialogKeyFromTitle ( const wxString & aTitle)
static

Strip parenthetical suffixes from dialog titles to create stable persistence keys.

Dialog titles like "Choose Symbol (1234 items loaded)" would otherwise create unique keys for each item count, flooding the settings file with duplicate entries.

Definition at line 79 of file dialog_shim.cpp.

References end, and getDialogKeyFromTitle().

Referenced by getDialogKeyFromTitle(), DIALOG_SHIM::LoadControlState(), DIALOG_SHIM::resetSize(), DIALOG_SHIM::SaveControlState(), and DIALOG_SHIM::Show().

◆ isCompoundDateTimePicker()

static bool isCompoundDateTimePicker ( const wxWindow * aWin)
static

Return true when the given window is a compound date/time picker whose internal children should be opaque to the dialog-wide state save/load and undo/redo helpers.

On wxGTK these controls are implemented as a wxComboCtrl + wxTextCtrl + popup wxCalendarCtrl. The inner text control reports as a wxTextEntry, so enumerating children causes the persisted state to clobber the picker's value on the next open and turns user edits into spurious undo entries.

Definition at line 107 of file dialog_shim.cpp.

Referenced by DIALOG_SHIM::LoadControlState(), DIALOG_SHIM::registerUndoRedoHandlers(), DIALOG_SHIM::SaveControlState(), DIALOG_SHIM::SelectAllInTextCtrls(), and DIALOG_SHIM::~DIALOG_SHIM().

◆ recursiveDescent()