mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-10 16:27:54 -06:00
Fixed scaling on MSW for new OptionsGroup
This commit is contained in:
parent
398ff9053d
commit
35d225d673
8 changed files with 59 additions and 18 deletions
|
@ -252,6 +252,7 @@ void BedShapePanel::build_panel(const ConfigOptionPoints& default_pt, const Conf
|
||||||
return sizer;
|
return sizer;
|
||||||
};
|
};
|
||||||
optgroup->append_line(line);
|
optgroup->append_line(line);
|
||||||
|
optgroup->activate();
|
||||||
|
|
||||||
wxPanel* texture_panel = init_texture_panel();
|
wxPanel* texture_panel = init_texture_panel();
|
||||||
wxPanel* model_panel = init_model_panel();
|
wxPanel* model_panel = init_model_panel();
|
||||||
|
@ -373,6 +374,7 @@ wxPanel* BedShapePanel::init_texture_panel()
|
||||||
return sizer;
|
return sizer;
|
||||||
};
|
};
|
||||||
optgroup->append_line(line);
|
optgroup->append_line(line);
|
||||||
|
optgroup->activate();
|
||||||
|
|
||||||
panel->SetSizerAndFit(optgroup->sizer);
|
panel->SetSizerAndFit(optgroup->sizer);
|
||||||
|
|
||||||
|
@ -452,6 +454,7 @@ wxPanel* BedShapePanel::init_model_panel()
|
||||||
return sizer;
|
return sizer;
|
||||||
};
|
};
|
||||||
optgroup->append_line(line);
|
optgroup->append_line(line);
|
||||||
|
optgroup->activate();
|
||||||
|
|
||||||
panel->SetSizerAndFit(optgroup->sizer);
|
panel->SetSizerAndFit(optgroup->sizer);
|
||||||
|
|
||||||
|
|
|
@ -80,22 +80,27 @@ namespace GUI {
|
||||||
|
|
||||||
class MainFrame;
|
class MainFrame;
|
||||||
|
|
||||||
class InitTimer
|
class TaskTimer
|
||||||
{
|
{
|
||||||
std::chrono::milliseconds start_timer;
|
std::chrono::milliseconds start_timer;
|
||||||
|
std::string task_name;
|
||||||
public:
|
public:
|
||||||
InitTimer()
|
TaskTimer(std::string task_name):
|
||||||
|
task_name(task_name.empty() ? "task" : task_name)
|
||||||
{
|
{
|
||||||
start_timer = std::chrono::duration_cast<std::chrono::milliseconds>(
|
start_timer = std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||||
std::chrono::system_clock::now().time_since_epoch());
|
std::chrono::system_clock::now().time_since_epoch());
|
||||||
}
|
}
|
||||||
|
|
||||||
~InitTimer()
|
~TaskTimer()
|
||||||
{
|
{
|
||||||
std::chrono::milliseconds stop_timer = std::chrono::duration_cast<std::chrono::milliseconds>(
|
std::chrono::milliseconds stop_timer = std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||||
std::chrono::system_clock::now().time_since_epoch());
|
std::chrono::system_clock::now().time_since_epoch());
|
||||||
auto process_duration = std::chrono::milliseconds(stop_timer - start_timer).count();
|
auto process_duration = std::chrono::milliseconds(stop_timer - start_timer).count();
|
||||||
printf("on_init duration = %lld ms \n", process_duration);
|
std::string out = (boost::format("\n!!! %1% duration = %2% ms \n\n") % task_name % process_duration).str();
|
||||||
|
printf(out.c_str());
|
||||||
|
std::wstring stemp = std::wstring(out.begin(), out.end());
|
||||||
|
OutputDebugString(stemp.c_str());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -617,7 +622,7 @@ bool GUI_App::OnInit()
|
||||||
|
|
||||||
bool GUI_App::on_init_inner()
|
bool GUI_App::on_init_inner()
|
||||||
{
|
{
|
||||||
InitTimer local_timer;
|
TaskTimer timer("on_init");
|
||||||
// Verify resources path
|
// Verify resources path
|
||||||
const wxString resources_dir = from_u8(Slic3r::resources_dir());
|
const wxString resources_dir = from_u8(Slic3r::resources_dir());
|
||||||
wxCHECK_MSG(wxDirExists(resources_dir), false,
|
wxCHECK_MSG(wxDirExists(resources_dir), false,
|
||||||
|
|
|
@ -345,8 +345,9 @@ void MainFrame::update_layout()
|
||||||
fromDlg,
|
fromDlg,
|
||||||
toDlg
|
toDlg
|
||||||
};
|
};
|
||||||
State update_scaling_state = m_layout == ESettingsLayout::Dlg ? State::fromDlg :
|
State update_scaling_state = m_layout == ESettingsLayout::Unknown ? State::noUpdate : // don't scale settings dialog from the application start
|
||||||
layout == ESettingsLayout::Dlg ? State::toDlg : State::noUpdate;
|
m_layout == ESettingsLayout::Dlg ? State::fromDlg :
|
||||||
|
layout == ESettingsLayout::Dlg ? State::toDlg : State::noUpdate;
|
||||||
#endif //__WXMSW__
|
#endif //__WXMSW__
|
||||||
|
|
||||||
m_layout = layout;
|
m_layout = layout;
|
||||||
|
|
|
@ -632,7 +632,7 @@ void ConfigOptionsGroup::msw_rescale()
|
||||||
const int em = em_unit(parent());
|
const int em = em_unit(parent());
|
||||||
|
|
||||||
// rescale width of label column
|
// rescale width of label column
|
||||||
if (!m_options_mode.empty() && label_width > 1)
|
if (m_grid_sizer && !m_options_mode.empty() && label_width > 1)
|
||||||
{
|
{
|
||||||
const int cols = m_grid_sizer->GetCols();
|
const int cols = m_grid_sizer->GetCols();
|
||||||
const int rows = m_grid_sizer->GetEffectiveRowsCount();
|
const int rows = m_grid_sizer->GetEffectiveRowsCount();
|
||||||
|
|
|
@ -374,6 +374,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
|
||||||
m_optgroup->append_single_option_line(option);
|
m_optgroup->append_single_option_line(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_optgroup->activate();
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -434,6 +435,7 @@ void PhysicalPrinterDialog::on_dpi_changed(const wxRect& suggested_rect)
|
||||||
{
|
{
|
||||||
const int& em = em_unit();
|
const int& em = em_unit();
|
||||||
|
|
||||||
|
m_add_preset_btn->msw_rescale();
|
||||||
m_printhost_browse_btn->msw_rescale();
|
m_printhost_browse_btn->msw_rescale();
|
||||||
m_printhost_test_btn->msw_rescale();
|
m_printhost_test_btn->msw_rescale();
|
||||||
if (m_printhost_cafile_browse_btn)
|
if (m_printhost_cafile_browse_btn)
|
||||||
|
|
|
@ -140,6 +140,8 @@ void PreferencesDialog::build()
|
||||||
option = Option(def, "show_splash_screen");
|
option = Option(def, "show_splash_screen");
|
||||||
m_optgroup_general->append_single_option_line(option);
|
m_optgroup_general->append_single_option_line(option);
|
||||||
|
|
||||||
|
m_optgroup_general->activate();
|
||||||
|
|
||||||
m_optgroup_camera = std::make_shared<ConfigOptionsGroup>(this, _(L("Camera")));
|
m_optgroup_camera = std::make_shared<ConfigOptionsGroup>(this, _(L("Camera")));
|
||||||
m_optgroup_camera->label_width = 40;
|
m_optgroup_camera->label_width = 40;
|
||||||
m_optgroup_camera->m_on_change = [this](t_config_option_key opt_key, boost::any value) {
|
m_optgroup_camera->m_on_change = [this](t_config_option_key opt_key, boost::any value) {
|
||||||
|
@ -160,6 +162,8 @@ void PreferencesDialog::build()
|
||||||
option = Option(def, "use_free_camera");
|
option = Option(def, "use_free_camera");
|
||||||
m_optgroup_camera->append_single_option_line(option);
|
m_optgroup_camera->append_single_option_line(option);
|
||||||
|
|
||||||
|
m_optgroup_camera->activate();
|
||||||
|
|
||||||
m_optgroup_gui = std::make_shared<ConfigOptionsGroup>(this, _(L("GUI")));
|
m_optgroup_gui = std::make_shared<ConfigOptionsGroup>(this, _(L("GUI")));
|
||||||
m_optgroup_gui->label_width = 40;
|
m_optgroup_gui->label_width = 40;
|
||||||
m_optgroup_gui->m_on_change = [this](t_config_option_key opt_key, boost::any value) {
|
m_optgroup_gui->m_on_change = [this](t_config_option_key opt_key, boost::any value) {
|
||||||
|
@ -184,6 +188,8 @@ void PreferencesDialog::build()
|
||||||
option = Option(def, "use_custom_toolbar_size");
|
option = Option(def, "use_custom_toolbar_size");
|
||||||
m_optgroup_gui->append_single_option_line(option);
|
m_optgroup_gui->append_single_option_line(option);
|
||||||
|
|
||||||
|
m_optgroup_gui->activate();
|
||||||
|
|
||||||
create_icon_size_slider();
|
create_icon_size_slider();
|
||||||
m_icon_size_sizer->ShowItems(app_config->get("use_custom_toolbar_size") == "1");
|
m_icon_size_sizer->ShowItems(app_config->get("use_custom_toolbar_size") == "1");
|
||||||
|
|
||||||
|
@ -202,6 +208,8 @@ void PreferencesDialog::build()
|
||||||
def.set_default_value(new ConfigOptionBool{ app_config->get("use_environment_map") == "1" });
|
def.set_default_value(new ConfigOptionBool{ app_config->get("use_environment_map") == "1" });
|
||||||
option = Option(def, "use_environment_map");
|
option = Option(def, "use_environment_map");
|
||||||
m_optgroup_render->append_single_option_line(option);
|
m_optgroup_render->append_single_option_line(option);
|
||||||
|
|
||||||
|
m_optgroup_render->activate();
|
||||||
#endif // ENABLE_ENVIRONMENT_MAP
|
#endif // ENABLE_ENVIRONMENT_MAP
|
||||||
|
|
||||||
auto sizer = new wxBoxSizer(wxVERTICAL);
|
auto sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
|
@ -882,8 +882,10 @@ void Tab::msw_rescale()
|
||||||
m_treectrl->AssignImageList(m_icons);
|
m_treectrl->AssignImageList(m_icons);
|
||||||
|
|
||||||
// rescale options_groups
|
// rescale options_groups
|
||||||
for (auto page : m_pages)
|
if (m_active_page)
|
||||||
page->msw_rescale();
|
m_active_page->msw_rescale();
|
||||||
|
//for (auto page : m_pages)
|
||||||
|
// page->msw_rescale();
|
||||||
|
|
||||||
Layout();
|
Layout();
|
||||||
}
|
}
|
||||||
|
@ -1169,7 +1171,9 @@ void Tab::build_preset_description_line(ConfigOptionsGroup* optgroup)
|
||||||
};
|
};
|
||||||
|
|
||||||
auto detach_preset_btn = [this](wxWindow* parent) {
|
auto detach_preset_btn = [this](wxWindow* parent) {
|
||||||
add_scaled_button(parent, &m_detach_preset_btn, "lock_open_sys", _(L("Detach from system preset")), wxBU_LEFT | wxBU_EXACTFIT);
|
//add_scaled_button(parent, &m_detach_preset_btn, "lock_open_sys", _(L("Detach from system preset")), wxBU_LEFT | wxBU_EXACTFIT);
|
||||||
|
m_detach_preset_btn = new ScalableButton(parent, wxID_ANY, "lock_open_sys", _L("Detach from system preset"),
|
||||||
|
wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT, true);
|
||||||
ScalableButton* btn = m_detach_preset_btn;
|
ScalableButton* btn = m_detach_preset_btn;
|
||||||
btn->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
btn->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||||
|
|
||||||
|
@ -2668,8 +2672,10 @@ void TabPrinter::build_unregular_pages()
|
||||||
optgroup = page->new_optgroup(L("Preview"));
|
optgroup = page->new_optgroup(L("Preview"));
|
||||||
|
|
||||||
auto reset_to_filament_color = [this, extruder_idx](wxWindow* parent) {
|
auto reset_to_filament_color = [this, extruder_idx](wxWindow* parent) {
|
||||||
add_scaled_button(parent, &m_reset_to_filament_color, "undo",
|
//add_scaled_button(parent, &m_reset_to_filament_color, "undo",
|
||||||
_(L("Reset to Filament Color")), wxBU_LEFT | wxBU_EXACTFIT);
|
// _(L("Reset to Filament Color")), wxBU_LEFT | wxBU_EXACTFIT);
|
||||||
|
m_reset_to_filament_color = new ScalableButton(parent, wxID_ANY, "undo", _L("Reset to Filament Color"),
|
||||||
|
wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT, true);
|
||||||
ScalableButton* btn = m_reset_to_filament_color;
|
ScalableButton* btn = m_reset_to_filament_color;
|
||||||
btn->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
btn->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||||
auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
@ -2776,6 +2782,12 @@ void TabPrinter::active_selected_page()
|
||||||
m_active_page->set_value("extruders_count", int(m_extruders_count));
|
m_active_page->set_value("extruders_count", int(m_extruders_count));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TabPrinter::clear_pages()
|
||||||
|
{
|
||||||
|
Tab::clear_pages();
|
||||||
|
m_reset_to_filament_color = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
void TabPrinter::toggle_options()
|
void TabPrinter::toggle_options()
|
||||||
{
|
{
|
||||||
if (!m_active_page || m_presets->get_edited_preset().printer_technology() == ptSLA)
|
if (!m_active_page || m_presets->get_edited_preset().printer_technology() == ptSLA)
|
||||||
|
@ -3289,9 +3301,15 @@ void Tab::clear_pages()
|
||||||
for (auto p : m_pages)
|
for (auto p : m_pages)
|
||||||
p->clear();
|
p->clear();
|
||||||
|
|
||||||
// nulling description lines pointers
|
// nulling pointers
|
||||||
m_parent_preset_description_line = nullptr;
|
m_parent_preset_description_line = nullptr;
|
||||||
m_detach_preset_btn = nullptr;
|
m_detach_preset_btn = nullptr;
|
||||||
|
|
||||||
|
m_compatible_printers.checkbox = nullptr;
|
||||||
|
m_compatible_printers.btn = nullptr;
|
||||||
|
|
||||||
|
m_compatible_prints.checkbox = nullptr;
|
||||||
|
m_compatible_prints.btn = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tab::update_description_lines()
|
void Tab::update_description_lines()
|
||||||
|
@ -3574,7 +3592,9 @@ wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &dep
|
||||||
{
|
{
|
||||||
deps.checkbox = new wxCheckBox(parent, wxID_ANY, _(L("All")));
|
deps.checkbox = new wxCheckBox(parent, wxID_ANY, _(L("All")));
|
||||||
deps.checkbox->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
deps.checkbox->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||||
add_scaled_button(parent, &deps.btn, "printer_white", from_u8((boost::format(" %s %s") % _utf8(L("Set")) % std::string(dots.ToUTF8())).str()), wxBU_LEFT | wxBU_EXACTFIT);
|
// add_scaled_button(parent, &deps.btn, "printer_white", from_u8((boost::format(" %s %s") % _utf8(L("Set")) % std::string(dots.ToUTF8())).str()), wxBU_LEFT | wxBU_EXACTFIT);
|
||||||
|
deps.btn = new ScalableButton(parent, wxID_ANY, "printer_white", from_u8((boost::format(" %s %s") % _utf8(L("Set")) % std::string(dots.ToUTF8())).str()),
|
||||||
|
wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT, true);
|
||||||
deps.btn->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
deps.btn->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||||
|
|
||||||
BlinkingBitmap* bbmp = new BlinkingBitmap(parent);
|
BlinkingBitmap* bbmp = new BlinkingBitmap(parent);
|
||||||
|
@ -3652,8 +3672,9 @@ wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &dep
|
||||||
// Return a callback to create a TabPrinter widget to edit bed shape
|
// Return a callback to create a TabPrinter widget to edit bed shape
|
||||||
wxSizer* TabPrinter::create_bed_shape_widget(wxWindow* parent)
|
wxSizer* TabPrinter::create_bed_shape_widget(wxWindow* parent)
|
||||||
{
|
{
|
||||||
ScalableButton* btn;
|
ScalableButton* btn = new ScalableButton(parent, wxID_ANY, "printer_white", " " + _(L("Set")) + " " + dots,
|
||||||
add_scaled_button(parent, &btn, "printer_white", " " + _(L("Set")) + " " + dots, wxBU_LEFT | wxBU_EXACTFIT);
|
wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT, true);
|
||||||
|
// add_scaled_button(parent, &btn, "printer_white", " " + _(L("Set")) + " " + dots, wxBU_LEFT | wxBU_EXACTFIT);
|
||||||
btn->SetFont(wxGetApp().normal_font());
|
btn->SetFont(wxGetApp().normal_font());
|
||||||
|
|
||||||
BlinkingBitmap* bbmp = new BlinkingBitmap(parent);
|
BlinkingBitmap* bbmp = new BlinkingBitmap(parent);
|
||||||
|
|
|
@ -441,6 +441,7 @@ public:
|
||||||
void build_fff();
|
void build_fff();
|
||||||
void build_sla();
|
void build_sla();
|
||||||
void active_selected_page() override;
|
void active_selected_page() override;
|
||||||
|
void clear_pages() override;
|
||||||
void toggle_options() override;
|
void toggle_options() override;
|
||||||
void update() override;
|
void update() override;
|
||||||
void update_fff();
|
void update_fff();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue