Merge branch 'master' of https://github.com/prusa3d/Slic3r into objects_centering
This commit is contained in:
commit
752a5b25f4
@ -147,28 +147,27 @@ bool GUI_App::OnInit()
|
||||
wxImage::AddHandler(new wxPNGHandler());
|
||||
mainframe = new MainFrame();
|
||||
sidebar().obj_list()->init_objects(); // propagate model objects to object list
|
||||
// update_mode(); // do that later
|
||||
// update_mode(); // !!! do that later
|
||||
SetTopWindow(mainframe);
|
||||
|
||||
m_printhost_job_queue.reset(new PrintHostJobQueue(mainframe->printhost_queue_dlg()));
|
||||
|
||||
CallAfter([this]() {
|
||||
// temporary workaround for the correct behavior of the Scrolled sidebar panel
|
||||
auto& panel = sidebar();
|
||||
if (panel.obj_list()->GetMinHeight() > 200) {
|
||||
wxWindowUpdateLocker noUpdates_sidebar(&panel);
|
||||
panel.obj_list()->SetMinSize(wxSize(-1, 200));
|
||||
// panel.Layout();
|
||||
}
|
||||
update_mode(); // update view mode after fix of the object_list size
|
||||
// to correct later layouts
|
||||
});
|
||||
|
||||
Bind(wxEVT_IDLE, [this](wxIdleEvent& event)
|
||||
{
|
||||
if (app_config->dirty())
|
||||
app_config->save();
|
||||
|
||||
// ! Temporary workaround for the correct behavior of the Scrolled sidebar panel
|
||||
// Do this "manipulations" only once ( after (re)create of the application )
|
||||
if (sidebar().obj_list()->GetMinHeight() > 200)
|
||||
{
|
||||
wxWindowUpdateLocker noUpdates_sidebar(&sidebar());
|
||||
sidebar().obj_list()->SetMinSize(wxSize(-1, 200));
|
||||
|
||||
// !!! to correct later layouts
|
||||
update_mode(); // update view mode after fix of the object_list size
|
||||
}
|
||||
|
||||
if (this->plater() != nullptr)
|
||||
this->obj_manipul()->update_if_dirty();
|
||||
});
|
||||
@ -273,10 +272,12 @@ void GUI_App::recreate_GUI()
|
||||
{
|
||||
std::cerr << "recreate_GUI" << std::endl;
|
||||
|
||||
clear_tabs_list();
|
||||
|
||||
MainFrame* topwindow = dynamic_cast<MainFrame*>(GetTopWindow());
|
||||
mainframe = new MainFrame();
|
||||
sidebar().obj_list()->init_objects(); // propagate model objects to object list
|
||||
// update_mode(); // do that later
|
||||
|
||||
if (topwindow) {
|
||||
SetTopWindow(mainframe);
|
||||
topwindow->Destroy();
|
||||
@ -284,18 +285,8 @@ void GUI_App::recreate_GUI()
|
||||
|
||||
m_printhost_job_queue.reset(new PrintHostJobQueue(mainframe->printhost_queue_dlg()));
|
||||
|
||||
CallAfter([this]() {
|
||||
// temporary workaround for the correct behavior of the Scrolled sidebar panel
|
||||
auto& panel = sidebar();
|
||||
if (panel.obj_list()->GetMinHeight() > 200) {
|
||||
wxWindowUpdateLocker noUpdates_sidebar(&panel);
|
||||
panel.obj_list()->SetMinSize(wxSize(-1, 200));
|
||||
// panel.Layout();
|
||||
}
|
||||
update_mode(); // update view mode after fix of the object_list size
|
||||
// to correct later layouts
|
||||
});
|
||||
|
||||
load_current_presets();
|
||||
|
||||
mainframe->Show(true);
|
||||
|
||||
// On OSX the UI was not initialized correctly if the wizard was called
|
||||
@ -680,13 +671,6 @@ bool GUI_App::checked_tab(Tab* tab)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void GUI_App::delete_tab_from_list(Tab* tab)
|
||||
{
|
||||
std::vector<Tab *>::iterator itr = find(tabs_list.begin(), tabs_list.end(), tab);
|
||||
if (itr != tabs_list.end())
|
||||
tabs_list.erase(itr);
|
||||
}
|
||||
|
||||
// Update UI / Tabs to reflect changes in the currently loaded presets
|
||||
void GUI_App::load_current_presets()
|
||||
{
|
||||
@ -700,6 +684,15 @@ void GUI_App::load_current_presets()
|
||||
}
|
||||
}
|
||||
|
||||
void GUI_App::clear_tabs_list()
|
||||
{
|
||||
for (auto tab : tabs_list) {
|
||||
tab->Destroy();
|
||||
tab = nullptr;
|
||||
}
|
||||
tabs_list.clear();
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
// wxWidgets override to get an event on open files.
|
||||
void GUI_App::MacOpenFiles(const wxArrayString &fileNames)
|
||||
|
@ -133,8 +133,8 @@ public:
|
||||
void add_config_menu(wxMenuBar *menu);
|
||||
bool check_unsaved_changes();
|
||||
bool checked_tab(Tab* tab);
|
||||
void delete_tab_from_list(Tab* tab);
|
||||
void load_current_presets();
|
||||
void clear_tabs_list();
|
||||
|
||||
#ifdef __APPLE__
|
||||
// wxWidgets override to get an event on open files.
|
||||
|
@ -73,7 +73,7 @@ class ObjectManipulation : public OG_Settings
|
||||
Vec3d m_new_scale;
|
||||
Vec3d m_new_size;
|
||||
bool m_new_enabled;
|
||||
bool m_uniform_scale {false};
|
||||
bool m_uniform_scale {true};
|
||||
PrusaLockButton* m_lock_bnt{ nullptr };
|
||||
|
||||
public:
|
||||
|
@ -121,6 +121,11 @@ void MainFrame::init_tabpanel()
|
||||
}
|
||||
});
|
||||
|
||||
if (wxGetApp().plater_) {
|
||||
// before creating a new plater let's delete old one
|
||||
wxGetApp().plater_->Destroy();
|
||||
wxGetApp().plater_ = nullptr;
|
||||
}
|
||||
m_plater = new Slic3r::GUI::Plater(m_tabpanel, this);
|
||||
wxGetApp().plater_ = m_plater;
|
||||
m_tabpanel->AddPage(m_plater, _(L("Plater")));
|
||||
|
@ -1612,7 +1612,14 @@ void Plater::priv::selection_changed()
|
||||
view3D->enable_toolbar_item("fewer", can_decrease_instances());
|
||||
view3D->enable_toolbar_item("splitobjects", can_split/*_to_objects*/());
|
||||
view3D->enable_toolbar_item("splitvolumes", can_split/*_to_volumes*/());
|
||||
view3D->enable_toolbar_item("layersediting", layers_height_allowed());
|
||||
|
||||
// if the selection is not valid to allow for layer editing, we need to turn off the tool if it is running
|
||||
bool enable_layer_editing = layers_height_allowed();
|
||||
if (!enable_layer_editing && view3D->is_layers_editing_enabled())
|
||||
on_action_layersediting(SimpleEvent(EVT_GLTOOLBAR_LAYERSEDITING));
|
||||
|
||||
view3D->enable_toolbar_item("layersediting", enable_layer_editing);
|
||||
|
||||
// forces a frame render to update the view (to avoid a missed update if, for example, the context menu appears)
|
||||
view3D->render();
|
||||
}
|
||||
@ -2294,6 +2301,9 @@ void Plater::priv::on_action_split_volumes(SimpleEvent&)
|
||||
|
||||
void Plater::priv::on_action_layersediting(SimpleEvent&)
|
||||
{
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
std::cout << "on_action_layersediting" << std::endl;
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
bool enable = !view3D->is_layers_editing_enabled();
|
||||
view3D->enable_layers_editing(enable);
|
||||
if (enable && !view3D->is_layers_editing_enabled())
|
||||
|
@ -213,9 +213,7 @@ public:
|
||||
|
||||
public:
|
||||
Tab(wxNotebook* parent, const wxString& title, const char* name);
|
||||
~Tab() {
|
||||
wxGetApp().delete_tab_from_list(this);
|
||||
}
|
||||
~Tab() {}
|
||||
|
||||
wxWindow* parent() const { return m_parent; }
|
||||
wxString title() const { return m_title; }
|
||||
|
Loading…
Reference in New Issue
Block a user