Completed split of the GUI_ObjectParts
This commit is contained in:
parent
bcedd71e99
commit
ea30385fd0
@ -33,8 +33,6 @@ add_library(libslic3r_gui STATIC
|
||||
${LIBDIR}/slic3r/GUI/PresetHints.hpp
|
||||
${LIBDIR}/slic3r/GUI/GUI.cpp
|
||||
${LIBDIR}/slic3r/GUI/GUI.hpp
|
||||
${LIBDIR}/slic3r/GUI/GUI_ObjectParts.cpp
|
||||
${LIBDIR}/slic3r/GUI/GUI_ObjectParts.hpp
|
||||
${LIBDIR}/slic3r/GUI/GUI_Preview.cpp
|
||||
${LIBDIR}/slic3r/GUI/GUI_Preview.hpp
|
||||
${LIBDIR}/slic3r/GUI/GUI_PreviewIface.cpp
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "../../libslic3r/PrintConfig.hpp"
|
||||
#include "../../libslic3r/GCode/PreviewData.hpp"
|
||||
#include "GUI_App.hpp"
|
||||
#include "GUI_ObjectList.hpp"
|
||||
#include "GUI_ObjectManipulation.hpp"
|
||||
|
||||
#include <GL/glew.h>
|
||||
@ -3243,7 +3244,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
||||
{
|
||||
v->set_scaling_factor((double)scale_factor);
|
||||
}
|
||||
update_scale_values((double)scale_factor);
|
||||
wxGetApp().obj_manipul()->update_scale_values((double)scale_factor);
|
||||
#endif // ENABLE_MODELINSTANCE_3D_FULL_TRANSFORM
|
||||
break;
|
||||
}
|
||||
@ -5397,7 +5398,7 @@ void GLCanvas3D::_on_select(int volume_idx, int object_idx)
|
||||
}
|
||||
|
||||
post_event(ObjectSelectEvent(obj_id, vol_id));
|
||||
Slic3r::GUI::select_current_volume(obj_id, vol_id);
|
||||
wxGetApp().obj_list()->select_current_volume(obj_id, vol_id);
|
||||
}
|
||||
|
||||
std::vector<float> GLCanvas3D::_parse_colors(const std::vector<std::string>& colors)
|
||||
|
@ -1,14 +1,12 @@
|
||||
#include "GUI.hpp"
|
||||
#include "GUI_App.hpp"
|
||||
#include "../AppController.hpp"
|
||||
#include "WipeTowerDialog.hpp"
|
||||
|
||||
#include <assert.h>
|
||||
#include <cmath>
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#if __APPLE__
|
||||
#import <IOKit/pwr_mgt/IOPMLib.h>
|
||||
@ -26,50 +24,18 @@
|
||||
#include "boost/nowide/convert.hpp"
|
||||
#endif
|
||||
|
||||
#include <wx/app.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dir.h>
|
||||
#include <wx/filename.h>
|
||||
#include <wx/frame.h>
|
||||
#include <wx/menu.h>
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/combo.h>
|
||||
#include <wx/window.h>
|
||||
#include <wx/msgdlg.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/display.h>
|
||||
#include <wx/collpane.h>
|
||||
#include <wx/wupdlock.h>
|
||||
|
||||
#include "wxExtensions.hpp"
|
||||
|
||||
#include "Tab.hpp"
|
||||
#include "TabIface.hpp"
|
||||
#include "GUI_Preview.hpp"
|
||||
#include "GUI_PreviewIface.hpp"
|
||||
#include "AboutDialog.hpp"
|
||||
#include "AppConfig.hpp"
|
||||
#include "ConfigSnapshotDialog.hpp"
|
||||
#include "ProgressStatusBar.hpp"
|
||||
#include "Utils.hpp"
|
||||
#include "MsgDialog.hpp"
|
||||
#include "ConfigWizard.hpp"
|
||||
#include "Preferences.hpp"
|
||||
#include "PresetBundle.hpp"
|
||||
#include "UpdateDialogs.hpp"
|
||||
#include "FirmwareDialog.hpp"
|
||||
#include "GUI_ObjectParts.hpp"
|
||||
|
||||
#include "../Utils/PresetUpdater.hpp"
|
||||
#include "../Config/Snapshot.hpp"
|
||||
|
||||
#include "3DScene.hpp"
|
||||
#include "libslic3r/I18N.hpp"
|
||||
#include "Model.hpp"
|
||||
#include "LambdaObjectDialog.hpp"
|
||||
|
||||
#include "../../libslic3r/Utils.hpp"
|
||||
#include "../../libslic3r/Print.hpp"
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
@ -116,91 +82,8 @@ void break_to_debugger()
|
||||
#endif /* _WIN32 */
|
||||
}
|
||||
|
||||
// #ys_FIXME_for_delete
|
||||
std::vector<Tab *> g_tabs_list;
|
||||
|
||||
//showed/hided controls according to the view mode
|
||||
wxWindow *g_right_panel = nullptr;
|
||||
wxBoxSizer *g_frequently_changed_parameters_sizer = nullptr;
|
||||
wxBoxSizer *g_info_sizer = nullptr;
|
||||
wxBoxSizer *g_object_list_sizer = nullptr;
|
||||
std::vector<wxButton*> g_buttons;
|
||||
wxStaticBitmap *g_manifold_warning_icon = nullptr;
|
||||
bool g_show_print_info = false;
|
||||
bool g_show_manifold_warning_icon = false;
|
||||
|
||||
PreviewIface* g_preview = nullptr;
|
||||
|
||||
enum ActionButtons
|
||||
{
|
||||
abExportGCode,
|
||||
abReslice,
|
||||
abPrint,
|
||||
abSendGCode,
|
||||
};
|
||||
|
||||
void set_objects_from_perl( wxWindow* parent,
|
||||
wxBoxSizer *frequently_changed_parameters_sizer,
|
||||
wxBoxSizer *info_sizer,
|
||||
wxButton *btn_export_gcode,
|
||||
wxButton *btn_reslice,
|
||||
wxButton *btn_print,
|
||||
wxButton *btn_send_gcode,
|
||||
wxStaticBitmap *manifold_warning_icon)
|
||||
{
|
||||
g_right_panel = parent->GetParent();
|
||||
g_frequently_changed_parameters_sizer = frequently_changed_parameters_sizer;
|
||||
g_info_sizer = info_sizer;
|
||||
|
||||
g_buttons.push_back(btn_export_gcode);
|
||||
g_buttons.push_back(btn_reslice);
|
||||
g_buttons.push_back(btn_print);
|
||||
g_buttons.push_back(btn_send_gcode);
|
||||
|
||||
// Update font style for buttons
|
||||
// for (auto btn : g_buttons)
|
||||
// btn->SetFont(bold_font());
|
||||
|
||||
g_manifold_warning_icon = manifold_warning_icon;
|
||||
}
|
||||
|
||||
void set_show_print_info(bool show)
|
||||
{
|
||||
g_show_print_info = show;
|
||||
}
|
||||
|
||||
void set_show_manifold_warning_icon(bool show)
|
||||
{
|
||||
g_show_manifold_warning_icon = show;
|
||||
if (!g_manifold_warning_icon)
|
||||
return;
|
||||
|
||||
// update manifold_warning_icon showing
|
||||
if (show && !g_info_sizer->IsShown(static_cast<size_t>(0)))
|
||||
g_show_manifold_warning_icon = false;
|
||||
|
||||
g_manifold_warning_icon->Show(g_show_manifold_warning_icon);
|
||||
g_manifold_warning_icon->GetParent()->Layout();
|
||||
}
|
||||
|
||||
void set_objects_list_sizer(wxBoxSizer *objects_list_sizer){
|
||||
g_object_list_sizer = objects_list_sizer;
|
||||
}
|
||||
|
||||
void open_model(wxWindow *parent, wxArrayString& input_files){
|
||||
auto dialog = new wxFileDialog(parent /*? parent : GetTopWindow()*/,
|
||||
_(L("Choose one or more files (STL/OBJ/AMF/3MF/PRUSA):")),
|
||||
get_app_config()->get_last_dir(), "",
|
||||
MODEL_WILDCARD, wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST);
|
||||
if (dialog->ShowModal() != wxID_OK) {
|
||||
dialog->Destroy();
|
||||
return ;
|
||||
}
|
||||
|
||||
dialog->GetPaths(input_files);
|
||||
dialog->Destroy();
|
||||
}
|
||||
|
||||
bool config_wizard_startup(bool app_config_exists)
|
||||
{
|
||||
if (!app_config_exists || wxGetApp().preset_bundle->printers.size() <= 1) {
|
||||
@ -236,38 +119,6 @@ void config_wizard(int reason)
|
||||
// Load the currently selected preset into the GUI, update the preset selection box.
|
||||
wxGetApp().load_current_presets();
|
||||
}
|
||||
// #ys_FIXME_for_delete
|
||||
std::vector<PresetTab> preset_tabs = {
|
||||
{ "print", nullptr, ptFFF },
|
||||
{ "filament", nullptr, ptFFF },
|
||||
{ "sla_material", nullptr, ptSLA }
|
||||
};
|
||||
std::vector<PresetTab>* get_preset_tabs() {
|
||||
return &preset_tabs;
|
||||
}
|
||||
|
||||
Tab* get_tab(const std::string& name)
|
||||
{
|
||||
std::vector<PresetTab>::iterator it = std::find_if(preset_tabs.begin(), preset_tabs.end(),
|
||||
[name](PresetTab& tab){ return name == tab.name; });
|
||||
return it != preset_tabs.end() ? it->panel : nullptr;
|
||||
}
|
||||
|
||||
TabIface* get_preset_tab_iface(char *name)
|
||||
{
|
||||
Tab* tab = get_tab(name);
|
||||
if (tab) return new TabIface(tab);
|
||||
|
||||
for (size_t i = 0; i < wxGetApp().tab_panel()->GetPageCount(); ++i) {
|
||||
Tab *tab = dynamic_cast<Tab*>(wxGetApp().tab_panel()->GetPage(i));
|
||||
if (! tab)
|
||||
continue;
|
||||
if (tab->name() == name) {
|
||||
return new TabIface(tab);
|
||||
}
|
||||
}
|
||||
return new TabIface(nullptr);
|
||||
}
|
||||
|
||||
PreviewIface* create_preview_iface(wxNotebook* parent, DynamicPrintConfig* config, Print* print, GCodePreviewData* gcode_preview_data)
|
||||
{
|
||||
@ -422,9 +273,6 @@ void set_print_callback_event(Print *print, int id)
|
||||
});
|
||||
}
|
||||
|
||||
wxWindow* get_right_panel(){
|
||||
return g_right_panel;
|
||||
}
|
||||
void create_combochecklist(wxComboCtrl* comboCtrl, std::string text, std::string items, bool initial_value)
|
||||
{
|
||||
if (comboCtrl == nullptr)
|
||||
@ -499,65 +347,6 @@ std::string into_u8(const wxString &str)
|
||||
return std::string(buffer_utf8.data());
|
||||
}
|
||||
|
||||
void set_model_events_from_perl(Model &model,
|
||||
int event_object_selection_changed,
|
||||
int event_object_settings_changed,
|
||||
int event_remove_object,
|
||||
int event_update_scene)
|
||||
{
|
||||
set_event_object_selection_changed(event_object_selection_changed);
|
||||
set_event_object_settings_changed(event_object_settings_changed);
|
||||
set_event_remove_object(event_remove_object);
|
||||
set_event_update_scene(event_update_scene);
|
||||
set_objects_from_model(model);
|
||||
init_mesh_icons();
|
||||
|
||||
// wxWindowUpdateLocker noUpdates(parent);
|
||||
|
||||
// add_objects_list(parent, sizer);
|
||||
|
||||
// add_collapsible_panes(parent, sizer);
|
||||
}
|
||||
|
||||
void show_buttons(bool show)
|
||||
{
|
||||
g_buttons[abReslice]->Show(show);
|
||||
for (size_t i = 0; i < wxGetApp().tab_panel()->GetPageCount(); ++i) {
|
||||
TabPrinter *tab = dynamic_cast<TabPrinter*>(wxGetApp().tab_panel()->GetPage(i));
|
||||
if (!tab)
|
||||
continue;
|
||||
if (wxGetApp().preset_bundle->printers.get_selected_preset().printer_technology() == ptFFF) {
|
||||
g_buttons[abPrint]->Show(show && !tab->m_config->opt_string("serial_port").empty());
|
||||
g_buttons[abSendGCode]->Show(show && !tab->m_config->opt_string("print_host").empty());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void show_info_sizer(const bool show)
|
||||
{
|
||||
g_info_sizer->Show(static_cast<size_t>(0), show);
|
||||
g_info_sizer->Show(1, show && g_show_print_info);
|
||||
g_manifold_warning_icon->Show(show && g_show_manifold_warning_icon);
|
||||
}
|
||||
|
||||
void show_object_name(bool show)
|
||||
{
|
||||
wxGridSizer* grid_sizer = get_optgroup(ogFrequentlyObjectSettings)->get_grid_sizer();
|
||||
grid_sizer->Show(static_cast<size_t>(0), show);
|
||||
grid_sizer->Show(static_cast<size_t>(1), show);
|
||||
}
|
||||
|
||||
ConfigOptionsGroup* get_optgroup(size_t i)
|
||||
{
|
||||
return wxGetApp().mainframe->m_plater->sidebar().get_optgroup(i);
|
||||
// return m_optgroups.empty() ? nullptr : m_optgroups[i].get();
|
||||
}
|
||||
|
||||
std::vector <std::shared_ptr<ConfigOptionsGroup>>& get_optgroups() {
|
||||
return wxGetApp().mainframe->m_plater->sidebar().get_optgroups();//m_optgroups;
|
||||
}
|
||||
|
||||
wxWindow* export_option_creator(wxWindow* parent)
|
||||
{
|
||||
wxPanel* panel = new wxPanel(parent, -1);
|
||||
@ -664,20 +453,6 @@ void restore_window_size(wxTopLevelWindow *window, const std::string &name)
|
||||
}
|
||||
}
|
||||
|
||||
void enable_action_buttons(bool enable)
|
||||
{
|
||||
if (g_buttons.empty())
|
||||
return;
|
||||
|
||||
// Update background colour for buttons
|
||||
const wxColour bgrd_color = enable ? wxColour(224, 224, 224/*255, 96, 0*/) : wxColour(204, 204, 204);
|
||||
|
||||
for (auto btn : g_buttons) {
|
||||
btn->Enable(enable);
|
||||
btn->SetBackgroundColour(bgrd_color);
|
||||
}
|
||||
}
|
||||
|
||||
void about()
|
||||
{
|
||||
AboutDialog dlg;
|
||||
|
@ -1,44 +1,22 @@
|
||||
#ifndef slic3r_GUI_hpp_
|
||||
#define slic3r_GUI_hpp_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "PrintConfig.hpp"
|
||||
#include "Config.hpp"
|
||||
#include "callback.hpp"
|
||||
#include "GUI_ObjectParts.hpp"
|
||||
|
||||
#include <wx/intl.h>
|
||||
#include <wx/string.h>
|
||||
|
||||
class wxApp;
|
||||
class wxWindow;
|
||||
class wxFrame;
|
||||
class wxMenuBar;
|
||||
class wxNotebook;
|
||||
class wxPanel;
|
||||
class wxComboCtrl;
|
||||
class wxString;
|
||||
class wxArrayString;
|
||||
class wxArrayLong;
|
||||
class wxColour;
|
||||
class wxBoxSizer;
|
||||
class wxFlexGridSizer;
|
||||
class wxButton;
|
||||
class wxFileDialog;
|
||||
class wxStaticBitmap;
|
||||
class wxFont;
|
||||
class wxTopLevelWindow;
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
class PresetBundle;
|
||||
class PresetCollection;
|
||||
class Print;
|
||||
class ProgressStatusBar;
|
||||
class AppConfig;
|
||||
class PresetUpdater;
|
||||
class DynamicPrintConfig;
|
||||
class TabIface;
|
||||
class PreviewIface;
|
||||
class Print;
|
||||
class GCodePreviewData;
|
||||
@ -71,56 +49,17 @@ namespace GUI { namespace I18N {
|
||||
|
||||
namespace GUI {
|
||||
|
||||
class Tab;
|
||||
class ConfigOptionsGroup;
|
||||
// Map from an file_type name to full file wildcard name.
|
||||
const std::map<const std::string, const std::string> FILE_WILDCARDS{
|
||||
std::make_pair("known", "Known files (*.stl, *.obj, *.amf, *.xml, *.prusa)|*.stl;*.STL;*.obj;*.OBJ;*.amf;*.AMF;*.xml;*.XML;*.prusa;*.PRUSA"),
|
||||
std::make_pair("stl", "STL files (*.stl)|*.stl;*.STL"),
|
||||
std::make_pair("obj", "OBJ files (*.obj)|*.obj;*.OBJ"),
|
||||
std::make_pair("amf", "AMF files (*.amf)|*.zip.amf;*.amf;*.AMF;*.xml;*.XML"),
|
||||
std::make_pair("3mf", "3MF files (*.3mf)|*.3mf;*.3MF;"),
|
||||
std::make_pair("prusa", "Prusa Control files (*.prusa)|*.prusa;*.PRUSA"),
|
||||
std::make_pair("ini", "INI files *.ini|*.ini;*.INI"),
|
||||
std::make_pair("gcode", "G-code files (*.gcode, *.gco, *.g, *.ngc)|*.gcode;*.GCODE;*.gco;*.GCO;*.g;*.G;*.ngc;*.NGC"),
|
||||
std::make_pair("svg", "SVG files *.svg|*.svg;*.SVG")
|
||||
};
|
||||
|
||||
const std::string MODEL_WILDCARD{ FILE_WILDCARDS.at("known") + std::string("|") +
|
||||
FILE_WILDCARDS.at("stl") + std::string("|") +
|
||||
FILE_WILDCARDS.at("obj") + std::string("|") +
|
||||
FILE_WILDCARDS.at("amf") + std::string("|") +
|
||||
FILE_WILDCARDS.at("3mf") + std::string("|") +
|
||||
FILE_WILDCARDS.at("prusa") };
|
||||
struct PresetTab {
|
||||
std::string name;
|
||||
Tab* panel;
|
||||
PrinterTechnology technology;
|
||||
};
|
||||
|
||||
|
||||
void disable_screensaver();
|
||||
void enable_screensaver();
|
||||
bool debugged();
|
||||
void break_to_debugger();
|
||||
|
||||
void set_show_print_info(bool show);
|
||||
void set_show_manifold_warning_icon(bool show);
|
||||
void set_objects_list_sizer(wxBoxSizer *objects_list_sizer);
|
||||
|
||||
AppConfig* get_app_config();
|
||||
|
||||
AppControllerPtr get_appctl();
|
||||
void set_cli_appctl();
|
||||
void set_gui_appctl();
|
||||
|
||||
void open_model(wxWindow *parent, wxArrayString& input_files);
|
||||
|
||||
wxWindow* get_right_panel();
|
||||
|
||||
Tab* get_tab(const std::string& name);
|
||||
std::vector<PresetTab>* get_preset_tabs();
|
||||
|
||||
extern void add_menus(wxMenuBar *menu, int event_preferences_changed, int event_language_change);
|
||||
|
||||
// Checks if configuration wizard needs to run, calls config_wizard if so.
|
||||
@ -131,12 +70,8 @@ extern bool config_wizard_startup(bool app_config_exists);
|
||||
// The run_reason argument is actually ConfigWizard::RunReason, but int is used here because of Perl.
|
||||
extern void config_wizard(int run_reason);
|
||||
|
||||
TabIface* get_preset_tab_iface(char *name);
|
||||
|
||||
PreviewIface* create_preview_iface(wxNotebook* notebook, DynamicPrintConfig* config, Print* print, GCodePreviewData* gcode_preview_data);
|
||||
|
||||
// add it at the end of the tab panel.
|
||||
// void add_created_tab(Tab* panel, int event_value_change, int event_presets_changed);
|
||||
// Change option value in config
|
||||
void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt_key, const boost::any& value, int opt_index = 0);
|
||||
|
||||
@ -149,8 +84,6 @@ void warning_catcher(wxWindow* parent, const wxString& message);
|
||||
// to deliver a progress status message.
|
||||
void set_print_callback_event(Print *print, int id);
|
||||
|
||||
void show_info_sizer(const bool show);
|
||||
|
||||
// Creates a wxCheckListBoxComboPopup inside the given wxComboCtrl, filled with the given text and items.
|
||||
// Items are all initialized to the given value.
|
||||
// Items must be separated by '|', for example "Item1|Item2|Item3", and so on.
|
||||
@ -167,19 +100,9 @@ wxString from_u8(const std::string &str);
|
||||
// Return std::string in UTF8 from wxString
|
||||
std::string into_u8(const wxString &str);
|
||||
|
||||
void set_model_events_from_perl(Model &model,
|
||||
int event_object_selection_changed,
|
||||
int event_object_settings_changed,
|
||||
int event_remove_object,
|
||||
int event_update_scene);
|
||||
void add_frequently_changed_parameters(wxWindow* parent, wxBoxSizer* sizer, wxFlexGridSizer* preset_sizer);
|
||||
|
||||
// Callback to trigger a configuration update timer on the Plater.
|
||||
static PerlCallback g_on_request_update_callback;
|
||||
|
||||
ConfigOptionsGroup* get_optgroup(size_t i);
|
||||
std::vector <std::shared_ptr<ConfigOptionsGroup>>& get_optgroups();
|
||||
|
||||
void add_export_option(wxFileDialog* dlg, const std::string& format);
|
||||
int get_export_option(wxFileDialog* dlg);
|
||||
|
||||
@ -191,9 +114,6 @@ void save_window_size(wxTopLevelWindow *window, const std::string &name);
|
||||
// Restore the above
|
||||
void restore_window_size(wxTopLevelWindow *window, const std::string &name);
|
||||
|
||||
// Update buttons view according to enable/disable
|
||||
void enable_action_buttons(bool enable);
|
||||
|
||||
// Display an About dialog
|
||||
extern void about();
|
||||
// Ask the destop to open the datadir using the default file explorer.
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "GUI_App.hpp"
|
||||
#include "GUI_ObjectList.hpp"
|
||||
#include "GUI_ObjectManipulation.hpp"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
@ -18,6 +19,7 @@
|
||||
#include "AppConfig.hpp"
|
||||
#include "PresetBundle.hpp"
|
||||
#include "3DScene.hpp"
|
||||
#include "Model.hpp"
|
||||
|
||||
#include "../Utils/PresetUpdater.hpp"
|
||||
#include "ConfigWizard_private.hpp"
|
||||
@ -92,6 +94,8 @@ bool GUI_App::OnInit()
|
||||
// wxImage::FindHandlerType(wxBITMAP_TYPE_PNG) ||
|
||||
wxImage::AddHandler(new wxPNGHandler());
|
||||
mainframe = new MainFrame(no_plater, false);
|
||||
sidebar().obj_list()->init_objects(); // propagate model objects to object list
|
||||
update_mode();
|
||||
SetTopWindow(mainframe);
|
||||
|
||||
// This makes CallAfter() work
|
||||
@ -220,6 +224,8 @@ void GUI_App::recreate_GUI()
|
||||
|
||||
auto topwindow = GetTopWindow();
|
||||
mainframe = new MainFrame(no_plater,false);
|
||||
sidebar().obj_list()->init_objects(); // propagate model objects to object list
|
||||
update_mode();
|
||||
|
||||
if (topwindow) {
|
||||
SetTopWindow(mainframe);
|
||||
@ -493,18 +499,18 @@ ConfigMenuIDs GUI_App::get_view_mode()
|
||||
// Update view mode according to selected menu
|
||||
void GUI_App::update_mode()
|
||||
{
|
||||
wxWindowUpdateLocker noUpdates(/*g_right_panel->GetParent()*/mainframe);
|
||||
wxWindowUpdateLocker noUpdates(mainframe->m_plater);
|
||||
|
||||
ConfigMenuIDs mode = wxGetApp().get_view_mode();
|
||||
|
||||
// g_object_list_sizer->Show(mode == ConfigMenuModeExpert);
|
||||
show_info_sizer(mode == ConfigMenuModeExpert);
|
||||
// show_buttons(mode == ConfigMenuModeExpert);
|
||||
// show_object_name(mode == ConfigMenuModeSimple);
|
||||
show_manipulation_sizer(mode == ConfigMenuModeSimple);
|
||||
obj_list()->get_sizer()->Show(mode == ConfigMenuModeExpert);
|
||||
sidebar().show_info_sizers(mode == ConfigMenuModeExpert);
|
||||
sidebar().show_buttons(mode == ConfigMenuModeExpert);
|
||||
obj_manipul()->show_object_name(mode == ConfigMenuModeSimple);
|
||||
obj_list()->update_manipulation_sizer(mode == ConfigMenuModeSimple);
|
||||
|
||||
/*g_right_panel*/mainframe->m_plater->Layout();
|
||||
/*g_right_panel->GetParent()*/mainframe->Layout();
|
||||
sidebar().Layout();
|
||||
mainframe->m_plater->Layout();
|
||||
}
|
||||
|
||||
void GUI_App::add_config_menu(wxMenuBar *menu)
|
||||
@ -658,25 +664,21 @@ ObjectManipulation* GUI_App::obj_manipul()
|
||||
return sidebar().obj_manipul();
|
||||
}
|
||||
|
||||
ObjectList* GUI_App::obj_list()
|
||||
{
|
||||
return sidebar().obj_list();
|
||||
}
|
||||
|
||||
ModelObjectPtrs* GUI_App::model_objects()
|
||||
{
|
||||
return &mainframe->m_plater->model().objects;
|
||||
}
|
||||
|
||||
wxNotebook* GUI_App::tab_panel() const
|
||||
{
|
||||
return mainframe->m_tabpanel;
|
||||
}
|
||||
|
||||
// std::vector<PresetTab> preset_tabs = {
|
||||
// { "print", nullptr, ptFFF },
|
||||
// { "filament", nullptr, ptFFF },
|
||||
// { "sla_material", nullptr, ptSLA }
|
||||
// };
|
||||
//
|
||||
// Tab* GUI_App::get_tab(const std::string& name)
|
||||
// {
|
||||
// std::vector<PresetTab>::iterator it = std::find_if(preset_tabs.begin(), preset_tabs.end(),
|
||||
// [name](PresetTab& tab){ return name == tab.name; });
|
||||
// return it != preset_tabs.end() ? it->panel : nullptr;
|
||||
// }
|
||||
|
||||
|
||||
// static method accepting a wxWindow object as first parameter
|
||||
// void warning_catcher{
|
||||
// my($self, $message_dialog) = @_;
|
||||
|
@ -2,11 +2,8 @@
|
||||
#define slic3r_GUI_App_hpp_
|
||||
|
||||
#include <string>
|
||||
// #include <vector>
|
||||
#include "PrintConfig.hpp"
|
||||
#include "MainFrame.hpp"
|
||||
// #include "../../libslic3r/Utils.hpp"
|
||||
// #include "GUI.hpp"
|
||||
|
||||
#include <wx/app.h>
|
||||
#include <wx/colour.h>
|
||||
@ -24,9 +21,31 @@ namespace Slic3r {
|
||||
class AppConfig;
|
||||
class PresetBundle;
|
||||
class PresetUpdater;
|
||||
class ModelObject;
|
||||
|
||||
namespace GUI
|
||||
{
|
||||
// Map from an file_type name to full file wildcard name.
|
||||
const std::map<const std::string, const std::string> FILE_WILDCARDS{
|
||||
std::make_pair("known", "Known files (*.stl, *.obj, *.amf, *.xml, *.prusa)|*.stl;*.STL;*.obj;*.OBJ;*.amf;*.AMF;*.xml;*.XML;*.prusa;*.PRUSA"),
|
||||
std::make_pair("stl", "STL files (*.stl)|*.stl;*.STL"),
|
||||
std::make_pair("obj", "OBJ files (*.obj)|*.obj;*.OBJ"),
|
||||
std::make_pair("amf", "AMF files (*.amf)|*.zip.amf;*.amf;*.AMF;*.xml;*.XML"),
|
||||
std::make_pair("3mf", "3MF files (*.3mf)|*.3mf;*.3MF;"),
|
||||
std::make_pair("prusa", "Prusa Control files (*.prusa)|*.prusa;*.PRUSA"),
|
||||
std::make_pair("ini", "INI files *.ini|*.ini;*.INI"),
|
||||
std::make_pair("gcode", "G-code files (*.gcode, *.gco, *.g, *.ngc)|*.gcode;*.GCODE;*.gco;*.GCO;*.g;*.G;*.ngc;*.NGC"),
|
||||
std::make_pair("svg", "SVG files *.svg|*.svg;*.SVG")
|
||||
};
|
||||
|
||||
const std::string MODEL_WILDCARD{ FILE_WILDCARDS.at("known") + std::string("|") +
|
||||
FILE_WILDCARDS.at("stl") + std::string("|") +
|
||||
FILE_WILDCARDS.at("obj") + std::string("|") +
|
||||
FILE_WILDCARDS.at("amf") + std::string("|") +
|
||||
FILE_WILDCARDS.at("3mf") + std::string("|") +
|
||||
FILE_WILDCARDS.at("prusa") };
|
||||
|
||||
|
||||
enum ConfigMenuIDs {
|
||||
ConfigMenuWizard,
|
||||
ConfigMenuSnapshots,
|
||||
@ -61,8 +80,6 @@ class GUI_App : public wxApp
|
||||
wxFont m_small_font;
|
||||
wxFont m_bold_font;
|
||||
|
||||
// #ys_FIXME
|
||||
// std::vector<Tab *> g_tabs_list;
|
||||
wxLocale* m_wxLocale{ nullptr };
|
||||
|
||||
public:
|
||||
@ -120,17 +137,12 @@ public:
|
||||
bool check_unsaved_changes();
|
||||
bool checked_tab(Tab* tab);
|
||||
void delete_tab_from_list(Tab* tab);
|
||||
// Tab* get_tab(const std::string& name);
|
||||
void load_current_presets();
|
||||
|
||||
|
||||
Sidebar& sidebar();
|
||||
ObjectManipulation* obj_manipul();
|
||||
// ObjectList& get_obj_list();
|
||||
|
||||
// Functions for updating of the object manipulation values
|
||||
void update_position_values();
|
||||
void update_position_values(const Vec3d& position);
|
||||
ObjectList* obj_list();
|
||||
std::vector<ModelObject*> *model_objects();
|
||||
|
||||
AppConfig* app_config{ nullptr };
|
||||
PresetBundle* preset_bundle{ nullptr };
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -3,24 +3,30 @@
|
||||
|
||||
#include <wx/panel.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <map>
|
||||
|
||||
class wxBoxSizer;
|
||||
class wxDataViewCtrl;
|
||||
class wxDataViewColumn;
|
||||
class wxDataViewEvent;
|
||||
class wxDataViewItem;
|
||||
class PrusaObjectDataViewModel;
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
class ConfigOptionsGroup;
|
||||
class DynamicPrintConfig;
|
||||
class ModelObject;
|
||||
class ModelVolume;
|
||||
|
||||
namespace GUI {
|
||||
|
||||
class ObjectList
|
||||
{
|
||||
wxBoxSizer *m_sizer {nullptr};
|
||||
wxDataViewCtrl *m_objects_ctrl{ nullptr };
|
||||
PrusaObjectDataViewModel *m_objects_model{ nullptr };
|
||||
wxWindow *m_parent{ nullptr };
|
||||
|
||||
DynamicPrintConfig *m_default_config {nullptr};
|
||||
|
||||
wxBitmap m_icon_modifiermesh;
|
||||
wxBitmap m_icon_solidmesh;
|
||||
wxBitmap m_icon_manifold_warning;
|
||||
@ -28,20 +34,99 @@ class ObjectList
|
||||
wxBitmap m_bmp_split;
|
||||
|
||||
int m_selected_object_id = -1;
|
||||
bool m_prevent_list_events = false; // We use this flag to avoid circular event handling Select()
|
||||
// happens to fire a wxEVT_LIST_ITEM_SELECTED on OSX, whose event handler
|
||||
// calls this method again and again and again
|
||||
#ifdef __WXOSX__
|
||||
wxString m_selected_extruder = "";
|
||||
#endif //__WXOSX__
|
||||
bool m_parts_changed = false;
|
||||
bool m_part_settings_changed = false;
|
||||
|
||||
public:
|
||||
ObjectList(wxWindow* parent);
|
||||
~ObjectList() {}
|
||||
~ObjectList();
|
||||
|
||||
|
||||
std::map<std::string, wxBitmap> CATEGORY_ICON;
|
||||
|
||||
wxDataViewCtrl *m_objects_ctrl{ nullptr };
|
||||
PrusaObjectDataViewModel *m_objects_model{ nullptr };
|
||||
DynamicPrintConfig *m_config {nullptr};
|
||||
|
||||
std::vector<ModelObject*> *m_objects{ nullptr };
|
||||
|
||||
|
||||
void create_objects_ctrl();
|
||||
wxDataViewColumn* create_objects_list_extruder_column(int extruders_count);
|
||||
void update_objects_list_extruder_column(int extruders_count);
|
||||
// show/hide "Extruder" column for Objects List
|
||||
void set_extruder_column_hidden(bool hide);
|
||||
// update extruder in current config
|
||||
void update_extruder_in_config(const wxString& selection);
|
||||
|
||||
void init_icons();
|
||||
|
||||
void set_tooltip_for_item(const wxPoint& pt);
|
||||
|
||||
void object_ctrl_selection_changed();
|
||||
void object_ctrl_context_menu();
|
||||
void show_context_menu();
|
||||
void object_ctrl_key_event(wxKeyEvent& event);
|
||||
void object_ctrl_item_value_change(wxDataViewEvent& event);
|
||||
|
||||
void on_begin_drag(wxDataViewEvent &event);
|
||||
void on_drop_possible(wxDataViewEvent &event);
|
||||
void on_drop(wxDataViewEvent &event);
|
||||
|
||||
void get_settings_choice(wxMenu *menu, int id, bool is_part);
|
||||
void menu_item_add_generic(wxMenuItem* &menu, int id);
|
||||
wxMenuItem* menu_item_split(wxMenu* menu, int id);
|
||||
wxMenuItem* menu_item_settings(wxMenu* menu, int id, const bool is_part);
|
||||
wxMenu* create_add_part_popupmenu();
|
||||
wxMenu* create_part_settings_popupmenu();
|
||||
wxMenu* create_add_settings_popupmenu(bool is_part);
|
||||
|
||||
void load_subobject(bool is_modifier = false, bool is_lambda = false);
|
||||
void load_part(ModelObject* model_object, wxArrayString& part_names, const bool is_modifier);
|
||||
void load_lambda(ModelObject* model_object, wxArrayString& part_names, const bool is_modifier);
|
||||
void load_lambda(const std::string& type_name);
|
||||
void del_subobject();
|
||||
void del_settings_from_config();
|
||||
bool del_subobject_from_object(const int volume_id);
|
||||
void split(const bool split_part);
|
||||
bool get_volume_by_item(const bool split_part, const wxDataViewItem& item, ModelVolume*& volume);
|
||||
bool is_splittable_object(const bool split_part);
|
||||
|
||||
wxPoint get_mouse_position_in_control();
|
||||
wxBoxSizer* get_sizer(){return m_sizer;}
|
||||
int get_sel_obj_id() { return m_selected_object_id; }
|
||||
int get_sel_obj_id() const { return m_selected_object_id; }
|
||||
bool is_parts_changed() const { return m_parts_changed; }
|
||||
bool is_part_settings_changed() const{ return m_part_settings_changed; }
|
||||
|
||||
void parts_changed(int obj_idx);
|
||||
void part_selection_changed();
|
||||
|
||||
void update_manipulation_sizer(const bool is_simple_mode);
|
||||
|
||||
// Add object to the list
|
||||
void add_object_to_list(const std::string &name, ModelObject* model_object);
|
||||
// Delete object from the list
|
||||
void delete_object_from_list();
|
||||
// Delete all objects from the list
|
||||
void delete_all_objects_from_list();
|
||||
// Set count of object on c++ side
|
||||
void set_object_count(int idx, int count);
|
||||
// Unselect all objects in the list on c++ side
|
||||
void unselect_objects();
|
||||
// Select current object in the list on c++ side
|
||||
void select_current_object(int idx);
|
||||
// Select current volume in the list on c++ side
|
||||
void select_current_volume(int idx, int vol_idx);
|
||||
// Remove objects/sub-object from the list
|
||||
void remove();
|
||||
|
||||
void init_objects();
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
#include "GUI_ObjectManipulation.hpp"
|
||||
#include "GUI_ObjectList.hpp"
|
||||
|
||||
#include "OptionsGroup.hpp"
|
||||
#include "wxExtensions.hpp"
|
||||
#include "PresetBundle.hpp"
|
||||
#include "Model.hpp"
|
||||
#include "Geometry.hpp"
|
||||
|
||||
@ -36,7 +38,7 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent):
|
||||
std::vector<std::string> axes{ "x", "y", "z" };
|
||||
for (auto axis : axes) {
|
||||
std::string key = "scale_" + axis;
|
||||
get_optgroup(ogFrequentlyObjectSettings)->set_side_text(key, selection);
|
||||
m_og->set_side_text(key, selection);
|
||||
}
|
||||
|
||||
m_is_percent_scale = selection == _("%");
|
||||
@ -80,7 +82,9 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent):
|
||||
auto btn = new PrusaLockButton(parent, wxID_ANY);
|
||||
btn->Bind(wxEVT_BUTTON, [btn](wxCommandEvent &event){
|
||||
event.Skip();
|
||||
wxTheApp->CallAfter([btn]() { set_uniform_scaling(btn->IsLocked()); });
|
||||
wxTheApp->CallAfter([btn]() {
|
||||
wxGetApp().obj_manipul()->set_uniform_scaling(btn->IsLocked());
|
||||
});
|
||||
});
|
||||
return btn;
|
||||
};
|
||||
@ -136,8 +140,8 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent):
|
||||
def.default_value = new ConfigOptionBool{ false };
|
||||
m_og->append_single_option_line(Option(def, "place_on_bed"));
|
||||
|
||||
m_extra_settings_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
m_og->sizer->Add(m_extra_settings_sizer, 1, wxEXPAND | wxLEFT, 5);
|
||||
m_settings_list_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
m_og->sizer->Add(m_settings_list_sizer, 1, wxEXPAND | wxLEFT, 5);
|
||||
|
||||
m_og->disable();
|
||||
}
|
||||
@ -147,6 +151,117 @@ int ObjectManipulation::ol_selection()
|
||||
return wxGetApp().sidebar().get_ol_selection();
|
||||
}
|
||||
|
||||
void ObjectManipulation::update_settings_list()
|
||||
{
|
||||
#ifdef __WXGTK__
|
||||
auto parent = m_og->get_parent();
|
||||
#else
|
||||
auto parent = m_og->parent();
|
||||
#endif /* __WXGTK__ */
|
||||
|
||||
// There is a bug related to Ubuntu overlay scrollbars, see https://github.com/prusa3d/Slic3r/issues/898 and https://github.com/prusa3d/Slic3r/issues/952.
|
||||
// The issue apparently manifests when Show()ing a window with overlay scrollbars while the UI is frozen. For this reason,
|
||||
// we will Thaw the UI prematurely on Linux. This means destroing the no_updates object prematurely.
|
||||
#ifdef __linux__
|
||||
std::unique_ptr<wxWindowUpdateLocker> no_updates(new wxWindowUpdateLocker(parent));
|
||||
#else
|
||||
wxWindowUpdateLocker noUpdates(parent);
|
||||
#endif
|
||||
|
||||
m_settings_list_sizer->Clear(true);
|
||||
bool show_manipulations = true;
|
||||
|
||||
auto objects_ctrl = wxGetApp().obj_list()->m_objects_ctrl;
|
||||
auto objects_model = wxGetApp().obj_list()->m_objects_model;
|
||||
auto config = wxGetApp().obj_list()->m_config;
|
||||
|
||||
const auto item = objects_ctrl->GetSelection();
|
||||
if (config && objects_model->IsSettingsItem(item))
|
||||
{
|
||||
auto extra_column = [config](wxWindow* parent, const Line& line)
|
||||
{
|
||||
auto opt_key = (line.get_options())[0].opt_id; //we assume that we have one option per line
|
||||
|
||||
auto btn = new wxBitmapButton(parent, wxID_ANY, wxBitmap(from_u8(var("colorchange_delete_on.png")), wxBITMAP_TYPE_PNG),
|
||||
wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
|
||||
#ifdef __WXMSW__
|
||||
btn->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
||||
#endif // __WXMSW__
|
||||
btn->Bind(wxEVT_BUTTON, [opt_key, config](wxEvent &event){
|
||||
config->erase(opt_key);
|
||||
wxTheApp->CallAfter([]() { wxGetApp().obj_manipul()->update_settings_list(); });
|
||||
});
|
||||
return btn;
|
||||
};
|
||||
|
||||
std::map<std::string, std::vector<std::string>> cat_options;
|
||||
auto opt_keys = config->keys();
|
||||
m_og_settings.resize(0);
|
||||
std::vector<std::string> categories;
|
||||
if (!(opt_keys.size() == 1 && opt_keys[0] == "extruder"))// return;
|
||||
{
|
||||
auto extruders_cnt = wxGetApp().preset_bundle->printers.get_selected_preset().printer_technology() == ptSLA ? 1 :
|
||||
wxGetApp().preset_bundle->printers.get_edited_preset().config.option<ConfigOptionFloats>("nozzle_diameter")->values.size();
|
||||
|
||||
for (auto& opt_key : opt_keys) {
|
||||
auto category = config->def()->get(opt_key)->category;
|
||||
if (category.empty() ||
|
||||
(category == "Extruders" && extruders_cnt == 1)) continue;
|
||||
|
||||
std::vector< std::string > new_category;
|
||||
|
||||
auto& cat_opt = cat_options.find(category) == cat_options.end() ? new_category : cat_options.at(category);
|
||||
cat_opt.push_back(opt_key);
|
||||
if (cat_opt.size() == 1)
|
||||
cat_options[category] = cat_opt;
|
||||
}
|
||||
|
||||
for (auto& cat : cat_options) {
|
||||
if (cat.second.size() == 1 && cat.second[0] == "extruder")
|
||||
continue;
|
||||
|
||||
auto optgroup = std::make_shared<ConfigOptionsGroup>(parent, cat.first, config, false, ogDEFAULT, extra_column);
|
||||
optgroup->label_width = 150;
|
||||
optgroup->sidetext_width = 70;
|
||||
|
||||
for (auto& opt : cat.second)
|
||||
{
|
||||
if (opt == "extruder")
|
||||
continue;
|
||||
Option option = optgroup->get_option(opt);
|
||||
option.opt.width = 70;
|
||||
optgroup->append_single_option_line(option);
|
||||
}
|
||||
optgroup->reload_config();
|
||||
m_settings_list_sizer->Add(optgroup->sizer, 0, wxEXPAND | wxALL, 0);
|
||||
m_og_settings.push_back(optgroup);
|
||||
|
||||
categories.push_back(cat.first);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_og_settings.empty()) {
|
||||
objects_ctrl->Select(objects_model->Delete(item));
|
||||
wxGetApp().obj_list()->part_selection_changed();
|
||||
}
|
||||
else {
|
||||
if (!categories.empty())
|
||||
objects_model->UpdateSettingsDigest(item, categories);
|
||||
show_manipulations = false;
|
||||
}
|
||||
}
|
||||
|
||||
show_manipulation_og(show_manipulations);
|
||||
wxGetApp().sidebar().show_info_sizers(show_manipulations && item && objects_model->GetParent(item) == wxDataViewItem(0));
|
||||
|
||||
#ifdef __linux__
|
||||
no_updates.reset(nullptr);
|
||||
#endif
|
||||
|
||||
parent->Layout();
|
||||
/*wxGetApp().sidebar().*/parent->GetParent()->Layout();
|
||||
}
|
||||
|
||||
void ObjectManipulation::update_values()
|
||||
{
|
||||
int selection = ol_selection();
|
||||
@ -298,7 +413,21 @@ void ObjectManipulation::update_rotation_value(const Vec3d& rotation)
|
||||
}
|
||||
#endif // ENABLE_MODELINSTANCE_3D_FULL_TRANSFORM
|
||||
|
||||
void ObjectManipulation::show_object_name(bool show)
|
||||
{
|
||||
wxGridSizer* grid_sizer = m_og->get_grid_sizer();
|
||||
grid_sizer->Show(static_cast<size_t>(0), show);
|
||||
grid_sizer->Show(static_cast<size_t>(1), show);
|
||||
}
|
||||
|
||||
void ObjectManipulation::show_manipulation_og(const bool show)
|
||||
{
|
||||
wxGridSizer* grid_sizer = m_og->get_grid_sizer();
|
||||
if (show == grid_sizer->IsShown(2))
|
||||
return;
|
||||
for (size_t id = 2; id < 12; id++)
|
||||
grid_sizer->Show(id, show);
|
||||
}
|
||||
|
||||
} //namespace GUI
|
||||
} //namespace Slic3r
|
@ -23,6 +23,7 @@ public:
|
||||
~OG_Settings() {}
|
||||
|
||||
wxSizer* get_sizer();
|
||||
ConfigOptionsGroup* get_og() { return m_og.get(); }
|
||||
};
|
||||
|
||||
|
||||
@ -30,13 +31,18 @@ class ObjectManipulation : public OG_Settings
|
||||
{
|
||||
bool m_is_percent_scale = false; // true -> percentage scale unit
|
||||
// false -> uniform scale unit
|
||||
wxBoxSizer* m_extra_settings_sizer{ nullptr }; // sizer for extra Object/Part's settings
|
||||
bool m_is_uniform_scale = false; // It indicates if scale is uniform
|
||||
// sizer for extra Object/Part's settings
|
||||
wxBoxSizer* m_settings_list_sizer{ nullptr };
|
||||
// option groups for settings
|
||||
std::vector <std::shared_ptr<ConfigOptionsGroup>> m_og_settings;
|
||||
|
||||
public:
|
||||
ObjectManipulation(wxWindow* parent);
|
||||
~ObjectManipulation() {}
|
||||
|
||||
int ol_selection();
|
||||
void update_settings_list();
|
||||
|
||||
void update_values();
|
||||
// update position values displacements or "gizmos"
|
||||
@ -57,6 +63,10 @@ public:
|
||||
void update_rotation_value(const Vec3d& rotation);
|
||||
#endif // ENABLE_MODELINSTANCE_3D_FULL_TRANSFORM
|
||||
|
||||
void set_uniform_scaling(const bool uniform_scale) { m_is_uniform_scale = uniform_scale; }
|
||||
|
||||
void show_object_name(bool show);
|
||||
void show_manipulation_og(const bool show);
|
||||
};
|
||||
|
||||
}}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,134 +0,0 @@
|
||||
#ifndef slic3r_GUI_ObjectParts_hpp_
|
||||
#define slic3r_GUI_ObjectParts_hpp_
|
||||
// #include "OptionsGroup.hpp"
|
||||
|
||||
class wxWindow;
|
||||
class wxSizer;
|
||||
class wxBoxSizer;
|
||||
class wxString;
|
||||
class wxArrayString;
|
||||
class wxMenu;
|
||||
class wxDataViewEvent;
|
||||
class wxKeyEvent;
|
||||
class wxGLCanvas;
|
||||
class wxBitmap;
|
||||
|
||||
namespace Slic3r {
|
||||
class ModelObject;
|
||||
class Model;
|
||||
|
||||
namespace GUI {
|
||||
class ConfigOptionsGroup;
|
||||
using t_optgroups = std::vector <std::shared_ptr<ConfigOptionsGroup>>;
|
||||
|
||||
enum ogGroup{
|
||||
ogFrequentlyChangingParameters,
|
||||
ogFrequentlyObjectSettings,
|
||||
ogObjectSettings
|
||||
};
|
||||
|
||||
enum LambdaTypeIDs{
|
||||
LambdaTypeBox,
|
||||
LambdaTypeCylinder,
|
||||
LambdaTypeSphere,
|
||||
LambdaTypeSlab
|
||||
};
|
||||
|
||||
struct OBJECT_PARAMETERS
|
||||
{
|
||||
LambdaTypeIDs type = LambdaTypeBox;
|
||||
double dim[3];// = { 1.0, 1.0, 1.0 };
|
||||
int cyl_r = 1;
|
||||
int cyl_h = 1;
|
||||
double sph_rho = 1.0;
|
||||
double slab_h = 1.0;
|
||||
double slab_z = 0.0;
|
||||
};
|
||||
|
||||
typedef std::map<std::string, wxBitmap> t_category_icon;
|
||||
inline t_category_icon& get_category_icon();
|
||||
|
||||
void add_objects_list(wxWindow* parent, wxBoxSizer* sizer);
|
||||
void add_object_settings(wxWindow* parent, wxBoxSizer* sizer, t_optgroups& optgroups);
|
||||
|
||||
wxMenu *create_add_settings_popupmenu(bool is_part);
|
||||
wxMenu *create_add_part_popupmenu();
|
||||
wxMenu *create_part_settings_popupmenu();
|
||||
|
||||
// Add object to the list
|
||||
//void add_object(const std::string &name);
|
||||
void add_object_to_list(const std::string &name, ModelObject* model_object);
|
||||
// Delete object from the list
|
||||
void delete_object_from_list();
|
||||
// Delete all objects from the list
|
||||
void delete_all_objects_from_list();
|
||||
// Set count of object on c++ side
|
||||
void set_object_count(int idx, int count);
|
||||
// Unselect all objects in the list on c++ side
|
||||
void unselect_objects();
|
||||
// Select current object in the list on c++ side
|
||||
void select_current_object(int idx);
|
||||
// Select current volume in the list on c++ side
|
||||
void select_current_volume(int idx, int vol_idx);
|
||||
// Remove objects/sub-object from the list
|
||||
void remove();
|
||||
|
||||
void object_ctrl_selection_changed();
|
||||
void object_ctrl_context_menu();
|
||||
void object_ctrl_key_event(wxKeyEvent& event);
|
||||
void object_ctrl_item_value_change(wxDataViewEvent& event);
|
||||
void show_context_menu();
|
||||
bool is_splittable_object(const bool split_part);
|
||||
|
||||
void init_mesh_icons();
|
||||
void set_event_object_selection_changed(const int& event);
|
||||
void set_event_object_settings_changed(const int& event);
|
||||
void set_event_remove_object(const int& event);
|
||||
void set_event_update_scene(const int& event);
|
||||
void set_objects_from_model(Model &model);
|
||||
|
||||
bool is_parts_changed();
|
||||
bool is_part_settings_changed();
|
||||
|
||||
void load_part( ModelObject* model_object,
|
||||
wxArrayString& part_names, const bool is_modifier);
|
||||
|
||||
void load_lambda( ModelObject* model_object,
|
||||
wxArrayString& part_names, const bool is_modifier);
|
||||
void load_lambda( const std::string& type_name);
|
||||
|
||||
void on_btn_load(bool is_modifier = false, bool is_lambda = false);
|
||||
void on_btn_del();
|
||||
void on_btn_split(const bool split_part);
|
||||
void on_btn_move_up();
|
||||
void on_btn_move_down();
|
||||
|
||||
void parts_changed(int obj_idx);
|
||||
void part_selection_changed();
|
||||
|
||||
// show/hide "Extruder" column for Objects List
|
||||
void set_extruder_column_hidden(bool hide);
|
||||
// update extruder in current config
|
||||
void update_extruder_in_config(const wxString& selection);
|
||||
|
||||
void set_uniform_scaling(const bool uniform_scale);
|
||||
|
||||
void on_begin_drag(wxDataViewEvent &event);
|
||||
void on_drop_possible(wxDataViewEvent &event);
|
||||
void on_drop(wxDataViewEvent &event);
|
||||
|
||||
// update extruder column for objects_ctrl according to extruders count
|
||||
void update_objects_list_extruder_column(int extruders_count);
|
||||
|
||||
// Create/Update/Reset double slider on 3dPreview
|
||||
void create_double_slider(wxWindow* parent, wxBoxSizer* sizer, wxGLCanvas* canvas);
|
||||
void update_double_slider(bool force_sliders_full_range);
|
||||
void reset_double_slider();
|
||||
// update DoubleSlider after keyDown in canvas
|
||||
void update_double_slider_from_canvas(wxKeyEvent& event);
|
||||
|
||||
void show_manipulation_sizer(const bool is_simple_mode);
|
||||
|
||||
} //namespace GUI
|
||||
} //namespace Slic3r
|
||||
#endif //slic3r_GUI_ObjectParts_hpp_
|
@ -6,6 +6,7 @@
|
||||
#include "GLCanvas3DManager.hpp"
|
||||
#include "../../libslic3r/GCode/PreviewData.hpp"
|
||||
#include "PresetBundle.hpp"
|
||||
#include "wxExtensions.hpp"
|
||||
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/glcanvas.h>
|
||||
@ -69,7 +70,7 @@ bool Preview::init(wxNotebook* notebook, DynamicPrintConfig* config, Print* prin
|
||||
_3DScene::enable_dynamic_background(m_canvas, true);
|
||||
|
||||
m_double_slider_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
create_double_slider(this, m_double_slider_sizer, m_canvas);
|
||||
create_double_slider();
|
||||
|
||||
m_label_view_type = new wxStaticText(this, wxID_ANY, _(L("View")));
|
||||
|
||||
@ -468,5 +469,104 @@ void Preview::on_checkbox_shells(wxCommandEvent& evt)
|
||||
refresh_print();
|
||||
}
|
||||
|
||||
void Preview::create_double_slider()
|
||||
{
|
||||
m_slider = new PrusaDoubleSlider(this, wxID_ANY, 0, 0, 0, 100);
|
||||
m_double_slider_sizer->Add(m_slider, 0, wxEXPAND, 0);
|
||||
|
||||
// sizer, m_canvas
|
||||
m_canvas->Bind(wxEVT_KEY_DOWN, &Preview::update_double_slider_from_canvas, this);
|
||||
|
||||
m_slider->Bind(wxEVT_SCROLL_CHANGED, [this](wxEvent& event) {
|
||||
_3DScene::set_toolpaths_range(m_canvas, m_slider->GetLowerValueD() - 1e-6, m_slider->GetHigherValueD() + 1e-6);
|
||||
if (IsShown())
|
||||
m_canvas->Refresh();
|
||||
});
|
||||
}
|
||||
|
||||
void Preview::update_double_slider(bool force_sliders_full_range)
|
||||
{
|
||||
std::vector<std::pair<int, double>> values;
|
||||
std::vector<double> layers_z = _3DScene::get_current_print_zs(m_canvas, true);
|
||||
fill_slider_values(values, layers_z);
|
||||
|
||||
const double z_low = m_slider->GetLowerValueD();
|
||||
const double z_high = m_slider->GetHigherValueD();
|
||||
m_slider->SetMaxValue(layers_z.size() - 1);
|
||||
m_slider->SetSliderValues(values);
|
||||
|
||||
set_double_slider_thumbs(force_sliders_full_range, layers_z, z_low, z_high);
|
||||
}
|
||||
|
||||
void Preview::fill_slider_values(std::vector<std::pair<int, double>> &values,
|
||||
const std::vector<double> &layers_z)
|
||||
{
|
||||
std::vector<double> layers_all_z = _3DScene::get_current_print_zs(m_canvas, false);
|
||||
if (layers_all_z.size() == layers_z.size())
|
||||
for (int i = 0; i < layers_z.size(); i++)
|
||||
values.push_back(std::pair<int, double>(i + 1, layers_z[i]));
|
||||
else if (layers_all_z.size() > layers_z.size()) {
|
||||
int cur_id = 0;
|
||||
for (int i = 0; i < layers_z.size(); i++)
|
||||
for (int j = cur_id; j < layers_all_z.size(); j++)
|
||||
if (layers_z[i] - 1e-6 < layers_all_z[j] && layers_all_z[j] < layers_z[i] + 1e-6) {
|
||||
values.push_back(std::pair<int, double>(j + 1, layers_z[i]));
|
||||
cur_id = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Preview::set_double_slider_thumbs(const bool force_sliders_full_range,
|
||||
const std::vector<double> &layers_z,
|
||||
const double z_low,
|
||||
const double z_high)
|
||||
{
|
||||
// Force slider full range only when slider is created.
|
||||
// Support selected diapason on the all next steps
|
||||
if (/*force_sliders_full_range*/z_high == 0.0) {
|
||||
m_slider->SetLowerValue(0);
|
||||
m_slider->SetHigherValue(layers_z.size() - 1);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = layers_z.size() - 1; i >= 0; i--)
|
||||
if (z_low >= layers_z[i]) {
|
||||
m_slider->SetLowerValue(i);
|
||||
break;
|
||||
}
|
||||
for (int i = layers_z.size() - 1; i >= 0; i--)
|
||||
if (z_high >= layers_z[i]) {
|
||||
m_slider->SetHigherValue(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Preview::reset_double_slider()
|
||||
{
|
||||
m_slider->SetHigherValue(0);
|
||||
m_slider->SetLowerValue(0);
|
||||
}
|
||||
|
||||
void Preview::update_double_slider_from_canvas(wxKeyEvent& event)
|
||||
{
|
||||
if (event.HasModifiers()) {
|
||||
event.Skip();
|
||||
return;
|
||||
}
|
||||
|
||||
const auto key = event.GetKeyCode();
|
||||
|
||||
if (key == 'U' || key == 'D') {
|
||||
const int new_pos = key == 'U' ? m_slider->GetHigherValue() + 1 : m_slider->GetHigherValue() - 1;
|
||||
m_slider->SetHigherValue(new_pos);
|
||||
if (event.ShiftDown()) m_slider->SetLowerValue(m_slider->GetHigherValue());
|
||||
}
|
||||
else if (key == 'S')
|
||||
m_slider->ChangeOneLayerLock();
|
||||
else
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
} // namespace GUI
|
||||
} // namespace Slic3r
|
||||
|
@ -13,6 +13,7 @@ class wxStaticText;
|
||||
class wxChoice;
|
||||
class wxComboCtrl;
|
||||
class wxCheckBox;
|
||||
class PrusaDoubleSlider;
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
@ -46,6 +47,8 @@ class Preview : public wxPanel
|
||||
bool m_enabled;
|
||||
bool m_force_sliders_full_range;
|
||||
|
||||
PrusaDoubleSlider* m_slider {nullptr};
|
||||
|
||||
public:
|
||||
Preview(wxNotebook* notebook, DynamicPrintConfig* config, Print* print, GCodePreviewData* gcode_preview_data);
|
||||
virtual ~Preview();
|
||||
@ -84,6 +87,19 @@ private:
|
||||
void on_checkbox_retractions(wxCommandEvent& evt);
|
||||
void on_checkbox_unretractions(wxCommandEvent& evt);
|
||||
void on_checkbox_shells(wxCommandEvent& evt);
|
||||
|
||||
// Create/Update/Reset double slider on 3dPreview
|
||||
void create_double_slider();
|
||||
void update_double_slider(bool force_sliders_full_range);
|
||||
void fill_slider_values(std::vector<std::pair<int, double>> &values,
|
||||
const std::vector<double> &layers_z);
|
||||
void set_double_slider_thumbs( const bool force_sliders_full_range,
|
||||
const std::vector<double> &layers_z,
|
||||
const double z_low,
|
||||
const double z_high);
|
||||
void reset_double_slider();
|
||||
// update DoubleSlider after keyDown in canvas
|
||||
void update_double_slider_from_canvas(wxKeyEvent& event);
|
||||
};
|
||||
|
||||
} // namespace GUI
|
||||
|
@ -13,6 +13,24 @@ namespace Slic3r
|
||||
{
|
||||
namespace GUI
|
||||
{
|
||||
enum LambdaTypeIDs{
|
||||
LambdaTypeBox,
|
||||
LambdaTypeCylinder,
|
||||
LambdaTypeSphere,
|
||||
LambdaTypeSlab
|
||||
};
|
||||
|
||||
struct OBJECT_PARAMETERS
|
||||
{
|
||||
LambdaTypeIDs type = LambdaTypeBox;
|
||||
double dim[3];// = { 1.0, 1.0, 1.0 };
|
||||
int cyl_r = 1;
|
||||
int cyl_h = 1;
|
||||
double sph_rho = 1.0;
|
||||
double slab_h = 1.0;
|
||||
double slab_z = 0.0;
|
||||
};
|
||||
class ConfigOptionsGroup;
|
||||
using ConfigOptionsGroupShp = std::shared_ptr<ConfigOptionsGroup>;
|
||||
class LambdaObjectDialog : public wxDialog
|
||||
{
|
||||
|
@ -100,9 +100,6 @@ wxFrame(NULL, wxID_ANY, SLIC3R_BUILD, wxDefaultPosition, wxDefaultSize, wxDEFAUL
|
||||
});
|
||||
|
||||
update_ui_from_settings();
|
||||
|
||||
// Slic3r::GUI::update_mode();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -247,6 +244,23 @@ void MainFrame::init_tabpanel()
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<PresetTab> preset_tabs = {
|
||||
{ "print", nullptr, ptFFF },
|
||||
{ "filament", nullptr, ptFFF },
|
||||
{ "sla_material", nullptr, ptSLA }
|
||||
};
|
||||
|
||||
std::vector<PresetTab>& MainFrame::get_preset_tabs() {
|
||||
return preset_tabs;
|
||||
}
|
||||
|
||||
Tab* MainFrame::get_tab(const std::string& name)
|
||||
{
|
||||
std::vector<PresetTab>::iterator it = std::find_if(preset_tabs.begin(), preset_tabs.end(),
|
||||
[name](PresetTab& tab){ return name == tab.name; });
|
||||
return it != preset_tabs.end() ? it->panel : nullptr;
|
||||
}
|
||||
|
||||
Tab* MainFrame::get_preset_tab(const std::string& name)
|
||||
{
|
||||
Tab* tab = get_tab(name);
|
||||
@ -282,10 +296,9 @@ void MainFrame::add_created_tab(Tab* panel)
|
||||
const wxString& tab_name = panel->GetName();
|
||||
bool add_panel = true;
|
||||
|
||||
auto preset_tabs = get_preset_tabs();
|
||||
auto it = std::find_if(preset_tabs->begin(), preset_tabs->end(),
|
||||
auto it = std::find_if(preset_tabs.begin(), preset_tabs.end(),
|
||||
[tab_name](PresetTab& tab){return tab.name == tab_name; });
|
||||
if (it != preset_tabs->end()) {
|
||||
if (it != preset_tabs.end()) {
|
||||
it->panel = panel;
|
||||
add_panel = it->technology == wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology();
|
||||
}
|
||||
|
@ -36,6 +36,12 @@ enum QuickSlice
|
||||
qsExportPNG
|
||||
};
|
||||
|
||||
struct PresetTab {
|
||||
std::string name;
|
||||
Tab* panel;
|
||||
PrinterTechnology technology;
|
||||
};
|
||||
|
||||
class MainFrame : public wxFrame
|
||||
{
|
||||
bool m_no_plater;
|
||||
@ -64,6 +70,9 @@ class MainFrame : public wxFrame
|
||||
|
||||
std::string get_base_name(const wxString full_name) const ;
|
||||
std::string get_dir_name(const wxString full_name) const ;
|
||||
|
||||
Tab* get_tab(const std::string& name);
|
||||
|
||||
public:
|
||||
MainFrame() {}
|
||||
MainFrame(const bool no_plater, const bool loaded);
|
||||
@ -94,6 +103,7 @@ public:
|
||||
void select_tab(size_t tab) const;
|
||||
void select_view(const std::string& direction);
|
||||
|
||||
std::vector<PresetTab>& get_preset_tabs();
|
||||
|
||||
Plater* m_plater { nullptr };
|
||||
wxNotebook* m_tabpanel { nullptr };
|
||||
|
@ -72,13 +72,13 @@ class ObjectInfo : public wxStaticBoxSizer
|
||||
public:
|
||||
ObjectInfo(wxWindow *parent);
|
||||
|
||||
wxStaticBitmap *manifold_warning_icon;
|
||||
private:
|
||||
wxStaticText *info_size;
|
||||
wxStaticText *info_volume;
|
||||
wxStaticText *info_facets;
|
||||
wxStaticText *info_materials;
|
||||
wxStaticText *info_manifold;
|
||||
wxStaticBitmap *manifold_warning_icon;
|
||||
};
|
||||
|
||||
ObjectInfo::ObjectInfo(wxWindow *parent) :
|
||||
@ -362,8 +362,6 @@ struct Sidebar::priv
|
||||
wxButton *btn_reslice;
|
||||
// wxButton *btn_print; // XXX: remove
|
||||
wxButton *btn_send_gcode;
|
||||
|
||||
std::vector <std::shared_ptr<ConfigOptionsGroup>> optgroups {};
|
||||
};
|
||||
|
||||
|
||||
@ -512,13 +510,14 @@ ObjectManipulation* Sidebar::obj_manipul()
|
||||
return p->object_manipulation;
|
||||
}
|
||||
|
||||
ConfigOptionsGroup* Sidebar::get_optgroup(size_t i)
|
||||
ObjectList* Sidebar::obj_list()
|
||||
{
|
||||
return p->optgroups.empty() ? nullptr : p->optgroups[i].get();
|
||||
return p->object_list;
|
||||
}
|
||||
|
||||
t_optgroups& Sidebar::get_optgroups() {
|
||||
return p->optgroups;
|
||||
ConfigOptionsGroup* Sidebar::og_freq_chng_params()
|
||||
{
|
||||
return p->frequently_changed_parameters->get_og();
|
||||
}
|
||||
|
||||
wxButton* Sidebar::get_wiping_dialog_button()
|
||||
@ -536,6 +535,26 @@ int Sidebar::get_ol_selection()
|
||||
return p->object_list->get_sel_obj_id();
|
||||
}
|
||||
|
||||
void Sidebar::show_info_sizers(const bool show)
|
||||
{
|
||||
p->object_info->Show(show);
|
||||
p->object_info->manifold_warning_icon->Show(show/* && g_show_manifold_warning_icon*/); // where is g_show_manifold_warning_icon updating? #ys_FIXME
|
||||
p->sliced_info->Show(show /*&& g_show_print_info*/); // where is g_show_print_info updating? #ys_FIXME
|
||||
}
|
||||
|
||||
void Sidebar::show_buttons(const bool show)
|
||||
{
|
||||
p->btn_reslice->Show(show);
|
||||
for (size_t i = 0; i < wxGetApp().tab_panel()->GetPageCount(); ++i) {
|
||||
TabPrinter *tab = dynamic_cast<TabPrinter*>(wxGetApp().tab_panel()->GetPage(i));
|
||||
if (!tab)
|
||||
continue;
|
||||
if (wxGetApp().preset_bundle->printers.get_selected_preset().printer_technology() == ptFFF) {
|
||||
p->btn_send_gcode->Show(show && !tab->m_config->opt_string("print_host").empty());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Plater::Object
|
||||
|
||||
@ -712,27 +731,6 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) :
|
||||
// Drop target:
|
||||
q->SetDropTarget(new PlaterDropTarget(q)); // if my understanding is right, wxWindow takes the owenership
|
||||
|
||||
// Setting of global access pointers
|
||||
// FIXME: We really should get rid of these once Perl code is gone...
|
||||
set_objects_from_model(model);
|
||||
// TODO: ?
|
||||
// # Send sizers/buttons to C++
|
||||
// Slic3r::GUI::set_objects_from_perl( $self->{scrolled_window_panel},
|
||||
// $frequently_changed_parameters_sizer,
|
||||
// $info_sizer,
|
||||
// $self->{btn_export_gcode},
|
||||
// # $self->{btn_export_stl},
|
||||
// $self->{btn_reslice},
|
||||
// $self->{btn_print},
|
||||
// $self->{btn_send_gcode},
|
||||
// $self->{object_info_manifold_warning_icon} );
|
||||
|
||||
// Slic3r::GUI::set_model_events_from_perl( $self->{model},
|
||||
// $self->{event_object_selection_changed},
|
||||
// $self->{event_object_settings_changed},
|
||||
// $self->{event_remove_object},
|
||||
// $self->{event_update_scene});
|
||||
|
||||
update_ui_from_settings();
|
||||
q->Layout();
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ namespace GUI {
|
||||
class MainFrame;
|
||||
class ConfigOptionsGroup;
|
||||
class ObjectManipulation;
|
||||
class ObjectList;
|
||||
|
||||
using t_optgroups = std::vector <std::shared_ptr<ConfigOptionsGroup>>;
|
||||
|
||||
@ -32,12 +33,14 @@ public:
|
||||
void update_presets(Slic3r::Preset::Type preset_type);
|
||||
|
||||
ObjectManipulation* obj_manipul();
|
||||
ObjectList* obj_list();
|
||||
|
||||
ConfigOptionsGroup* get_optgroup(size_t i); // #ys_FIXME_for_delete
|
||||
t_optgroups& get_optgroups();// #ys_FIXME_for_delete
|
||||
ConfigOptionsGroup* og_freq_chng_params();
|
||||
wxButton* get_wiping_dialog_button();
|
||||
void update_objects_list_extruder_column(int extruders_count);
|
||||
int get_ol_selection();
|
||||
void show_info_sizers(const bool show);
|
||||
void show_buttons(const bool show);
|
||||
|
||||
private:
|
||||
struct priv;
|
||||
|
@ -683,10 +683,12 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
|
||||
|
||||
// g_wxMainFrame->ProcessWindowEvent(event);// #ys_FIXME
|
||||
}
|
||||
|
||||
auto og_freq_chng_params = wxGetApp().sidebar().og_freq_chng_params();
|
||||
if (opt_key == "fill_density")
|
||||
{
|
||||
boost::any val = get_optgroup(ogFrequentlyChangingParameters)->get_config_value(*m_config, opt_key);
|
||||
get_optgroup(ogFrequentlyChangingParameters)->set_value(opt_key, val);
|
||||
boost::any val = og_freq_chng_params->get_config_value(*m_config, opt_key);
|
||||
og_freq_chng_params->set_value(opt_key, val);
|
||||
}
|
||||
if (opt_key == "support_material" || opt_key == "support_material_buildplate_only")
|
||||
{
|
||||
@ -695,12 +697,12 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
|
||||
m_config->opt_bool("support_material_buildplate_only") ?
|
||||
_("Support on build plate only") :
|
||||
_("Everywhere");
|
||||
get_optgroup(ogFrequentlyChangingParameters)->set_value("support", new_selection);
|
||||
og_freq_chng_params->set_value("support", new_selection);
|
||||
}
|
||||
if (opt_key == "brim_width")
|
||||
{
|
||||
bool val = m_config->opt_float("brim_width") > 0.0 ? true : false;
|
||||
get_optgroup(ogFrequentlyChangingParameters)->set_value("brim", val);
|
||||
og_freq_chng_params->set_value("brim", val);
|
||||
}
|
||||
|
||||
if (opt_key == "wipe_tower" || opt_key == "single_extruder_multi_material" || opt_key == "extruders_count" )
|
||||
@ -789,19 +791,20 @@ void Tab::update_preset_description_line()
|
||||
|
||||
void Tab::update_frequently_changed_parameters()
|
||||
{
|
||||
if (!get_optgroup(ogFrequentlyChangingParameters)) return;
|
||||
boost::any value = get_optgroup(ogFrequentlyChangingParameters)->get_config_value(*m_config, "fill_density");
|
||||
get_optgroup(ogFrequentlyChangingParameters)->set_value("fill_density", value);
|
||||
auto og_freq_chng_params = wxGetApp().sidebar().og_freq_chng_params();
|
||||
if (!og_freq_chng_params) return;
|
||||
boost::any value = og_freq_chng_params->get_config_value(*m_config, "fill_density");
|
||||
og_freq_chng_params->set_value("fill_density", value);
|
||||
|
||||
wxString new_selection = !m_config->opt_bool("support_material") ?
|
||||
_("None") :
|
||||
m_config->opt_bool("support_material_buildplate_only") ?
|
||||
_("Support on build plate only") :
|
||||
_("Everywhere");
|
||||
get_optgroup(ogFrequentlyChangingParameters)->set_value("support", new_selection);
|
||||
og_freq_chng_params->set_value("support", new_selection);
|
||||
|
||||
bool val = m_config->opt_float("brim_width") > 0.0 ? true : false;
|
||||
get_optgroup(ogFrequentlyChangingParameters)->set_value("brim", val);
|
||||
og_freq_chng_params->set_value("brim", val);
|
||||
|
||||
update_wiping_button_visibility();
|
||||
}
|
||||
@ -1841,8 +1844,9 @@ void TabPrinter::extruders_count_changed(size_t extruders_count){
|
||||
m_preset_bundle->update_multi_material_filament_presets();
|
||||
build_extruder_pages();
|
||||
reload_config();
|
||||
if (!wxGetApp().mainframe)
|
||||
return;
|
||||
on_value_change("extruders_count", extruders_count);
|
||||
if (wxGetApp().mainframe)
|
||||
wxGetApp().mainframe->m_plater->sidebar().update_objects_list_extruder_column(extruders_count);
|
||||
}
|
||||
|
||||
@ -2193,7 +2197,7 @@ void Tab::load_current_preset()
|
||||
PrinterTechnology& printer_technology = m_presets->get_edited_preset().printer_technology();
|
||||
if (printer_technology != static_cast<TabPrinter*>(this)->m_printer_technology)
|
||||
{
|
||||
for (auto& tab : *get_preset_tabs()){
|
||||
for (auto& tab : wxGetApp().mainframe->get_preset_tabs()){
|
||||
if (tab.technology != printer_technology)
|
||||
{
|
||||
int page_id = wxGetApp().tab_panel()->FindPage(tab.panel);
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "wxExtensions.hpp"
|
||||
|
||||
#include "GUI.hpp"
|
||||
#include "../../libslic3r/Utils.hpp"
|
||||
#include "BitmapCache.hpp"
|
||||
|
||||
@ -8,6 +7,8 @@
|
||||
#include <wx/statline.h>
|
||||
#include <wx/dcclient.h>
|
||||
#include <wx/numformatter.h>
|
||||
#include "GUI_App.hpp"
|
||||
#include "GUI_ObjectList.hpp"
|
||||
|
||||
const unsigned int wxCheckListBoxComboPopup::DefaultWidth = 200;
|
||||
const unsigned int wxCheckListBoxComboPopup::DefaultHeight = 200;
|
||||
@ -368,7 +369,7 @@ bool PrusaObjectDataViewModelNode::update_settings_digest(const std::vector<std:
|
||||
m_name = wxEmptyString;
|
||||
m_icon = m_empty_icon;
|
||||
|
||||
auto categories_icon = Slic3r::GUI::get_category_icon();
|
||||
std::map<std::string, wxBitmap>& categories_icon = Slic3r::GUI::wxGetApp().obj_list()->CATEGORY_ICON;//Slic3r::GUI::get_category_icon();
|
||||
|
||||
for (auto& cat : m_opt_categories)
|
||||
m_name += cat + "; ";
|
||||
|
Loading…
Reference in New Issue
Block a user