New concept of the main IU.

* only 2 mode - Regular & Expert
* "Export Gcode" moved to bottom of the window (analogue to the PrusaControll)
* Experiments with layout of collapsible_pane [! not successful]
This commit is contained in:
YuSanka 2018-05-27 22:12:01 +02:00
parent 46f71661b2
commit d93a8aec3d
7 changed files with 131 additions and 76 deletions

View File

@ -256,7 +256,7 @@ sub new {
}); });
# right pane buttons # right pane buttons
$self->{btn_export_gcode} = Wx::Button->new($self->{right_panel}, -1, L("Export G-code…"), wxDefaultPosition, [-1, 30], wxBU_LEFT); $self->{btn_export_gcode} = Wx::Button->new($self->{right_panel}, -1, L("Export G-code…"), wxDefaultPosition, [-1, 30], wxNO_BORDER);#, wxBU_LEFT);
$self->{btn_reslice} = Wx::Button->new($self->{right_panel}, -1, L("Slice now"), wxDefaultPosition, [-1, 30], wxBU_LEFT); $self->{btn_reslice} = Wx::Button->new($self->{right_panel}, -1, L("Slice now"), wxDefaultPosition, [-1, 30], wxBU_LEFT);
$self->{btn_print} = Wx::Button->new($self->{right_panel}, -1, L("Print…"), wxDefaultPosition, [-1, 30], wxBU_LEFT); $self->{btn_print} = Wx::Button->new($self->{right_panel}, -1, L("Print…"), wxDefaultPosition, [-1, 30], wxBU_LEFT);
$self->{btn_send_gcode} = Wx::Button->new($self->{right_panel}, -1, L("Send to printer"), wxDefaultPosition, [-1, 30], wxBU_LEFT); $self->{btn_send_gcode} = Wx::Button->new($self->{right_panel}, -1, L("Send to printer"), wxDefaultPosition, [-1, 30], wxBU_LEFT);
@ -266,12 +266,12 @@ sub new {
$self->{btn_print}->Hide; $self->{btn_print}->Hide;
$self->{btn_send_gcode}->Hide; $self->{btn_send_gcode}->Hide;
# export_gcode cog_go.png
my %icons = qw( my %icons = qw(
add brick_add.png add brick_add.png
remove brick_delete.png remove brick_delete.png
reset cross.png reset cross.png
arrange bricks.png arrange bricks.png
export_gcode cog_go.png
print arrow_up.png print arrow_up.png
send_gcode arrow_up.png send_gcode arrow_up.png
reslice reslice.png reslice reslice.png
@ -508,7 +508,7 @@ sub new {
$buttons_sizer->Add($self->{btn_reslice}, 0, wxALIGN_RIGHT, 0); $buttons_sizer->Add($self->{btn_reslice}, 0, wxALIGN_RIGHT, 0);
$buttons_sizer->Add($self->{btn_print}, 0, wxALIGN_RIGHT, 0); $buttons_sizer->Add($self->{btn_print}, 0, wxALIGN_RIGHT, 0);
$buttons_sizer->Add($self->{btn_send_gcode}, 0, wxALIGN_RIGHT, 0); $buttons_sizer->Add($self->{btn_send_gcode}, 0, wxALIGN_RIGHT, 0);
$buttons_sizer->Add($self->{btn_export_gcode}, 0, wxALIGN_RIGHT, 0); #$buttons_sizer->Add($self->{btn_export_gcode}, 0, wxALIGN_RIGHT, 0);
$scrolled_window_sizer->Add($self->{list}, 1, wxEXPAND, 5); $scrolled_window_sizer->Add($self->{list}, 1, wxEXPAND, 5);
$scrolled_window_sizer->Add($object_info_sizer, 0, wxEXPAND, 0); $scrolled_window_sizer->Add($object_info_sizer, 0, wxEXPAND, 0);
@ -517,10 +517,11 @@ sub new {
my $right_sizer = Wx::BoxSizer->new(wxVERTICAL); my $right_sizer = Wx::BoxSizer->new(wxVERTICAL);
$right_sizer->SetMinSize([320, -1]); $right_sizer->SetMinSize([320, -1]);
$right_sizer->Add($presets, 0, wxEXPAND | wxTOP, 10) if defined $presets; $right_sizer->Add($presets, 0, wxEXPAND | wxTOP, 10) if defined $presets;
$right_sizer->Add($frequently_changed_parameters_sizer, 0, wxEXPAND | wxTOP, 0) if defined $frequently_changed_parameters_sizer; $right_sizer->Add($frequently_changed_parameters_sizer, 1, wxEXPAND | wxTOP, 0) if defined $frequently_changed_parameters_sizer;
$right_sizer->Add($expert_mode_part_sizer, 1, wxEXPAND | wxTOP, 0) if defined $expert_mode_part_sizer; $right_sizer->Add($expert_mode_part_sizer, 0, wxEXPAND | wxTOP, 0) if defined $expert_mode_part_sizer;
$right_sizer->Add($buttons_sizer, 0, wxEXPAND | wxBOTTOM, 5); $right_sizer->Add($buttons_sizer, 0, wxEXPAND | wxBOTTOM, 5);
$right_sizer->Add($scrolled_window_panel, 0, wxEXPAND | wxALL, 1); $right_sizer->Add($scrolled_window_panel, 0, wxEXPAND | wxALL, 1);
$right_sizer->Add($self->{btn_export_gcode}, 0, wxEXPAND | wxLEFT | wxTOP | wxBOTTOM, 20);
# Callback for showing / hiding the print info box. # Callback for showing / hiding the print info box.
$self->{"print_info_box_show"} = sub { $self->{"print_info_box_show"} = sub {
# if ($right_sizer->IsShown(5) != $_[0]) { # if ($right_sizer->IsShown(5) != $_[0]) {
@ -556,6 +557,7 @@ sub new {
$frequently_changed_parameters_sizer, $frequently_changed_parameters_sizer,
$expert_mode_part_sizer, $expert_mode_part_sizer,
$scrolled_window_sizer, $scrolled_window_sizer,
$self->{btn_export_gcode},
$self->{btn_export_stl}, $self->{btn_export_stl},
$self->{btn_reslice}, $self->{btn_reslice},
$self->{btn_print}, $self->{btn_print},

View File

@ -128,6 +128,7 @@ wxWindow *g_right_panel = nullptr;
wxBoxSizer *g_frequently_changed_parameters_sizer = nullptr; wxBoxSizer *g_frequently_changed_parameters_sizer = nullptr;
wxBoxSizer *g_expert_mode_part_sizer = nullptr; wxBoxSizer *g_expert_mode_part_sizer = nullptr;
wxBoxSizer *g_scrolled_window_sizer = nullptr; wxBoxSizer *g_scrolled_window_sizer = nullptr;
wxButton *g_btn_export_gcode = nullptr;
wxButton *g_btn_export_stl = nullptr; wxButton *g_btn_export_stl = nullptr;
wxButton *g_btn_reslice = nullptr; wxButton *g_btn_reslice = nullptr;
wxButton *g_btn_print = nullptr; wxButton *g_btn_print = nullptr;
@ -135,6 +136,9 @@ wxButton *g_btn_send_gcode = nullptr;
wxStaticBitmap *g_manifold_warning_icon = nullptr; wxStaticBitmap *g_manifold_warning_icon = nullptr;
bool g_show_print_info = false; bool g_show_print_info = false;
bool g_show_manifold_warning_icon = false; bool g_show_manifold_warning_icon = false;
wxSizer *m_sizer_object_buttons = nullptr;
wxSizer *m_sizer_part_buttons = nullptr;
wxDataViewCtrl *m_objects_ctrl = nullptr;
wxFont g_small_font{ wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT) }; wxFont g_small_font{ wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT) };
#ifdef __WXMAC__ #ifdef __WXMAC__
@ -203,6 +207,7 @@ void set_preset_updater(PresetUpdater *updater)
void set_objects_from_perl( wxWindow* parent, wxBoxSizer *frequently_changed_parameters_sizer, void set_objects_from_perl( wxWindow* parent, wxBoxSizer *frequently_changed_parameters_sizer,
wxBoxSizer *expert_mode_part_sizer, wxBoxSizer *scrolled_window_sizer, wxBoxSizer *expert_mode_part_sizer, wxBoxSizer *scrolled_window_sizer,
wxButton *btn_export_gcode,
wxButton *btn_export_stl, wxButton *btn_reslice, wxButton *btn_export_stl, wxButton *btn_reslice,
wxButton *btn_print, wxButton *btn_send_gcode, wxButton *btn_print, wxButton *btn_send_gcode,
wxStaticBitmap *manifold_warning_icon) wxStaticBitmap *manifold_warning_icon)
@ -211,6 +216,7 @@ void set_objects_from_perl( wxWindow* parent, wxBoxSizer *frequently_changed_par
g_frequently_changed_parameters_sizer = frequently_changed_parameters_sizer; g_frequently_changed_parameters_sizer = frequently_changed_parameters_sizer;
g_expert_mode_part_sizer = expert_mode_part_sizer; g_expert_mode_part_sizer = expert_mode_part_sizer;
g_scrolled_window_sizer = scrolled_window_sizer; g_scrolled_window_sizer = scrolled_window_sizer;
g_btn_export_gcode = btn_export_gcode;
g_btn_export_stl = btn_export_stl; g_btn_export_stl = btn_export_stl;
g_btn_reslice = btn_reslice; g_btn_reslice = btn_reslice;
g_btn_print = btn_print; g_btn_print = btn_print;
@ -353,7 +359,6 @@ enum ConfigMenuIDs {
ConfigMenuUpdate, ConfigMenuUpdate,
ConfigMenuPreferences, ConfigMenuPreferences,
ConfigMenuModeSimple, ConfigMenuModeSimple,
ConfigMenuModeRegular,
ConfigMenuModeExpert, ConfigMenuModeExpert,
ConfigMenuLanguage, ConfigMenuLanguage,
ConfigMenuFlashFirmware, ConfigMenuFlashFirmware,
@ -366,11 +371,7 @@ ConfigMenuIDs get_view_mode()
return ConfigMenuModeSimple; return ConfigMenuModeSimple;
const auto mode = g_AppConfig->get("view_mode"); const auto mode = g_AppConfig->get("view_mode");
return mode == "expert" ? return mode == "expert" ? ConfigMenuModeExpert : ConfigMenuModeSimple;
ConfigMenuModeExpert :
mode == "regular" ?
ConfigMenuModeRegular :
ConfigMenuModeSimple;
} }
void add_config_menu(wxMenuBar *menu, int event_preferences_changed, int event_language_change) void add_config_menu(wxMenuBar *menu, int event_preferences_changed, int event_language_change)
@ -389,7 +390,6 @@ void add_config_menu(wxMenuBar *menu, int event_preferences_changed, int event_l
local_menu->AppendSeparator(); local_menu->AppendSeparator();
auto mode_menu = new wxMenu(); auto mode_menu = new wxMenu();
mode_menu->AppendRadioItem(config_id_base + ConfigMenuModeSimple, _(L("&Simple")), _(L("Simple View Mode"))); mode_menu->AppendRadioItem(config_id_base + ConfigMenuModeSimple, _(L("&Simple")), _(L("Simple View Mode")));
mode_menu->AppendRadioItem(config_id_base + ConfigMenuModeRegular, _(L("&Regular")), _(L("Regular View Mode")));
mode_menu->AppendRadioItem(config_id_base + ConfigMenuModeExpert, _(L("&Expert")), _(L("Expert View Mode"))); mode_menu->AppendRadioItem(config_id_base + ConfigMenuModeExpert, _(L("&Expert")), _(L("Expert View Mode")));
mode_menu->Check(config_id_base + get_view_mode(), true); mode_menu->Check(config_id_base + get_view_mode(), true);
local_menu->AppendSubMenu(mode_menu, _(L("&Mode")), _(L("Slic3r View Mode"))); local_menu->AppendSubMenu(mode_menu, _(L("&Mode")), _(L("Slic3r View Mode")));
@ -463,18 +463,8 @@ void add_config_menu(wxMenuBar *menu, int event_preferences_changed, int event_l
} }
}); });
mode_menu->Bind(wxEVT_MENU, [config_id_base](wxEvent& event) { mode_menu->Bind(wxEVT_MENU, [config_id_base](wxEvent& event) {
std::string mode = ""; std::string mode = event.GetId() - config_id_base == ConfigMenuModeExpert ?
switch (event.GetId() - config_id_base){ "expert" : "simple";
case ConfigMenuModeExpert:
mode = "expert";
break;
case ConfigMenuModeRegular:
mode = "regular";
break;
case ConfigMenuModeSimple:
mode = "simple";
break;
}
g_AppConfig->set("view_mode", mode); g_AppConfig->set("view_mode", mode);
g_AppConfig->save(); g_AppConfig->save();
update_mode(); update_mode();
@ -839,9 +829,10 @@ wxString from_u8(const std::string &str)
} }
// add PrusaCollapsiblePane to sizer // add PrusaCollapsiblePane to sizer
void add_prusa_collapsible_pane(wxWindow* parent, wxBoxSizer* sizer_parent, const wxString& name, std::function<wxSizer *(wxWindow *)> content_function) PrusaCollapsiblePane* add_prusa_collapsible_pane(wxWindow* parent, wxBoxSizer* sizer_parent, const wxString& name, std::function<wxSizer *(wxWindow *)> content_function)
{ {
auto *collpane = new PrusaCollapsiblePane(parent, wxID_ANY, name); auto *collpane = new PrusaCollapsiblePane(parent, wxID_ANY, name);
collpane->SetTopParent(g_right_panel);
// add the pane with a zero proportion value to the sizer which contains it // add the pane with a zero proportion value to the sizer which contains it
sizer_parent->Add(collpane, 0, wxGROW | wxALL, 0); sizer_parent->Add(collpane, 0, wxGROW | wxALL, 0);
@ -853,42 +844,54 @@ void add_prusa_collapsible_pane(wxWindow* parent, wxBoxSizer* sizer_parent, cons
sizer_pane->Add(sizer, 1, wxGROW | wxEXPAND | wxBOTTOM, 2); sizer_pane->Add(sizer, 1, wxGROW | wxEXPAND | wxBOTTOM, 2);
win->SetSizer(sizer_pane); win->SetSizer(sizer_pane);
sizer_pane->SetSizeHints(win); sizer_pane->SetSizeHints(win);
return collpane;
} }
wxBoxSizer* content_objects_list(wxWindow *win) wxBoxSizer* content_objects_list(wxWindow *win)
{ {
auto objects_ctrl = new wxDataViewCtrl(win, wxID_ANY, wxDefaultPosition, wxDefaultSize); m_objects_ctrl = new wxDataViewCtrl(win, wxID_ANY, wxDefaultPosition, wxDefaultSize);
objects_ctrl->SetBestFittingSize(wxSize(-1, 150)); // TODO - Set correct height according to the opened/closed objects m_objects_ctrl->SetBestFittingSize(wxSize(-1, 150)); // TODO - Set correct height according to the opened/closed objects
auto objects_sz = new wxBoxSizer(wxVERTICAL); auto objects_sz = new wxBoxSizer(wxVERTICAL);
objects_sz->Add(objects_ctrl, 1, wxGROW | wxALL, 5); objects_sz->Add(m_objects_ctrl, 1, wxGROW | wxLEFT/*ALL*/, 20/*5*/);
auto objects_model = new MyObjectTreeModel; auto objects_model = new MyObjectTreeModel;
objects_ctrl->AssociateModel(objects_model); m_objects_ctrl->AssociateModel(objects_model);
#if wxUSE_DRAG_AND_DROP && wxUSE_UNICODE #if wxUSE_DRAG_AND_DROP && wxUSE_UNICODE
objects_ctrl->EnableDragSource(wxDF_UNICODETEXT); m_objects_ctrl->EnableDragSource(wxDF_UNICODETEXT);
objects_ctrl->EnableDropTarget(wxDF_UNICODETEXT); m_objects_ctrl->EnableDropTarget(wxDF_UNICODETEXT);
#endif // wxUSE_DRAG_AND_DROP && wxUSE_UNICODE #endif // wxUSE_DRAG_AND_DROP && wxUSE_UNICODE
// column 0 of the view control: // column 0 of the view control:
wxDataViewTextRenderer *tr = new wxDataViewTextRenderer("string", wxDATAVIEW_CELL_INERT); wxDataViewTextRenderer *tr = new wxDataViewTextRenderer("string", wxDATAVIEW_CELL_INERT);
wxDataViewColumn *column00 = new wxDataViewColumn("Name", tr, 0, 140, wxALIGN_LEFT, wxDataViewColumn *column00 = new wxDataViewColumn("Name", tr, 0, 110, wxALIGN_LEFT,
wxDATAVIEW_COL_SORTABLE | wxDATAVIEW_COL_RESIZABLE); wxDATAVIEW_COL_SORTABLE | wxDATAVIEW_COL_RESIZABLE);
objects_ctrl->AppendColumn(column00); m_objects_ctrl->AppendColumn(column00);
// column 1 of the view control: // column 1 of the view control:
tr = new wxDataViewTextRenderer("string", wxDATAVIEW_CELL_INERT); tr = new wxDataViewTextRenderer("string", wxDATAVIEW_CELL_INERT);
wxDataViewColumn *column01 = new wxDataViewColumn("Copy", tr, 1, 75, wxALIGN_CENTER_HORIZONTAL, wxDataViewColumn *column01 = new wxDataViewColumn("Copy", tr, 1, 75, wxALIGN_CENTER_HORIZONTAL,
wxDATAVIEW_COL_SORTABLE | wxDATAVIEW_COL_RESIZABLE); wxDATAVIEW_COL_SORTABLE | wxDATAVIEW_COL_RESIZABLE);
objects_ctrl->AppendColumn(column01); m_objects_ctrl->AppendColumn(column01);
// column 2 of the view control: // column 2 of the view control:
tr = new wxDataViewTextRenderer("string", wxDATAVIEW_CELL_INERT); tr = new wxDataViewTextRenderer("string", wxDATAVIEW_CELL_INERT);
wxDataViewColumn *column02 = new wxDataViewColumn("Scale", tr, 2, 80, wxALIGN_CENTER_HORIZONTAL, wxDataViewColumn *column02 = new wxDataViewColumn("Scale", tr, 2, 80, wxALIGN_CENTER_HORIZONTAL,
wxDATAVIEW_COL_SORTABLE | wxDATAVIEW_COL_RESIZABLE); wxDATAVIEW_COL_SORTABLE | wxDATAVIEW_COL_RESIZABLE);
objects_ctrl->AppendColumn(column02); m_objects_ctrl->AppendColumn(column02);
m_objects_ctrl->Bind(wxEVT_DATAVIEW_SELECTION_CHANGED, [objects_model](wxCommandEvent& evt)
{
wxWindowUpdateLocker noUpdates(g_right_panel);
auto item = m_objects_ctrl->GetSelection();
auto show_obj_sizer = objects_model->GetParent(item) == wxDataViewItem(0);
m_sizer_object_buttons->Show(show_obj_sizer);
m_sizer_part_buttons->Show(!show_obj_sizer);
g_right_panel->Layout();
});
return objects_sz; return objects_sz;
} }
@ -897,11 +900,11 @@ wxBoxSizer* content_edit_object_buttons(wxWindow* win)
{ {
auto sizer = new wxBoxSizer(wxVERTICAL); auto sizer = new wxBoxSizer(wxVERTICAL);
auto btn_load_part = new wxButton(win, wxID_ANY, "Load part…", wxDefaultPosition, wxDefaultSize, wxBU_LEFT); auto btn_load_part = new wxButton(win, wxID_ANY, /*Load */"part…", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER/*wxBU_LEFT*/);
auto btn_load_modifier = new wxButton(win, wxID_ANY, "Load modifier…", wxDefaultPosition, wxDefaultSize, wxBU_LEFT); auto btn_load_modifier = new wxButton(win, wxID_ANY, /*Load */"modifier…", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER/*wxBU_LEFT*/);
auto btn_load_lambda_modifier = new wxButton(win, wxID_ANY, "Load generic…", wxDefaultPosition, wxDefaultSize, wxBU_LEFT); auto btn_load_lambda_modifier = new wxButton(win, wxID_ANY, /*Load */"generic…", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER/*wxBU_LEFT*/);
auto btn_delete = new wxButton(win, wxID_ANY, "Delete part", wxDefaultPosition, wxDefaultSize, wxBU_LEFT); auto btn_delete = new wxButton(win, wxID_ANY, "Delete"/*" part"*/, wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER/*wxBU_LEFT*/);
auto btn_split = new wxButton(win, wxID_ANY, "Split part", wxDefaultPosition, wxDefaultSize, wxBU_LEFT); auto btn_split = new wxButton(win, wxID_ANY, "Split"/*" part"*/, wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER/*wxBU_LEFT*/);
auto btn_move_up = new wxButton(win, wxID_ANY, "", wxDefaultPosition, wxDefaultSize/*wxSize(30, -1)*/, wxBU_LEFT); auto btn_move_up = new wxButton(win, wxID_ANY, "", wxDefaultPosition, wxDefaultSize/*wxSize(30, -1)*/, wxBU_LEFT);
auto btn_move_down = new wxButton(win, wxID_ANY, "", wxDefaultPosition, wxDefaultSize/*wxSize(30, -1)*/, wxBU_LEFT); auto btn_move_down = new wxButton(win, wxID_ANY, "", wxDefaultPosition, wxDefaultSize/*wxSize(30, -1)*/, wxBU_LEFT);
btn_move_up->SetMinSize(wxSize(20, -1)); btn_move_up->SetMinSize(wxSize(20, -1));
@ -914,23 +917,24 @@ wxBoxSizer* content_edit_object_buttons(wxWindow* win)
btn_move_up->SetBitmap(wxBitmap(from_u8(Slic3r::var("bullet_arrow_up.png")), wxBITMAP_TYPE_PNG)); btn_move_up->SetBitmap(wxBitmap(from_u8(Slic3r::var("bullet_arrow_up.png")), wxBITMAP_TYPE_PNG));
btn_move_down->SetBitmap(wxBitmap(from_u8(Slic3r::var("bullet_arrow_down.png")), wxBITMAP_TYPE_PNG)); btn_move_down->SetBitmap(wxBitmap(from_u8(Slic3r::var("bullet_arrow_down.png")), wxBITMAP_TYPE_PNG));
auto buttons_object_sizer = new wxFlexGridSizer(1, 3, 0, 1); m_sizer_object_buttons = new /*wxFlex*/wxGridSizer(1, 3, 0, 0);
buttons_object_sizer->SetFlexibleDirection(wxBOTH); // static_cast<wxFlexGridSizer*>(m_sizer_object_buttons)->SetFlexibleDirection(wxBOTH);
buttons_object_sizer->Add(btn_load_part, 0, wxEXPAND); m_sizer_object_buttons->Add(btn_load_part, 0, wxEXPAND);
buttons_object_sizer->Add(btn_load_modifier, 0, wxEXPAND); m_sizer_object_buttons->Add(btn_load_modifier, 0, wxEXPAND);
buttons_object_sizer->Add(btn_load_lambda_modifier, 0, wxEXPAND); m_sizer_object_buttons->Add(btn_load_lambda_modifier, 0, wxEXPAND);
m_sizer_object_buttons->Show(false);
auto buttons_part_sizer = new wxFlexGridSizer(1, 3, 0, 1); m_sizer_part_buttons = new /*wxFlex*/wxGridSizer(1, 3, 0, 0);
buttons_part_sizer->SetFlexibleDirection(wxBOTH); // m_sizer_part_buttons->SetFlexibleDirection(wxBOTH);
buttons_part_sizer->Add(btn_delete, 0, wxEXPAND); m_sizer_part_buttons->Add(btn_delete, 0, wxEXPAND);
buttons_part_sizer->Add(btn_split, 0, wxEXPAND); m_sizer_part_buttons->Add(btn_split, 0, wxEXPAND);
{ {
auto up_down_sizer = new wxGridSizer(1, 2, 0, 1); auto up_down_sizer = new wxGridSizer(1, 2, 0, 0);
up_down_sizer->Add(btn_move_up, 1, wxEXPAND); up_down_sizer->Add(btn_move_up, 1, wxEXPAND);
up_down_sizer->Add(btn_move_down, 1, wxEXPAND); up_down_sizer->Add(btn_move_down, 1, wxEXPAND);
buttons_part_sizer->Add(up_down_sizer, 0, wxEXPAND); m_sizer_part_buttons->Add(up_down_sizer, 0, wxEXPAND);
} }
buttons_part_sizer->Show(false); m_sizer_part_buttons->Show(false);
btn_load_part->SetFont(Slic3r::GUI::small_font()); btn_load_part->SetFont(Slic3r::GUI::small_font());
btn_load_modifier->SetFont(Slic3r::GUI::small_font()); btn_load_modifier->SetFont(Slic3r::GUI::small_font());
@ -940,8 +944,8 @@ wxBoxSizer* content_edit_object_buttons(wxWindow* win)
btn_move_up->SetFont(Slic3r::GUI::small_font()); btn_move_up->SetFont(Slic3r::GUI::small_font());
btn_move_down->SetFont(Slic3r::GUI::small_font()); btn_move_down->SetFont(Slic3r::GUI::small_font());
sizer->Add(buttons_object_sizer, 0, wxALIGN_CENTER_HORIZONTAL); sizer->Add(m_sizer_object_buttons, 0, wxEXPAND|wxLEFT, 20/*wxALIGN_CENTER_HORIZONTAL*/);
sizer->Add(buttons_part_sizer, 0, wxALIGN_CENTER_HORIZONTAL); sizer->Add(m_sizer_part_buttons, 0, wxEXPAND|wxLEFT, 20/*wxALIGN_CENTER_HORIZONTAL*/);
return sizer; return sizer;
} }
@ -999,14 +1003,27 @@ wxBoxSizer* content_object_settings(wxWindow *win)
m_optgroups.push_back(optgroup); // ogObjectSettings m_optgroups.push_back(optgroup); // ogObjectSettings
auto sizer = new wxBoxSizer(wxVERTICAL); auto sizer = new wxBoxSizer(wxVERTICAL);
sizer->Add(optgroup->sizer, 1, wxEXPAND | wxBOTTOM, 2); sizer->Add(optgroup->sizer, 1, wxEXPAND | wxLEFT, 20);
return sizer; return sizer;
} }
wxBoxSizer* content_part_settings(wxWindow *win) wxBoxSizer* content_part_settings(wxWindow *win)
{ {
DynamicPrintConfig* config = &g_PresetBundle->printers.get_edited_preset().config; // TODO get config from Model_volume
std::shared_ptr<ConfigOptionsGroup> optgroup = std::make_shared<ConfigOptionsGroup>(win, "Extruders", config);
optgroup->label_width = m_label_width;
Option option = optgroup->get_option("extruder");
option.opt.default_value = new ConfigOptionInt(1);
optgroup->append_single_option_line(option);
m_optgroups.push_back(optgroup); // ogPartSettings
auto sizer = new wxBoxSizer(wxVERTICAL); auto sizer = new wxBoxSizer(wxVERTICAL);
sizer->Add(new wxStaticText(win, wxID_ANY, "Some part text")); sizer->Add(optgroup->sizer, 1, wxEXPAND | wxLEFT, 20);
return sizer; return sizer;
} }
@ -1021,7 +1038,17 @@ void add_expert_mode_part(wxWindow* parent, wxBoxSizer* sizer)
// Experiments with new UI // Experiments with new UI
// *** Objects List *** // *** Objects List ***
add_prusa_collapsible_pane(main_page, main_sizer, "Objects List:", content_objects_list); auto collpane = add_prusa_collapsible_pane(main_page, main_sizer, "Objects List:", content_objects_list);
collpane->Bind(wxEVT_COLLAPSIBLEPANE_CHANGED, ([collpane](wxCommandEvent e){
wxWindowUpdateLocker noUpdates(g_right_panel);
if (collpane->IsCollapsed()) {
m_sizer_object_buttons->Show(false);
m_sizer_part_buttons->Show(false);
}
else
m_objects_ctrl->UnselectAll();
g_right_panel->Layout();
}));
// *** Edit Object Buttons*** // *** Edit Object Buttons***
main_sizer->Add(content_edit_object_buttons(main_page), 0, wxEXPAND, 0); main_sizer->Add(content_edit_object_buttons(main_page), 0, wxEXPAND, 0);
// *** Object Settings *** // *** Object Settings ***
@ -1235,7 +1262,7 @@ void show_buttons(bool show)
void show_scrolled_window_sizer(bool show) void show_scrolled_window_sizer(bool show)
{ {
g_scrolled_window_sizer->Show(static_cast<size_t>(0), show); g_scrolled_window_sizer->Show(static_cast<size_t>(0), false/*show*/); //don't used now
g_scrolled_window_sizer->Show(1, show); g_scrolled_window_sizer->Show(1, show);
g_scrolled_window_sizer->Show(2, show && g_show_print_info); g_scrolled_window_sizer->Show(2, show && g_show_print_info);
g_manifold_warning_icon->Show(show && g_show_manifold_warning_icon); g_manifold_warning_icon->Show(show && g_show_manifold_warning_icon);
@ -1243,13 +1270,22 @@ void show_scrolled_window_sizer(bool show)
void update_mode() void update_mode()
{ {
//TODO There is a not the best place of it!
//*** Update style of the "Export G-code" button****
if (g_btn_export_gcode->GetFont() != bold_font()){
g_btn_export_gcode->SetBackgroundColour(wxColour(252, 77, 1));
g_btn_export_gcode->SetFont(bold_font());
}
//************************************
wxWindowUpdateLocker noUpdates(g_right_panel); wxWindowUpdateLocker noUpdates(g_right_panel);
ConfigMenuIDs mode = get_view_mode(); ConfigMenuIDs mode = get_view_mode();
show_frequently_changed_parameters(mode >= ConfigMenuModeRegular); // show_frequently_changed_parameters(mode >= ConfigMenuModeRegular);
g_expert_mode_part_sizer->Show(mode == ConfigMenuModeExpert); g_expert_mode_part_sizer->Show(mode == ConfigMenuModeExpert);
show_scrolled_window_sizer(mode >= ConfigMenuModeRegular); show_scrolled_window_sizer(mode == ConfigMenuModeExpert);
show_buttons(mode >= ConfigMenuModeRegular); show_buttons(mode == ConfigMenuModeExpert);
g_right_panel->GetParent()->Layout();
g_right_panel->Layout(); g_right_panel->Layout();
} }

View File

@ -91,6 +91,7 @@ void set_objects_from_perl( wxWindow* parent,
wxBoxSizer *frequently_changed_parameters_sizer, wxBoxSizer *frequently_changed_parameters_sizer,
wxBoxSizer *expert_mode_part_sizer, wxBoxSizer *expert_mode_part_sizer,
wxBoxSizer *scrolled_window_sizer, wxBoxSizer *scrolled_window_sizer,
wxButton *btn_export_gcode,
wxButton *btn_export_stl, wxButton *btn_export_stl,
wxButton *btn_reslice, wxButton *btn_reslice,
wxButton *btn_print, wxButton *btn_print,

View File

@ -266,7 +266,7 @@ void OptionsGroup::on_change_OG(const t_config_option_key& opt_id, const boost::
Option ConfigOptionsGroup::get_option(const std::string& opt_key, int opt_index /*= -1*/) Option ConfigOptionsGroup::get_option(const std::string& opt_key, int opt_index /*= -1*/)
{ {
if (!m_config->has(opt_key)) { if (!m_config->has(opt_key)) {
std::cerr << "No " << opt_key << " in ConfigOptionsGroup config."; std::cerr << "No " << opt_key << " in ConfigOptionsGroup config.\n";
} }
std::string opt_id = opt_index == -1 ? opt_key : opt_key + "#" + std::to_string(opt_index); std::string opt_id = opt_index == -1 ? opt_key : opt_key + "#" + std::to_string(opt_index);

View File

@ -706,17 +706,11 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
// Show/hide the 'purging volumes' button // Show/hide the 'purging volumes' button
void Tab::update_wiping_button_visibility() { void Tab::update_wiping_button_visibility() {
if (!get_app_config()->has("view_mode") || get_app_config()->get("view_mode") == "simple") bool wipe_tower_enabled = dynamic_cast<ConfigOptionBool*>((m_preset_bundle->prints.get_edited_preset().config).option("wipe_tower"))->value;
get_wiping_dialog_button()->Hide(); bool multiple_extruders = dynamic_cast<ConfigOptionFloats*>((m_preset_bundle->printers.get_edited_preset().config).option("nozzle_diameter"))->values.size() > 1;
else { bool single_extruder_mm = dynamic_cast<ConfigOptionBool*>((m_preset_bundle->printers.get_edited_preset().config).option("single_extruder_multi_material"))->value;
bool wipe_tower_enabled = dynamic_cast<ConfigOptionBool*>((m_preset_bundle->prints.get_edited_preset().config).option("wipe_tower"))->value;
bool multiple_extruders = dynamic_cast<ConfigOptionFloats*>((m_preset_bundle->printers.get_edited_preset().config).option("nozzle_diameter"))->values.size() > 1;
bool single_extruder_mm = dynamic_cast<ConfigOptionBool*>((m_preset_bundle->printers.get_edited_preset().config).option("single_extruder_multi_material"))->value;
if (wipe_tower_enabled && multiple_extruders && single_extruder_mm) get_wiping_dialog_button()->Show(wipe_tower_enabled && multiple_extruders && single_extruder_mm);
get_wiping_dialog_button()->Show();
else get_wiping_dialog_button()->Hide();
}
(get_wiping_dialog_button()->GetParent())->Layout(); (get_wiping_dialog_button()->GetParent())->Layout();
} }

View File

@ -8,6 +8,7 @@
#include <wx/collpane.h> #include <wx/collpane.h>
#include <wx/wupdlock.h> #include <wx/wupdlock.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/sizer.h>
#include <vector> #include <vector>
#include <set> #include <set>
@ -83,6 +84,7 @@ class PrusaCollapsiblePane : public wxCollapsiblePane
wxBitmap m_bmp_close; wxBitmap m_bmp_close;
wxBitmap m_bmp_open; wxBitmap m_bmp_open;
#endif //__WXMSW__ #endif //__WXMSW__
wxWindow* m_top_parent = nullptr;
public: public:
PrusaCollapsiblePane() {} PrusaCollapsiblePane() {}
PrusaCollapsiblePane( wxWindow *parent, PrusaCollapsiblePane( wxWindow *parent,
@ -102,14 +104,32 @@ public:
this->Bind(wxEVT_COLLAPSIBLEPANE_CHANGED, ([parent, this](wxCommandEvent e){ this->Bind(wxEVT_COLLAPSIBLEPANE_CHANGED, ([parent, this](wxCommandEvent e){
wxWindowUpdateLocker noUpdates_cp(this); wxWindowUpdateLocker noUpdates_cp(this);
wxWindowUpdateLocker noUpdates(parent); wxWindowUpdateLocker noUpdates(parent);
parent->GetParent() ? parent->GetParent()->Layout() : //;
parent->Layout(); parent->Layout();
// this->Refresh(); this->Refresh();
if (m_top_parent)
{
m_top_parent->GetSizer()->Layout();
}
else{
wxGetTopLevelParent(this)->Layout();
}
// if (parent->GetParent()){
// parent->GetParent()->Layout();
// parent->Refresh();
// }
// else{
// parent->Layout();
// this->Refresh();}
})); }));
} }
~PrusaCollapsiblePane() {} ~PrusaCollapsiblePane() {}
void SetTopParent(wxWindow *parent) { m_top_parent = parent; }
#ifdef __WXMSW__ #ifdef __WXMSW__
bool Create(wxWindow *parent, bool Create(wxWindow *parent,
wxWindowID id, wxWindowID id,

View File

@ -95,6 +95,7 @@ void set_objects_from_perl( SV *ui_parent,
SV *frequently_changed_parameters_sizer, SV *frequently_changed_parameters_sizer,
SV *expert_mode_part_sizer, SV *expert_mode_part_sizer,
SV *scrolled_window_sizer, SV *scrolled_window_sizer,
SV *btn_export_gcode,
SV *btn_export_stl, SV *btn_export_stl,
SV *btn_reslice, SV *btn_reslice,
SV *btn_print, SV *btn_print,
@ -105,6 +106,7 @@ void set_objects_from_perl( SV *ui_parent,
(wxBoxSizer *)wxPli_sv_2_object(aTHX_ frequently_changed_parameters_sizer, "Wx::BoxSizer"), (wxBoxSizer *)wxPli_sv_2_object(aTHX_ frequently_changed_parameters_sizer, "Wx::BoxSizer"),
(wxBoxSizer *)wxPli_sv_2_object(aTHX_ expert_mode_part_sizer, "Wx::BoxSizer"), (wxBoxSizer *)wxPli_sv_2_object(aTHX_ expert_mode_part_sizer, "Wx::BoxSizer"),
(wxBoxSizer *)wxPli_sv_2_object(aTHX_ scrolled_window_sizer, "Wx::BoxSizer"), (wxBoxSizer *)wxPli_sv_2_object(aTHX_ scrolled_window_sizer, "Wx::BoxSizer"),
(wxButton *)wxPli_sv_2_object(aTHX_ btn_export_gcode, "Wx::Button"),
(wxButton *)wxPli_sv_2_object(aTHX_ btn_export_stl, "Wx::Button"), (wxButton *)wxPli_sv_2_object(aTHX_ btn_export_stl, "Wx::Button"),
(wxButton *)wxPli_sv_2_object(aTHX_ btn_reslice, "Wx::Button"), (wxButton *)wxPli_sv_2_object(aTHX_ btn_reslice, "Wx::Button"),
(wxButton *)wxPli_sv_2_object(aTHX_ btn_print, "Wx::Button"), (wxButton *)wxPli_sv_2_object(aTHX_ btn_print, "Wx::Button"),