Removed obsolete LambdaObjectDialog.cpp/hpp, more include cleanups:
BedShapeDialog.hpp (needs not include) OptionsGroup.hpp Tab.hpp GUI_App.hpp
This commit is contained in:
parent
48c186331a
commit
d9b764bd10
9 changed files with 21 additions and 277 deletions
|
@ -89,8 +89,6 @@ set(SLIC3R_GUI_SOURCES
|
||||||
GUI/GUI_ObjectSettings.hpp
|
GUI/GUI_ObjectSettings.hpp
|
||||||
GUI/GUI_ObjectLayers.cpp
|
GUI/GUI_ObjectLayers.cpp
|
||||||
GUI/GUI_ObjectLayers.hpp
|
GUI/GUI_ObjectLayers.hpp
|
||||||
GUI/LambdaObjectDialog.cpp
|
|
||||||
GUI/LambdaObjectDialog.hpp
|
|
||||||
GUI/MeshUtils.cpp
|
GUI/MeshUtils.cpp
|
||||||
GUI/MeshUtils.hpp
|
GUI/MeshUtils.hpp
|
||||||
GUI/Tab.cpp
|
GUI/Tab.cpp
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "BedShapeDialog.hpp"
|
#include "BedShapeDialog.hpp"
|
||||||
#include "GUI_App.hpp"
|
#include "GUI_App.hpp"
|
||||||
|
#include "OptionsGroup.hpp"
|
||||||
|
|
||||||
#include <wx/wx.h>
|
#include <wx/wx.h>
|
||||||
#include <wx/numformatter.h>
|
#include <wx/numformatter.h>
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
// The bed shape dialog.
|
// The bed shape dialog.
|
||||||
// The dialog opens from Print Settins tab->Bed Shape : Set...
|
// The dialog opens from Print Settins tab->Bed Shape : Set...
|
||||||
|
|
||||||
#include "OptionsGroup.hpp"
|
|
||||||
#include "GUI_Utils.hpp"
|
#include "GUI_Utils.hpp"
|
||||||
#include "2DBed.hpp"
|
#include "2DBed.hpp"
|
||||||
#include "I18N.hpp"
|
#include "I18N.hpp"
|
||||||
|
@ -14,6 +13,8 @@
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
|
class ConfigOptionsGroup;
|
||||||
|
|
||||||
using ConfigOptionsGroupShp = std::shared_ptr<ConfigOptionsGroup>;
|
using ConfigOptionsGroupShp = std::shared_ptr<ConfigOptionsGroup>;
|
||||||
class BedShapePanel : public wxPanel
|
class BedShapePanel : public wxPanel
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
#include "AppConfig.hpp"
|
#include "AppConfig.hpp"
|
||||||
#include "PresetBundle.hpp"
|
#include "PresetBundle.hpp"
|
||||||
#include "BedShapeDialog.hpp"
|
#include "BedShapeDialog.hpp"
|
||||||
|
#include "GUI.hpp"
|
||||||
|
#include "wxExtensions.hpp"
|
||||||
|
|
||||||
|
|
||||||
namespace fs = boost::filesystem;
|
namespace fs = boost::filesystem;
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
#include "Tab.hpp"
|
#include "Tab.hpp"
|
||||||
#include "wxExtensions.hpp"
|
#include "wxExtensions.hpp"
|
||||||
#include "libslic3r/Model.hpp"
|
#include "libslic3r/Model.hpp"
|
||||||
#include "LambdaObjectDialog.hpp"
|
|
||||||
#include "GLCanvas3D.hpp"
|
#include "GLCanvas3D.hpp"
|
||||||
#include "Selection.hpp"
|
#include "Selection.hpp"
|
||||||
|
|
||||||
|
|
|
@ -1,201 +0,0 @@
|
||||||
#include "LambdaObjectDialog.hpp"
|
|
||||||
|
|
||||||
#include <wx/window.h>
|
|
||||||
#include <wx/button.h>
|
|
||||||
#include "OptionsGroup.hpp"
|
|
||||||
#include "GUI_App.hpp"
|
|
||||||
#include "I18N.hpp"
|
|
||||||
|
|
||||||
namespace Slic3r
|
|
||||||
{
|
|
||||||
namespace GUI
|
|
||||||
{
|
|
||||||
|
|
||||||
LambdaObjectDialog::LambdaObjectDialog(wxWindow* parent,
|
|
||||||
const wxString type_name):
|
|
||||||
m_type_name(type_name)
|
|
||||||
{
|
|
||||||
Create(parent, wxID_ANY, _(L("Lambda Object")),
|
|
||||||
parent->GetScreenPosition(), wxDefaultSize,
|
|
||||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
|
|
||||||
|
|
||||||
// instead of double dim[3] = { 1.0, 1.0, 1.0 };
|
|
||||||
object_parameters.dim[0] = 1.0;
|
|
||||||
object_parameters.dim[1] = 1.0;
|
|
||||||
object_parameters.dim[2] = 1.0;
|
|
||||||
|
|
||||||
sizer = new wxBoxSizer(wxVERTICAL);
|
|
||||||
|
|
||||||
// modificator options
|
|
||||||
if (m_type_name == wxEmptyString) {
|
|
||||||
m_modificator_options_book = new wxChoicebook( this, wxID_ANY, wxDefaultPosition,
|
|
||||||
wxDefaultSize, wxCHB_TOP);
|
|
||||||
sizer->Add(m_modificator_options_book, 1, wxEXPAND | wxALL, 10);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
m_panel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
|
||||||
sizer->Add(m_panel, 1, wxEXPAND | wxALL, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
ConfigOptionDef def;
|
|
||||||
def.width = 70;
|
|
||||||
auto optgroup = init_modificator_options_page(_(L("Box")));
|
|
||||||
if (optgroup) {
|
|
||||||
optgroup->m_on_change = [this](t_config_option_key opt_key, boost::any value) {
|
|
||||||
int opt_id = opt_key == "l" ? 0 :
|
|
||||||
opt_key == "w" ? 1 :
|
|
||||||
opt_key == "h" ? 2 : -1;
|
|
||||||
if (opt_id < 0) return;
|
|
||||||
object_parameters.dim[opt_id] = boost::any_cast<double>(value);
|
|
||||||
};
|
|
||||||
|
|
||||||
def.type = coFloat;
|
|
||||||
def.set_default_value(new ConfigOptionFloat{ 1.0 });
|
|
||||||
def.label = L("Length");
|
|
||||||
Option option(def, "l");
|
|
||||||
optgroup->append_single_option_line(option);
|
|
||||||
|
|
||||||
def.label = L("Width");
|
|
||||||
option = Option(def, "w");
|
|
||||||
optgroup->append_single_option_line(option);
|
|
||||||
|
|
||||||
def.label = L("Height");
|
|
||||||
option = Option(def, "h");
|
|
||||||
optgroup->append_single_option_line(option);
|
|
||||||
}
|
|
||||||
|
|
||||||
optgroup = init_modificator_options_page(_(L("Cylinder")));
|
|
||||||
if (optgroup) {
|
|
||||||
optgroup->m_on_change = [this](t_config_option_key opt_key, boost::any value) {
|
|
||||||
int val = boost::any_cast<int>(value);
|
|
||||||
if (opt_key == "cyl_r")
|
|
||||||
object_parameters.cyl_r = val;
|
|
||||||
else if (opt_key == "cyl_h")
|
|
||||||
object_parameters.cyl_h = val;
|
|
||||||
else return;
|
|
||||||
};
|
|
||||||
|
|
||||||
def.type = coInt;
|
|
||||||
def.set_default_value(new ConfigOptionInt{ 1 });
|
|
||||||
def.label = L("Radius");
|
|
||||||
auto option = Option(def, "cyl_r");
|
|
||||||
optgroup->append_single_option_line(option);
|
|
||||||
|
|
||||||
def.label = L("Height");
|
|
||||||
option = Option(def, "cyl_h");
|
|
||||||
optgroup->append_single_option_line(option);
|
|
||||||
}
|
|
||||||
|
|
||||||
optgroup = init_modificator_options_page(_(L("Sphere")));
|
|
||||||
if (optgroup) {
|
|
||||||
optgroup->m_on_change = [this](t_config_option_key opt_key, boost::any value) {
|
|
||||||
if (opt_key == "sph_rho")
|
|
||||||
object_parameters.sph_rho = boost::any_cast<double>(value);
|
|
||||||
else return;
|
|
||||||
};
|
|
||||||
|
|
||||||
def.type = coFloat;
|
|
||||||
def.set_default_value(new ConfigOptionFloat{ 1.0 });
|
|
||||||
def.label = L("Rho");
|
|
||||||
auto option = Option(def, "sph_rho");
|
|
||||||
optgroup->append_single_option_line(option);
|
|
||||||
}
|
|
||||||
|
|
||||||
optgroup = init_modificator_options_page(_(L("Slab")));
|
|
||||||
if (optgroup) {
|
|
||||||
optgroup->m_on_change = [this](t_config_option_key opt_key, boost::any value) {
|
|
||||||
double val = boost::any_cast<double>(value);
|
|
||||||
if (opt_key == "slab_z")
|
|
||||||
object_parameters.slab_z = val;
|
|
||||||
else if (opt_key == "slab_h")
|
|
||||||
object_parameters.slab_h = val;
|
|
||||||
else return;
|
|
||||||
};
|
|
||||||
|
|
||||||
def.type = coFloat;
|
|
||||||
def.set_default_value(new ConfigOptionFloat{ 1.0 });
|
|
||||||
def.label = L("Height");
|
|
||||||
auto option = Option(def, "slab_h");
|
|
||||||
optgroup->append_single_option_line(option);
|
|
||||||
|
|
||||||
def.label = L("Initial Z");
|
|
||||||
option = Option(def, "slab_z");
|
|
||||||
optgroup->append_single_option_line(option);
|
|
||||||
}
|
|
||||||
|
|
||||||
Bind(wxEVT_CHOICEBOOK_PAGE_CHANGED, ([this](wxCommandEvent e)
|
|
||||||
{
|
|
||||||
auto page_idx = m_modificator_options_book->GetSelection();
|
|
||||||
if (page_idx < 0) return;
|
|
||||||
switch (page_idx)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
object_parameters.type = LambdaTypeBox;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
object_parameters.type = LambdaTypeCylinder;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
object_parameters.type = LambdaTypeSphere;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
object_parameters.type = LambdaTypeSlab;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
const auto button_sizer = CreateStdDialogButtonSizer(wxOK | wxCANCEL);
|
|
||||||
|
|
||||||
wxButton* btn_OK = static_cast<wxButton*>(FindWindowById(wxID_OK, this));
|
|
||||||
btn_OK->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) {
|
|
||||||
// validate user input
|
|
||||||
if (!CanClose())return;
|
|
||||||
EndModal(wxID_OK);
|
|
||||||
Destroy();
|
|
||||||
});
|
|
||||||
|
|
||||||
wxButton* btn_CANCEL = static_cast<wxButton*>(FindWindowById(wxID_CANCEL, this));
|
|
||||||
btn_CANCEL->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) {
|
|
||||||
// validate user input
|
|
||||||
if (!CanClose())return;
|
|
||||||
EndModal(wxID_CANCEL);
|
|
||||||
Destroy();
|
|
||||||
});
|
|
||||||
|
|
||||||
sizer->Add(button_sizer, 0, wxALIGN_CENTER_HORIZONTAL | wxBOTTOM, 10);
|
|
||||||
|
|
||||||
SetSizer(sizer);
|
|
||||||
sizer->Fit(this);
|
|
||||||
sizer->SetSizeHints(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called from the constructor.
|
|
||||||
// Create a panel for a rectangular / circular / custom bed shape.
|
|
||||||
ConfigOptionsGroupShp LambdaObjectDialog::init_modificator_options_page(const wxString& title)
|
|
||||||
{
|
|
||||||
if (!m_type_name.IsEmpty() && m_type_name != title)
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
auto panel = m_type_name.IsEmpty() ? new wxPanel(m_modificator_options_book) : m_panel;
|
|
||||||
|
|
||||||
ConfigOptionsGroupShp optgroup;
|
|
||||||
optgroup = std::make_shared<ConfigOptionsGroup>(panel, _(L("Add")) + " " +title + " " +dots);
|
|
||||||
optgroup->label_width = 100;
|
|
||||||
|
|
||||||
m_optgroups.push_back(optgroup);
|
|
||||||
|
|
||||||
if (m_type_name.IsEmpty()) {
|
|
||||||
panel->SetSizerAndFit(optgroup->sizer);
|
|
||||||
m_modificator_options_book->AddPage(panel, title);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
panel->SetSizer(optgroup->sizer);
|
|
||||||
|
|
||||||
return optgroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} //namespace GUI
|
|
||||||
} //namespace Slic3r
|
|
|
@ -1,59 +0,0 @@
|
||||||
#ifndef slic3r_LambdaObjectDialog_hpp_
|
|
||||||
#define slic3r_LambdaObjectDialog_hpp_
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include <wx/dialog.h>
|
|
||||||
#include <wx/sizer.h>
|
|
||||||
#include <wx/choicebk.h>
|
|
||||||
|
|
||||||
class wxPanel;
|
|
||||||
|
|
||||||
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
|
|
||||||
{
|
|
||||||
wxChoicebook* m_modificator_options_book = nullptr;
|
|
||||||
std::vector <ConfigOptionsGroupShp> m_optgroups;
|
|
||||||
wxString m_type_name;
|
|
||||||
wxPanel* m_panel = nullptr;
|
|
||||||
public:
|
|
||||||
LambdaObjectDialog(wxWindow* parent,
|
|
||||||
const wxString type_name = wxEmptyString);
|
|
||||||
~LambdaObjectDialog() {}
|
|
||||||
|
|
||||||
bool CanClose() { return true; } // ???
|
|
||||||
OBJECT_PARAMETERS& ObjectParameters() { return object_parameters; }
|
|
||||||
|
|
||||||
ConfigOptionsGroupShp init_modificator_options_page(const wxString& title);
|
|
||||||
|
|
||||||
// Note whether the window was already closed, so a pending update is not executed.
|
|
||||||
bool m_already_closed = false;
|
|
||||||
OBJECT_PARAMETERS object_parameters;
|
|
||||||
wxBoxSizer* sizer = nullptr;
|
|
||||||
};
|
|
||||||
} //namespace GUI
|
|
||||||
} //namespace Slic3r
|
|
||||||
#endif //slic3r_LambdaObjectDialog_hpp_
|
|
|
@ -3584,6 +3584,18 @@ void Tab::set_tooltips_text()
|
||||||
"Click to reset current value to the last saved preset."));
|
"Click to reset current value to the last saved preset."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Page::Page(wxWindow* parent, const wxString& title, const int iconID, const std::vector<ScalableBitmap>& mode_bmp_cache) :
|
||||||
|
m_parent(parent),
|
||||||
|
m_title(title),
|
||||||
|
m_iconID(iconID),
|
||||||
|
m_mode_bitmap_cache(mode_bmp_cache)
|
||||||
|
{
|
||||||
|
Create(m_parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
||||||
|
m_vsizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
m_item_color = &wxGetApp().get_label_clr_default();
|
||||||
|
SetSizer(m_vsizer);
|
||||||
|
}
|
||||||
|
|
||||||
void Page::reload_config()
|
void Page::reload_config()
|
||||||
{
|
{
|
||||||
for (auto group : m_optgroups)
|
for (auto group : m_optgroups)
|
||||||
|
|
|
@ -34,12 +34,11 @@
|
||||||
#include "wxExtensions.hpp"
|
#include "wxExtensions.hpp"
|
||||||
#include "ConfigManipulation.hpp"
|
#include "ConfigManipulation.hpp"
|
||||||
#include "Preset.hpp"
|
#include "Preset.hpp"
|
||||||
#include "GUI_App.hpp"
|
#include "OptionsGroup.hpp"
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
|
|
||||||
// Single Tab page containing a{ vsizer } of{ optgroups }
|
// Single Tab page containing a{ vsizer } of{ optgroups }
|
||||||
// package Slic3r::GUI::Tab::Page;
|
// package Slic3r::GUI::Tab::Page;
|
||||||
using ConfigOptionsGroupShp = std::shared_ptr<ConfigOptionsGroup>;
|
using ConfigOptionsGroupShp = std::shared_ptr<ConfigOptionsGroup>;
|
||||||
|
@ -51,17 +50,8 @@ class Page : public wxScrolledWindow
|
||||||
wxBoxSizer* m_vsizer;
|
wxBoxSizer* m_vsizer;
|
||||||
bool m_show = true;
|
bool m_show = true;
|
||||||
public:
|
public:
|
||||||
Page(wxWindow* parent, const wxString& title, const int iconID, const std::vector<ScalableBitmap>& mode_bmp_cache) :
|
Page(wxWindow* parent, const wxString& title, const int iconID,
|
||||||
m_parent(parent),
|
const std::vector<ScalableBitmap>& mode_bmp_cache);
|
||||||
m_title(title),
|
|
||||||
m_iconID(iconID),
|
|
||||||
m_mode_bitmap_cache(mode_bmp_cache)
|
|
||||||
{
|
|
||||||
Create(m_parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
|
||||||
m_vsizer = new wxBoxSizer(wxVERTICAL);
|
|
||||||
m_item_color = &wxGetApp().get_label_clr_default();
|
|
||||||
SetSizer(m_vsizer);
|
|
||||||
}
|
|
||||||
~Page() {}
|
~Page() {}
|
||||||
|
|
||||||
bool m_is_modified_values{ false };
|
bool m_is_modified_values{ false };
|
||||||
|
|
Loading…
Reference in a new issue