NEW:add BaseTransparentDPIFrame and timed disappearance
jira: none Change-Id: I8fcf56ead20aba640c59406c0dad3b6ad67f18a6
This commit is contained in:
parent
45e7d7bb7d
commit
d34a8cb2ee
|
@ -318,6 +318,8 @@ set(SLIC3R_GUI_SOURCES
|
||||||
GUI/SendSystemInfoDialog.hpp
|
GUI/SendSystemInfoDialog.hpp
|
||||||
GUI/StepMeshDialog.cpp
|
GUI/StepMeshDialog.cpp
|
||||||
GUI/StepMeshDialog.hpp
|
GUI/StepMeshDialog.hpp
|
||||||
|
GUI/BaseTransparentDPIFrame.cpp
|
||||||
|
GUI/BaseTransparentDPIFrame.hpp
|
||||||
GUI/SyncAmsInfoDialog.cpp
|
GUI/SyncAmsInfoDialog.cpp
|
||||||
GUI/SyncAmsInfoDialog.hpp
|
GUI/SyncAmsInfoDialog.hpp
|
||||||
GUI/SurfaceDrag.cpp
|
GUI/SurfaceDrag.cpp
|
||||||
|
|
|
@ -0,0 +1,171 @@
|
||||||
|
#include "BaseTransparentDPIFrame.hpp"
|
||||||
|
|
||||||
|
#include <thread>
|
||||||
|
#include <wx/event.h>
|
||||||
|
#include <wx/sizer.h>
|
||||||
|
#include <wx/slider.h>
|
||||||
|
#include <wx/dcmemory.h>
|
||||||
|
#include "GUI_App.hpp"
|
||||||
|
#include "Tab.hpp"
|
||||||
|
#include "PartPlate.hpp"
|
||||||
|
#include "I18N.hpp"
|
||||||
|
#include "MainFrame.hpp"
|
||||||
|
#include "Widgets/Button.hpp"
|
||||||
|
#include "Widgets/TextInput.hpp"
|
||||||
|
#include "Notebook.hpp"
|
||||||
|
#include <chrono>
|
||||||
|
#include "Widgets/Button.hpp"
|
||||||
|
#include "Widgets/CheckBox.hpp"
|
||||||
|
#include "CapsuleButton.hpp"
|
||||||
|
using namespace Slic3r;
|
||||||
|
using namespace Slic3r::GUI;
|
||||||
|
|
||||||
|
namespace Slic3r { namespace GUI {
|
||||||
|
#define ANIMATION_REFRESH_INTERVAL 15
|
||||||
|
BaseTransparentDPIFrame::BaseTransparentDPIFrame(
|
||||||
|
wxWindow *parent, int win_width, wxPoint dialog_pos, int ok_button_width, wxString win_text, wxString ok_text, wxString cancel_text, DisappearanceMode disappearance_mode)
|
||||||
|
: DPIFrame(static_cast<wxWindow *>(wxGetApp().mainframe), wxID_ANY, "", wxDefaultPosition, wxDefaultSize, !wxCAPTION | !wxCLOSE_BOX | wxBORDER_NONE)
|
||||||
|
, m_timed_disappearance_mode(disappearance_mode)
|
||||||
|
{
|
||||||
|
// SetBackgroundStyle(wxBackgroundStyle::wxBG_STYLE_TRANSPARENT);
|
||||||
|
SetTransparent(220);
|
||||||
|
SetBackgroundColour(wxColour(23, 25, 22, 128));
|
||||||
|
SetMinSize(wxSize(FromDIP(win_width), -1));
|
||||||
|
SetMaxSize(wxSize(FromDIP(win_width), -1));
|
||||||
|
SetPosition(dialog_pos);
|
||||||
|
|
||||||
|
m_sizer_main = new wxBoxSizer(wxVERTICAL);
|
||||||
|
wxBoxSizer *text_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
text_sizer->AddSpacer(FromDIP(20));
|
||||||
|
auto image_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
auto imgsize = FromDIP(25);
|
||||||
|
auto completedimg = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap("completed", this, 25), wxDefaultPosition, wxSize(imgsize, imgsize), 0);
|
||||||
|
image_sizer->Add(completedimg, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, FromDIP(0));
|
||||||
|
image_sizer->AddStretchSpacer();
|
||||||
|
text_sizer->Add(image_sizer);
|
||||||
|
text_sizer->AddSpacer(FromDIP(5));
|
||||||
|
auto finish_text = new Label(this, win_text, LB_AUTO_WRAP);
|
||||||
|
finish_text->SetMinSize(wxSize(FromDIP(win_width - 64), -1));
|
||||||
|
finish_text->SetMaxSize(wxSize(FromDIP(win_width - 64), -1));
|
||||||
|
finish_text->SetForegroundColour(wxColour(255, 255, 255, 255));
|
||||||
|
text_sizer->Add(finish_text, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 0);
|
||||||
|
text_sizer->AddSpacer(FromDIP(20));
|
||||||
|
m_sizer_main->Add(text_sizer, FromDIP(0), wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxTOP, FromDIP(15));
|
||||||
|
|
||||||
|
wxBoxSizer *bSizer_button = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
bSizer_button->SetMinSize(wxSize(FromDIP(100), -1));
|
||||||
|
/* m_checkbox = new wxCheckBox(this, wxID_ANY, _L("Don't show again"), wxDefaultPosition, wxDefaultSize, 0);
|
||||||
|
bSizer_button->Add(m_checkbox, 0, wxALIGN_LEFT);*/
|
||||||
|
bSizer_button->AddStretchSpacer(1);
|
||||||
|
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(27, 136, 68), StateColor::Pressed), std::pair<wxColour, int>(wxColour(61, 203, 115), StateColor::Hovered),
|
||||||
|
std::pair<wxColour, int>(AMS_CONTROL_BRAND_COLOUR, StateColor::Normal));
|
||||||
|
StateColor btn_bg_white(std::pair<wxColour, int>(wxColour(23, 25, 22), StateColor::Pressed), std::pair<wxColour, int>(wxColour(43, 45, 42), StateColor::Hovered),
|
||||||
|
std::pair<wxColour, int>(wxColour(23, 25, 22), StateColor::Normal));
|
||||||
|
m_button_ok = new Button(this, ok_text);
|
||||||
|
m_button_ok->SetBackgroundColor(btn_bg_green);
|
||||||
|
m_button_ok->SetBorderWidth(0);
|
||||||
|
m_button_ok->SetTextColor(wxColour(0xFEFEFE));
|
||||||
|
m_button_ok->SetFont(Label::Body_12);
|
||||||
|
m_button_ok->SetSize(wxSize(FromDIP(60), FromDIP(30)));
|
||||||
|
m_button_ok->SetMinSize(wxSize(FromDIP(90), FromDIP(30)));
|
||||||
|
m_button_ok->SetCornerRadius(FromDIP(6));
|
||||||
|
bSizer_button->Add(m_button_ok, 0, wxALIGN_RIGHT | wxLEFT | wxTOP, FromDIP(10));
|
||||||
|
|
||||||
|
m_button_ok->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { deal_ok(); });
|
||||||
|
|
||||||
|
m_button_cancel = new Button(this, cancel_text);
|
||||||
|
m_button_cancel->SetBackgroundColor(btn_bg_white);
|
||||||
|
m_button_cancel->SetBorderColor(wxColour(93, 93, 91));
|
||||||
|
m_button_cancel->SetFont(Label::Body_12);
|
||||||
|
m_button_cancel->SetTextColor(wxColour(0xFEFEFE));
|
||||||
|
m_button_cancel->SetSize(wxSize(FromDIP(65), FromDIP(30)));
|
||||||
|
m_button_cancel->SetMinSize(wxSize(FromDIP(65), FromDIP(30)));
|
||||||
|
m_button_cancel->SetCornerRadius(FromDIP(6));
|
||||||
|
bSizer_button->Add(m_button_cancel, 0, wxALIGN_RIGHT | wxLEFT | wxTOP, FromDIP(10));
|
||||||
|
|
||||||
|
m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { deal_cancel(); });
|
||||||
|
|
||||||
|
m_sizer_main->Add(bSizer_button, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(20));
|
||||||
|
|
||||||
|
Bind(wxEVT_CLOSE_WINDOW, [this](auto &e) { this->on_hide(); });
|
||||||
|
SetSizer(m_sizer_main);
|
||||||
|
Layout();
|
||||||
|
Fit();
|
||||||
|
|
||||||
|
if (m_timed_disappearance_mode != DisappearanceMode::None) {
|
||||||
|
init_timer();
|
||||||
|
Bind(wxEVT_TIMER, &BaseTransparentDPIFrame::on_timer, this);
|
||||||
|
Bind(wxEVT_ENTER_WINDOW, [this](auto &e) {
|
||||||
|
clear_timer_count();
|
||||||
|
m_refresh_timer->Stop();
|
||||||
|
});
|
||||||
|
Bind(wxEVT_LEAVE_WINDOW, [this](auto &e) {
|
||||||
|
m_refresh_timer->Start(ANIMATION_REFRESH_INTERVAL);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseTransparentDPIFrame::~BaseTransparentDPIFrame() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BaseTransparentDPIFrame::Show(bool show)
|
||||||
|
{
|
||||||
|
if (show) {
|
||||||
|
if (m_refresh_timer) {
|
||||||
|
m_refresh_timer->Start(ANIMATION_REFRESH_INTERVAL);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (m_refresh_timer) {
|
||||||
|
m_refresh_timer->Stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Layout();
|
||||||
|
return DPIFrame::Show(show);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseTransparentDPIFrame::on_dpi_changed(const wxRect &suggested_rect)
|
||||||
|
{
|
||||||
|
m_button_ok->Rescale();
|
||||||
|
m_button_cancel->Rescale();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseTransparentDPIFrame::on_show() {
|
||||||
|
Show();
|
||||||
|
Raise();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseTransparentDPIFrame::on_hide()
|
||||||
|
{
|
||||||
|
this->Hide();
|
||||||
|
if (wxGetApp().mainframe != nullptr) {
|
||||||
|
wxGetApp().mainframe->Show();
|
||||||
|
wxGetApp().mainframe->Raise();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseTransparentDPIFrame::clear_timer_count() {
|
||||||
|
m_timer_count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseTransparentDPIFrame::init_timer()
|
||||||
|
{
|
||||||
|
m_refresh_timer = new wxTimer();
|
||||||
|
m_refresh_timer->SetOwner(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseTransparentDPIFrame::on_timer(wxTimerEvent &event) {
|
||||||
|
m_timer_count++;
|
||||||
|
if (m_timed_disappearance_mode == DisappearanceMode::TimedDisappearance) {
|
||||||
|
auto cur_time = ANIMATION_REFRESH_INTERVAL * m_timer_count;
|
||||||
|
if (cur_time > m_disappearance_second) {
|
||||||
|
on_hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseTransparentDPIFrame::deal_ok(){}
|
||||||
|
|
||||||
|
void BaseTransparentDPIFrame::deal_cancel(){}
|
||||||
|
|
||||||
|
}} // namespace Slic3r::GUI
|
|
@ -0,0 +1,58 @@
|
||||||
|
#ifndef _BaseTransparentDPIFrame_H_
|
||||||
|
#define _BaseTransparentDPIFrame_H_
|
||||||
|
|
||||||
|
#include <future>
|
||||||
|
#include <thread>
|
||||||
|
#include "GUI_App.hpp"
|
||||||
|
#include "GUI_Utils.hpp"
|
||||||
|
|
||||||
|
class Button;
|
||||||
|
class CheckBox;
|
||||||
|
namespace Slic3r { namespace GUI {
|
||||||
|
class CapsuleButton;
|
||||||
|
|
||||||
|
class BaseTransparentDPIFrame : public Slic3r::GUI::DPIFrame
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum DisappearanceMode {
|
||||||
|
None,
|
||||||
|
TimedDisappearance,//defalut 7 second
|
||||||
|
QuickDisappearance
|
||||||
|
};
|
||||||
|
|
||||||
|
BaseTransparentDPIFrame(wxWindow * parent,
|
||||||
|
int win_width,
|
||||||
|
wxPoint dialog_pos,
|
||||||
|
int ok_button_width,
|
||||||
|
wxString win_text,
|
||||||
|
wxString ok_text,
|
||||||
|
wxString cancel_text = "",
|
||||||
|
DisappearanceMode disappearance_mode = DisappearanceMode::None);
|
||||||
|
~BaseTransparentDPIFrame() override;
|
||||||
|
void on_dpi_changed(const wxRect &suggested_rect) override;
|
||||||
|
void on_show();
|
||||||
|
void on_hide();
|
||||||
|
void clear_timer_count();
|
||||||
|
bool Show(bool show =true) override;
|
||||||
|
|
||||||
|
virtual void deal_ok();
|
||||||
|
virtual void deal_cancel();
|
||||||
|
virtual void on_timer(wxTimerEvent &event);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Button * m_button_ok = nullptr;
|
||||||
|
Button * m_button_cancel = nullptr;
|
||||||
|
|
||||||
|
DisappearanceMode m_timed_disappearance_mode;
|
||||||
|
float m_timer_count = 0;
|
||||||
|
wxTimer *m_refresh_timer{nullptr};
|
||||||
|
int m_disappearance_second = 2500;//unit ms: mean 5s
|
||||||
|
|
||||||
|
private:
|
||||||
|
wxBoxSizer *m_sizer_main{nullptr};
|
||||||
|
|
||||||
|
private:
|
||||||
|
void init_timer();
|
||||||
|
};
|
||||||
|
}} // namespace Slic3r::GUI
|
||||||
|
#endif // _STEP_MESH_DIALOG_H_
|
|
@ -3032,7 +3032,7 @@ void Sidebar::sync_ams_list(bool is_from_big_sync_btn)
|
||||||
}
|
}
|
||||||
m_fna_dialog.reset();
|
m_fna_dialog.reset();
|
||||||
}
|
}
|
||||||
m_fna_dialog = std::make_shared<FinishSyncAmsDialog>(this, temp_fsa_info);
|
m_fna_dialog = std::make_shared<FinishSyncAmsDialog>(temp_fsa_info);
|
||||||
m_fna_dialog->Show();
|
m_fna_dialog->Show();
|
||||||
m_fna_dialog->Raise();
|
m_fna_dialog->Raise();
|
||||||
}
|
}
|
||||||
|
@ -3138,7 +3138,7 @@ void Sidebar::pop_sync_nozzle_and_ams_ialog() {
|
||||||
}
|
}
|
||||||
m_sna_dialog.reset();
|
m_sna_dialog.reset();
|
||||||
}
|
}
|
||||||
m_sna_dialog = std::make_shared<SyncNozzleAndAmsDialog>(this, temp_na_info);
|
m_sna_dialog = std::make_shared<SyncNozzleAndAmsDialog>(temp_na_info);
|
||||||
m_sna_dialog->Show();
|
m_sna_dialog->Show();
|
||||||
m_sna_dialog->Raise();
|
m_sna_dialog->Raise();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4368,94 +4368,22 @@ std::string SyncAmsInfoDialog::get_print_status_info(PrintDialogStatus status)
|
||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
SyncNozzleAndAmsDialog::SyncNozzleAndAmsDialog(wxWindow *parent, InputInfo &input_info)
|
SyncNozzleAndAmsDialog::SyncNozzleAndAmsDialog(InputInfo &input_info)
|
||||||
: DPIFrame(static_cast<wxWindow *>(wxGetApp().mainframe), wxID_ANY, "", wxDefaultPosition, wxDefaultSize, !wxCAPTION | !wxCLOSE_BOX | wxBORDER_NONE)
|
: BaseTransparentDPIFrame(static_cast<wxWindow *>(wxGetApp().mainframe),
|
||||||
|
300,
|
||||||
|
input_info.dialog_pos,
|
||||||
|
90,
|
||||||
|
_L("Successfully synchronized nozzle and AMS number information."),
|
||||||
|
_L("Continue to sync filaments"),
|
||||||
|
_CTX(L_CONTEXT("Cancel", "Sync_Nozzle_AMS"), "Sync_Nozzle_AMS"),
|
||||||
|
DisappearanceMode::TimedDisappearance)
|
||||||
, m_input_info(input_info)
|
, m_input_info(input_info)
|
||||||
{
|
{
|
||||||
//SetBackgroundStyle(wxBackgroundStyle::wxBG_STYLE_TRANSPARENT);
|
|
||||||
SetTransparent(220);
|
|
||||||
SetBackgroundColour(wxColour(23, 25, 22, 128));
|
|
||||||
auto win_width = 300;
|
|
||||||
SetMinSize(wxSize(FromDIP(win_width), -1));
|
|
||||||
SetMaxSize(wxSize(FromDIP(win_width), -1));
|
|
||||||
SetPosition(m_input_info.dialog_pos);
|
|
||||||
|
|
||||||
m_sizer_main = new wxBoxSizer(wxVERTICAL);
|
|
||||||
wxBoxSizer *text_sizer = new wxBoxSizer(wxHORIZONTAL);
|
|
||||||
text_sizer->AddSpacer(FromDIP(20));
|
|
||||||
auto image_sizer= new wxBoxSizer(wxVERTICAL);
|
|
||||||
auto imgsize = FromDIP(25);
|
|
||||||
auto completedimg = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap("completed", this, 25), wxDefaultPosition, wxSize(imgsize, imgsize), 0);
|
|
||||||
image_sizer->Add(completedimg, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, FromDIP(0));
|
|
||||||
image_sizer->AddStretchSpacer();
|
|
||||||
text_sizer->Add(image_sizer);
|
|
||||||
text_sizer->AddSpacer(FromDIP(5));
|
|
||||||
auto finish_text = new Label(this, _L("Successfully synchronized nozzle and AMS number information."), LB_AUTO_WRAP);
|
|
||||||
finish_text->SetMinSize(wxSize(FromDIP(win_width - 64), -1));
|
|
||||||
finish_text->SetMaxSize(wxSize(FromDIP(win_width - 64), -1));
|
|
||||||
finish_text->SetForegroundColour(wxColour(255, 255, 255, 255));
|
|
||||||
text_sizer->Add(finish_text, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 0);
|
|
||||||
text_sizer->AddSpacer(FromDIP(20));
|
|
||||||
m_sizer_main->Add(text_sizer, FromDIP(0), wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxTOP, FromDIP(15));
|
|
||||||
|
|
||||||
wxBoxSizer *bSizer_button = new wxBoxSizer(wxHORIZONTAL);
|
|
||||||
bSizer_button->SetMinSize(wxSize(FromDIP(100), -1));
|
|
||||||
/* m_checkbox = new wxCheckBox(this, wxID_ANY, _L("Don't show again"), wxDefaultPosition, wxDefaultSize, 0);
|
|
||||||
bSizer_button->Add(m_checkbox, 0, wxALIGN_LEFT);*/
|
|
||||||
bSizer_button->AddStretchSpacer(1);
|
|
||||||
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(27, 136, 68), StateColor::Pressed), std::pair<wxColour, int>(wxColour(61, 203, 115), StateColor::Hovered),
|
|
||||||
std::pair<wxColour, int>(AMS_CONTROL_BRAND_COLOUR, StateColor::Normal));
|
|
||||||
StateColor btn_bg_white(std::pair<wxColour, int>(wxColour(23, 25, 22), StateColor::Pressed), std::pair<wxColour, int>(wxColour(43, 45, 42), StateColor::Hovered),
|
|
||||||
std::pair<wxColour, int>(wxColour(23, 25, 22), StateColor::Normal));
|
|
||||||
m_button_ok = new Button(this, _L("Continue to sync filaments"));
|
|
||||||
m_button_ok->SetBackgroundColor(btn_bg_green);
|
|
||||||
m_button_ok->SetBorderWidth(0);
|
|
||||||
m_button_ok->SetTextColor(wxColour(0xFEFEFE));
|
|
||||||
m_button_ok->SetFont(Label::Body_12);
|
|
||||||
m_button_ok->SetSize(wxSize(FromDIP(60), FromDIP(30)));
|
|
||||||
m_button_ok->SetMinSize(wxSize(FromDIP(90), FromDIP(30)));
|
|
||||||
m_button_ok->SetCornerRadius(FromDIP(6));
|
|
||||||
bSizer_button->Add(m_button_ok, 0, wxALIGN_RIGHT | wxLEFT | wxTOP, FromDIP(10));
|
|
||||||
|
|
||||||
m_button_ok->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
|
||||||
deal_ok();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
m_button_cancel = new Button(this, _CTX(L_CONTEXT("Cancel", "Sync_Nozzle_AMS"), "Sync_Nozzle_AMS"));
|
|
||||||
m_button_cancel->SetBackgroundColor(btn_bg_white);
|
|
||||||
m_button_cancel->SetBorderColor(wxColour(93, 93, 91));
|
|
||||||
m_button_cancel->SetFont(Label::Body_12);
|
|
||||||
m_button_cancel->SetTextColor(wxColour(0xFEFEFE));
|
|
||||||
m_button_cancel->SetSize(wxSize(FromDIP(65), FromDIP(30)));
|
|
||||||
m_button_cancel->SetMinSize(wxSize(FromDIP(65), FromDIP(30)));
|
|
||||||
m_button_cancel->SetCornerRadius(FromDIP(6));
|
|
||||||
bSizer_button->Add(m_button_cancel, 0, wxALIGN_RIGHT | wxLEFT | wxTOP, FromDIP(10));
|
|
||||||
|
|
||||||
m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
|
||||||
deal_cancel();
|
|
||||||
});
|
|
||||||
|
|
||||||
m_sizer_main->Add(bSizer_button, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(20));
|
|
||||||
|
|
||||||
Bind(wxEVT_CLOSE_WINDOW, [this](auto &e) { this->on_hide(); });
|
|
||||||
SetSizer(m_sizer_main);
|
|
||||||
Layout();
|
|
||||||
Fit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SyncNozzleAndAmsDialog::~SyncNozzleAndAmsDialog() {}
|
SyncNozzleAndAmsDialog::~SyncNozzleAndAmsDialog() {}
|
||||||
|
|
||||||
void SyncNozzleAndAmsDialog::on_dpi_changed(const wxRect &suggested_rect)
|
|
||||||
{
|
|
||||||
m_button_ok->Rescale();
|
|
||||||
m_button_cancel->Rescale();
|
|
||||||
}
|
|
||||||
void SyncNozzleAndAmsDialog::deal_ok() {
|
void SyncNozzleAndAmsDialog::deal_ok() {
|
||||||
//SyncAmsInfoDialog::SyncInfo temp_info;
|
|
||||||
//temp_info.connected_printer = true;
|
|
||||||
//SyncAmsInfoDialog sync_dlg(this, temp_info);
|
|
||||||
//auto dlg_res = wxGetApp().plater()->sidebar().pop_sync_ams_info_dialog(sync_dlg);
|
|
||||||
on_hide();
|
on_hide();
|
||||||
wxGetApp().plater()->sidebar().sync_ams_list(true);
|
wxGetApp().plater()->sidebar().sync_ams_list(true);
|
||||||
}
|
}
|
||||||
|
@ -4464,98 +4392,22 @@ void SyncNozzleAndAmsDialog::deal_cancel() {
|
||||||
on_hide();
|
on_hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SyncNozzleAndAmsDialog::on_hide()
|
FinishSyncAmsDialog::FinishSyncAmsDialog(InputInfo &input_info)
|
||||||
{
|
: BaseTransparentDPIFrame(static_cast<wxWindow *>(wxGetApp().mainframe),
|
||||||
this->Hide();
|
300,
|
||||||
if (wxGetApp().mainframe != nullptr) {
|
input_info.dialog_pos,
|
||||||
wxGetApp().mainframe->Show();
|
68,
|
||||||
wxGetApp().mainframe->Raise();
|
_L("Successfully synchronized color and type of filament from printer."),
|
||||||
}
|
_CTX(L_CONTEXT("OK", "FinishSyncAms"), "FinishSyncAms"),
|
||||||
}
|
"",
|
||||||
|
DisappearanceMode::TimedDisappearance)
|
||||||
FinishSyncAmsDialog::FinishSyncAmsDialog(wxWindow *parent, InputInfo &input_info)
|
|
||||||
: DPIFrame(static_cast<wxWindow *>(wxGetApp().mainframe), wxID_ANY, "", wxDefaultPosition, wxDefaultSize, !wxCAPTION | !wxCLOSE_BOX | wxBORDER_NONE)
|
|
||||||
, m_input_info(input_info)
|
, m_input_info(input_info)
|
||||||
{
|
{
|
||||||
// SetBackgroundStyle(wxBackgroundStyle::wxBG_STYLE_TRANSPARENT);
|
m_button_cancel->Hide();
|
||||||
SetTransparent(220);
|
|
||||||
SetBackgroundColour(wxColour(23, 25, 22, 128));
|
|
||||||
auto win_width = 300;
|
|
||||||
SetMinSize(wxSize(FromDIP(win_width), -1));
|
|
||||||
SetMaxSize(wxSize(FromDIP(win_width), -1));
|
|
||||||
SetPosition(m_input_info.dialog_pos);
|
|
||||||
|
|
||||||
m_sizer_main = new wxBoxSizer(wxVERTICAL);
|
|
||||||
wxBoxSizer *text_sizer = new wxBoxSizer(wxHORIZONTAL);
|
|
||||||
text_sizer->AddSpacer(FromDIP(20));
|
|
||||||
auto image_sizer = new wxBoxSizer(wxVERTICAL);
|
|
||||||
auto imgsize = FromDIP(25);
|
|
||||||
auto completedimg = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap("completed", this, 25), wxDefaultPosition, wxSize(imgsize, imgsize), 0);
|
|
||||||
image_sizer->Add(completedimg, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, FromDIP(0));
|
|
||||||
image_sizer->AddStretchSpacer();
|
|
||||||
text_sizer->Add(image_sizer);
|
|
||||||
text_sizer->AddSpacer(FromDIP(5));
|
|
||||||
auto finish_text = new Label(this, _L("Successfully synchronized color and type of filament from printer."), LB_AUTO_WRAP);
|
|
||||||
finish_text->SetMinSize(wxSize(FromDIP(win_width - 64), -1));
|
|
||||||
finish_text->SetMaxSize(wxSize(FromDIP(win_width - 64), -1));
|
|
||||||
finish_text->SetForegroundColour(wxColour(255, 255, 255, 255));
|
|
||||||
text_sizer->Add(finish_text, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 0);
|
|
||||||
text_sizer->AddSpacer(FromDIP(20));
|
|
||||||
m_sizer_main->Add(text_sizer, FromDIP(0), wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxTOP, FromDIP(15));
|
|
||||||
|
|
||||||
wxBoxSizer *bSizer_button = new wxBoxSizer(wxHORIZONTAL);
|
|
||||||
bSizer_button->SetMinSize(wxSize(FromDIP(100), -1));
|
|
||||||
/* m_checkbox = new wxCheckBox(this, wxID_ANY, _L("Don't show again"), wxDefaultPosition, wxDefaultSize, 0);
|
|
||||||
bSizer_button->Add(m_checkbox, 0, wxALIGN_LEFT);*/
|
|
||||||
bSizer_button->AddStretchSpacer(1);
|
|
||||||
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(27, 136, 68), StateColor::Pressed), std::pair<wxColour, int>(wxColour(61, 203, 115), StateColor::Hovered),
|
|
||||||
std::pair<wxColour, int>(AMS_CONTROL_BRAND_COLOUR, StateColor::Normal));
|
|
||||||
StateColor btn_bg_white(std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Pressed), std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered),
|
|
||||||
std::pair<wxColour, int>(*wxWHITE, StateColor::Normal));
|
|
||||||
m_button_ok = new Button(this, _CTX(L_CONTEXT("OK", "FinishSyncAms"), "FinishSyncAms"));
|
|
||||||
m_button_ok->SetBackgroundColor(btn_bg_green);
|
|
||||||
m_button_ok->SetBorderWidth(0);
|
|
||||||
m_button_ok->SetTextColor(wxColour(0xFEFEFE));
|
|
||||||
m_button_ok->SetFont(Label::Body_12);
|
|
||||||
m_button_ok->SetSize(wxSize(FromDIP(68), FromDIP(30)));
|
|
||||||
m_button_ok->SetMinSize(wxSize(FromDIP(68), FromDIP(30)));
|
|
||||||
m_button_ok->SetCornerRadius(FromDIP(6));
|
|
||||||
bSizer_button->Add(m_button_ok, 0, wxALIGN_RIGHT | wxLEFT | wxTOP, FromDIP(10));
|
|
||||||
|
|
||||||
m_button_ok->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
|
||||||
deal_ok();
|
|
||||||
});
|
|
||||||
|
|
||||||
//m_button_cancel = new Button(this, _CTX(L_CONTEXT("Cancel", "Sync_Nozzle_AMS"), "Sync_Nozzle_AMS"));
|
|
||||||
//m_button_cancel->SetBackgroundColor(btn_bg_white);
|
|
||||||
//m_button_cancel->SetBorderColor(wxColour(38, 46, 48));
|
|
||||||
//m_button_cancel->SetFont(Label::Body_12);
|
|
||||||
//m_button_cancel->SetSize(wxSize(FromDIP(65), FromDIP(30)));
|
|
||||||
//m_button_cancel->SetMinSize(wxSize(FromDIP(65), FromDIP(30)));
|
|
||||||
//m_button_cancel->SetCornerRadius(FromDIP(6));
|
|
||||||
|
|
||||||
//m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_CANCEL); });
|
|
||||||
//bSizer_button->Add(m_button_cancel, 0, wxALIGN_RIGHT | wxLEFT | wxTOP, FromDIP(10));
|
|
||||||
m_sizer_main->Add(bSizer_button, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(20));
|
|
||||||
|
|
||||||
Bind(wxEVT_CLOSE_WINDOW, [this](auto &e) { this->on_hide(); });
|
|
||||||
SetSizer(m_sizer_main);
|
|
||||||
Layout();
|
|
||||||
Fit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FinishSyncAmsDialog::~FinishSyncAmsDialog() {}
|
FinishSyncAmsDialog::~FinishSyncAmsDialog() {}
|
||||||
void FinishSyncAmsDialog::on_dpi_changed(const wxRect &suggested_rect)
|
|
||||||
{
|
|
||||||
m_button_ok->Rescale();
|
|
||||||
}
|
|
||||||
void FinishSyncAmsDialog::deal_ok() { on_hide(); }
|
void FinishSyncAmsDialog::deal_ok() { on_hide(); }
|
||||||
void FinishSyncAmsDialog::deal_cancel() {}
|
|
||||||
void FinishSyncAmsDialog::on_hide()
|
|
||||||
{
|
|
||||||
this->Hide();
|
|
||||||
if (wxGetApp().mainframe != nullptr) {
|
|
||||||
wxGetApp().mainframe->Show();
|
|
||||||
wxGetApp().mainframe->Raise();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}} // namespace Slic3r
|
}} // namespace Slic3r
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "SelectMachine.hpp"
|
#include "SelectMachine.hpp"
|
||||||
#include "DeviceManager.hpp"
|
#include "DeviceManager.hpp"
|
||||||
|
#include "BaseTransparentDPIFrame.hpp"
|
||||||
class Button;
|
class Button;
|
||||||
class CheckBox;
|
class CheckBox;
|
||||||
class Label;
|
class Label;
|
||||||
|
@ -355,55 +356,33 @@ private:
|
||||||
MapModeEnum m_map_mode{MapModeEnum::ColorMap};
|
MapModeEnum m_map_mode{MapModeEnum::ColorMap};
|
||||||
};
|
};
|
||||||
|
|
||||||
class SyncNozzleAndAmsDialog : public Slic3r::GUI::DPIFrame
|
class SyncNozzleAndAmsDialog : public Slic3r::GUI::BaseTransparentDPIFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct InputInfo
|
struct InputInfo
|
||||||
{
|
{
|
||||||
wxPoint dialog_pos{wxPoint(400, 200)};
|
wxPoint dialog_pos{wxPoint(400, 200)};
|
||||||
bool only_external_material = false;
|
|
||||||
};
|
};
|
||||||
struct ResultInfo
|
SyncNozzleAndAmsDialog(InputInfo &input_info);
|
||||||
{};
|
|
||||||
SyncNozzleAndAmsDialog(wxWindow *parent, InputInfo &input_info);
|
|
||||||
~SyncNozzleAndAmsDialog() override;
|
~SyncNozzleAndAmsDialog() override;
|
||||||
void on_dpi_changed(const wxRect &suggested_rect) override;
|
void deal_ok() override;
|
||||||
void deal_ok();
|
void deal_cancel() override;
|
||||||
void deal_cancel();
|
|
||||||
void on_hide();
|
|
||||||
//bool Show(bool show) override;
|
|
||||||
private:
|
private:
|
||||||
InputInfo& m_input_info;
|
InputInfo& m_input_info;
|
||||||
ResultInfo m_result_info;
|
|
||||||
|
|
||||||
wxBoxSizer *m_sizer_main{nullptr};
|
|
||||||
Button *m_button_ok = nullptr;
|
|
||||||
Button *m_button_cancel = nullptr;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class FinishSyncAmsDialog : public Slic3r::GUI::DPIFrame
|
class FinishSyncAmsDialog : public Slic3r::GUI::BaseTransparentDPIFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct InputInfo
|
struct InputInfo
|
||||||
{
|
{
|
||||||
wxPoint dialog_pos{wxPoint(400, 200)};
|
wxPoint dialog_pos{wxPoint(400, 200)};
|
||||||
};
|
};
|
||||||
struct ResultInfo
|
FinishSyncAmsDialog(InputInfo &input_info);
|
||||||
{};
|
|
||||||
FinishSyncAmsDialog(wxWindow *parent, InputInfo &input_info);
|
|
||||||
~FinishSyncAmsDialog() override;
|
~FinishSyncAmsDialog() override;
|
||||||
void on_dpi_changed(const wxRect &suggested_rect) override;
|
|
||||||
void deal_ok();
|
void deal_ok();
|
||||||
void deal_cancel();
|
|
||||||
void on_hide();
|
|
||||||
// bool Show(bool show) override;
|
|
||||||
private:
|
private:
|
||||||
InputInfo& m_input_info;
|
InputInfo& m_input_info;
|
||||||
ResultInfo m_result_info;
|
|
||||||
|
|
||||||
wxBoxSizer *m_sizer_main{nullptr};
|
|
||||||
Button * m_button_ok = nullptr;
|
|
||||||
Button * m_button_cancel = nullptr;
|
|
||||||
};
|
};
|
||||||
}} // namespace Slic3r::GUI
|
}} // namespace Slic3r::GUI
|
||||||
#endif // _STEP_MESH_DIALOG_H_
|
#endif // _STEP_MESH_DIALOG_H_
|
||||||
|
|
Loading…
Reference in New Issue