Refactoring:
1. Use C++ style cast instead of C style 2. Deleted unused code from Search
This commit is contained in:
parent
d9be78d4cb
commit
7f22ce63f6
18 changed files with 110 additions and 256 deletions
|
@ -4,7 +4,7 @@
|
||||||
#include "libslic3r/Utils.hpp"
|
#include "libslic3r/Utils.hpp"
|
||||||
#include "GUI.hpp"
|
#include "GUI.hpp"
|
||||||
#include "GUI_App.hpp"
|
#include "GUI_App.hpp"
|
||||||
|
#include "MainFrame.hpp"
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
@ -37,7 +37,7 @@ void AboutDialogLogo::onRepaint(wxEvent &event)
|
||||||
// CopyrightsDialog
|
// CopyrightsDialog
|
||||||
// -----------------------------------------
|
// -----------------------------------------
|
||||||
CopyrightsDialog::CopyrightsDialog()
|
CopyrightsDialog::CopyrightsDialog()
|
||||||
: DPIDialog((wxWindow*)wxGetApp().mainframe, wxID_ANY, from_u8((boost::format("%1% - %2%")
|
: DPIDialog(static_cast<wxWindow*>(wxGetApp().mainframe), wxID_ANY, from_u8((boost::format("%1% - %2%")
|
||||||
% (wxGetApp().is_editor() ? SLIC3R_APP_NAME : GCODEVIEWER_APP_NAME)
|
% (wxGetApp().is_editor() ? SLIC3R_APP_NAME : GCODEVIEWER_APP_NAME)
|
||||||
% _utf8(L("Portions copyright"))).str()),
|
% _utf8(L("Portions copyright"))).str()),
|
||||||
wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
||||||
|
@ -201,7 +201,7 @@ void CopyrightsDialog::onCloseDialog(wxEvent &)
|
||||||
}
|
}
|
||||||
|
|
||||||
AboutDialog::AboutDialog()
|
AboutDialog::AboutDialog()
|
||||||
: DPIDialog((wxWindow*)wxGetApp().mainframe, wxID_ANY, from_u8((boost::format(_utf8(L("About %s"))) % (wxGetApp().is_editor() ? SLIC3R_APP_NAME : GCODEVIEWER_APP_NAME)).str()), wxDefaultPosition,
|
: DPIDialog(static_cast<wxWindow*>(wxGetApp().mainframe), wxID_ANY, from_u8((boost::format(_utf8(L("About %s"))) % (wxGetApp().is_editor() ? SLIC3R_APP_NAME : GCODEVIEWER_APP_NAME)).str()), wxDefaultPosition,
|
||||||
wxDefaultSize, /*wxCAPTION*/wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
wxDefaultSize, /*wxCAPTION*/wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
||||||
{
|
{
|
||||||
SetFont(wxGetApp().normal_font());
|
SetFont(wxGetApp().normal_font());
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "libslic3r/Utils.hpp"
|
#include "libslic3r/Utils.hpp"
|
||||||
#include "libslic3r/Time.hpp"
|
#include "libslic3r/Time.hpp"
|
||||||
#include "GUI_App.hpp"
|
#include "GUI_App.hpp"
|
||||||
|
#include "MainFrame.hpp"
|
||||||
#include "wxExtensions.hpp"
|
#include "wxExtensions.hpp"
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
@ -109,7 +110,7 @@ static wxString generate_html_page(const Config::SnapshotDB &snapshot_db, const
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigSnapshotDialog::ConfigSnapshotDialog(const Config::SnapshotDB &snapshot_db, const wxString &on_snapshot)
|
ConfigSnapshotDialog::ConfigSnapshotDialog(const Config::SnapshotDB &snapshot_db, const wxString &on_snapshot)
|
||||||
: DPIDialog((wxWindow*)wxGetApp().mainframe, wxID_ANY, _(L("Configuration Snapshots")), wxDefaultPosition,
|
: DPIDialog(static_cast<wxWindow*>(wxGetApp().mainframe), wxID_ANY, _(L("Configuration Snapshots")), wxDefaultPosition,
|
||||||
wxSize(45 * wxGetApp().em_unit(), 40 * wxGetApp().em_unit()),
|
wxSize(45 * wxGetApp().em_unit(), 40 * wxGetApp().em_unit()),
|
||||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMAXIMIZE_BOX)
|
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMAXIMIZE_BOX)
|
||||||
{
|
{
|
||||||
|
|
|
@ -316,7 +316,7 @@ wxWindow* BitmapChoiceRenderer::CreateEditorCtrl(wxWindow* parent, wxRect labelR
|
||||||
|
|
||||||
bool BitmapChoiceRenderer::GetValueFromEditorCtrl(wxWindow* ctrl, wxVariant& value)
|
bool BitmapChoiceRenderer::GetValueFromEditorCtrl(wxWindow* ctrl, wxVariant& value)
|
||||||
{
|
{
|
||||||
wxBitmapComboBox* c = (wxBitmapComboBox*)ctrl;
|
wxBitmapComboBox* c = static_cast<wxBitmapComboBox*>(ctrl);
|
||||||
int selection = c->GetSelection();
|
int selection = c->GetSelection();
|
||||||
if (selection < 0)
|
if (selection < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -14,13 +14,14 @@
|
||||||
#include "GUI_App.hpp"
|
#include "GUI_App.hpp"
|
||||||
#include "I18N.hpp"
|
#include "I18N.hpp"
|
||||||
#include "OptionsGroup.hpp"
|
#include "OptionsGroup.hpp"
|
||||||
|
#include "MainFrame.hpp"
|
||||||
|
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
ExtruderSequenceDialog::ExtruderSequenceDialog(const DoubleSlider::ExtrudersSequence& sequence)
|
ExtruderSequenceDialog::ExtruderSequenceDialog(const DoubleSlider::ExtrudersSequence& sequence)
|
||||||
: DPIDialog((wxWindow*)wxGetApp().mainframe, wxID_ANY, wxString(SLIC3R_APP_NAME) + " - " + _(L("Set extruder sequence")),
|
: DPIDialog(static_cast<wxWindow*>(wxGetApp().mainframe), wxID_ANY, wxString(SLIC3R_APP_NAME) + " - " + _(L("Set extruder sequence")),
|
||||||
wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
|
wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
|
||||||
m_sequence(sequence)
|
m_sequence(sequence)
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,39 +38,6 @@ using t_back_to_init = std::function<void(const std::string&)>;
|
||||||
|
|
||||||
wxString double_to_string(double const value, const int max_precision = 4);
|
wxString double_to_string(double const value, const int max_precision = 4);
|
||||||
|
|
||||||
class RevertButton : public ScalableButton
|
|
||||||
{
|
|
||||||
bool hidden = false; // never show button if it's hidden ones
|
|
||||||
public:
|
|
||||||
// RevertButton() {}
|
|
||||||
// RevertButton(wxWindow* parent, wxWindowID id, const wxString& label = wxEmptyString,
|
|
||||||
// const wxPoint& pos = wxDefaultPosition,
|
|
||||||
// const wxSize& size = wxDefaultSize, long style = 0,
|
|
||||||
// const wxValidator& validator = wxDefaultValidator,
|
|
||||||
// const wxString& name = wxTextCtrlNameStr)
|
|
||||||
// {
|
|
||||||
// this->Create(parent, id, label, pos, size, style, validator, name);
|
|
||||||
// }
|
|
||||||
RevertButton(
|
|
||||||
wxWindow *parent,
|
|
||||||
const std::string& icon_name = ""
|
|
||||||
) :
|
|
||||||
ScalableButton(parent, wxID_ANY, icon_name) {}
|
|
||||||
|
|
||||||
// overridden from wxWindow base class
|
|
||||||
virtual bool
|
|
||||||
AcceptsFocusFromKeyboard() const { return false; }
|
|
||||||
|
|
||||||
void set_as_hidden() {
|
|
||||||
Hide();
|
|
||||||
hidden = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool Show(bool show = true) override {
|
|
||||||
return wxButton::Show(hidden ? false : show);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class Field {
|
class Field {
|
||||||
protected:
|
protected:
|
||||||
// factory function to defer and enforce creation of derived type.
|
// factory function to defer and enforce creation of derived type.
|
||||||
|
@ -283,14 +250,14 @@ public:
|
||||||
void propagate_value();
|
void propagate_value();
|
||||||
wxWindow* window {nullptr};
|
wxWindow* window {nullptr};
|
||||||
|
|
||||||
virtual void set_value(const std::string& value, bool change_event = false) {
|
void set_value(const std::string& value, bool change_event = false) {
|
||||||
m_disable_change_event = !change_event;
|
m_disable_change_event = !change_event;
|
||||||
dynamic_cast<wxTextCtrl*>(window)->SetValue(wxString(value));
|
dynamic_cast<wxTextCtrl*>(window)->SetValue(wxString(value));
|
||||||
m_disable_change_event = false;
|
m_disable_change_event = false;
|
||||||
}
|
}
|
||||||
virtual void set_value(const boost::any& value, bool change_event = false) override;
|
void set_value(const boost::any& value, bool change_event = false) override;
|
||||||
virtual void set_last_meaningful_value() override;
|
void set_last_meaningful_value() override;
|
||||||
virtual void set_na_value() override;
|
void set_na_value() override;
|
||||||
|
|
||||||
boost::any& get_value() override;
|
boost::any& get_value() override;
|
||||||
|
|
||||||
|
@ -392,7 +359,7 @@ public:
|
||||||
|
|
||||||
void set_selection();
|
void set_selection();
|
||||||
void set_value(const std::string& value, bool change_event = false);
|
void set_value(const std::string& value, bool change_event = false);
|
||||||
void set_value(const boost::any& value, bool change_event = false);
|
void set_value(const boost::any& value, bool change_event = false) override;
|
||||||
void set_values(const std::vector<std::string> &values);
|
void set_values(const std::vector<std::string> &values);
|
||||||
void set_values(const wxArrayString &values);
|
void set_values(const wxArrayString &values);
|
||||||
boost::any& get_value() override;
|
boost::any& get_value() override;
|
||||||
|
@ -448,7 +415,7 @@ public:
|
||||||
// Propagate value from field to the OptionGroupe and Config after kill_focus/ENTER
|
// Propagate value from field to the OptionGroupe and Config after kill_focus/ENTER
|
||||||
void propagate_value(wxTextCtrl* win);
|
void propagate_value(wxTextCtrl* win);
|
||||||
void set_value(const Vec2d& value, bool change_event = false);
|
void set_value(const Vec2d& value, bool change_event = false);
|
||||||
void set_value(const boost::any& value, bool change_event = false);
|
void set_value(const boost::any& value, bool change_event = false) override;
|
||||||
boost::any& get_value() override;
|
boost::any& get_value() override;
|
||||||
|
|
||||||
void msw_rescale() override;
|
void msw_rescale() override;
|
||||||
|
@ -478,7 +445,7 @@ public:
|
||||||
dynamic_cast<wxStaticText*>(window)->SetLabel(wxString::FromUTF8(value.data()));
|
dynamic_cast<wxStaticText*>(window)->SetLabel(wxString::FromUTF8(value.data()));
|
||||||
m_disable_change_event = false;
|
m_disable_change_event = false;
|
||||||
}
|
}
|
||||||
void set_value(const boost::any& value, bool change_event = false) {
|
void set_value(const boost::any& value, bool change_event = false) override {
|
||||||
m_disable_change_event = !change_event;
|
m_disable_change_event = !change_event;
|
||||||
dynamic_cast<wxStaticText*>(window)->SetLabel(boost::any_cast<wxString>(value));
|
dynamic_cast<wxStaticText*>(window)->SetLabel(boost::any_cast<wxString>(value));
|
||||||
m_disable_change_event = false;
|
m_disable_change_event = false;
|
||||||
|
@ -509,7 +476,7 @@ public:
|
||||||
void BUILD() override;
|
void BUILD() override;
|
||||||
|
|
||||||
void set_value(const int value, bool change_event = false);
|
void set_value(const int value, bool change_event = false);
|
||||||
void set_value(const boost::any& value, bool change_event = false);
|
void set_value(const boost::any& value, bool change_event = false) override;
|
||||||
boost::any& get_value() override;
|
boost::any& get_value() override;
|
||||||
|
|
||||||
void enable() override {
|
void enable() override {
|
||||||
|
|
|
@ -86,7 +86,7 @@ class SplashScreen : public wxSplashScreen
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds, wxPoint pos = wxDefaultPosition)
|
SplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds, wxPoint pos = wxDefaultPosition)
|
||||||
: wxSplashScreen(bitmap, splashStyle, milliseconds, (wxWindow*)wxGetApp().mainframe, wxID_ANY, wxDefaultPosition, wxDefaultSize,
|
: wxSplashScreen(bitmap, splashStyle, milliseconds, static_cast<wxWindow*>(wxGetApp().mainframe), wxID_ANY, wxDefaultPosition, wxDefaultSize,
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
wxSIMPLE_BORDER | wxFRAME_NO_TASKBAR | wxSTAY_ON_TOP
|
wxSIMPLE_BORDER | wxFRAME_NO_TASKBAR | wxSTAY_ON_TOP
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -31,7 +31,7 @@ namespace Slic3r {
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
KBShortcutsDialog::KBShortcutsDialog()
|
KBShortcutsDialog::KBShortcutsDialog()
|
||||||
: DPIDialog((wxWindow*)wxGetApp().mainframe, wxID_ANY, wxString(wxGetApp().is_editor() ? SLIC3R_APP_NAME : GCODEVIEWER_APP_NAME) + " - " + _L("Keyboard Shortcuts"),
|
: DPIDialog(static_cast<wxWindow*>(wxGetApp().mainframe), wxID_ANY, wxString(wxGetApp().is_editor() ? SLIC3R_APP_NAME : GCODEVIEWER_APP_NAME) + " - " + _L("Keyboard Shortcuts"),
|
||||||
wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
||||||
{
|
{
|
||||||
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
||||||
|
|
|
@ -285,7 +285,7 @@ wxDataViewItem ObjectDataViewModel::AddVolumeChild( const wxDataViewItem &parent
|
||||||
const int extruder/* = 0*/,
|
const int extruder/* = 0*/,
|
||||||
const bool create_frst_child/* = true*/)
|
const bool create_frst_child/* = true*/)
|
||||||
{
|
{
|
||||||
ObjectDataViewModelNode *root = (ObjectDataViewModelNode*)parent_item.GetID();
|
ObjectDataViewModelNode *root = static_cast<ObjectDataViewModelNode*>(parent_item.GetID());
|
||||||
if (!root) return wxDataViewItem(0);
|
if (!root) return wxDataViewItem(0);
|
||||||
|
|
||||||
wxString extruder_str = extruder == 0 ? _(L("default")) : wxString::Format("%d", extruder);
|
wxString extruder_str = extruder == 0 ? _(L("default")) : wxString::Format("%d", extruder);
|
||||||
|
@ -331,7 +331,7 @@ wxDataViewItem ObjectDataViewModel::AddVolumeChild( const wxDataViewItem &parent
|
||||||
|
|
||||||
wxDataViewItem ObjectDataViewModel::AddSettingsChild(const wxDataViewItem &parent_item)
|
wxDataViewItem ObjectDataViewModel::AddSettingsChild(const wxDataViewItem &parent_item)
|
||||||
{
|
{
|
||||||
ObjectDataViewModelNode *root = (ObjectDataViewModelNode*)parent_item.GetID();
|
ObjectDataViewModelNode *root = static_cast<ObjectDataViewModelNode*>(parent_item.GetID());
|
||||||
if (!root) return wxDataViewItem(0);
|
if (!root) return wxDataViewItem(0);
|
||||||
|
|
||||||
const auto node = new ObjectDataViewModelNode(root, itSettings);
|
const auto node = new ObjectDataViewModelNode(root, itSettings);
|
||||||
|
@ -370,7 +370,7 @@ static bool append_root_node(ObjectDataViewModelNode *parent_node,
|
||||||
|
|
||||||
wxDataViewItem ObjectDataViewModel::AddRoot(const wxDataViewItem &parent_item, ItemType root_type)
|
wxDataViewItem ObjectDataViewModel::AddRoot(const wxDataViewItem &parent_item, ItemType root_type)
|
||||||
{
|
{
|
||||||
ObjectDataViewModelNode *parent_node = (ObjectDataViewModelNode*)parent_item.GetID();
|
ObjectDataViewModelNode *parent_node = static_cast<ObjectDataViewModelNode*>(parent_item.GetID());
|
||||||
if (!parent_node) return wxDataViewItem(0);
|
if (!parent_node) return wxDataViewItem(0);
|
||||||
|
|
||||||
// get InstanceRoot node
|
// get InstanceRoot node
|
||||||
|
@ -408,7 +408,7 @@ wxDataViewItem ObjectDataViewModel::AddInstanceChild(const wxDataViewItem& paren
|
||||||
const wxDataViewItem inst_root_item = AddInstanceRoot(parent_item);
|
const wxDataViewItem inst_root_item = AddInstanceRoot(parent_item);
|
||||||
if (!inst_root_item) return wxDataViewItem(0);
|
if (!inst_root_item) return wxDataViewItem(0);
|
||||||
|
|
||||||
ObjectDataViewModelNode* inst_root_node = (ObjectDataViewModelNode*)inst_root_item.GetID();
|
ObjectDataViewModelNode* inst_root_node = static_cast<ObjectDataViewModelNode*>(inst_root_item.GetID());
|
||||||
|
|
||||||
// Add instance nodes
|
// Add instance nodes
|
||||||
ObjectDataViewModelNode *instance_node = nullptr;
|
ObjectDataViewModelNode *instance_node = nullptr;
|
||||||
|
@ -437,7 +437,7 @@ void ObjectDataViewModel::UpdateObjectPrintable(wxDataViewItem parent_item)
|
||||||
if (!inst_root_item)
|
if (!inst_root_item)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ObjectDataViewModelNode* inst_root_node = (ObjectDataViewModelNode*)inst_root_item.GetID();
|
ObjectDataViewModelNode* inst_root_node = static_cast<ObjectDataViewModelNode*>(inst_root_item.GetID());
|
||||||
|
|
||||||
const size_t child_cnt = inst_root_node->GetChildren().Count();
|
const size_t child_cnt = inst_root_node->GetChildren().Count();
|
||||||
PrintIndicator obj_pi = piUnprintable;
|
PrintIndicator obj_pi = piUnprintable;
|
||||||
|
@ -447,7 +447,7 @@ void ObjectDataViewModel::UpdateObjectPrintable(wxDataViewItem parent_item)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// and set printable state for object_node to piUndef
|
// and set printable state for object_node to piUndef
|
||||||
ObjectDataViewModelNode* obj_node = (ObjectDataViewModelNode*)parent_item.GetID();
|
ObjectDataViewModelNode* obj_node = static_cast<ObjectDataViewModelNode*>(parent_item.GetID());
|
||||||
obj_node->set_printable_icon(obj_pi);
|
obj_node->set_printable_icon(obj_pi);
|
||||||
ItemChanged(parent_item);
|
ItemChanged(parent_item);
|
||||||
}
|
}
|
||||||
|
@ -459,10 +459,10 @@ void ObjectDataViewModel::UpdateInstancesPrintable(wxDataViewItem parent_item)
|
||||||
if (!inst_root_item)
|
if (!inst_root_item)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ObjectDataViewModelNode* obj_node = (ObjectDataViewModelNode*)parent_item.GetID();
|
ObjectDataViewModelNode* obj_node = static_cast<ObjectDataViewModelNode*>(parent_item.GetID());
|
||||||
const PrintIndicator obj_pi = obj_node->IsPrintable();
|
const PrintIndicator obj_pi = obj_node->IsPrintable();
|
||||||
|
|
||||||
ObjectDataViewModelNode* inst_root_node = (ObjectDataViewModelNode*)inst_root_item.GetID();
|
ObjectDataViewModelNode* inst_root_node = static_cast<ObjectDataViewModelNode*>(inst_root_item.GetID());
|
||||||
const size_t child_cnt = inst_root_node->GetChildren().Count();
|
const size_t child_cnt = inst_root_node->GetChildren().Count();
|
||||||
|
|
||||||
for (size_t i=0; i < child_cnt; i++)
|
for (size_t i=0; i < child_cnt; i++)
|
||||||
|
@ -476,7 +476,7 @@ void ObjectDataViewModel::UpdateInstancesPrintable(wxDataViewItem parent_item)
|
||||||
|
|
||||||
bool ObjectDataViewModel::IsPrintable(const wxDataViewItem& item) const
|
bool ObjectDataViewModel::IsPrintable(const wxDataViewItem& item) const
|
||||||
{
|
{
|
||||||
ObjectDataViewModelNode* node = (ObjectDataViewModelNode*)item.GetID();
|
ObjectDataViewModelNode* node = static_cast<ObjectDataViewModelNode*>(item.GetID());
|
||||||
if (!node)
|
if (!node)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -493,7 +493,7 @@ wxDataViewItem ObjectDataViewModel::AddLayersChild(const wxDataViewItem &parent_
|
||||||
const int extruder/* = 0*/,
|
const int extruder/* = 0*/,
|
||||||
const int index /* = -1*/)
|
const int index /* = -1*/)
|
||||||
{
|
{
|
||||||
ObjectDataViewModelNode *parent_node = (ObjectDataViewModelNode*)parent_item.GetID();
|
ObjectDataViewModelNode *parent_node = static_cast<ObjectDataViewModelNode*>(parent_item.GetID());
|
||||||
if (!parent_node) return wxDataViewItem(0);
|
if (!parent_node) return wxDataViewItem(0);
|
||||||
|
|
||||||
wxString extruder_str = extruder == 0 ? _(L("default")) : wxString::Format("%d", extruder);
|
wxString extruder_str = extruder == 0 ? _(L("default")) : wxString::Format("%d", extruder);
|
||||||
|
@ -530,7 +530,7 @@ wxDataViewItem ObjectDataViewModel::AddLayersChild(const wxDataViewItem &parent_
|
||||||
wxDataViewItem ObjectDataViewModel::Delete(const wxDataViewItem &item)
|
wxDataViewItem ObjectDataViewModel::Delete(const wxDataViewItem &item)
|
||||||
{
|
{
|
||||||
auto ret_item = wxDataViewItem(0);
|
auto ret_item = wxDataViewItem(0);
|
||||||
ObjectDataViewModelNode *node = (ObjectDataViewModelNode*)item.GetID();
|
ObjectDataViewModelNode *node = static_cast<ObjectDataViewModelNode*>(item.GetID());
|
||||||
if (!node) // happens if item.IsOk()==false
|
if (!node) // happens if item.IsOk()==false
|
||||||
return ret_item;
|
return ret_item;
|
||||||
|
|
||||||
|
@ -701,7 +701,7 @@ wxDataViewItem ObjectDataViewModel::Delete(const wxDataViewItem &item)
|
||||||
wxDataViewItem ObjectDataViewModel::DeleteLastInstance(const wxDataViewItem &parent_item, size_t num)
|
wxDataViewItem ObjectDataViewModel::DeleteLastInstance(const wxDataViewItem &parent_item, size_t num)
|
||||||
{
|
{
|
||||||
auto ret_item = wxDataViewItem(0);
|
auto ret_item = wxDataViewItem(0);
|
||||||
ObjectDataViewModelNode *parent_node = (ObjectDataViewModelNode*)parent_item.GetID();
|
ObjectDataViewModelNode *parent_node = static_cast<ObjectDataViewModelNode*>(parent_item.GetID());
|
||||||
if (!parent_node) return ret_item;
|
if (!parent_node) return ret_item;
|
||||||
|
|
||||||
const int inst_root_id = get_root_idx(parent_node, itInstanceRoot);
|
const int inst_root_id = get_root_idx(parent_node, itInstanceRoot);
|
||||||
|
@ -755,7 +755,7 @@ void ObjectDataViewModel::DeleteAll()
|
||||||
|
|
||||||
void ObjectDataViewModel::DeleteChildren(wxDataViewItem& parent)
|
void ObjectDataViewModel::DeleteChildren(wxDataViewItem& parent)
|
||||||
{
|
{
|
||||||
ObjectDataViewModelNode *root = (ObjectDataViewModelNode*)parent.GetID();
|
ObjectDataViewModelNode *root = static_cast<ObjectDataViewModelNode*>(parent.GetID());
|
||||||
if (!root) // happens if item.IsOk()==false
|
if (!root) // happens if item.IsOk()==false
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -787,7 +787,7 @@ void ObjectDataViewModel::DeleteChildren(wxDataViewItem& parent)
|
||||||
|
|
||||||
void ObjectDataViewModel::DeleteVolumeChildren(wxDataViewItem& parent)
|
void ObjectDataViewModel::DeleteVolumeChildren(wxDataViewItem& parent)
|
||||||
{
|
{
|
||||||
ObjectDataViewModelNode *root = (ObjectDataViewModelNode*)parent.GetID();
|
ObjectDataViewModelNode *root = static_cast<ObjectDataViewModelNode*>(parent.GetID());
|
||||||
if (!root) // happens if item.IsOk()==false
|
if (!root) // happens if item.IsOk()==false
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -821,7 +821,7 @@ void ObjectDataViewModel::DeleteVolumeChildren(wxDataViewItem& parent)
|
||||||
|
|
||||||
void ObjectDataViewModel::DeleteSettings(const wxDataViewItem& parent)
|
void ObjectDataViewModel::DeleteSettings(const wxDataViewItem& parent)
|
||||||
{
|
{
|
||||||
ObjectDataViewModelNode *node = (ObjectDataViewModelNode*)parent.GetID();
|
ObjectDataViewModelNode *node = static_cast<ObjectDataViewModelNode*>(parent.GetID());
|
||||||
if (!node) return;
|
if (!node) return;
|
||||||
|
|
||||||
// if volume has a "settings"item, than delete it before volume deleting
|
// if volume has a "settings"item, than delete it before volume deleting
|
||||||
|
@ -880,7 +880,7 @@ wxDataViewItem ObjectDataViewModel::GetItemById(const int obj_idx, const int sub
|
||||||
if (!item)
|
if (!item)
|
||||||
return wxDataViewItem(0);
|
return wxDataViewItem(0);
|
||||||
|
|
||||||
auto parent = (ObjectDataViewModelNode*)item.GetID();
|
auto parent = static_cast<ObjectDataViewModelNode*>(item.GetID());
|
||||||
for (size_t i = 0; i < parent->GetChildCount(); i++)
|
for (size_t i = 0; i < parent->GetChildCount(); i++)
|
||||||
if (parent->GetNthChild(i)->m_idx == sub_obj_idx)
|
if (parent->GetNthChild(i)->m_idx == sub_obj_idx)
|
||||||
return wxDataViewItem(parent->GetNthChild(i));
|
return wxDataViewItem(parent->GetNthChild(i));
|
||||||
|
@ -909,7 +909,7 @@ wxDataViewItem ObjectDataViewModel::GetItemByLayerRange(const int obj_idx, const
|
||||||
if (!item)
|
if (!item)
|
||||||
return wxDataViewItem(0);
|
return wxDataViewItem(0);
|
||||||
|
|
||||||
auto parent = (ObjectDataViewModelNode*)item.GetID();
|
auto parent = static_cast<ObjectDataViewModelNode*>(item.GetID());
|
||||||
for (size_t i = 0; i < parent->GetChildCount(); i++)
|
for (size_t i = 0; i < parent->GetChildCount(); i++)
|
||||||
if (parent->GetNthChild(i)->m_layer_range == layer_range)
|
if (parent->GetNthChild(i)->m_layer_range == layer_range)
|
||||||
return wxDataViewItem(parent->GetNthChild(i));
|
return wxDataViewItem(parent->GetNthChild(i));
|
||||||
|
@ -931,7 +931,7 @@ int ObjectDataViewModel::GetIdByItem(const wxDataViewItem& item) const
|
||||||
if(!item.IsOk())
|
if(!item.IsOk())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
ObjectDataViewModelNode *node = (ObjectDataViewModelNode*)item.GetID();
|
ObjectDataViewModelNode *node = static_cast<ObjectDataViewModelNode*>(item.GetID());
|
||||||
auto it = find(m_objects.begin(), m_objects.end(), node);
|
auto it = find(m_objects.begin(), m_objects.end(), node);
|
||||||
if (it == m_objects.end())
|
if (it == m_objects.end())
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -943,7 +943,7 @@ int ObjectDataViewModel::GetIdByItemAndType(const wxDataViewItem& item, const It
|
||||||
{
|
{
|
||||||
wxASSERT(item.IsOk());
|
wxASSERT(item.IsOk());
|
||||||
|
|
||||||
ObjectDataViewModelNode *node = (ObjectDataViewModelNode*)item.GetID();
|
ObjectDataViewModelNode *node = static_cast<ObjectDataViewModelNode*>(item.GetID());
|
||||||
if (!node || node->m_type != type)
|
if (!node || node->m_type != type)
|
||||||
return -1;
|
return -1;
|
||||||
return node->GetIdx();
|
return node->GetIdx();
|
||||||
|
@ -973,7 +973,7 @@ t_layer_height_range ObjectDataViewModel::GetLayerRangeByItem(const wxDataViewIt
|
||||||
{
|
{
|
||||||
wxASSERT(item.IsOk());
|
wxASSERT(item.IsOk());
|
||||||
|
|
||||||
ObjectDataViewModelNode *node = (ObjectDataViewModelNode*)item.GetID();
|
ObjectDataViewModelNode *node = static_cast<ObjectDataViewModelNode*>(item.GetID());
|
||||||
if (!node || node->m_type != itLayer)
|
if (!node || node->m_type != itLayer)
|
||||||
return { 0.0f, 0.0f };
|
return { 0.0f, 0.0f };
|
||||||
return node->GetLayerRange();
|
return node->GetLayerRange();
|
||||||
|
@ -1029,7 +1029,7 @@ void ObjectDataViewModel::GetItemInfo(const wxDataViewItem& item, ItemType& type
|
||||||
wxASSERT(item.IsOk());
|
wxASSERT(item.IsOk());
|
||||||
type = itUndef;
|
type = itUndef;
|
||||||
|
|
||||||
ObjectDataViewModelNode *node = (ObjectDataViewModelNode*)item.GetID();
|
ObjectDataViewModelNode *node = static_cast<ObjectDataViewModelNode*>(item.GetID());
|
||||||
if (!node ||
|
if (!node ||
|
||||||
node->GetIdx() <-1 ||
|
node->GetIdx() <-1 ||
|
||||||
( node->GetIdx() == -1 &&
|
( node->GetIdx() == -1 &&
|
||||||
|
@ -1098,7 +1098,7 @@ bool ObjectDataViewModel::InvalidItem(const wxDataViewItem& item)
|
||||||
if (!item)
|
if (!item)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
ObjectDataViewModelNode* node = (ObjectDataViewModelNode*)item.GetID();
|
ObjectDataViewModelNode* node = static_cast<ObjectDataViewModelNode*>(item.GetID());
|
||||||
if (!node || node->invalid())
|
if (!node || node->invalid())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -1107,7 +1107,7 @@ bool ObjectDataViewModel::InvalidItem(const wxDataViewItem& item)
|
||||||
|
|
||||||
wxString ObjectDataViewModel::GetName(const wxDataViewItem &item) const
|
wxString ObjectDataViewModel::GetName(const wxDataViewItem &item) const
|
||||||
{
|
{
|
||||||
ObjectDataViewModelNode *node = (ObjectDataViewModelNode*)item.GetID();
|
ObjectDataViewModelNode *node = static_cast<ObjectDataViewModelNode*>(item.GetID());
|
||||||
if (!node) // happens if item.IsOk()==false
|
if (!node) // happens if item.IsOk()==false
|
||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
|
|
||||||
|
@ -1116,13 +1116,13 @@ wxString ObjectDataViewModel::GetName(const wxDataViewItem &item) const
|
||||||
|
|
||||||
wxBitmap& ObjectDataViewModel::GetBitmap(const wxDataViewItem &item) const
|
wxBitmap& ObjectDataViewModel::GetBitmap(const wxDataViewItem &item) const
|
||||||
{
|
{
|
||||||
ObjectDataViewModelNode *node = (ObjectDataViewModelNode*)item.GetID();
|
ObjectDataViewModelNode *node = static_cast<ObjectDataViewModelNode*>(item.GetID());
|
||||||
return node->m_bmp;
|
return node->m_bmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString ObjectDataViewModel::GetExtruder(const wxDataViewItem& item) const
|
wxString ObjectDataViewModel::GetExtruder(const wxDataViewItem& item) const
|
||||||
{
|
{
|
||||||
ObjectDataViewModelNode *node = (ObjectDataViewModelNode*)item.GetID();
|
ObjectDataViewModelNode *node = static_cast<ObjectDataViewModelNode*>(item.GetID());
|
||||||
if (!node) // happens if item.IsOk()==false
|
if (!node) // happens if item.IsOk()==false
|
||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
|
|
||||||
|
@ -1131,7 +1131,7 @@ wxString ObjectDataViewModel::GetExtruder(const wxDataViewItem& item) const
|
||||||
|
|
||||||
int ObjectDataViewModel::GetExtruderNumber(const wxDataViewItem& item) const
|
int ObjectDataViewModel::GetExtruderNumber(const wxDataViewItem& item) const
|
||||||
{
|
{
|
||||||
ObjectDataViewModelNode *node = (ObjectDataViewModelNode*)item.GetID();
|
ObjectDataViewModelNode *node = static_cast<ObjectDataViewModelNode*>(item.GetID());
|
||||||
if (!node) // happens if item.IsOk()==false
|
if (!node) // happens if item.IsOk()==false
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -1142,7 +1142,7 @@ void ObjectDataViewModel::GetValue(wxVariant &variant, const wxDataViewItem &ite
|
||||||
{
|
{
|
||||||
wxASSERT(item.IsOk());
|
wxASSERT(item.IsOk());
|
||||||
|
|
||||||
ObjectDataViewModelNode *node = (ObjectDataViewModelNode*)item.GetID();
|
ObjectDataViewModelNode *node = static_cast<ObjectDataViewModelNode*>(item.GetID());
|
||||||
switch (col)
|
switch (col)
|
||||||
{
|
{
|
||||||
case colPrint:
|
case colPrint:
|
||||||
|
@ -1166,7 +1166,7 @@ bool ObjectDataViewModel::SetValue(const wxVariant &variant, const wxDataViewIte
|
||||||
{
|
{
|
||||||
wxASSERT(item.IsOk());
|
wxASSERT(item.IsOk());
|
||||||
|
|
||||||
ObjectDataViewModelNode *node = (ObjectDataViewModelNode*)item.GetID();
|
ObjectDataViewModelNode *node = static_cast<ObjectDataViewModelNode*>(item.GetID());
|
||||||
return node->SetValue(variant, col);
|
return node->SetValue(variant, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1196,7 +1196,7 @@ void ObjectDataViewModel::SetExtruder(const wxString& extruder, wxDataViewItem i
|
||||||
|
|
||||||
void ObjectDataViewModel::AddAllChildren(const wxDataViewItem& parent)
|
void ObjectDataViewModel::AddAllChildren(const wxDataViewItem& parent)
|
||||||
{
|
{
|
||||||
ObjectDataViewModelNode* node = (ObjectDataViewModelNode*)parent.GetID();
|
ObjectDataViewModelNode* node = static_cast<ObjectDataViewModelNode*>(parent.GetID());
|
||||||
if (!node || node->GetChildCount() == 0)
|
if (!node || node->GetChildCount() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1222,7 +1222,7 @@ wxDataViewItem ObjectDataViewModel::ReorganizeChildren( const int current_volume
|
||||||
if (current_volume_id == new_volume_id)
|
if (current_volume_id == new_volume_id)
|
||||||
return ret_item;
|
return ret_item;
|
||||||
wxASSERT(parent.IsOk());
|
wxASSERT(parent.IsOk());
|
||||||
ObjectDataViewModelNode *node_parent = (ObjectDataViewModelNode*)parent.GetID();
|
ObjectDataViewModelNode *node_parent = static_cast<ObjectDataViewModelNode*>(parent.GetID());
|
||||||
if (!node_parent) // happens if item.IsOk()==false
|
if (!node_parent) // happens if item.IsOk()==false
|
||||||
return ret_item;
|
return ret_item;
|
||||||
|
|
||||||
|
@ -1270,7 +1270,7 @@ wxDataViewItem ObjectDataViewModel::ReorganizeObjects( const int current_id, co
|
||||||
bool ObjectDataViewModel::IsEnabled(const wxDataViewItem &item, unsigned int col) const
|
bool ObjectDataViewModel::IsEnabled(const wxDataViewItem &item, unsigned int col) const
|
||||||
{
|
{
|
||||||
wxASSERT(item.IsOk());
|
wxASSERT(item.IsOk());
|
||||||
ObjectDataViewModelNode *node = (ObjectDataViewModelNode*)item.GetID();
|
ObjectDataViewModelNode *node = static_cast<ObjectDataViewModelNode*>(item.GetID());
|
||||||
|
|
||||||
// disable extruder selection for the non "itObject|itVolume" item
|
// disable extruder selection for the non "itObject|itVolume" item
|
||||||
return !(col == colExtruder && node->m_extruder.IsEmpty());
|
return !(col == colExtruder && node->m_extruder.IsEmpty());
|
||||||
|
@ -1282,7 +1282,7 @@ wxDataViewItem ObjectDataViewModel::GetParent(const wxDataViewItem &item) const
|
||||||
if (!item.IsOk())
|
if (!item.IsOk())
|
||||||
return wxDataViewItem(0);
|
return wxDataViewItem(0);
|
||||||
|
|
||||||
ObjectDataViewModelNode *node = (ObjectDataViewModelNode*)item.GetID();
|
ObjectDataViewModelNode *node = static_cast<ObjectDataViewModelNode*>(item.GetID());
|
||||||
assert(node != nullptr && node->valid());
|
assert(node != nullptr && node->valid());
|
||||||
|
|
||||||
// objects nodes has no parent too
|
// objects nodes has no parent too
|
||||||
|
@ -1298,7 +1298,7 @@ wxDataViewItem ObjectDataViewModel::GetTopParent(const wxDataViewItem &item) con
|
||||||
if (!item.IsOk())
|
if (!item.IsOk())
|
||||||
return wxDataViewItem(0);
|
return wxDataViewItem(0);
|
||||||
|
|
||||||
ObjectDataViewModelNode *node = (ObjectDataViewModelNode*)item.GetID();
|
ObjectDataViewModelNode *node = static_cast<ObjectDataViewModelNode*>(item.GetID());
|
||||||
if (node->m_type == itObject)
|
if (node->m_type == itObject)
|
||||||
return item;
|
return item;
|
||||||
|
|
||||||
|
@ -1315,13 +1315,13 @@ bool ObjectDataViewModel::IsContainer(const wxDataViewItem &item) const
|
||||||
if (!item.IsOk())
|
if (!item.IsOk())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
ObjectDataViewModelNode *node = (ObjectDataViewModelNode*)item.GetID();
|
ObjectDataViewModelNode *node = static_cast<ObjectDataViewModelNode*>(item.GetID());
|
||||||
return node->IsContainer();
|
return node->IsContainer();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int ObjectDataViewModel::GetChildren(const wxDataViewItem &parent, wxDataViewItemArray &array) const
|
unsigned int ObjectDataViewModel::GetChildren(const wxDataViewItem &parent, wxDataViewItemArray &array) const
|
||||||
{
|
{
|
||||||
ObjectDataViewModelNode *node = (ObjectDataViewModelNode*)parent.GetID();
|
ObjectDataViewModelNode *node = static_cast<ObjectDataViewModelNode*>(parent.GetID());
|
||||||
if (!node)
|
if (!node)
|
||||||
{
|
{
|
||||||
for (auto object : m_objects)
|
for (auto object : m_objects)
|
||||||
|
@ -1346,7 +1346,7 @@ unsigned int ObjectDataViewModel::GetChildren(const wxDataViewItem &parent, wxDa
|
||||||
|
|
||||||
void ObjectDataViewModel::GetAllChildren(const wxDataViewItem &parent, wxDataViewItemArray &array) const
|
void ObjectDataViewModel::GetAllChildren(const wxDataViewItem &parent, wxDataViewItemArray &array) const
|
||||||
{
|
{
|
||||||
ObjectDataViewModelNode *node = (ObjectDataViewModelNode*)parent.GetID();
|
ObjectDataViewModelNode *node = static_cast<ObjectDataViewModelNode*>(parent.GetID());
|
||||||
if (!node) {
|
if (!node) {
|
||||||
for (auto object : m_objects)
|
for (auto object : m_objects)
|
||||||
array.Add(wxDataViewItem((void*)object));
|
array.Add(wxDataViewItem((void*)object));
|
||||||
|
@ -1374,7 +1374,7 @@ ItemType ObjectDataViewModel::GetItemType(const wxDataViewItem &item) const
|
||||||
{
|
{
|
||||||
if (!item.IsOk())
|
if (!item.IsOk())
|
||||||
return itUndef;
|
return itUndef;
|
||||||
ObjectDataViewModelNode *node = (ObjectDataViewModelNode*)item.GetID();
|
ObjectDataViewModelNode *node = static_cast<ObjectDataViewModelNode*>(item.GetID());
|
||||||
return node->m_type < 0 ? itUndef : node->m_type;
|
return node->m_type < 0 ? itUndef : node->m_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1383,7 +1383,7 @@ wxDataViewItem ObjectDataViewModel::GetItemByType(const wxDataViewItem &parent_i
|
||||||
if (!parent_item.IsOk())
|
if (!parent_item.IsOk())
|
||||||
return wxDataViewItem(0);
|
return wxDataViewItem(0);
|
||||||
|
|
||||||
ObjectDataViewModelNode *node = (ObjectDataViewModelNode*)parent_item.GetID();
|
ObjectDataViewModelNode *node = static_cast<ObjectDataViewModelNode*>(parent_item.GetID());
|
||||||
if (node->GetChildCount() == 0)
|
if (node->GetChildCount() == 0)
|
||||||
return wxDataViewItem(0);
|
return wxDataViewItem(0);
|
||||||
|
|
||||||
|
@ -1414,7 +1414,7 @@ bool ObjectDataViewModel::IsSettingsItem(const wxDataViewItem &item) const
|
||||||
{
|
{
|
||||||
if (!item.IsOk())
|
if (!item.IsOk())
|
||||||
return false;
|
return false;
|
||||||
ObjectDataViewModelNode *node = (ObjectDataViewModelNode*)item.GetID();
|
ObjectDataViewModelNode *node = static_cast<ObjectDataViewModelNode*>(item.GetID());
|
||||||
return node->m_type == itSettings;
|
return node->m_type == itSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1422,7 +1422,7 @@ void ObjectDataViewModel::UpdateSettingsDigest(const wxDataViewItem &item,
|
||||||
const std::vector<std::string>& categories)
|
const std::vector<std::string>& categories)
|
||||||
{
|
{
|
||||||
if (!item.IsOk()) return;
|
if (!item.IsOk()) return;
|
||||||
ObjectDataViewModelNode *node = (ObjectDataViewModelNode*)item.GetID();
|
ObjectDataViewModelNode *node = static_cast<ObjectDataViewModelNode*>(item.GetID());
|
||||||
if (!node->update_settings_digest(categories))
|
if (!node->update_settings_digest(categories))
|
||||||
return;
|
return;
|
||||||
ItemChanged(item);
|
ItemChanged(item);
|
||||||
|
@ -1433,7 +1433,7 @@ void ObjectDataViewModel::SetVolumeType(const wxDataViewItem &item, const Slic3r
|
||||||
if (!item.IsOk() || GetItemType(item) != itVolume)
|
if (!item.IsOk() || GetItemType(item) != itVolume)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ObjectDataViewModelNode *node = (ObjectDataViewModelNode*)item.GetID();
|
ObjectDataViewModelNode *node = static_cast<ObjectDataViewModelNode*>(item.GetID());
|
||||||
node->SetBitmap(*m_volume_bmps[int(type)]);
|
node->SetBitmap(*m_volume_bmps[int(type)]);
|
||||||
ItemChanged(item);
|
ItemChanged(item);
|
||||||
}
|
}
|
||||||
|
@ -1451,7 +1451,7 @@ wxDataViewItem ObjectDataViewModel::SetPrintableState(
|
||||||
item = subobj_type&itInstance ? GetItemByInstanceId(obj_idx, subobj_idx) :
|
item = subobj_type&itInstance ? GetItemByInstanceId(obj_idx, subobj_idx) :
|
||||||
GetItemByVolumeId(obj_idx, subobj_idx);
|
GetItemByVolumeId(obj_idx, subobj_idx);
|
||||||
|
|
||||||
ObjectDataViewModelNode* node = (ObjectDataViewModelNode*)item.GetID();
|
ObjectDataViewModelNode* node = static_cast<ObjectDataViewModelNode*>(item.GetID());
|
||||||
if (!node)
|
if (!node)
|
||||||
return wxDataViewItem(0);
|
return wxDataViewItem(0);
|
||||||
node->set_printable_icon(printable);
|
node->set_printable_icon(printable);
|
||||||
|
@ -1467,7 +1467,7 @@ wxDataViewItem ObjectDataViewModel::SetObjectPrintableState(
|
||||||
PrintIndicator printable,
|
PrintIndicator printable,
|
||||||
wxDataViewItem obj_item)
|
wxDataViewItem obj_item)
|
||||||
{
|
{
|
||||||
ObjectDataViewModelNode* node = (ObjectDataViewModelNode*)obj_item.GetID();
|
ObjectDataViewModelNode* node = static_cast<ObjectDataViewModelNode*>(obj_item.GetID());
|
||||||
if (!node)
|
if (!node)
|
||||||
return wxDataViewItem(0);
|
return wxDataViewItem(0);
|
||||||
node->set_printable_icon(printable);
|
node->set_printable_icon(printable);
|
||||||
|
@ -1488,7 +1488,7 @@ void ObjectDataViewModel::Rescale()
|
||||||
if (!item.IsOk())
|
if (!item.IsOk())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ObjectDataViewModelNode *node = (ObjectDataViewModelNode*)item.GetID();
|
ObjectDataViewModelNode *node = static_cast<ObjectDataViewModelNode*>(item.GetID());
|
||||||
node->msw_rescale();
|
node->msw_rescale();
|
||||||
|
|
||||||
switch (node->m_type)
|
switch (node->m_type)
|
||||||
|
@ -1537,7 +1537,7 @@ void ObjectDataViewModel::DeleteWarningIcon(const wxDataViewItem& item, const bo
|
||||||
if (!item.IsOk())
|
if (!item.IsOk())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ObjectDataViewModelNode *node = (ObjectDataViewModelNode*)item.GetID();
|
ObjectDataViewModelNode *node = static_cast<ObjectDataViewModelNode*>(item.GetID());
|
||||||
|
|
||||||
if (!node->GetBitmap().IsOk() || !(node->GetType() & (itVolume | itObject)))
|
if (!node->GetBitmap().IsOk() || !(node->GetType() & (itVolume | itObject)))
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -300,13 +300,13 @@ public:
|
||||||
|
|
||||||
// helper methods to change the model
|
// helper methods to change the model
|
||||||
|
|
||||||
virtual unsigned int GetColumnCount() const override { return 3;}
|
unsigned int GetColumnCount() const override { return 3;}
|
||||||
virtual wxString GetColumnType(unsigned int col) const override{ return wxT("string"); }
|
wxString GetColumnType(unsigned int col) const override{ return wxT("string"); }
|
||||||
|
|
||||||
virtual void GetValue( wxVariant &variant,
|
void GetValue( wxVariant &variant,
|
||||||
const wxDataViewItem &item,
|
const wxDataViewItem &item,
|
||||||
unsigned int col) const override;
|
unsigned int col) const override;
|
||||||
virtual bool SetValue( const wxVariant &variant,
|
bool SetValue( const wxVariant &variant,
|
||||||
const wxDataViewItem &item,
|
const wxDataViewItem &item,
|
||||||
unsigned int col) override;
|
unsigned int col) override;
|
||||||
bool SetValue( const wxVariant &variant,
|
bool SetValue( const wxVariant &variant,
|
||||||
|
@ -322,18 +322,17 @@ public:
|
||||||
const wxDataViewItem &parent);
|
const wxDataViewItem &parent);
|
||||||
wxDataViewItem ReorganizeObjects( int current_id, int new_id);
|
wxDataViewItem ReorganizeObjects( int current_id, int new_id);
|
||||||
|
|
||||||
virtual bool IsEnabled(const wxDataViewItem &item, unsigned int col) const override;
|
bool IsEnabled(const wxDataViewItem &item, unsigned int col) const override;
|
||||||
|
|
||||||
virtual wxDataViewItem GetParent(const wxDataViewItem &item) const override;
|
wxDataViewItem GetParent(const wxDataViewItem &item) const override;
|
||||||
// get object item
|
// get object item
|
||||||
wxDataViewItem GetTopParent(const wxDataViewItem &item) const;
|
wxDataViewItem GetTopParent(const wxDataViewItem &item) const;
|
||||||
virtual bool IsContainer(const wxDataViewItem &item) const override;
|
bool IsContainer(const wxDataViewItem &item) const override;
|
||||||
virtual unsigned int GetChildren(const wxDataViewItem &parent,
|
unsigned int GetChildren(const wxDataViewItem &parent, wxDataViewItemArray &array) const override;
|
||||||
wxDataViewItemArray &array) const override;
|
|
||||||
void GetAllChildren(const wxDataViewItem &parent,wxDataViewItemArray &array) const;
|
void GetAllChildren(const wxDataViewItem &parent,wxDataViewItemArray &array) const;
|
||||||
// Is the container just a header or an item with all columns
|
// Is the container just a header or an item with all columns
|
||||||
// In our case it is an item with all columns
|
// In our case it is an item with all columns
|
||||||
virtual bool HasContainerColumns(const wxDataViewItem& WXUNUSED(item)) const override { return true; }
|
bool HasContainerColumns(const wxDataViewItem& WXUNUSED(item)) const override { return true; }
|
||||||
|
|
||||||
ItemType GetItemType(const wxDataViewItem &item) const ;
|
ItemType GetItemType(const wxDataViewItem &item) const ;
|
||||||
wxDataViewItem GetItemByType( const wxDataViewItem &parent_item,
|
wxDataViewItem GetItemByType( const wxDataViewItem &parent_item,
|
||||||
|
|
|
@ -111,6 +111,11 @@ OptionsGroup::OptionsGroup( wxWindow* _parent, const wxString& title,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxWindow* OptionsGroup::ctrl_parent() const
|
||||||
|
{
|
||||||
|
return this->custom_ctrl && m_use_custom_ctrl_as_parent ? static_cast<wxWindow*>(this->custom_ctrl) : (this->stb ? static_cast<wxWindow*>(this->stb) : this->parent());
|
||||||
|
}
|
||||||
|
|
||||||
bool OptionsGroup::is_legend_line()
|
bool OptionsGroup::is_legend_line()
|
||||||
{
|
{
|
||||||
if (m_lines.size() == 1) {
|
if (m_lines.size() == 1) {
|
||||||
|
@ -209,7 +214,7 @@ void OptionsGroup::activate_line(Line& line)
|
||||||
bool is_legend_line = option_set.front().opt.gui_type == "legend";
|
bool is_legend_line = option_set.front().opt.gui_type == "legend";
|
||||||
|
|
||||||
if (!custom_ctrl && m_use_custom_ctrl) {
|
if (!custom_ctrl && m_use_custom_ctrl) {
|
||||||
custom_ctrl = new OG_CustomCtrl(is_legend_line ? this->parent() : (wxWindow*)this->stb, this);
|
custom_ctrl = new OG_CustomCtrl(is_legend_line ? this->parent() : static_cast<wxWindow*>(this->stb), this);
|
||||||
if (is_legend_line)
|
if (is_legend_line)
|
||||||
sizer->Add(custom_ctrl, 0, wxEXPAND | wxLEFT, wxOSX ? 0 : 10);
|
sizer->Add(custom_ctrl, 0, wxEXPAND | wxLEFT, wxOSX ? 0 : 10);
|
||||||
else
|
else
|
||||||
|
|
|
@ -115,22 +115,9 @@ public:
|
||||||
/// Returns a copy of the pointer of the parent wxWindow.
|
/// Returns a copy of the pointer of the parent wxWindow.
|
||||||
/// Accessor function is because users are not allowed to change the parent
|
/// Accessor function is because users are not allowed to change the parent
|
||||||
/// but defining it as const means a lot of const_casts to deal with wx functions.
|
/// but defining it as const means a lot of const_casts to deal with wx functions.
|
||||||
inline wxWindow* parent() const {
|
inline wxWindow* parent() const { return m_parent; }
|
||||||
#if 0//#ifdef __WXGTK__
|
|
||||||
return m_panel;
|
|
||||||
#else
|
|
||||||
return m_parent;
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
}
|
|
||||||
#if 0//#ifdef __WXGTK__
|
|
||||||
wxWindow* get_parent() const {
|
|
||||||
return m_parent;
|
|
||||||
}
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
|
|
||||||
wxWindow* ctrl_parent() const {
|
wxWindow* ctrl_parent() const;
|
||||||
return this->custom_ctrl && m_use_custom_ctrl_as_parent ? (wxWindow*)this->custom_ctrl : (this->stb ? (wxWindow*)this->stb : this->parent());
|
|
||||||
}
|
|
||||||
|
|
||||||
void append_line(const Line& line);
|
void append_line(const Line& line);
|
||||||
// create controls for the option group
|
// create controls for the option group
|
||||||
|
|
|
@ -1396,7 +1396,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
ProjectDropDialog::ProjectDropDialog(const std::string& filename)
|
ProjectDropDialog::ProjectDropDialog(const std::string& filename)
|
||||||
: DPIDialog((wxWindow*)wxGetApp().mainframe, wxID_ANY,
|
: DPIDialog(static_cast<wxWindow*>(wxGetApp().mainframe), wxID_ANY,
|
||||||
from_u8((boost::format(_utf8(L("%s - Drop project file"))) % SLIC3R_APP_NAME).str()), wxDefaultPosition,
|
from_u8((boost::format(_utf8(L("%s - Drop project file"))) % SLIC3R_APP_NAME).str()), wxDefaultPosition,
|
||||||
wxDefaultSize, wxDEFAULT_DIALOG_STYLE)
|
wxDefaultSize, wxDEFAULT_DIALOG_STYLE)
|
||||||
{
|
{
|
||||||
|
@ -1463,7 +1463,7 @@ bool PlaterDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if (paths.size() > 1) {
|
if (paths.size() > 1) {
|
||||||
wxMessageDialog((wxWindow*)m_plater, _L("You can open only one .gcode file at a time."),
|
wxMessageDialog(static_cast<wxWindow*>(m_plater), _L("You can open only one .gcode file at a time."),
|
||||||
wxString(SLIC3R_APP_NAME) + " - " + _L("Drag and drop G-code file"), wxCLOSE | wxICON_WARNING | wxCENTRE).ShowModal();
|
wxString(SLIC3R_APP_NAME) + " - " + _L("Drag and drop G-code file"), wxCLOSE | wxICON_WARNING | wxCENTRE).ShowModal();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2070,7 +2070,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
||||||
q->SetDropTarget(new PlaterDropTarget(q)); // if my understanding is right, wxWindow takes the owenership
|
q->SetDropTarget(new PlaterDropTarget(q)); // if my understanding is right, wxWindow takes the owenership
|
||||||
q->Layout();
|
q->Layout();
|
||||||
|
|
||||||
set_current_panel(wxGetApp().is_editor() ? (wxPanel*)view3D : (wxPanel*)preview);
|
set_current_panel(wxGetApp().is_editor() ? static_cast<wxPanel*>(view3D) : static_cast<wxPanel*>(preview));
|
||||||
if (wxGetApp().is_gcode_viewer())
|
if (wxGetApp().is_gcode_viewer())
|
||||||
preview->hide_layers_slider();
|
preview->hide_layers_slider();
|
||||||
|
|
||||||
|
@ -4836,7 +4836,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
ProjectDropDialog::ProjectDropDialog(const std::string& filename)
|
ProjectDropDialog::ProjectDropDialog(const std::string& filename)
|
||||||
: DPIDialog((wxWindow*)wxGetApp().mainframe, wxID_ANY,
|
: DPIDialog(static_cast<wxWindow*>(wxGetApp().mainframe), wxID_ANY,
|
||||||
from_u8((boost::format(_utf8(L("%s - Drop project file"))) % SLIC3R_APP_NAME).str()), wxDefaultPosition,
|
from_u8((boost::format(_utf8(L("%s - Drop project file"))) % SLIC3R_APP_NAME).str()), wxDefaultPosition,
|
||||||
wxDefaultSize, wxDEFAULT_DIALOG_STYLE)
|
wxDefaultSize, wxDEFAULT_DIALOG_STYLE)
|
||||||
{
|
{
|
||||||
|
@ -4895,7 +4895,7 @@ bool Plater::load_files(const wxArrayString& filenames)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (paths.size() > 1) {
|
if (paths.size() > 1) {
|
||||||
wxMessageDialog((wxWindow*)this, _L("You can open only one .gcode file at a time."),
|
wxMessageDialog(static_cast<wxWindow*>(this), _L("You can open only one .gcode file at a time."),
|
||||||
wxString(SLIC3R_APP_NAME) + " - " + _L("Drag and drop G-code file"), wxCLOSE | wxICON_WARNING | wxCENTRE).ShowModal();
|
wxString(SLIC3R_APP_NAME) + " - " + _L("Drag and drop G-code file"), wxCLOSE | wxICON_WARNING | wxCENTRE).ShowModal();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -5021,7 +5021,7 @@ void Plater::remove(size_t obj_idx) { p->remove(obj_idx); }
|
||||||
void Plater::reset() { p->reset(); }
|
void Plater::reset() { p->reset(); }
|
||||||
void Plater::reset_with_confirm()
|
void Plater::reset_with_confirm()
|
||||||
{
|
{
|
||||||
if (wxMessageDialog((wxWindow*)this, _L("All objects will be removed, continue?"), wxString(SLIC3R_APP_NAME) + " - " + _L("Delete all"), wxYES_NO | wxCANCEL | wxYES_DEFAULT | wxCENTRE).ShowModal() == wxID_YES)
|
if (wxMessageDialog(static_cast<wxWindow*>(this), _L("All objects will be removed, continue?"), wxString(SLIC3R_APP_NAME) + " - " + _L("Delete all"), wxYES_NO | wxCANCEL | wxYES_DEFAULT | wxCENTRE).ShowModal() == wxID_YES)
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -519,7 +519,7 @@ void PresetComboBox::OnDrawItem(wxDC& dc,
|
||||||
int item,
|
int item,
|
||||||
int flags) const
|
int flags) const
|
||||||
{
|
{
|
||||||
const wxBitmap& bmp = *(wxBitmap*)m_bitmaps[item];
|
const wxBitmap& bmp = *(static_cast<wxBitmap*>(m_bitmaps[item]));
|
||||||
if (bmp.IsOk())
|
if (bmp.IsOk())
|
||||||
{
|
{
|
||||||
// we should use scaled! size values of bitmap
|
// we should use scaled! size values of bitmap
|
||||||
|
|
|
@ -131,8 +131,8 @@ protected:
|
||||||
* For this purpose control drawing methods and
|
* For this purpose control drawing methods and
|
||||||
* control size calculation methods (virtual) are overridden.
|
* control size calculation methods (virtual) are overridden.
|
||||||
**/
|
**/
|
||||||
virtual bool OnAddBitmap(const wxBitmap& bitmap) override;
|
bool OnAddBitmap(const wxBitmap& bitmap) override;
|
||||||
virtual void OnDrawItem(wxDC& dc, const wxRect& rect, int item, int flags) const override;
|
void OnDrawItem(wxDC& dc, const wxRect& rect, int item, int flags) const override;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -335,81 +335,6 @@ void OptionsSearcher::add_key(const std::string& opt_key, const wxString& group,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------
|
|
||||||
// SearchComboPopup
|
|
||||||
//------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
void SearchComboPopup::Init()
|
|
||||||
{
|
|
||||||
this->Bind(wxEVT_MOTION, &SearchComboPopup::OnMouseMove, this);
|
|
||||||
this->Bind(wxEVT_LEFT_UP, &SearchComboPopup::OnMouseClick, this);
|
|
||||||
this->Bind(wxEVT_KEY_DOWN, &SearchComboPopup::OnKeyDown, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SearchComboPopup::Create(wxWindow* parent)
|
|
||||||
{
|
|
||||||
return wxListBox::Create(parent, 1, wxPoint(0, 0), wxDefaultSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SearchComboPopup::SetStringValue(const wxString& s)
|
|
||||||
{
|
|
||||||
int n = wxListBox::FindString(s);
|
|
||||||
if (n >= 0 && n < int(wxListBox::GetCount()))
|
|
||||||
wxListBox::Select(n);
|
|
||||||
|
|
||||||
// save a combo control's string
|
|
||||||
m_input_string = s;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SearchComboPopup::ProcessSelection(int selection)
|
|
||||||
{
|
|
||||||
wxCommandEvent event(wxEVT_LISTBOX, GetId());
|
|
||||||
event.SetInt(selection);
|
|
||||||
event.SetEventObject(this);
|
|
||||||
ProcessEvent(event);
|
|
||||||
|
|
||||||
Dismiss();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SearchComboPopup::OnMouseMove(wxMouseEvent& event)
|
|
||||||
{
|
|
||||||
wxPoint pt = wxGetMousePosition() - this->GetScreenPosition();
|
|
||||||
int selection = this->HitTest(pt);
|
|
||||||
wxListBox::Select(selection);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SearchComboPopup::OnMouseClick(wxMouseEvent&)
|
|
||||||
{
|
|
||||||
int selection = wxListBox::GetSelection();
|
|
||||||
SetSelection(wxNOT_FOUND);
|
|
||||||
ProcessSelection(selection);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SearchComboPopup::OnKeyDown(wxKeyEvent& event)
|
|
||||||
{
|
|
||||||
int key = event.GetKeyCode();
|
|
||||||
|
|
||||||
// change selected item in the list
|
|
||||||
if (key == WXK_UP || key == WXK_DOWN)
|
|
||||||
{
|
|
||||||
int selection = wxListBox::GetSelection();
|
|
||||||
|
|
||||||
if (key == WXK_UP && selection > 0)
|
|
||||||
selection--;
|
|
||||||
if (key == WXK_DOWN && selection < int(wxListBox::GetCount() - 1))
|
|
||||||
selection++;
|
|
||||||
|
|
||||||
wxListBox::Select(selection);
|
|
||||||
}
|
|
||||||
// send wxEVT_LISTBOX event if "Enter" was pushed
|
|
||||||
else if (key == WXK_NUMPAD_ENTER || key == WXK_RETURN)
|
|
||||||
ProcessSelection(wxListBox::GetSelection());
|
|
||||||
else
|
|
||||||
event.Skip(); // !Needed to have EVT_CHAR generated as well
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
// SearchDialog
|
// SearchDialog
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
|
|
|
@ -131,38 +131,6 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class SearchComboPopup : public wxListBox, public wxComboPopup
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// Initialize member variables
|
|
||||||
void Init();
|
|
||||||
|
|
||||||
// Create popup control
|
|
||||||
virtual bool Create(wxWindow* parent);
|
|
||||||
// Return pointer to the created control
|
|
||||||
virtual wxWindow* GetControl() { return this; }
|
|
||||||
|
|
||||||
// Translate string into a list selection
|
|
||||||
virtual void SetStringValue(const wxString& s);
|
|
||||||
// Get list selection as a string
|
|
||||||
virtual wxString GetStringValue() const {
|
|
||||||
// we shouldn't change a combo control's string
|
|
||||||
return m_input_string;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProcessSelection(int selection);
|
|
||||||
|
|
||||||
// Do mouse hot-tracking (which is typical in list popups)
|
|
||||||
void OnMouseMove(wxMouseEvent& event);
|
|
||||||
// On mouse left up, set the value and close the popup
|
|
||||||
void OnMouseClick(wxMouseEvent& WXUNUSED(event));
|
|
||||||
// process Up/Down arrows and Enter press
|
|
||||||
void OnKeyDown(wxKeyEvent& event);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
wxString m_input_string;
|
|
||||||
};
|
|
||||||
|
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
// SearchDialog
|
// SearchDialog
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
|
@ -204,7 +172,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void on_dpi_changed(const wxRect& suggested_rect) override;
|
void on_dpi_changed(const wxRect& suggested_rect) override;
|
||||||
virtual void on_sys_color_changed() override;
|
void on_sys_color_changed() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -234,11 +202,11 @@ public:
|
||||||
|
|
||||||
// implementation of base class virtuals to define model
|
// implementation of base class virtuals to define model
|
||||||
|
|
||||||
virtual unsigned int GetColumnCount() const override { return colMax; }
|
unsigned int GetColumnCount() const override { return colMax; }
|
||||||
virtual wxString GetColumnType(unsigned int col) const override;
|
wxString GetColumnType(unsigned int col) const override;
|
||||||
virtual void GetValueByRow(wxVariant& variant, unsigned int row, unsigned int col) const override;
|
void GetValueByRow(wxVariant& variant, unsigned int row, unsigned int col) const override;
|
||||||
virtual bool GetAttrByRow(unsigned int row, unsigned int col, wxDataViewItemAttr& attr) const override { return true; }
|
bool GetAttrByRow(unsigned int row, unsigned int col, wxDataViewItemAttr& attr) const override { return true; }
|
||||||
virtual bool SetValueByRow(const wxVariant& variant, unsigned int row, unsigned int col) override { return false; }
|
bool SetValueByRow(const wxVariant& variant, unsigned int row, unsigned int col) override { return false; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <wx/clipbrd.h>
|
#include <wx/clipbrd.h>
|
||||||
#include <wx/platinfo.h>
|
#include <wx/platinfo.h>
|
||||||
#include "GUI_App.hpp"
|
#include "GUI_App.hpp"
|
||||||
|
#include "MainFrame.hpp"
|
||||||
#include "wxExtensions.hpp"
|
#include "wxExtensions.hpp"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -78,7 +79,7 @@ std::string get_mem_info(bool format_as_html)
|
||||||
}
|
}
|
||||||
|
|
||||||
SysInfoDialog::SysInfoDialog()
|
SysInfoDialog::SysInfoDialog()
|
||||||
: DPIDialog((wxWindow*)wxGetApp().mainframe, wxID_ANY, (wxGetApp().is_editor() ? wxString(SLIC3R_APP_NAME) : wxString(GCODEVIEWER_APP_NAME)) + " - " + _L("System Information"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
: DPIDialog(static_cast<wxWindow*>(wxGetApp().mainframe), wxID_ANY, (wxGetApp().is_editor() ? wxString(SLIC3R_APP_NAME) : wxString(GCODEVIEWER_APP_NAME)) + " - " + _L("System Information"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
||||||
{
|
{
|
||||||
wxColour bgr_clr = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
|
wxColour bgr_clr = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
|
||||||
SetBackgroundColour(bgr_clr);
|
SetBackgroundColour(bgr_clr);
|
||||||
|
|
|
@ -327,7 +327,7 @@ static void update_parents(ModelNode* node)
|
||||||
void UnsavedChangesModel::UpdateItemEnabling(wxDataViewItem item)
|
void UnsavedChangesModel::UpdateItemEnabling(wxDataViewItem item)
|
||||||
{
|
{
|
||||||
assert(item.IsOk());
|
assert(item.IsOk());
|
||||||
ModelNode* node = (ModelNode*)item.GetID();
|
ModelNode* node = static_cast<ModelNode*>(item.GetID());
|
||||||
node->UpdateEnabling();
|
node->UpdateEnabling();
|
||||||
|
|
||||||
update_children(node);
|
update_children(node);
|
||||||
|
@ -337,7 +337,7 @@ void UnsavedChangesModel::UpdateItemEnabling(wxDataViewItem item)
|
||||||
bool UnsavedChangesModel::IsEnabledItem(const wxDataViewItem& item)
|
bool UnsavedChangesModel::IsEnabledItem(const wxDataViewItem& item)
|
||||||
{
|
{
|
||||||
assert(item.IsOk());
|
assert(item.IsOk());
|
||||||
ModelNode* node = (ModelNode*)item.GetID();
|
ModelNode* node = static_cast<ModelNode*>(item.GetID());
|
||||||
return node->IsToggled();
|
return node->IsToggled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,7 +345,7 @@ void UnsavedChangesModel::GetValue(wxVariant& variant, const wxDataViewItem& ite
|
||||||
{
|
{
|
||||||
assert(item.IsOk());
|
assert(item.IsOk());
|
||||||
|
|
||||||
ModelNode* node = (ModelNode*)item.GetID();
|
ModelNode* node = static_cast<ModelNode*>(item.GetID());
|
||||||
switch (col)
|
switch (col)
|
||||||
{
|
{
|
||||||
case colToggle:
|
case colToggle:
|
||||||
|
@ -382,7 +382,7 @@ bool UnsavedChangesModel::SetValue(const wxVariant& variant, const wxDataViewIte
|
||||||
{
|
{
|
||||||
assert(item.IsOk());
|
assert(item.IsOk());
|
||||||
|
|
||||||
ModelNode* node = (ModelNode*)item.GetID();
|
ModelNode* node = static_cast<ModelNode*>(item.GetID());
|
||||||
switch (col)
|
switch (col)
|
||||||
{
|
{
|
||||||
case colToggle:
|
case colToggle:
|
||||||
|
@ -440,7 +440,7 @@ bool UnsavedChangesModel::IsEnabled(const wxDataViewItem& item, unsigned int col
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// disable unchecked nodes
|
// disable unchecked nodes
|
||||||
return ((ModelNode*)item.GetID())->IsToggled();
|
return (static_cast<ModelNode*>(item.GetID()))->IsToggled();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDataViewItem UnsavedChangesModel::GetParent(const wxDataViewItem& item) const
|
wxDataViewItem UnsavedChangesModel::GetParent(const wxDataViewItem& item) const
|
||||||
|
@ -449,7 +449,7 @@ wxDataViewItem UnsavedChangesModel::GetParent(const wxDataViewItem& item) const
|
||||||
if (!item.IsOk())
|
if (!item.IsOk())
|
||||||
return wxDataViewItem(nullptr);
|
return wxDataViewItem(nullptr);
|
||||||
|
|
||||||
ModelNode* node = (ModelNode*)item.GetID();
|
ModelNode* node = static_cast<ModelNode*>(item.GetID());
|
||||||
|
|
||||||
// "MyMusic" also has no parent
|
// "MyMusic" also has no parent
|
||||||
if (node->IsRoot())
|
if (node->IsRoot())
|
||||||
|
@ -464,7 +464,7 @@ bool UnsavedChangesModel::IsContainer(const wxDataViewItem& item) const
|
||||||
if (!item.IsOk())
|
if (!item.IsOk())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
ModelNode* node = (ModelNode*)item.GetID();
|
ModelNode* node = static_cast<ModelNode*>(item.GetID());
|
||||||
return node->IsContainer();
|
return node->IsContainer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -522,7 +522,7 @@ void UnsavedChangesModel::Rescale()
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
|
|
||||||
UnsavedChangesDialog::UnsavedChangesDialog(const wxString& header)
|
UnsavedChangesDialog::UnsavedChangesDialog(const wxString& header)
|
||||||
: DPIDialog((wxWindow*)wxGetApp().mainframe , wxID_ANY, _L("PrusaSlicer is closing: Unsaved Changes"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
: DPIDialog(static_cast<wxWindow*>(wxGetApp().mainframe), wxID_ANY, _L("PrusaSlicer is closing: Unsaved Changes"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
||||||
{
|
{
|
||||||
m_app_config_key = "default_action_on_close_application";
|
m_app_config_key = "default_action_on_close_application";
|
||||||
|
|
||||||
|
@ -539,7 +539,7 @@ UnsavedChangesDialog::UnsavedChangesDialog(const wxString& header)
|
||||||
}
|
}
|
||||||
|
|
||||||
UnsavedChangesDialog::UnsavedChangesDialog(Preset::Type type, PresetCollection* dependent_presets, const std::string& new_selected_preset)
|
UnsavedChangesDialog::UnsavedChangesDialog(Preset::Type type, PresetCollection* dependent_presets, const std::string& new_selected_preset)
|
||||||
: DPIDialog((wxWindow*)wxGetApp().mainframe, wxID_ANY, _L("Switching Presets: Unsaved Changes"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
: DPIDialog(static_cast<wxWindow*>(wxGetApp().mainframe), wxID_ANY, _L("Switching Presets: Unsaved Changes"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
||||||
{
|
{
|
||||||
m_app_config_key = "default_action_on_select_preset";
|
m_app_config_key = "default_action_on_select_preset";
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue