mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-18 11:02:08 +00:00
NEW: add calibration for 3rd printer
cherry pick from SoftFever Change-Id: Ibb2b4693c3f2e800dbef1542cbada6736154ce48
This commit is contained in:
@@ -24,6 +24,7 @@ enum CUSTOM_ID
|
||||
ID_TITLE,
|
||||
ID_MODEL_STORE,
|
||||
ID_PUBLISH,
|
||||
ID_CALIB,
|
||||
ID_TOOL_BAR = 3200,
|
||||
ID_AMS_NOTEBOOK,
|
||||
};
|
||||
@@ -194,6 +195,7 @@ void BBLTopbar::Init(wxFrame* parent)
|
||||
m_frame = parent;
|
||||
m_skip_popup_file_menu = false;
|
||||
m_skip_popup_dropdown_menu = false;
|
||||
m_skip_popup_calib_menu = false;
|
||||
|
||||
wxInitAllImageHandlers();
|
||||
|
||||
@@ -241,6 +243,13 @@ void BBLTopbar::Init(wxFrame* parent)
|
||||
wxBitmap redo_inactive_bitmap = create_scaled_bitmap("topbar_redo_inactive", nullptr, TOPBAR_ICON_SIZE);
|
||||
m_redo_item->SetDisabledBitmap(redo_inactive_bitmap);
|
||||
|
||||
this->AddSpacer(FromDIP(10));
|
||||
|
||||
wxBitmap calib_bitmap = create_scaled_bitmap("calib_sf", nullptr, TOPBAR_ICON_SIZE);
|
||||
wxBitmap calib_bitmap_inactive = create_scaled_bitmap("calib_sf_inactive", nullptr, TOPBAR_ICON_SIZE);
|
||||
m_calib_item = this->AddTool(ID_CALIB, _L("Calibration"), calib_bitmap);
|
||||
m_calib_item->SetDisabledBitmap(calib_bitmap_inactive);
|
||||
|
||||
this->AddSpacer(FromDIP(10));
|
||||
this->AddStretchSpacer(1);
|
||||
|
||||
@@ -296,6 +305,7 @@ void BBLTopbar::Init(wxFrame* parent)
|
||||
this->Bind(wxEVT_MENU_CLOSE, &BBLTopbar::OnMenuClose, this);
|
||||
this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnFileToolItem, this, ID_TOP_FILE_MENU);
|
||||
this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnDropdownToolItem, this, ID_TOP_DROPDOWN_MENU);
|
||||
this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnCalibToolItem, this, ID_CALIB);
|
||||
this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnIconize, this, wxID_ICONIZE_FRAME);
|
||||
this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnFullScreen, this, wxID_MAXIMIZE_FRAME);
|
||||
this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnCloseFrame, this, wxID_CLOSE_FRAME);
|
||||
@@ -355,6 +365,7 @@ void BBLTopbar::EnableUndoRedoItems()
|
||||
{
|
||||
this->EnableTool(m_undo_item->GetId(), true);
|
||||
this->EnableTool(m_redo_item->GetId(), true);
|
||||
this->EnableTool(m_calib_item->GetId(), true);
|
||||
Refresh();
|
||||
}
|
||||
|
||||
@@ -362,6 +373,7 @@ void BBLTopbar::DisableUndoRedoItems()
|
||||
{
|
||||
this->EnableTool(m_undo_item->GetId(), false);
|
||||
this->EnableTool(m_redo_item->GetId(), false);
|
||||
this->EnableTool(m_calib_item->GetId(), false);
|
||||
Refresh();
|
||||
}
|
||||
|
||||
@@ -417,6 +429,11 @@ wxMenu* BBLTopbar::GetTopMenu()
|
||||
return &m_top_menu;
|
||||
}
|
||||
|
||||
wxMenu* BBLTopbar::GetCalibMenu()
|
||||
{
|
||||
return &m_calib_menu;
|
||||
}
|
||||
|
||||
void BBLTopbar::SetTitle(wxString title)
|
||||
{
|
||||
wxGCDC dc(this);
|
||||
@@ -469,6 +486,10 @@ void BBLTopbar::Rescale() {
|
||||
item->SetBitmap(create_scaled_bitmap("topbar_redo", this, TOPBAR_ICON_SIZE));
|
||||
item->SetDisabledBitmap(create_scaled_bitmap("topbar_redo_inactive", nullptr, TOPBAR_ICON_SIZE));
|
||||
|
||||
item = this->FindTool(ID_CALIB);
|
||||
item->SetBitmap(create_scaled_bitmap("calib_sf", nullptr, TOPBAR_ICON_SIZE));
|
||||
item->SetDisabledBitmap(create_scaled_bitmap("calib_sf_inactive", nullptr, TOPBAR_ICON_SIZE));
|
||||
|
||||
item = this->FindTool(ID_TITLE);
|
||||
|
||||
/*item = this->FindTool(ID_PUBLISH);
|
||||
@@ -580,6 +601,23 @@ void BBLTopbar::OnDropdownToolItem(wxAuiToolBarEvent& evt)
|
||||
tb->SetToolSticky(evt.GetId(), false);
|
||||
}
|
||||
|
||||
void BBLTopbar::OnCalibToolItem(wxAuiToolBarEvent &evt)
|
||||
{
|
||||
wxAuiToolBar *tb = static_cast<wxAuiToolBar *>(evt.GetEventObject());
|
||||
|
||||
tb->SetToolSticky(evt.GetId(), true);
|
||||
|
||||
if (!m_skip_popup_calib_menu) {
|
||||
auto rec = this->GetToolRect(ID_CALIB);
|
||||
PopupMenu(&m_calib_menu, wxPoint(rec.GetLeft(), this->GetSize().GetHeight() - 2));
|
||||
} else {
|
||||
m_skip_popup_calib_menu = false;
|
||||
}
|
||||
|
||||
// make sure the button is "un-stuck"
|
||||
tb->SetToolSticky(evt.GetId(), false);
|
||||
}
|
||||
|
||||
void BBLTopbar::OnMouseLeftDown(wxMouseEvent& event)
|
||||
{
|
||||
wxPoint mouse_pos = ::wxGetMousePosition();
|
||||
|
||||
Reference in New Issue
Block a user