Fix for #8728 - Remember Size/Location of Shape Gallery window box
This commit is contained in:
parent
7e77048593
commit
98e94c3329
7 changed files with 40 additions and 18 deletions
|
@ -2828,6 +2828,11 @@ NotificationManager * GUI_App::notification_manager()
|
||||||
return plater_->get_notification_manager();
|
return plater_->get_notification_manager();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GalleryDialog* GUI_App::gallery_dialog()
|
||||||
|
{
|
||||||
|
return mainframe->gallery_dialog();
|
||||||
|
}
|
||||||
|
|
||||||
// extruders count from selected printer preset
|
// extruders count from selected printer preset
|
||||||
int GUI_App::extruders_cnt() const
|
int GUI_App::extruders_cnt() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,6 +47,7 @@ class ObjectLayers;
|
||||||
class Plater;
|
class Plater;
|
||||||
class NotificationManager;
|
class NotificationManager;
|
||||||
struct GUI_InitParams;
|
struct GUI_InitParams;
|
||||||
|
class GalleryDialog;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -296,6 +297,7 @@ public:
|
||||||
const Plater* plater() const;
|
const Plater* plater() const;
|
||||||
Model& model();
|
Model& model();
|
||||||
NotificationManager * notification_manager();
|
NotificationManager * notification_manager();
|
||||||
|
GalleryDialog * gallery_dialog();
|
||||||
|
|
||||||
// Parameters extracted from the command line to be passed to GUI after initialization.
|
// Parameters extracted from the command line to be passed to GUI after initialization.
|
||||||
GUI_InitParams* init_params { nullptr };
|
GUI_InitParams* init_params { nullptr };
|
||||||
|
|
|
@ -1409,9 +1409,8 @@ void ObjectList::load_subobject(ModelVolumeType type, bool from_galery/* = false
|
||||||
|
|
||||||
wxArrayString input_files;
|
wxArrayString input_files;
|
||||||
if (from_galery) {
|
if (from_galery) {
|
||||||
GalleryDialog dlg(this);
|
if (wxGetApp().gallery_dialog()->show() != wxID_CLOSE)
|
||||||
if (dlg.ShowModal() != wxID_CLOSE)
|
wxGetApp().gallery_dialog()->get_input_files(input_files);
|
||||||
dlg.get_input_files(input_files);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
wxGetApp().import_model(wxGetApp().tab_panel()->GetPage(0), input_files);
|
wxGetApp().import_model(wxGetApp().tab_panel()->GetPage(0), input_files);
|
||||||
|
@ -1737,10 +1736,10 @@ void ObjectList::load_shape_object_from_gallery()
|
||||||
return;// Add nothing if something is selected on 3DScene
|
return;// Add nothing if something is selected on 3DScene
|
||||||
|
|
||||||
wxArrayString input_files;
|
wxArrayString input_files;
|
||||||
GalleryDialog gallery_dlg(this);
|
GalleryDialog* gallery_dlg = wxGetApp().gallery_dialog();
|
||||||
if (gallery_dlg.ShowModal() == wxID_CLOSE)
|
if (gallery_dlg->show() == wxID_CLOSE)
|
||||||
return;
|
return;
|
||||||
gallery_dlg.get_input_files(input_files);
|
gallery_dlg->get_input_files(input_files);
|
||||||
if (input_files.IsEmpty())
|
if (input_files.IsEmpty())
|
||||||
return;
|
return;
|
||||||
load_shape_object_from_gallery(input_files);
|
load_shape_object_from_gallery(input_files);
|
||||||
|
|
|
@ -65,7 +65,7 @@ bool GalleryDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GalleryDialog::GalleryDialog(wxWindow* parent, bool modify_gallery/* = false*/) :
|
GalleryDialog::GalleryDialog(wxWindow* parent) :
|
||||||
DPIDialog(parent, wxID_ANY, _L("Shape Gallery"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
DPIDialog(parent, wxID_ANY, _L("Shape Gallery"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
@ -94,12 +94,9 @@ GalleryDialog::GalleryDialog(wxWindow* parent, bool modify_gallery/* = false*/)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxStdDialogButtonSizer* buttons = this->CreateStdDialogButtonSizer(wxOK | wxCLOSE);
|
wxStdDialogButtonSizer* buttons = this->CreateStdDialogButtonSizer(wxOK | wxCLOSE);
|
||||||
wxButton* ok_btn = static_cast<wxButton*>(FindWindowById(wxID_OK, this));
|
m_ok_btn = static_cast<wxButton*>(FindWindowById(wxID_OK, this));
|
||||||
ok_btn->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(!m_selected_items.empty()); });
|
m_ok_btn->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(!m_selected_items.empty()); });
|
||||||
if (modify_gallery) {
|
|
||||||
ok_btn->SetLabel(_L("Add to bed"));
|
|
||||||
ok_btn->SetToolTip(_L("Add selected shape(s) to the bed"));
|
|
||||||
}
|
|
||||||
static_cast<wxButton*>(FindWindowById(wxID_CLOSE, this))->Bind(wxEVT_BUTTON, [this](wxCommandEvent&){ this->EndModal(wxID_CLOSE); });
|
static_cast<wxButton*>(FindWindowById(wxID_CLOSE, this))->Bind(wxEVT_BUTTON, [this](wxCommandEvent&){ this->EndModal(wxID_CLOSE); });
|
||||||
this->SetEscapeId(wxID_CLOSE);
|
this->SetEscapeId(wxID_CLOSE);
|
||||||
auto add_btn = [this, buttons]( size_t pos, int& ID, wxString title, wxString tooltip,
|
auto add_btn = [this, buttons]( size_t pos, int& ID, wxString title, wxString tooltip,
|
||||||
|
@ -140,6 +137,14 @@ GalleryDialog::~GalleryDialog()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GalleryDialog::show(bool show_from_menu)
|
||||||
|
{
|
||||||
|
m_ok_btn->SetLabel( show_from_menu ? _L("Add to bed") : _L("OK"));
|
||||||
|
m_ok_btn->SetToolTip(show_from_menu ? _L("Add selected shape(s) to the bed") : "");
|
||||||
|
|
||||||
|
return this->ShowModal();
|
||||||
|
}
|
||||||
|
|
||||||
bool GalleryDialog::can_delete()
|
bool GalleryDialog::can_delete()
|
||||||
{
|
{
|
||||||
if (m_selected_items.empty())
|
if (m_selected_items.empty())
|
||||||
|
|
|
@ -20,6 +20,7 @@ class GalleryDialog : public DPIDialog
|
||||||
{
|
{
|
||||||
wxListCtrl* m_list_ctrl { nullptr };
|
wxListCtrl* m_list_ctrl { nullptr };
|
||||||
wxImageList* m_image_list { nullptr };
|
wxImageList* m_image_list { nullptr };
|
||||||
|
wxButton* m_ok_btn { nullptr };
|
||||||
|
|
||||||
struct Item {
|
struct Item {
|
||||||
std::string name;
|
std::string name;
|
||||||
|
@ -48,9 +49,10 @@ class GalleryDialog : public DPIDialog
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GalleryDialog(wxWindow* parent, bool modify_gallery = false);
|
GalleryDialog(wxWindow* parent);
|
||||||
~GalleryDialog();
|
~GalleryDialog();
|
||||||
|
|
||||||
|
int show(bool show_from_menu = false);
|
||||||
void get_input_files(wxArrayString& input_files);
|
void get_input_files(wxArrayString& input_files);
|
||||||
bool load_files(const wxArrayString& input_files);
|
bool load_files(const wxArrayString& input_files);
|
||||||
|
|
||||||
|
|
|
@ -622,6 +622,13 @@ void MainFrame::shutdown()
|
||||||
wxGetApp().plater_ = nullptr;
|
wxGetApp().plater_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GalleryDialog* MainFrame::gallery_dialog()
|
||||||
|
{
|
||||||
|
if (!m_gallery_dialog)
|
||||||
|
m_gallery_dialog = new GalleryDialog(this);
|
||||||
|
return m_gallery_dialog;
|
||||||
|
}
|
||||||
|
|
||||||
void MainFrame::update_title()
|
void MainFrame::update_title()
|
||||||
{
|
{
|
||||||
wxString title = wxEmptyString;
|
wxString title = wxEmptyString;
|
||||||
|
@ -1413,11 +1420,10 @@ void MainFrame::init_menubar_as_editor()
|
||||||
|
|
||||||
windowMenu->AppendSeparator();
|
windowMenu->AppendSeparator();
|
||||||
append_menu_item(windowMenu, wxID_ANY, _L("Shape Gallery"), _L("Open the dialog to modify shape gallery"),
|
append_menu_item(windowMenu, wxID_ANY, _L("Shape Gallery"), _L("Open the dialog to modify shape gallery"),
|
||||||
[this](wxCommandEvent&) {
|
[this](wxCommandEvent&) {
|
||||||
GalleryDialog dlg(this, true);
|
if (gallery_dialog()->show(true) == wxID_OK) {
|
||||||
if (dlg.ShowModal() == wxID_OK) {
|
|
||||||
wxArrayString input_files;
|
wxArrayString input_files;
|
||||||
dlg.get_input_files(input_files);
|
m_gallery_dialog->get_input_files(input_files);
|
||||||
if (!input_files.IsEmpty())
|
if (!input_files.IsEmpty())
|
||||||
m_plater->sidebar().obj_list()->load_shape_object_from_gallery(input_files);
|
m_plater->sidebar().obj_list()->load_shape_object_from_gallery(input_files);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ class PrintHostQueueDialog;
|
||||||
class Plater;
|
class Plater;
|
||||||
class MainFrame;
|
class MainFrame;
|
||||||
class PreferencesDialog;
|
class PreferencesDialog;
|
||||||
|
class GalleryDialog;
|
||||||
|
|
||||||
enum QuickSlice
|
enum QuickSlice
|
||||||
{
|
{
|
||||||
|
@ -146,6 +147,7 @@ public:
|
||||||
void shutdown();
|
void shutdown();
|
||||||
|
|
||||||
Plater* plater() { return m_plater; }
|
Plater* plater() { return m_plater; }
|
||||||
|
GalleryDialog* gallery_dialog();
|
||||||
|
|
||||||
void update_title();
|
void update_title();
|
||||||
|
|
||||||
|
@ -207,6 +209,7 @@ public:
|
||||||
PreferencesDialog* preferences_dialog { nullptr };
|
PreferencesDialog* preferences_dialog { nullptr };
|
||||||
PrintHostQueueDialog* m_printhost_queue_dlg;
|
PrintHostQueueDialog* m_printhost_queue_dlg;
|
||||||
// std::shared_ptr<ProgressStatusBar> m_statusbar;
|
// std::shared_ptr<ProgressStatusBar> m_statusbar;
|
||||||
|
GalleryDialog* m_gallery_dialog{ nullptr };
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
std::unique_ptr<wxTaskBarIcon> m_taskbar_icon;
|
std::unique_ptr<wxTaskBarIcon> m_taskbar_icon;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue