|
KiCad PCB EDA Suite
|
KISTATUSBAR is a wxStatusBar suitable for Kicad manager. More...
#include <kistatusbar.h>
Public Types | |
| enum | STYLE_FLAGS : int { NONE_STYLE = 0x00 , NOTIFICATION_ICON = 0x01 , CANCEL_BUTTON = 0x02 , WARNING_ICON = 0x04 } |
Public Member Functions | |
| KISTATUSBAR (int aNumberFields, wxWindow *parent, wxWindowID id, STYLE_FLAGS aFlags=DEFAULT_STYLE) | |
| ~KISTATUSBAR () | |
| void | ShowBackgroundProgressBar (bool aCancellable=false) |
| Show the background progress bar. | |
| void | HideBackgroundProgressBar () |
| Hide the background progress bar. | |
| void | SetBackgroundProgress (int aAmount) |
| Set the current progress of the progress bar. | |
| void | SetBackgroundProgressMax (int aAmount) |
| Set the max progress of the progress bar. | |
| void | SetBackgroundStatusText (const wxString &aTxt) |
| Set the status text that displays next to the progress bar. | |
| void | SetNotificationCount (int aCount) |
| Set the notification count on the notifications button. | |
| void | ClearWarningMessages (const wxString &aSource=wxEmptyString) |
| Clears all warning messages from the given source (or all sources if aSource is empty) | |
| void | AddWarningMessages (const wxString &aSource, const wxString &aMessages) |
| Add warning/error messages (not thread-safe, use the std::vector<KI_ERROR> variant from other threads) | |
| void | AddWarningMessages (const wxString &aSource, const std::vector< KI_ERROR > &aMessages) |
| Add warning/error messages thread-safely. | |
| size_t | GetLoadWarningCount () const |
| Get current message count (thread-safe). | |
| std::map< wxString, std::vector< KI_ERROR > > | GetWarningMessages () const |
| Get a copy of all stored warning/error messages, grouped by source and sorted by source name for stable display order. | |
| void | CloseWarningList () |
| Close the warning message overlay panel, if it is shown. | |
| void | PositionWarningPanel () |
| Position the warning message overlay panel above the warning icon. | |
| virtual void | SetStatusWidths (int aSize, const int *aWidths) override |
Static Public Attributes | |
| static constexpr auto | DEFAULT_STYLE |
Private Types | |
| enum class | FIELD { BGJOB_LABEL , BGJOB_GAUGE , BGJOB_CANCEL , WARNING , NOTIFICATION } |
Private Member Functions | |
| void | onSize (wxSizeEvent &aEvent) |
| void | onBackgroundProgressClick (wxMouseEvent &aEvent) |
| void | onNotificationsIconClick (wxCommandEvent &aEvent) |
| void | onLoadWarningsIconClick (wxCommandEvent &aEvent) |
| void | openWarningList () |
| void | updateWarningUI () |
| Update warning button visibility and badge (main thread only) | |
| void | updateAuxFieldWidths () |
| void | updateBackgroundText () |
| void | layoutControls () |
| std::optional< int > | fieldIndex (FIELD aField) const |
Private Attributes | |
| wxGauge * | m_backgroundProgressBar |
| wxButton * | m_backgroundStopButton |
| wxStaticText * | m_backgroundTxt |
| BITMAP_BUTTON * | m_notificationsButton |
| BITMAP_BUTTON * | m_warningButton |
| STATUSBAR_WARNING_LIST * | m_warningList |
| Overlay panel listing the warning messages. | |
| std::mutex | m_warningMutex |
| Protects m_warningMessages. | |
| std::unordered_map< wxString, std::vector< KI_ERROR > > | m_warningMessages |
| int | m_normalFieldsCount |
| STYLE_FLAGS | m_styleFlags |
| wxString | m_savedStatusText |
| Saved text from adjacent field during background jobs. | |
| wxString | m_backgroundRawText |
| Unellipsized background status text. | |
| std::vector< int > | m_fieldWidths |
KISTATUSBAR is a wxStatusBar suitable for Kicad manager.
It displays the fields needed by the caller, and room for 4 other fields (see kistatusbar.cpp) Background text (FIELD_OFFSET_BGJOB_TEXT offset id) Background gauge widget (FIELD_OFFSET_BGJOB_GAUGE offset id) Background background stop button (FIELD_OFFSET_BGJOB_CANCEL offset id) Background notifications button (FIELD_OFFSET_NOTIFICATION_BUTTON offset id)
Definition at line 49 of file kistatusbar.h.
|
strongprivate |
| Enumerator | |
|---|---|
| BGJOB_LABEL | |
| BGJOB_GAUGE | |
| BGJOB_CANCEL | |
| WARNING | |
| NOTIFICATION | |
Definition at line 150 of file kistatusbar.h.
| enum KISTATUSBAR::STYLE_FLAGS : int |
| Enumerator | |
|---|---|
| NONE_STYLE | |
| NOTIFICATION_ICON | |
| CANCEL_BUTTON | |
| WARNING_ICON | |
Definition at line 52 of file kistatusbar.h.
| KISTATUSBAR::KISTATUSBAR | ( | int | aNumberFields, |
| wxWindow * | parent, | ||
| wxWindowID | id, | ||
| STYLE_FLAGS | aFlags = DEFAULT_STYLE ) |
Definition at line 296 of file kistatusbar.cpp.
References _, CANCEL_BUTTON, KIUI::GetTextSize(), HideBackgroundProgressBar(), KiBitmapBundle(), m_backgroundProgressBar, m_backgroundStopButton, m_backgroundTxt, m_fieldWidths, m_normalFieldsCount, m_notificationsButton, m_styleFlags, m_warningButton, m_warningList, NOTIFICATION_ICON, notifications, onBackgroundProgressClick(), onLoadWarningsIconClick(), onNotificationsIconClick(), onSize(), small_warning, and WARNING_ICON.
| KISTATUSBAR::~KISTATUSBAR | ( | ) |
Definition at line 387 of file kistatusbar.cpp.
References CloseWarningList(), m_backgroundProgressBar, m_notificationsButton, m_warningButton, onBackgroundProgressClick(), onLoadWarningsIconClick(), onNotificationsIconClick(), and onSize().
| void KISTATUSBAR::AddWarningMessages | ( | const wxString & | aSource, |
| const std::vector< KI_ERROR > & | aMessages ) |
Add warning/error messages thread-safely.
Can be called from any thread. UI update is deferred to main thread.
Definition at line 690 of file kistatusbar.cpp.
References end, m_warningMessages, m_warningMutex, traceLibraries, and updateWarningUI().
| void KISTATUSBAR::AddWarningMessages | ( | const wxString & | aSource, |
| const wxString & | aMessages ) |
Add warning/error messages (not thread-safe, use the std::vector<KI_ERROR> variant from other threads)
Definition at line 670 of file kistatusbar.cpp.
References m_warningMessages, m_warningMutex, RPT_SEVERITY_WARNING, KI_ERROR::SetSeverity(), KI_ERROR::SetTitle(), and updateWarningUI().
Referenced by STATUSBAR_WARNING_REPORTER::Report().
| void KISTATUSBAR::ClearWarningMessages | ( | const wxString & | aSource = wxEmptyString | ) |
Clears all warning messages from the given source (or all sources if aSource is empty)
Definition at line 798 of file kistatusbar.cpp.
References m_warningMessages, m_warningMutex, and updateWarningUI().
| void KISTATUSBAR::CloseWarningList | ( | ) |
Close the warning message overlay panel, if it is shown.
Definition at line 863 of file kistatusbar.cpp.
References m_warningList.
Referenced by onLoadWarningsIconClick(), updateWarningUI(), and ~KISTATUSBAR().
|
private |
Definition at line 874 of file kistatusbar.cpp.
References CANCEL_BUTTON, m_styleFlags, NOTIFICATION_ICON, and WARNING_ICON.
Referenced by layoutControls(), onBackgroundProgressClick(), onNotificationsIconClick(), updateAuxFieldWidths(), and updateBackgroundText().
| size_t KISTATUSBAR::GetLoadWarningCount | ( | ) | const |
Get current message count (thread-safe).
Definition at line 716 of file kistatusbar.cpp.
References m_warningMessages, and m_warningMutex.
Referenced by onLoadWarningsIconClick().
| std::map< wxString, std::vector< KI_ERROR > > KISTATUSBAR::GetWarningMessages | ( | ) | const |
Get a copy of all stored warning/error messages, grouped by source and sorted by source name for stable display order.
Thread-safe.
Definition at line 729 of file kistatusbar.cpp.
References m_warningMessages, and m_warningMutex.
| void KISTATUSBAR::HideBackgroundProgressBar | ( | ) |
Hide the background progress bar.
Definition at line 530 of file kistatusbar.cpp.
References m_backgroundProgressBar, m_backgroundStopButton, and updateAuxFieldWidths().
Referenced by KISTATUSBAR().
|
private |
Definition at line 440 of file kistatusbar.cpp.
References fieldIndex(), KIUI::GetTextSize(), m_backgroundProgressBar, m_backgroundStopButton, m_backgroundTxt, m_normalFieldsCount, m_notificationsButton, m_warningButton, and updateBackgroundText().
Referenced by onSize(), and updateAuxFieldWidths().
|
private |
Definition at line 419 of file kistatusbar.cpp.
References fieldIndex(), PGM_BASE::GetBackgroundJobMonitor(), m_backgroundProgressBar, m_normalFieldsCount, Pgm(), and BACKGROUND_JOBS_MONITOR::ShowList().
Referenced by KISTATUSBAR(), and ~KISTATUSBAR().
|
private |
Definition at line 813 of file kistatusbar.cpp.
References CloseWarningList(), g_warning_list_closed_timer, GetLoadWarningCount(), m_warningList, and openWarningList().
Referenced by KISTATUSBAR(), and ~KISTATUSBAR().
|
private |
Definition at line 403 of file kistatusbar.cpp.
References fieldIndex(), PGM_BASE::GetNotificationsManager(), m_normalFieldsCount, m_notificationsButton, Pgm(), and NOTIFICATIONS_MANAGER::ShowList().
Referenced by KISTATUSBAR(), and ~KISTATUSBAR().
|
private |
Definition at line 434 of file kistatusbar.cpp.
References layoutControls().
Referenced by KISTATUSBAR(), and ~KISTATUSBAR().
|
private |
Definition at line 835 of file kistatusbar.cpp.
References KIPLATFORM::UI::ForceFocus(), m_warningButton, m_warningList, and PositionWarningPanel().
Referenced by onLoadWarningsIconClick().
| void KISTATUSBAR::PositionWarningPanel | ( | ) |
Position the warning message overlay panel above the warning icon.
Definition at line 846 of file kistatusbar.cpp.
References m_warningButton, and m_warningList.
Referenced by openWarningList().
| void KISTATUSBAR::SetBackgroundProgress | ( | int | aAmount | ) |
Set the current progress of the progress bar.
Definition at line 541 of file kistatusbar.cpp.
References m_backgroundProgressBar.
| void KISTATUSBAR::SetBackgroundProgressMax | ( | int | aAmount | ) |
Set the max progress of the progress bar.
Definition at line 552 of file kistatusbar.cpp.
References m_backgroundProgressBar.
| void KISTATUSBAR::SetBackgroundStatusText | ( | const wxString & | aTxt | ) |
Set the status text that displays next to the progress bar.
Definition at line 558 of file kistatusbar.cpp.
References m_backgroundRawText, m_normalFieldsCount, m_savedStatusText, and updateBackgroundText().
| void KISTATUSBAR::SetNotificationCount | ( | int | aCount | ) |
Set the notification count on the notifications button.
A value of 0 will hide the count.
Definition at line 655 of file kistatusbar.cpp.
References m_notificationsButton.
Referenced by NOTIFICATIONS_MANAGER::RegisterStatusBar().
|
overridevirtual |
Definition at line 924 of file kistatusbar.cpp.
References m_fieldWidths.
Referenced by KICAD_MANAGER_FRAME::OnCreateStatusBar(), and updateAuxFieldWidths().
| void KISTATUSBAR::ShowBackgroundProgressBar | ( | bool | aCancellable = false | ) |
Show the background progress bar.
Definition at line 519 of file kistatusbar.cpp.
References m_backgroundProgressBar, m_backgroundStopButton, and updateAuxFieldWidths().
|
private |
Definition at line 588 of file kistatusbar.cpp.
References fieldIndex(), KIUI::GetTextSize(), layoutControls(), m_backgroundProgressBar, m_backgroundStopButton, m_fieldWidths, m_normalFieldsCount, m_notificationsButton, m_warningButton, SetStatusWidths(), and updateBackgroundText().
Referenced by HideBackgroundProgressBar(), ShowBackgroundProgressBar(), and updateWarningUI().
|
private |
Definition at line 635 of file kistatusbar.cpp.
References fieldIndex(), KIUI::GetTextSize(), m_backgroundRawText, m_backgroundTxt, m_normalFieldsCount, and text.
Referenced by layoutControls(), SetBackgroundStatusText(), and updateAuxFieldWidths().
|
private |
Update warning button visibility and badge (main thread only)
Definition at line 739 of file kistatusbar.cpp.
References _, CloseWarningList(), m_warningButton, m_warningList, m_warningMessages, m_warningMutex, traceLibraries, and updateAuxFieldWidths().
Referenced by AddWarningMessages(), AddWarningMessages(), and ClearWarningMessages().
|
staticconstexpr |
Definition at line 60 of file kistatusbar.h.
|
private |
Definition at line 162 of file kistatusbar.h.
Referenced by HideBackgroundProgressBar(), KISTATUSBAR(), layoutControls(), onBackgroundProgressClick(), SetBackgroundProgress(), SetBackgroundProgressMax(), ShowBackgroundProgressBar(), updateAuxFieldWidths(), and ~KISTATUSBAR().
|
private |
Unellipsized background status text.
Definition at line 173 of file kistatusbar.h.
Referenced by SetBackgroundStatusText(), and updateBackgroundText().
|
private |
Definition at line 163 of file kistatusbar.h.
Referenced by HideBackgroundProgressBar(), KISTATUSBAR(), layoutControls(), ShowBackgroundProgressBar(), and updateAuxFieldWidths().
|
private |
Definition at line 164 of file kistatusbar.h.
Referenced by KISTATUSBAR(), layoutControls(), and updateBackgroundText().
|
private |
Definition at line 174 of file kistatusbar.h.
Referenced by KISTATUSBAR(), SetStatusWidths(), and updateAuxFieldWidths().
|
private |
Definition at line 170 of file kistatusbar.h.
Referenced by KISTATUSBAR(), layoutControls(), onBackgroundProgressClick(), onNotificationsIconClick(), SetBackgroundStatusText(), updateAuxFieldWidths(), and updateBackgroundText().
|
private |
Definition at line 165 of file kistatusbar.h.
Referenced by KISTATUSBAR(), layoutControls(), onNotificationsIconClick(), SetNotificationCount(), updateAuxFieldWidths(), and ~KISTATUSBAR().
|
private |
Saved text from adjacent field during background jobs.
Definition at line 172 of file kistatusbar.h.
Referenced by SetBackgroundStatusText().
|
private |
Definition at line 171 of file kistatusbar.h.
Referenced by fieldIndex(), and KISTATUSBAR().
|
private |
Definition at line 166 of file kistatusbar.h.
Referenced by KISTATUSBAR(), layoutControls(), openWarningList(), PositionWarningPanel(), updateAuxFieldWidths(), updateWarningUI(), and ~KISTATUSBAR().
|
private |
Overlay panel listing the warning messages.
Definition at line 167 of file kistatusbar.h.
Referenced by CloseWarningList(), KISTATUSBAR(), onLoadWarningsIconClick(), openWarningList(), PositionWarningPanel(), and updateWarningUI().
|
private |
Definition at line 169 of file kistatusbar.h.
Referenced by AddWarningMessages(), AddWarningMessages(), ClearWarningMessages(), GetLoadWarningCount(), GetWarningMessages(), and updateWarningUI().
|
mutableprivate |
Protects m_warningMessages.
Definition at line 168 of file kistatusbar.h.
Referenced by AddWarningMessages(), AddWarningMessages(), ClearWarningMessages(), GetLoadWarningCount(), GetWarningMessages(), and updateWarningUI().