ENH: jump to prepare in preview only mode
Change-Id: Ic7d1b17938172f81f334df020699b3ffbe92d65f
This commit is contained in:
parent
6bccef66b0
commit
38dfde8fc2
|
@ -687,6 +687,17 @@ void MainFrame::update_layout()
|
||||||
m_tabpanel->InsertPage(tp3DEditor, m_plater, _L("Prepare"), std::string("tab_3d_active"), std::string("tab_3d_active"));
|
m_tabpanel->InsertPage(tp3DEditor, m_plater, _L("Prepare"), std::string("tab_3d_active"), std::string("tab_3d_active"));
|
||||||
m_tabpanel->InsertPage(tpPreview, m_plater, _L("Preview"), std::string("tab_preview_active"), std::string("tab_preview_active"));
|
m_tabpanel->InsertPage(tpPreview, m_plater, _L("Preview"), std::string("tab_preview_active"), std::string("tab_preview_active"));
|
||||||
m_main_sizer->Add(m_tabpanel, 1, wxEXPAND | wxTOP, 0);
|
m_main_sizer->Add(m_tabpanel, 1, wxEXPAND | wxTOP, 0);
|
||||||
|
|
||||||
|
m_tabpanel->Bind(wxCUSTOMEVT_NOTEBOOK_SEL_CHANGED, [this](wxCommandEvent& evt)
|
||||||
|
{
|
||||||
|
// jump to 3deditor under preview_only mode
|
||||||
|
if (evt.GetId() == tp3DEditor){
|
||||||
|
if (!preview_only_hint())
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
evt.Skip();
|
||||||
|
});
|
||||||
|
|
||||||
m_plater->Show();
|
m_plater->Show();
|
||||||
m_tabpanel->Show();
|
m_tabpanel->Show();
|
||||||
|
|
||||||
|
@ -860,14 +871,6 @@ void MainFrame::init_tabpanel()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (new_sel == tp3DEditor) {
|
|
||||||
if (m_plater && (m_plater->only_gcode_mode() || (m_plater->using_exported_file()))) {
|
|
||||||
e.Veto();
|
|
||||||
BOOST_LOG_TRIVIAL(info) << boost::format("skipped tab switch from %1% to %2% in preview mode")%old_sel %new_sel;
|
|
||||||
wxCommandEvent *evt = new wxCommandEvent(EVT_PREVIEW_ONLY_MODE_HINT);
|
|
||||||
wxQueueEvent(m_plater, evt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
|
@ -965,6 +968,30 @@ void MainFrame::init_tabpanel()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MainFrame::preview_only_hint()
|
||||||
|
{
|
||||||
|
if (m_plater && (m_plater->only_gcode_mode() || (m_plater->using_exported_file()))) {
|
||||||
|
BOOST_LOG_TRIVIAL(info) << boost::format("skipped tab switch from %1% to %2% in preview mode")%m_tabpanel->GetSelection() %tp3DEditor;
|
||||||
|
|
||||||
|
ConfirmBeforeSendDialog confirm_dlg(this, wxID_ANY, _L("Warning"));
|
||||||
|
confirm_dlg.Bind(EVT_SECONDARY_CHECK_CONFIRM, [this](wxCommandEvent& e) {
|
||||||
|
preview_only_to_editor = true;
|
||||||
|
});
|
||||||
|
confirm_dlg.update_btn_label(_L("Yes"), _L("No"));
|
||||||
|
auto filename = wxString((m_plater->get_preview_only_filename()).c_str(), wxConvUTF8);
|
||||||
|
confirm_dlg.update_text(filename + _L(" needs to be closed before creating a new model. Do you want to continue?"));
|
||||||
|
confirm_dlg.on_show();
|
||||||
|
if (preview_only_to_editor) {
|
||||||
|
m_plater->new_project();
|
||||||
|
preview_only_to_editor = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
void MainFrame::register_win32_callbacks()
|
void MainFrame::register_win32_callbacks()
|
||||||
{
|
{
|
||||||
|
|
|
@ -178,6 +178,9 @@ class MainFrame : public DPIFrame
|
||||||
eSlicePlate = 1,
|
eSlicePlate = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//jump to editor under preview only mode
|
||||||
|
bool preview_only_to_editor = false;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void on_dpi_changed(const wxRect &suggested_rect) override;
|
virtual void on_dpi_changed(const wxRect &suggested_rect) override;
|
||||||
virtual void on_sys_color_changed() override;
|
virtual void on_sys_color_changed() override;
|
||||||
|
@ -289,6 +292,8 @@ public:
|
||||||
void load_config(const DynamicPrintConfig& config);
|
void load_config(const DynamicPrintConfig& config);
|
||||||
//BBS: jump to monitor
|
//BBS: jump to monitor
|
||||||
void jump_to_monitor(std::string dev_id = "");
|
void jump_to_monitor(std::string dev_id = "");
|
||||||
|
//BBS: hint when jump to 3Deditor under preview only mode
|
||||||
|
bool preview_only_hint();
|
||||||
// Select tab in m_tabpanel
|
// Select tab in m_tabpanel
|
||||||
// When tab == -1, will be selected last selected tab
|
// When tab == -1, will be selected last selected tab
|
||||||
//BBS: GUI refactor
|
//BBS: GUI refactor
|
||||||
|
|
|
@ -2772,8 +2772,7 @@ void Plater::priv::select_view_3D(const std::string& name, bool no_slice)
|
||||||
if (name == "3D") {
|
if (name == "3D") {
|
||||||
BOOST_LOG_TRIVIAL(info) << "select view3D";
|
BOOST_LOG_TRIVIAL(info) << "select view3D";
|
||||||
if (q->only_gcode_mode() || q->using_exported_file()) {
|
if (q->only_gcode_mode() || q->using_exported_file()) {
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": can not goto preview page when loading gcode/exported_3mf");
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format("goto preview page when loading gcode/exported_3mf");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
set_current_panel(view3D, no_slice);
|
set_current_panel(view3D, no_slice);
|
||||||
}
|
}
|
||||||
|
@ -6478,6 +6477,8 @@ void Plater::priv::set_project_filename(const wxString& filename)
|
||||||
//BBS
|
//BBS
|
||||||
wxString project_name = from_u8(full_path.filename().string());
|
wxString project_name = from_u8(full_path.filename().string());
|
||||||
set_project_name(project_name);
|
set_project_name(project_name);
|
||||||
|
if (q->m_only_gcode)
|
||||||
|
q->m_preview_only_filename = std::string((project_name + ".gcode").mb_str());
|
||||||
|
|
||||||
wxGetApp().mainframe->update_title();
|
wxGetApp().mainframe->update_title();
|
||||||
|
|
||||||
|
@ -8496,6 +8497,10 @@ bool Plater::open_3mf_file(const fs::path &file_path)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// record filename for hint when open exported file
|
||||||
|
m_preview_only_filename = filename;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -665,6 +665,8 @@ public:
|
||||||
static bool has_illegal_filename_characters(const std::string& name);
|
static bool has_illegal_filename_characters(const std::string& name);
|
||||||
static void show_illegal_characters_warning(wxWindow* parent);
|
static void show_illegal_characters_warning(wxWindow* parent);
|
||||||
|
|
||||||
|
std::string get_preview_only_filename() { return m_preview_only_filename; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct priv;
|
struct priv;
|
||||||
std::unique_ptr<priv> p;
|
std::unique_ptr<priv> p;
|
||||||
|
@ -680,6 +682,7 @@ private:
|
||||||
bool m_only_gcode { false };
|
bool m_only_gcode { false };
|
||||||
bool m_exported_file { false };
|
bool m_exported_file { false };
|
||||||
bool skip_thumbnail_invalid { false };
|
bool skip_thumbnail_invalid { false };
|
||||||
|
std::string m_preview_only_filename;
|
||||||
int m_valid_plates_count { 0 };
|
int m_valid_plates_count { 0 };
|
||||||
|
|
||||||
void suppress_snapshots();
|
void suppress_snapshots();
|
||||||
|
|
|
@ -563,8 +563,8 @@ ConfirmBeforeSendDialog::ConfirmBeforeSendDialog(wxWindow* parent, wxWindowID id
|
||||||
m_button_ok->SetBorderColor(*wxWHITE);
|
m_button_ok->SetBorderColor(*wxWHITE);
|
||||||
m_button_ok->SetTextColor(wxColour("#FFFFFE"));
|
m_button_ok->SetTextColor(wxColour("#FFFFFE"));
|
||||||
m_button_ok->SetFont(Label::Body_12);
|
m_button_ok->SetFont(Label::Body_12);
|
||||||
m_button_ok->SetSize(wxSize(FromDIP(58), FromDIP(24)));
|
m_button_ok->SetSize(wxSize(-1, FromDIP(24)));
|
||||||
m_button_ok->SetMinSize(wxSize(-1, FromDIP(24)));
|
m_button_ok->SetMinSize(wxSize(FromDIP(58), FromDIP(24)));
|
||||||
m_button_ok->SetCornerRadius(FromDIP(12));
|
m_button_ok->SetCornerRadius(FromDIP(12));
|
||||||
|
|
||||||
m_button_ok->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& e) {
|
m_button_ok->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& e) {
|
||||||
|
@ -578,8 +578,8 @@ ConfirmBeforeSendDialog::ConfirmBeforeSendDialog(wxWindow* parent, wxWindowID id
|
||||||
m_button_cancel->SetBackgroundColor(btn_bg_white);
|
m_button_cancel->SetBackgroundColor(btn_bg_white);
|
||||||
m_button_cancel->SetBorderColor(wxColour(38, 46, 48));
|
m_button_cancel->SetBorderColor(wxColour(38, 46, 48));
|
||||||
m_button_cancel->SetFont(Label::Body_12);
|
m_button_cancel->SetFont(Label::Body_12);
|
||||||
m_button_cancel->SetSize(wxSize(FromDIP(58), FromDIP(24)));
|
m_button_cancel->SetSize(wxSize(-1, FromDIP(24)));
|
||||||
m_button_cancel->SetMinSize(wxSize(-1, FromDIP(24)));
|
m_button_cancel->SetMinSize(wxSize(FromDIP(58), FromDIP(24)));
|
||||||
m_button_cancel->SetCornerRadius(FromDIP(12));
|
m_button_cancel->SetCornerRadius(FromDIP(12));
|
||||||
|
|
||||||
m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& e) {
|
m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& e) {
|
||||||
|
|
Loading…
Reference in New Issue