mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-22 22:24:01 -06:00
MSW specific: Implementation of the own notebook control
* MSW specific: First implementation of the Notebook control to support Dark/Light color modes * MSW specific: Set mode sizer to the Notebook control. * MSW specific: Added icons to the Notepad control + There is no need to restart application after the changing of the color mode * Fixed non-MSW build * Updated color for SavePresetDialog + Added wrapper to wxMessageBox for mom-MSW platforms
This commit is contained in:
parent
7fce368cca
commit
4652733201
25 changed files with 703 additions and 135 deletions
|
@ -44,6 +44,7 @@
|
|||
#include "UnsavedChangesDialog.hpp"
|
||||
#include "SavePresetDialog.hpp"
|
||||
#include "MsgDialog.hpp"
|
||||
#include "Notebook.hpp"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <commctrl.h>
|
||||
|
@ -255,8 +256,11 @@ void Tab::create_preset_tab()
|
|||
m_modified_label_clr = wxGetApp().get_label_clr_modified();
|
||||
m_default_text_clr = wxGetApp().get_label_clr_default();
|
||||
|
||||
#ifdef _MSW_DARK_MODE
|
||||
// Sizer with buttons for mode changing
|
||||
m_mode_sizer = new ModeSizer(panel, int (0.5*em_unit(this)));
|
||||
if (wxGetApp().tabs_as_menu())
|
||||
#endif
|
||||
m_mode_sizer = new ModeSizer(panel, int (0.5*em_unit(this)));
|
||||
|
||||
const float scale_factor = /*wxGetApp().*/em_unit(this)*0.1;// GetContentScaleFactor();
|
||||
m_hsizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
@ -285,9 +289,11 @@ void Tab::create_preset_tab()
|
|||
// m_hsizer->AddStretchSpacer(32);
|
||||
// StretchSpacer has a strange behavior under OSX, so
|
||||
// There is used just additional sizer for m_mode_sizer with right alignment
|
||||
auto mode_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
mode_sizer->Add(m_mode_sizer, 1, wxALIGN_RIGHT);
|
||||
m_hsizer->Add(mode_sizer, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT, wxOSX ? 15 : 10);
|
||||
if (m_mode_sizer) {
|
||||
auto mode_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
mode_sizer->Add(m_mode_sizer, 1, wxALIGN_RIGHT);
|
||||
m_hsizer->Add(mode_sizer, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT, wxOSX ? 15 : 10);
|
||||
}
|
||||
|
||||
//Horizontal sizer to hold the tree and the selected page.
|
||||
m_hsizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
@ -490,7 +496,8 @@ void Tab::OnActivate()
|
|||
|
||||
// Workaroud for Menu instead of NoteBook
|
||||
#ifdef _MSW_DARK_MODE
|
||||
if (wxGetApp().tabs_as_menu()) {
|
||||
// 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) {
|
||||
|
@ -943,7 +950,8 @@ void Tab::update_mode()
|
|||
m_mode = wxGetApp().get_mode();
|
||||
|
||||
// update mode for ModeSizer
|
||||
m_mode_sizer->SetMode(m_mode);
|
||||
if (m_mode_sizer)
|
||||
m_mode_sizer->SetMode(m_mode);
|
||||
|
||||
update_visibility();
|
||||
|
||||
|
@ -969,7 +977,8 @@ void Tab::msw_rescale()
|
|||
{
|
||||
m_em_unit = em_unit(m_parent);
|
||||
|
||||
m_mode_sizer->msw_rescale();
|
||||
if (m_mode_sizer)
|
||||
m_mode_sizer->msw_rescale();
|
||||
m_presets_choice->msw_rescale();
|
||||
|
||||
m_treectrl->SetMinSize(wxSize(20 * m_em_unit, -1));
|
||||
|
@ -1026,7 +1035,8 @@ void Tab::sys_color_changed()
|
|||
update_label_colours();
|
||||
#ifdef _WIN32
|
||||
wxWindowUpdateLocker noUpdates(this);
|
||||
m_mode_sizer->msw_rescale();
|
||||
if (m_mode_sizer)
|
||||
m_mode_sizer->msw_rescale();
|
||||
wxGetApp().UpdateDarkUI(this);
|
||||
wxGetApp().UpdateDarkUI(m_treectrl);
|
||||
#endif
|
||||
|
@ -3085,7 +3095,15 @@ void Tab::load_current_preset()
|
|||
}
|
||||
if (tab->supports_printer_technology(printer_technology))
|
||||
{
|
||||
wxGetApp().tab_panel()->InsertPage(wxGetApp().tab_panel()->FindPage(this), tab, tab->title());
|
||||
#ifdef _MSW_DARK_MODE
|
||||
if (!wxGetApp().tabs_as_menu()) {
|
||||
std::string bmp_name = tab->type() == Slic3r::Preset::TYPE_FILAMENT ? "spool" :
|
||||
tab->type() == Slic3r::Preset::TYPE_SLA_MATERIAL ? "resin" : "cog";
|
||||
dynamic_cast<Notebook*>(wxGetApp().tab_panel())->InsertPage(wxGetApp().tab_panel()->FindPage(this), tab, tab->title(), bmp_name);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
wxGetApp().tab_panel()->InsertPage(wxGetApp().tab_panel()->FindPage(this), tab, tab->title());
|
||||
#ifdef __linux__ // the tabs apparently need to be explicitly shown on Linux (pull request #1563)
|
||||
int page_id = wxGetApp().tab_panel()->FindPage(tab);
|
||||
wxGetApp().tab_panel()->GetPage(page_id)->Show(true);
|
||||
|
@ -3099,6 +3117,10 @@ void Tab::load_current_preset()
|
|||
}
|
||||
static_cast<TabPrinter*>(this)->m_printer_technology = printer_technology;
|
||||
m_active_page = tmp_page;
|
||||
#ifdef _MSW_DARK_MODE
|
||||
if (!wxGetApp().tabs_as_menu())
|
||||
dynamic_cast<Notebook*>(wxGetApp().tab_panel())->SetPageImage(wxGetApp().tab_panel()->FindPage(this), printer_technology == ptFFF ? "printer" : "sla_printer");
|
||||
#endif
|
||||
}
|
||||
on_presets_changed();
|
||||
if (printer_technology == ptFFF) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue