Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuSanka <yusanka@gmail.com>2020-09-24 16:41:48 +0300
committerYuSanka <yusanka@gmail.com>2020-09-24 16:41:48 +0300
commit8fb3a44a4e293ca01eb897a5706ef8283c8c9770 (patch)
tree5ba6db5c8a10fdf2c5b88642c270f96898961032 /src/slic3r
parent52e605069844c02113c93d30f2306c4fb6e2970c (diff)
Fixed highlighting of the searched option
+ Create controls only on the shown and active tab + Line class : deleted unused sizer + In GUI_Utils added TaskTimer class for the print a time of some task duration + BedShapeDialog:: activated options_groups + commented some unused code
Diffstat (limited to 'src/slic3r')
-rw-r--r--src/slic3r/GUI/BedShapeDialog.cpp2
-rw-r--r--src/slic3r/GUI/GUI_App.cpp36
-rw-r--r--src/slic3r/GUI/GUI_Utils.hpp28
-rw-r--r--src/slic3r/GUI/MainFrame.cpp77
-rw-r--r--src/slic3r/GUI/MainFrame.hpp2
-rw-r--r--src/slic3r/GUI/OptionsGroup.cpp8
-rw-r--r--src/slic3r/GUI/OptionsGroup.hpp1
-rw-r--r--src/slic3r/GUI/Plater.cpp11
-rw-r--r--src/slic3r/GUI/Tab.cpp121
-rw-r--r--src/slic3r/GUI/Tab.hpp8
10 files changed, 187 insertions, 107 deletions
diff --git a/src/slic3r/GUI/BedShapeDialog.cpp b/src/slic3r/GUI/BedShapeDialog.cpp
index 29acdff00..3caf168b5 100644
--- a/src/slic3r/GUI/BedShapeDialog.cpp
+++ b/src/slic3r/GUI/BedShapeDialog.cpp
@@ -229,9 +229,11 @@ void BedShapePanel::build_panel(const ConfigOptionPoints& default_pt, const Conf
auto optgroup = init_shape_options_page(BedShape::get_name(BedShape::Type::Rectangular));
BedShape::append_option_line(optgroup, BedShape::Parameter::RectSize);
BedShape::append_option_line(optgroup, BedShape::Parameter::RectOrigin);
+ optgroup->activate();
optgroup = init_shape_options_page(BedShape::get_name(BedShape::Type::Circular));
BedShape::append_option_line(optgroup, BedShape::Parameter::Diameter);
+ optgroup->activate();
optgroup = init_shape_options_page(BedShape::get_name(BedShape::Type::Custom));
diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp
index a9d75e5df..f99e87caf 100644
--- a/src/slic3r/GUI/GUI_App.cpp
+++ b/src/slic3r/GUI/GUI_App.cpp
@@ -68,8 +68,6 @@
#include <shlobj.h>
#endif // __WXMSW__
-#include <chrono>
-
#if ENABLE_THUMBNAIL_GENERATOR_DEBUG
#include <boost/beast/core/detail/base64.hpp>
#include <boost/nowide/fstream.hpp>
@@ -80,32 +78,6 @@ namespace GUI {
class MainFrame;
-class TaskTimer
-{
- std::chrono::milliseconds start_timer;
- std::string task_name;
-public:
- TaskTimer(std::string task_name):
- task_name(task_name.empty() ? "task" : task_name)
- {
- start_timer = std::chrono::duration_cast<std::chrono::milliseconds>(
- std::chrono::system_clock::now().time_since_epoch());
- }
-
- ~TaskTimer()
- {
- std::chrono::milliseconds stop_timer = std::chrono::duration_cast<std::chrono::milliseconds>(
- std::chrono::system_clock::now().time_since_epoch());
- auto process_duration = std::chrono::milliseconds(stop_timer - start_timer).count();
- std::string out = (boost::format("\n!!! %1% duration = %2% ms \n\n") % task_name % process_duration).str();
- printf(out.c_str());
-#ifdef __WXMSW__
- std::wstring stemp = std::wstring(out.begin(), out.end());
- OutputDebugString(stemp.c_str());
-#endif
- }
-};
-
class SplashScreen : public wxSplashScreen
{
public:
@@ -753,9 +725,11 @@ bool GUI_App::on_init_inner()
#endif // ENABLE_GCODE_VIEWER
scrn->SetText(_L("Creating settings tabs..."));
+ TaskTimer timer2("Creating settings tabs");
+
mainframe = new MainFrame();
// hide settings tabs after first Layout
- mainframe->select_tab(0);
+ mainframe->select_tab(size_t(0));
sidebar().obj_list()->init_objects(); // propagate model objects to object list
// update_mode(); // !!! do that later
@@ -1007,7 +981,7 @@ void GUI_App::recreate_GUI(const wxString& msg_name)
MainFrame *old_main_frame = mainframe;
mainframe = new MainFrame();
// hide settings tabs after first Layout
- mainframe->select_tab(0);
+ mainframe->select_tab(size_t(0));
// Propagate model objects to object list.
sidebar().obj_list()->init_objects();
SetTopWindow(mainframe);
@@ -1456,7 +1430,7 @@ void GUI_App::add_config_menu(wxMenuBar *menu)
// hide full main_sizer for mainFrame
mainframe->GetSizer()->Show(false);
mainframe->update_layout();
- mainframe->select_tab(0);
+ mainframe->select_tab(size_t(0));
}
break;
}
diff --git a/src/slic3r/GUI/GUI_Utils.hpp b/src/slic3r/GUI/GUI_Utils.hpp
index 1c88de570..ea2f0e782 100644
--- a/src/slic3r/GUI/GUI_Utils.hpp
+++ b/src/slic3r/GUI/GUI_Utils.hpp
@@ -18,6 +18,8 @@
#include <wx/debug.h>
#include <wx/settings.h>
+#include <chrono>
+
#include "Event.hpp"
class wxCheckBox;
@@ -396,6 +398,32 @@ inline int hex_digit_to_int(const char c)
}
#endif // ENABLE_GCODE_VIEWER
+class TaskTimer
+{
+ std::chrono::milliseconds start_timer;
+ std::string task_name;
+public:
+ TaskTimer(std::string task_name):
+ task_name(task_name.empty() ? "task" : task_name)
+ {
+ start_timer = std::chrono::duration_cast<std::chrono::milliseconds>(
+ std::chrono::system_clock::now().time_since_epoch());
+ }
+
+ ~TaskTimer()
+ {
+ std::chrono::milliseconds stop_timer = std::chrono::duration_cast<std::chrono::milliseconds>(
+ std::chrono::system_clock::now().time_since_epoch());
+ auto process_duration = std::chrono::milliseconds(stop_timer - start_timer).count();
+ std::string out = (boost::format("\n!!! %1% duration = %2% ms \n\n") % task_name % process_duration).str();
+ printf(out.c_str());
+#ifdef __WXMSW__
+ std::wstring stemp = std::wstring(out.begin(), out.end());
+ OutputDebugString(stemp.c_str());
+#endif
+ }
+};
+
}}
#endif
diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp
index 941841f6f..3165b625b 100644
--- a/src/slic3r/GUI/MainFrame.cpp
+++ b/src/slic3r/GUI/MainFrame.cpp
@@ -595,7 +595,7 @@ void MainFrame::init_tabpanel()
m_last_selected_tab = m_tabpanel->GetSelection();
}
else
- select_tab(0); // select Plater
+ select_tab(size_t(0)); // select Plater
});
m_plater = new Plater(this, this);
@@ -650,6 +650,24 @@ void MainFrame::add_created_tab(Tab* panel)
m_tabpanel->AddPage(panel, panel->title());
}
+bool MainFrame::is_active_and_shown_tab(Tab* tab)
+{
+ if (!this)
+ return false;
+ int page_id = m_tabpanel->FindPage(tab);
+
+ if (m_tabpanel->GetSelection() != page_id)
+ return false;
+
+ if (m_layout == ESettingsLayout::Dlg)
+ return m_settings_dialog.IsShown();
+
+ if (m_layout == ESettingsLayout::New)
+ return m_main_sizer->IsShown(m_tabpanel);
+
+ return true;
+}
+
bool MainFrame::can_start_new_project() const
{
return (m_plater != nullptr) && !m_plater->model().objects.empty();
@@ -1167,7 +1185,7 @@ void MainFrame::init_menubar()
{
if (m_plater) {
append_menu_item(windowMenu, wxID_HIGHEST + 1, _L("&Plater Tab") + "\tCtrl+1", _L("Show the plater"),
- [this](wxCommandEvent&) { select_tab(0); }, "plater", nullptr,
+ [this](wxCommandEvent&) { select_tab(size_t(0)); }, "plater", nullptr,
[this]() {return true; }, this);
windowMenu->AppendSeparator();
}
@@ -1723,9 +1741,35 @@ void MainFrame::load_config(const DynamicPrintConfig& config)
#endif
}
+void MainFrame::select_tab(Tab* tab)
+{
+ if (!tab)
+ return;
+ int page_idx = m_tabpanel->FindPage(tab);
+ if (page_idx != wxNOT_FOUND && m_layout == ESettingsLayout::Dlg)
+ page_idx++;
+ select_tab(size_t(page_idx));
+}
+
void MainFrame::select_tab(size_t tab/* = size_t(-1)*/)
{
bool tabpanel_was_hidden = false;
+
+ // Controls on page are created on active page of active tab now.
+ // We should select/activate tab before its showing to avoid an UI-flickering
+ auto select = [this, tab](bool was_hidden) {
+ // when tab == -1, it means we should show the last selected tab
+ size_t new_selection = tab == (size_t)(-1) ? m_last_selected_tab : (m_layout == ESettingsLayout::Dlg && tab != 0) ? tab - 1 : tab;
+
+ if (m_tabpanel->GetSelection() != new_selection)
+ m_tabpanel->SetSelection(new_selection);
+ else if (was_hidden) {
+ Tab* cur_tab = dynamic_cast<Tab*>(m_tabpanel->GetPage(new_selection));
+ if (cur_tab)
+ cur_tab->OnActivate();
+ }
+ };
+
if (m_layout == ESettingsLayout::Dlg) {
if (tab==0) {
if (m_settings_dialog.IsShown())
@@ -1739,14 +1783,20 @@ void MainFrame::select_tab(size_t tab/* = size_t(-1)*/)
#ifdef __WXOSX__ // Don't call SetFont under OSX to avoid name cutting in ObjectList
if (m_settings_dialog.IsShown())
m_settings_dialog.Hide();
-
+ else
+ tabpanel_was_hidden = true;
+
+ select(tabpanel_was_hidden);
m_tabpanel->Show();
m_settings_dialog.Show();
#else
- if (m_settings_dialog.IsShown())
+ if (m_settings_dialog.IsShown()) {
+ select(false);
m_settings_dialog.SetFocus();
+ }
else {
tabpanel_was_hidden = true;
+ select(tabpanel_was_hidden);
m_tabpanel->Show();
m_settings_dialog.Show();
}
@@ -1755,6 +1805,7 @@ void MainFrame::select_tab(size_t tab/* = size_t(-1)*/)
else if (m_layout == ESettingsLayout::New) {
m_main_sizer->Show(m_plater, tab == 0);
tabpanel_was_hidden = !m_main_sizer->IsShown(m_tabpanel);
+ select(tabpanel_was_hidden);
m_main_sizer->Show(m_tabpanel, tab != 0);
// plater should be focused for correct navigation inside search window
@@ -1762,17 +1813,23 @@ void MainFrame::select_tab(size_t tab/* = size_t(-1)*/)
m_plater->SetFocus();
Layout();
}
+ else
+ select(false);
// When we run application in ESettingsLayout::New or ESettingsLayout::Dlg mode, tabpanel is hidden from the very beginning
// and as a result Tab::update_changed_tree_ui() function couldn't update m_is_nonsys_values values,
// which are used for update TreeCtrl and "revert_buttons".
// So, force the call of this function for Tabs, if tab panel was hidden
if (tabpanel_was_hidden)
- for (auto tab : wxGetApp().tabs_list)
- tab->update_changed_tree_ui();
-
- // when tab == -1, it means we should show the last selected tab
- m_tabpanel->SetSelection(tab == (size_t)(-1) ? m_last_selected_tab : (m_layout == ESettingsLayout::Dlg && tab != 0) ? tab - 1 : tab);
+ for (auto cur_tab : wxGetApp().tabs_list)
+ cur_tab->update_changed_tree_ui();
+
+ //// when tab == -1, it means we should show the last selected tab
+ //size_t new_selection = tab == (size_t)(-1) ? m_last_selected_tab : (m_layout == ESettingsLayout::Dlg && tab != 0) ? tab - 1 : tab;
+ //if (m_tabpanel->GetSelection() != new_selection)
+ // m_tabpanel->SetSelection(new_selection);
+ //if (tabpanel_was_hidden)
+ // static_cast<Tab*>(m_tabpanel->GetPage(new_selection))->OnActivate();
}
// Set a camera direction, zoom to all objects.
@@ -1919,7 +1976,7 @@ SettingsDialog::SettingsDialog(MainFrame* mainframe)
auto key_up_handker = [this](wxKeyEvent& evt) {
if ((evt.GetModifiers() & wxMOD_CONTROL) != 0) {
switch (evt.GetKeyCode()) {
- case '1': { m_main_frame->select_tab(0); break; }
+ case '1': { m_main_frame->select_tab(size_t(0)); break; }
case '2': { m_main_frame->select_tab(1); break; }
case '3': { m_main_frame->select_tab(2); break; }
case '4': { m_main_frame->select_tab(3); break; }
diff --git a/src/slic3r/GUI/MainFrame.hpp b/src/slic3r/GUI/MainFrame.hpp
index 868a68492..18d2a73bd 100644
--- a/src/slic3r/GUI/MainFrame.hpp
+++ b/src/slic3r/GUI/MainFrame.hpp
@@ -159,6 +159,7 @@ public:
void init_tabpanel();
void create_preset_tabs();
void add_created_tab(Tab* panel);
+ bool is_active_and_shown_tab(Tab* tab);
#if ENABLE_GCODE_VIEWER
void init_menubar_as_editor();
void init_menubar_as_gcodeviewer();
@@ -184,6 +185,7 @@ public:
void load_config(const DynamicPrintConfig& config);
// Select tab in m_tabpanel
// When tab == -1, will be selected last selected tab
+ void select_tab(Tab* tab);
void select_tab(size_t tab = size_t(-1));
void select_view(const std::string& direction);
// Propagate changed configuration from the Tab to the Plater and save changes to the AppConfig
diff --git a/src/slic3r/GUI/OptionsGroup.cpp b/src/slic3r/GUI/OptionsGroup.cpp
index d96b0565a..13c577662 100644
--- a/src/slic3r/GUI/OptionsGroup.cpp
+++ b/src/slic3r/GUI/OptionsGroup.cpp
@@ -138,7 +138,6 @@ void OptionsGroup::append_line(const Line& line)
m_lines.emplace_back(line);
if (line.full_width && (
- line.sizer != nullptr ||
line.widget != nullptr ||
!line.get_extra_widgets().empty())
)
@@ -156,14 +155,9 @@ void OptionsGroup::append_line(const Line& line)
void OptionsGroup::activate_line(Line& line)
{
if (line.full_width && (
- line.sizer != nullptr ||
line.widget != nullptr ||
!line.get_extra_widgets().empty())
) {
- if (line.sizer != nullptr) {
- sizer->Add(line.sizer, 0, wxEXPAND | wxALL, wxOSX ? 0 : 15);
- return;
- }
if (line.widget != nullptr) {
sizer->Add(line.widget(this->ctrl_parent()), 0, wxEXPAND | wxALL, wxOSX ? 0 : 15);
return;
@@ -585,7 +579,7 @@ bool ConfigOptionsGroup::is_visible(ConfigOptionMode mode)
bool ConfigOptionsGroup::update_visibility(ConfigOptionMode mode)
{
- if (m_options_mode.empty())
+ if (m_options_mode.empty() || !m_grid_sizer)
return true;
int opt_mode_size = m_options_mode.size();
if (m_grid_sizer->GetEffectiveRowsCount() != opt_mode_size &&
diff --git a/src/slic3r/GUI/OptionsGroup.hpp b/src/slic3r/GUI/OptionsGroup.hpp
index 2a4c2cdb6..b3198137b 100644
--- a/src/slic3r/GUI/OptionsGroup.hpp
+++ b/src/slic3r/GUI/OptionsGroup.hpp
@@ -49,7 +49,6 @@ public:
wxString label_tooltip {wxString("")};
size_t full_width {0};
wxStaticText** full_Label {nullptr};
- wxSizer* sizer {nullptr};
widget_t widget {nullptr};
std::function<wxWindow*(wxWindow*)> near_label_widget{ nullptr };
diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp
index 19f735714..6607bd575 100644
--- a/src/slic3r/GUI/Plater.cpp
+++ b/src/slic3r/GUI/Plater.cpp
@@ -305,11 +305,12 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent) :
if (!tab_print) return;
if (opt_key == "fill_density") {
- value = m_og->get_config_value(*config, opt_key);
- tab_print->set_value(opt_key, value);
+ tab_print->update_dirty();
+ tab_print->reload_config();
tab_print->update();
}
- else{
+ else
+ {
DynamicPrintConfig new_conf = *config;
if (opt_key == "brim") {
double new_val;
@@ -350,8 +351,6 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent) :
}
tab_print->load_config(new_conf);
}
-
- tab_print->update_dirty();
};
@@ -982,7 +981,7 @@ void Sidebar::jump_to_option(size_t selected)
wxGetApp().get_tab(opt.type)->activate_option(boost::nowide::narrow(opt.opt_key), boost::nowide::narrow(opt.category));
// Switch to the Settings NotePad
- wxGetApp().mainframe->select_tab();
+// wxGetApp().mainframe->select_tab();
}
ObjectManipulation* Sidebar::obj_manipul()
diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp
index 47c4cf8f9..8d1560448 100644
--- a/src/slic3r/GUI/Tab.cpp
+++ b/src/slic3r/GUI/Tab.cpp
@@ -67,8 +67,10 @@ void Tab::Highlighter::invalidate()
{
timer.Stop();
- bbmp->invalidate();
- bbmp = nullptr;
+ if (bbmp) {
+ bbmp->invalidate();
+ bbmp = nullptr;
+ }
blink_counter = 0;
}
@@ -385,19 +387,24 @@ Slic3r::GUI::PageShp Tab::add_options_page(const wxString& title, const std::str
void Tab::OnActivate()
{
-#ifdef __WXOSX__
wxWindowUpdateLocker noUpdates(this);
-
+#ifdef __WXOSX__
+// wxWindowUpdateLocker noUpdates(this);
auto size = GetSizer()->GetSize();
m_tmp_panel->GetSizer()->SetMinSize(size.x + m_size_move, size.y);
Fit();
m_size_move *= -1;
#endif // __WXOSX__
+
+ // create controls on active page
+ active_selected_page();
+ m_active_page->Show();
+ m_hsizer->Layout();
+ Refresh();
}
void Tab::update_labels_colour()
{
-// Freeze();
//update options "decoration"
for (const auto opt : m_options_list)
{
@@ -426,7 +433,6 @@ void Tab::update_labels_colour()
if (field == nullptr) continue;
field->set_label_colour_force(color);
}
-// Thaw();
auto cur_item = m_treectrl->GetFirstVisibleItem();
if (!cur_item || !m_treectrl->IsVisible(cur_item))
@@ -722,6 +728,8 @@ void Tab::update_undo_buttons()
void Tab::on_roll_back_value(const bool to_sys /*= true*/)
{
+ if (!m_active_page) return;
+
int os;
if (to_sys) {
if (!m_is_nonsys_values) return;
@@ -734,10 +742,10 @@ void Tab::on_roll_back_value(const bool to_sys /*= true*/)
m_postpone_update_ui = true;
- auto selection = m_treectrl->GetItemText(m_treectrl->GetSelection());
- for (auto page : m_pages)
- if (_(page->title()) == selection) {
- for (auto group : page->m_optgroups) {
+ //auto selection = m_treectrl->GetItemText(m_treectrl->GetSelection());
+ //for (auto page : m_pages)
+ // if (_(page->title()) == selection) {
+ for (auto group : /*page*/m_active_page->m_optgroups) {
if (group->title == "Capabilities") {
if ((m_options_list["extruders_count"] & os) == 0)
to_sys ? group->back_to_sys_value("extruders_count") : group->back_to_initial_value("extruders_count");
@@ -778,8 +786,8 @@ void Tab::on_roll_back_value(const bool to_sys /*= true*/)
to_sys ? group->back_to_sys_value(opt_key) : group->back_to_initial_value(opt_key);
}
}
- break;
- }
+ // break;
+ //}
m_postpone_update_ui = false;
update_changed_ui();
@@ -819,10 +827,10 @@ void Tab::load_config(const DynamicPrintConfig& config)
// Reload current $self->{config} (aka $self->{presets}->edited_preset->config) into the UI fields.
void Tab::reload_config()
{
-// Freeze();
- for (auto page : m_pages)
- page->reload_config();
-// Thaw();
+ //for (auto page : m_pages)
+ // page->reload_config();
+ if (m_active_page)
+ m_active_page->reload_config();
}
void Tab::update_mode()
@@ -884,8 +892,6 @@ void Tab::msw_rescale()
// rescale options_groups
if (m_active_page)
m_active_page->msw_rescale();
- //for (auto page : m_pages)
- // page->msw_rescale();
Layout();
}
@@ -918,14 +924,16 @@ void Tab::sys_color_changed()
update_labels_colour();
// update options_groups
- for (auto page : m_pages)
- page->sys_color_changed();
+ if (m_active_page)
+ m_active_page->msw_rescale();
Layout();
}
Field* Tab::get_field(const t_config_option_key& opt_key, int opt_index/* = -1*/) const
{
+ return m_active_page ? m_active_page->get_field(opt_key, opt_index) : nullptr;
+
Field* field = nullptr;
for (auto page : m_pages) {
field = page->get_field(opt_key, opt_index);
@@ -960,14 +968,14 @@ void Tab::toggle_option(const std::string& opt_key, bool toggle, int opt_index/*
// Set a key/value pair on this page. Return true if the value has been modified.
// Currently used for distributing extruders_count over preset pages of Slic3r::GUI::Tab::Printer
// after a preset is loaded.
-bool Tab::set_value(const t_config_option_key& opt_key, const boost::any& value) {
- bool changed = false;
- for(auto page: m_pages) {
- if (page->set_value(opt_key, value))
- changed = true;
- }
- return changed;
-}
+//bool Tab::set_value(const t_config_option_key& opt_key, const boost::any& value) {
+// bool changed = false;
+// for(auto page: m_pages) {
+// if (page->set_value(opt_key, value))
+// changed = true;
+// }
+// return changed;
+//}
// To be called by custom widgets, load a value into a config,
// update the preset selection boxes (the dirty flags)
@@ -1020,7 +1028,7 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
if (opt_key == "pad_around_object") {
for (PageShp &pg : m_pages) {
- Field * fld = pg->get_field(opt_key);
+ Field * fld = pg->get_field(opt_key); /// !!! ysFIXME ????
if (fld) fld->set_value(value, false);
}
}
@@ -1064,11 +1072,20 @@ void Tab::update_wiping_button_visibility() {
void Tab::activate_option(const std::string& opt_key, const wxString& category)
{
- Page* page {nullptr};
- Field* field = get_field(opt_key, &page);
+// wxWindowUpdateLocker noUpdates(this);
+
+ // we should to activate a tab with searched option, if it doesn't.
+ //if (!wxGetApp().mainframe->is_active_tab(this)) {
+ // wxNotebook* tap_panel = wxGetApp().tab_panel();
+ // tap_panel->SetSelection(tap_panel->FindPage(this));
+ //}
+// Page* page {nullptr};
+// Field* field = get_field(opt_key, &page);
// for option, which doesn't have field but just a text or button
- wxString page_title = (!field || !page) ? category : page->title();
+// wxString page_title = (!field || !page) ? category : page->title();
+
+ wxString page_title = _(category);
auto cur_item = m_treectrl->GetFirstVisibleItem();
if (!cur_item || !m_treectrl->IsVisible(cur_item))
@@ -1076,7 +1093,7 @@ void Tab::activate_option(const std::string& opt_key, const wxString& category)
while (cur_item) {
auto title = m_treectrl->GetItemText(cur_item);
- if (_(page_title) != title) {
+ if (page_title != title) {
cur_item = m_treectrl->GetNextVisible(cur_item);
continue;
}
@@ -1086,10 +1103,14 @@ void Tab::activate_option(const std::string& opt_key, const wxString& category)
}
// we should to activate a tab with searched option, if it doesn't.
- wxNotebook* tap_panel = wxGetApp().tab_panel();
- int page_id = tap_panel->FindPage(this);
- if (tap_panel->GetSelection() != page_id)
- tap_panel->SetSelection(page_id);
+ wxGetApp().mainframe->select_tab(this);
+ Field* field = get_field(opt_key);
+
+ // we should to activate a tab with searched option, if it doesn't.
+ //wxNotebook* tap_panel = wxGetApp().tab_panel();
+ //int page_id = tap_panel->FindPage(this);
+ //if (tap_panel->GetSelection() != page_id)
+ // tap_panel->SetSelection(page_id);
// focused selected field
if (field) {
@@ -1973,7 +1994,7 @@ bool Tab::current_preset_is_dirty()
{
return m_presets->current_is_dirty();
}
-
+/*
void TabPrinter::build_printhost(ConfigOptionsGroup *optgroup)
{
const PrinterTechnology tech = m_presets->get_selected_preset().printer_technology();
@@ -2090,7 +2111,7 @@ void TabPrinter::build_printhost(ConfigOptionsGroup *optgroup)
\tOn this system, %s uses HTTPS certificates from the system Certificate Store or Keychain.\n\
\tTo use a custom CA file, please import your CA file into Certificate Store / Keychain."))) % SLIC3R_APP_NAME).str()
% std::string(ca_file_hint.ToUTF8())).str()));
-*/ txt->SetFont(Slic3r::GUI::wxGetApp().normal_font());
+* / txt->SetFont(Slic3r::GUI::wxGetApp().normal_font());
auto sizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(txt, 1, wxEXPAND);
return sizer;
@@ -2099,7 +2120,7 @@ void TabPrinter::build_printhost(ConfigOptionsGroup *optgroup)
optgroup->append_line(line);
}
}
-
+*/
void TabPrinter::build()
{
m_presets = &m_preset_bundle->printers;
@@ -2423,14 +2444,14 @@ void TabPrinter::build_sla()
build_preset_description_line(optgroup.get());
}
-
+/*
void TabPrinter::update_serial_ports()
{
Field *field = get_field("serial_port");
Choice *choice = static_cast<Choice *>(field);
choice->set_values(Utils::scan_serial_ports());
}
-
+*/
void TabPrinter::extruders_count_changed(size_t extruders_count)
{
bool is_count_changed = false;
@@ -2728,7 +2749,7 @@ void TabPrinter::on_preset_loaded()
// update the extruders count field
auto *nozzle_diameter = dynamic_cast<const ConfigOptionFloats*>(m_config->option("nozzle_diameter"));
size_t extruders_count = nozzle_diameter->values.size();
- set_value("extruders_count", int(extruders_count));
+// set_value("extruders_count", int(extruders_count));
// update the GUI field according to the number of nozzle diameters supplied
extruders_count_changed(extruders_count);
}
@@ -3297,6 +3318,8 @@ bool Tab::may_switch_to_SLA_preset()
void Tab::clear_pages()
{
+ // invalidated highlighter, if any exists
+ m_highlighter.invalidate();
// clear pages from the controlls
for (auto p : m_pages)
p->clear();
@@ -3310,6 +3333,8 @@ void Tab::clear_pages()
m_compatible_prints.checkbox = nullptr;
m_compatible_prints.btn = nullptr;
+
+ m_blinking_ikons.clear();
}
void Tab::update_description_lines()
@@ -3372,7 +3397,10 @@ void Tab::OnTreeSelChange(wxTreeEvent& event)
for (auto& el : m_pages)
el.get()->Hide();
- active_selected_page();
+ if (wxGetApp().mainframe->is_active_and_shown_tab(this)) {
+ active_selected_page();
+ m_active_page->Show();
+ }
#ifdef __linux__
no_updates.reset(nullptr);
@@ -3380,7 +3408,7 @@ void Tab::OnTreeSelChange(wxTreeEvent& event)
update_undo_buttons();
- m_active_page->Show();
+// m_active_page->Show();
m_hsizer->Layout();
Refresh();
}
@@ -3592,7 +3620,6 @@ wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &dep
{
deps.checkbox = new wxCheckBox(parent, wxID_ANY, _(L("All")));
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);
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());
@@ -3674,7 +3701,6 @@ wxSizer* TabPrinter::create_bed_shape_widget(wxWindow* parent)
{
ScalableButton* btn = new ScalableButton(parent, wxID_ANY, "printer_white", " " + _(L("Set")) + " " + dots,
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());
BlinkingBitmap* bbmp = new BlinkingBitmap(parent);
@@ -4103,7 +4129,6 @@ void TabSLAPrint::build()
optgroup->append_single_option_line("support_base_safety_distance");
// Mirrored parameter from Pad page for toggling elevation on the same page
-// optgroup->append_single_option_line("pad_around_object");
optgroup->append_single_option_line("support_object_elevation");
Line line{ "", "" };
diff --git a/src/slic3r/GUI/Tab.hpp b/src/slic3r/GUI/Tab.hpp
index 89dc2d131..0a9d17c0e 100644
--- a/src/slic3r/GUI/Tab.hpp
+++ b/src/slic3r/GUI/Tab.hpp
@@ -223,9 +223,9 @@ protected:
void set_timer_owner(wxEvtHandler* owner, int timerid = wxID_ANY);
void init(BlinkingBitmap* bmp);
void blink();
+ void invalidate();
private:
- void invalidate();
BlinkingBitmap* bbmp {nullptr};
int blink_counter {0};
@@ -327,7 +327,7 @@ public:
Field* get_field(const t_config_option_key& opt_key, int opt_index = -1) const;
Field* get_field(const t_config_option_key &opt_key, Page** selected_page, int opt_index = -1);
void toggle_option(const std::string& opt_key, bool toggle, int opt_index = -1);
- bool set_value(const t_config_option_key& opt_key, const boost::any& value);
+// bool set_value(const t_config_option_key& opt_key, const boost::any& value);
wxSizer* description_line_widget(wxWindow* parent, ogStaticText** StaticText);
bool current_preset_is_dirty();
@@ -417,7 +417,7 @@ class TabPrinter : public Tab
std::vector<PageShp> m_pages_fff;
std::vector<PageShp> m_pages_sla;
- void build_printhost(ConfigOptionsGroup *optgroup);
+// void build_printhost(ConfigOptionsGroup *optgroup);
public:
wxButton* m_serial_test_btn = nullptr;
ScalableButton* m_print_host_test_btn = nullptr;
@@ -447,7 +447,7 @@ public:
void update_fff();
void update_sla();
void update_pages(); // update m_pages according to printer technology
- void update_serial_ports();
+// void update_serial_ports();
void extruders_count_changed(size_t extruders_count);
PageShp build_kinematics_page();
void build_unregular_pages();