Some code beautification for the last commit
+ Fix of the TabPresetComboBox layout for "light mode" + "tabs as a menu items" preferences
This commit is contained in:
parent
fd071421cb
commit
5434a8980f
4 changed files with 15 additions and 9 deletions
|
@ -904,6 +904,8 @@ bool GUI_App::on_init_inner()
|
|||
if (scrn && is_editor())
|
||||
scrn->SetText(_L("Preparing settings tabs") + dots);
|
||||
|
||||
m_tabs_as_menu = dark_mode() || app_config->get("tabs_as_menu") == "1";
|
||||
|
||||
mainframe = new MainFrame();
|
||||
// hide settings tabs after first Layout
|
||||
if (is_editor())
|
||||
|
@ -1903,6 +1905,7 @@ void GUI_App::add_config_menu(wxMenuBar *menu)
|
|||
init_label_colours();
|
||||
}
|
||||
#endif
|
||||
m_tabs_as_menu = dark_mode() || app_config->get("tabs_as_menu") == "1";
|
||||
recreate_GUI(_L("Restart application") + dots);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -127,6 +127,8 @@ private:
|
|||
//bool m_force_sys_colors_update { false }; // #ysDarkMSW - Use to force dark colors for SystemLightMode
|
||||
#endif
|
||||
|
||||
bool m_tabs_as_menu{ false };
|
||||
|
||||
wxFont m_small_font;
|
||||
wxFont m_bold_font;
|
||||
wxFont m_normal_font;
|
||||
|
@ -208,6 +210,7 @@ public:
|
|||
const wxFont& normal_font() { return m_normal_font; }
|
||||
const wxFont& code_font() { return m_code_font; }
|
||||
int em_unit() const { return m_em_unit; }
|
||||
bool tabs_as_menu() const { return m_tabs_as_menu;}
|
||||
wxSize get_min_size() const;
|
||||
float toolbar_icon_scale(const bool is_limited = false) const;
|
||||
void set_auto_toolbar_icon_scale(float scale) const;
|
||||
|
|
|
@ -386,7 +386,7 @@ void MainFrame::update_layout()
|
|||
|
||||
ESettingsLayout layout = wxGetApp().is_gcode_viewer() ? ESettingsLayout::GCodeViewer :
|
||||
(wxGetApp().app_config->get("old_settings_layout_mode") == "1" ? ESettingsLayout::Old :
|
||||
wxGetApp().app_config->get("new_settings_layout_mode") == "1" ? ( wxGetApp().dark_mode() || wxGetApp().app_config->get("tabs_as_menu") == "1" ? ESettingsLayout::Old : ESettingsLayout::New) :
|
||||
wxGetApp().app_config->get("new_settings_layout_mode") == "1" ? ( wxGetApp().tabs_as_menu() ? ESettingsLayout::Old : ESettingsLayout::New) :
|
||||
wxGetApp().app_config->get("dlg_settings_layout_mode") == "1" ? ESettingsLayout::Dlg : ESettingsLayout::Old);
|
||||
|
||||
if (m_layout == layout)
|
||||
|
@ -436,7 +436,7 @@ void MainFrame::update_layout()
|
|||
if (int sel = m_tabpanel->GetSelection(); sel != wxNOT_FOUND)
|
||||
m_tabpanel->SetSelection(sel+1);// call SetSelection to correct layout after switching from Dlg to Old mode
|
||||
#ifdef _MSW_DARK_MODE
|
||||
if (wxGetApp().dark_mode() || wxGetApp().app_config->get("tabs_as_menu") == "1")
|
||||
if (wxGetApp().tabs_as_menu())
|
||||
show_tabs_menu(true);
|
||||
#endif
|
||||
break;
|
||||
|
@ -460,7 +460,7 @@ void MainFrame::update_layout()
|
|||
m_plater->Show();
|
||||
|
||||
#ifdef _MSW_DARK_MODE
|
||||
if (wxGetApp().dark_mode() || wxGetApp().app_config->get("tabs_as_menu") == "1")
|
||||
if (wxGetApp().tabs_as_menu())
|
||||
show_tabs_menu(false);
|
||||
#endif
|
||||
break;
|
||||
|
@ -635,7 +635,7 @@ void MainFrame::init_tabpanel()
|
|||
// wxNB_NOPAGETHEME: Disable Windows Vista theme for the Notebook background. The theme performance is terrible on Windows 10
|
||||
// with multiple high resolution displays connected.
|
||||
#ifdef _MSW_DARK_MODE
|
||||
if (wxGetApp().dark_mode() || wxGetApp().app_config->get("tabs_as_menu") == "1") {
|
||||
if (wxGetApp().tabs_as_menu()) {
|
||||
m_tabpanel = new wxSimplebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_TOP | wxTAB_TRAVERSAL | wxNB_NOPAGETHEME);
|
||||
wxGetApp().UpdateDarkUI(m_tabpanel);
|
||||
}
|
||||
|
@ -1416,7 +1416,7 @@ void MainFrame::init_menubar_as_editor()
|
|||
m_menubar->Append(helpMenu, _L("&Help"));
|
||||
|
||||
#ifdef _MSW_DARK_MODE
|
||||
if (wxGetApp().dark_mode() || wxGetApp().app_config->get("tabs_as_menu") == "1") {
|
||||
if (wxGetApp().tabs_as_menu()) {
|
||||
// Add separator
|
||||
m_menubar->Append(new wxMenu(), " ");
|
||||
add_tabs_as_menu(m_menubar, this, this);
|
||||
|
@ -1425,7 +1425,7 @@ void MainFrame::init_menubar_as_editor()
|
|||
SetMenuBar(m_menubar);
|
||||
|
||||
#ifdef _MSW_DARK_MODE
|
||||
if (wxGetApp().dark_mode() || wxGetApp().app_config->get("tabs_as_menu") == "1")
|
||||
if (wxGetApp().tabs_as_menu())
|
||||
m_menubar->EnableTop(6, false);
|
||||
#endif
|
||||
|
||||
|
@ -1869,7 +1869,7 @@ void MainFrame::select_tab(size_t tab/* = size_t(-1)*/)
|
|||
if (m_tabpanel->GetSelection() != (int)new_selection)
|
||||
m_tabpanel->SetSelection(new_selection);
|
||||
#ifdef _MSW_DARK_MODE
|
||||
if (wxGetApp().dark_mode() || wxGetApp().app_config->get("tabs_as_menu") == "1") {
|
||||
if (wxGetApp().tabs_as_menu()) {
|
||||
if (Tab* cur_tab = dynamic_cast<Tab*>(m_tabpanel->GetPage(new_selection)))
|
||||
update_marker_for_tabs_menu((m_layout == ESettingsLayout::Old ? m_menubar : m_settings_dialog.menubar()), cur_tab->title(), m_layout == ESettingsLayout::Old);
|
||||
else if (tab == 0 && m_layout == ESettingsLayout::Old)
|
||||
|
@ -2135,7 +2135,7 @@ SettingsDialog::SettingsDialog(MainFrame* mainframe)
|
|||
this->Bind(wxEVT_CLOSE_WINDOW, [this](wxCloseEvent& evt) { this->Hide(); });
|
||||
|
||||
#ifdef _MSW_DARK_MODE
|
||||
if (wxGetApp().dark_mode() || wxGetApp().app_config->get("tabs_as_menu") == "1") {
|
||||
if (wxGetApp().tabs_as_menu()) {
|
||||
// menubar
|
||||
m_menubar = new wxMenuBar();
|
||||
add_tabs_as_menu(m_menubar, mainframe, this);
|
||||
|
|
|
@ -490,7 +490,7 @@ void Tab::OnActivate()
|
|||
|
||||
// Workaroud for Menu instead of NoteBook
|
||||
#ifdef _MSW_DARK_MODE
|
||||
if (wxGetApp().dark_mode()) {
|
||||
if (wxGetApp().tabs_as_menu()) {
|
||||
wxSize sz = m_presets_choice->GetSize();
|
||||
wxSize ok_sz = wxSize(35 * m_em_unit, m_presets_choice->GetBestSize().y+1);
|
||||
if (sz != ok_sz) {
|
||||
|
|
Loading…
Reference in a new issue