OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
BBLTopbar Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/BBLTopbar.hpp>

Inheritance diagram for BBLTopbar:
Collaboration diagram for BBLTopbar:

Public Member Functions

 BBLTopbar (wxWindow *pwin, wxFrame *parent)
 BBLTopbar (wxFrame *parent)
void Init (wxFrame *parent)
 ~BBLTopbar ()
void UpdateToolbarWidth (int width)
void Rescale ()
void OnIconize (wxAuiToolBarEvent &event)
void OnFullScreen (wxAuiToolBarEvent &event)
void OnCloseFrame (wxAuiToolBarEvent &event)
void OnFileToolItem (wxAuiToolBarEvent &evt)
void OnDropdownToolItem (wxAuiToolBarEvent &evt)
void OnCalibToolItem (wxAuiToolBarEvent &evt)
void OnMouseLeftDClock (wxMouseEvent &mouse)
void OnMouseLeftDown (wxMouseEvent &event)
void OnMouseLeftUp (wxMouseEvent &event)
void OnMouseMotion (wxMouseEvent &event)
void OnMouseCaptureLost (wxMouseCaptureLostEvent &event)
void OnMenuClose (wxMenuEvent &event)
void OnOpenProject (wxAuiToolBarEvent &event)
void OnSaveProject (wxAuiToolBarEvent &event)
void OnUndo (wxAuiToolBarEvent &event)
void OnRedo (wxAuiToolBarEvent &event)
void OnModelStoreClicked (wxAuiToolBarEvent &event)
wxAuiToolBarItem * FindToolByCurrentPosition ()
void SetFileMenu (wxMenu *file_menu)
void AddDropDownSubMenu (wxMenu *sub_menu, const wxString &title)
void AddDropDownMenuItem (wxMenuItem *menu_item)
wxMenu * GetTopMenu ()
wxMenu * GetCalibMenu ()
void SetTitle (wxString title)
void SetMaximizedSize ()
void SetWindowSize ()
void EnableUndoRedoItems ()
void DisableUndoRedoItems ()
void EnableUndoRedo (bool undo, bool redo)
void SaveNormalRect ()
void ShowCalibrationButton (bool show=true)

Private Attributes

wxFrame * m_frame
wxAuiToolBarItem * m_file_menu_item
wxAuiToolBarItem * m_dropdown_menu_item
wxRect m_normalRect
wxPoint m_delta
wxPoint m_last_mouse_position {wxDefaultPosition}
wxMenu m_top_menu
wxMenu * m_file_menu
wxMenu m_calib_menu
CenteredTitle * m_title_ctrl { nullptr }
wxString m_titleText
wxAuiToolBarItem * m_undo_item
wxAuiToolBarItem * m_redo_item
wxAuiToolBarItem * m_calib_item
wxAuiToolBarItem * maximize_btn
wxBitmap maximize_bitmap
wxBitmap window_bitmap
int m_toolbar_h
bool m_skip_popup_file_menu
bool m_skip_popup_dropdown_menu
bool m_skip_popup_calib_menu

Detailed Description

Constructor & Destructor Documentation

◆ BBLTopbar() [1/2]

BBLTopbar::BBLTopbar ( wxWindow * pwin,
wxFrame * parent )
237 : wxAuiToolBar(pwin, ID_TOOL_BAR, wxDefaultPosition, wxDefaultSize, wxAUI_TB_TEXT | wxAUI_TB_HORZ_TEXT)
238{
239 Init(parent);
240}
@ ID_TOOL_BAR
Definition BBLTopbar.cpp:55
void Init(wxFrame *parent)
Definition BBLTopbar.cpp:242

References ID_TOOL_BAR, and Init().

Here is the call graph for this function:

◆ BBLTopbar() [2/2]

BBLTopbar::BBLTopbar ( wxFrame * parent)
231 : wxAuiToolBar(parent, ID_TOOL_BAR, wxDefaultPosition, wxDefaultSize, wxAUI_TB_TEXT | wxAUI_TB_HORZ_TEXT)
232{
233 Init(parent);
234}

References ID_TOOL_BAR, and Init().

Here is the call graph for this function:

◆ ~BBLTopbar()

BBLTopbar::~BBLTopbar ( )
409{
410 m_file_menu_item = nullptr;
411 m_dropdown_menu_item = nullptr;
412 m_file_menu = nullptr;
413}
wxMenu * m_file_menu
Definition BBLTopbar.hpp:97
wxAuiToolBarItem * m_file_menu_item
Definition BBLTopbar.hpp:91
wxAuiToolBarItem * m_dropdown_menu_item
Definition BBLTopbar.hpp:92

References m_dropdown_menu_item, m_file_menu, and m_file_menu_item.

Member Function Documentation

◆ AddDropDownMenuItem()

void BBLTopbar::AddDropDownMenuItem ( wxMenuItem * menu_item)
502{
503 m_top_menu.Append(menu_item);
504}
wxMenu m_top_menu
Definition BBLTopbar.hpp:96

References m_top_menu.

◆ AddDropDownSubMenu()

void BBLTopbar::AddDropDownSubMenu ( wxMenu * sub_menu,
const wxString & title )
497{
498 m_top_menu.AppendSubMenu(sub_menu, title);
499}

References m_top_menu.

◆ DisableUndoRedoItems()

void BBLTopbar::DisableUndoRedoItems ( )
465{
466 this->EnableTool(m_undo_item->GetId(), false);
467 this->EnableTool(m_redo_item->GetId(), false);
468 this->EnableTool(m_calib_item->GetId(), false);
469 Refresh();
470}
wxAuiToolBarItem * m_redo_item
Definition BBLTopbar.hpp:105
wxAuiToolBarItem * m_calib_item
Definition BBLTopbar.hpp:106
wxAuiToolBarItem * m_undo_item
Definition BBLTopbar.hpp:104

References m_calib_item, m_redo_item, and m_undo_item.

◆ EnableUndoRedo()

void BBLTopbar::EnableUndoRedo ( bool undo,
bool redo )
458{
459 this->EnableTool(m_undo_item->GetId(), undo);
460 this->EnableTool(m_redo_item->GetId(), redo);
461 Refresh();
462}

References m_redo_item, and m_undo_item.

◆ EnableUndoRedoItems()

void BBLTopbar::EnableUndoRedoItems ( )
450{
451 this->EnableTool(m_undo_item->GetId(), true);
452 this->EnableTool(m_redo_item->GetId(), true);
453 this->EnableTool(m_calib_item->GetId(), true);
454 Refresh();
455}

References m_calib_item, m_redo_item, and m_undo_item.

◆ FindToolByCurrentPosition()

wxAuiToolBarItem * BBLTopbar::FindToolByCurrentPosition ( )
793{
794 if (m_last_mouse_position != wxDefaultPosition && GetClientRect().Contains(m_last_mouse_position))
795 return this->FindToolByPosition(m_last_mouse_position.x, m_last_mouse_position.y);
796
797#ifdef __WXGTK__
798 if (Slic3r::GUI::is_running_on_wayland())
799 return nullptr;
800#endif
801
802 wxPoint mouse_pos = ::wxGetMousePosition();
803 wxPoint client_pos = this->ScreenToClient(mouse_pos);
804 return this->FindToolByPosition(client_pos.x, client_pos.y);
805}
wxPoint m_last_mouse_position
Definition BBLTopbar.hpp:95

References m_last_mouse_position.

Referenced by OnMenuClose().

Here is the caller graph for this function:

◆ GetCalibMenu()

wxMenu * BBLTopbar::GetCalibMenu ( )
512{
513 return &m_calib_menu;
514}
wxMenu m_calib_menu
Definition BBLTopbar.hpp:98

References m_calib_menu.

◆ GetTopMenu()

wxMenu * BBLTopbar::GetTopMenu ( )
507{
508 return &m_top_menu;
509}

References m_top_menu.

◆ Init()

void BBLTopbar::Init ( wxFrame * parent)
243{
244 auto* art = new BBLTopbarArt();
245 art->SetFont(Label::Body_12);
246 SetArtProvider(art);
247 m_frame = parent;
251
252 wxInitAllImageHandlers();
253
254 bool window_btns_on_left = false;
255
256#ifdef __linux__
257 window_btns_on_left = wxGetApp().app_config->get("window_buttons_on_left") == "true";
258
259 if(window_btns_on_left){
260 wxBitmap close_bitmap = create_scaled_bitmap("topbar_close", nullptr, TOPBAR_ICON_SIZE);
261 wxAuiToolBarItem* close_btn = this->AddTool(wxID_CLOSE_FRAME, "", close_bitmap);
262
263 this->AddSpacer(FromDIP(4));
264
265 maximize_bitmap = create_scaled_bitmap("topbar_max", nullptr, TOPBAR_ICON_SIZE);
266 window_bitmap = create_scaled_bitmap("topbar_win", nullptr, TOPBAR_ICON_SIZE);
267 if (m_frame->IsMaximized()) {
268 maximize_btn = this->AddTool(wxID_MAXIMIZE_FRAME, "", window_bitmap);
269 }
270 else {
271 maximize_btn = this->AddTool(wxID_MAXIMIZE_FRAME, "", maximize_bitmap);
272 }
273
274 this->AddSpacer(FromDIP(4));
275
276 wxBitmap iconize_bitmap = create_scaled_bitmap("topbar_min", nullptr, TOPBAR_ICON_SIZE);
277 wxAuiToolBarItem* iconize_btn = this->AddTool(wxID_ICONIZE_FRAME, "", iconize_bitmap);
278
279 this->AddSpacer(15);
280 }
281#endif
282
283 if(!window_btns_on_left)
284 this->AddSpacer(5);
285
286 /*wxBitmap logo_bitmap = create_scaled_bitmap("topbar_logo", nullptr, TOPBAR_ICON_SIZE);
287 wxAuiToolBarItem* logo_item = this->AddTool(ID_LOGO, "", logo_bitmap);
288 logo_item->SetHoverBitmap(logo_bitmap);
289 logo_item->SetActive(false);*/
290
291 wxBitmap file_bitmap = create_scaled_bitmap("topbar_file", nullptr, TOPBAR_ICON_SIZE);
292 m_file_menu_item = this->AddTool(ID_TOP_FILE_MENU, _L("File"), file_bitmap, wxEmptyString, wxITEM_NORMAL);
293
294 this->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT));
295
296 this->AddSpacer(FromDIP(5));
297
298 wxBitmap dropdown_bitmap = create_scaled_bitmap("topbar_dropdown", nullptr, TOPBAR_ICON_SIZE);
299 m_dropdown_menu_item = this->AddTool(ID_TOP_DROPDOWN_MENU, "",
300 dropdown_bitmap, wxEmptyString);
301
302 this->AddSpacer(FromDIP(5));
303 this->AddSeparator();
304 this->AddSpacer(FromDIP(5));
305
306 //wxBitmap open_bitmap = create_scaled_bitmap("topbar_open", nullptr, TOPBAR_ICON_SIZE);
307 //wxAuiToolBarItem* tool_item = this->AddTool(wxID_OPEN, "", open_bitmap);
308
309 this->AddSpacer(FromDIP(10));
310
311 wxBitmap save_bitmap = create_scaled_bitmap("topbar_save", nullptr, TOPBAR_ICON_SIZE);
312 wxAuiToolBarItem* save_btn = this->AddTool(wxID_SAVE, "", save_bitmap);
313
314 this->AddSpacer(FromDIP(10));
315
316 wxBitmap undo_bitmap = create_scaled_bitmap("topbar_undo", nullptr, TOPBAR_ICON_SIZE);
317 m_undo_item = this->AddTool(wxID_UNDO, "", undo_bitmap);
318 wxBitmap undo_inactive_bitmap = create_scaled_bitmap("topbar_undo_inactive", nullptr, TOPBAR_ICON_SIZE);
319 m_undo_item->SetDisabledBitmap(undo_inactive_bitmap);
320
321 this->AddSpacer(FromDIP(10));
322
323 wxBitmap redo_bitmap = create_scaled_bitmap("topbar_redo", nullptr, TOPBAR_ICON_SIZE);
324 m_redo_item = this->AddTool(wxID_REDO, "", redo_bitmap);
325 wxBitmap redo_inactive_bitmap = create_scaled_bitmap("topbar_redo_inactive", nullptr, TOPBAR_ICON_SIZE);
326 m_redo_item->SetDisabledBitmap(redo_inactive_bitmap);
327
328 this->AddSpacer(FromDIP(10));
329
330 wxBitmap calib_bitmap = create_scaled_bitmap("calib_sf", nullptr, TOPBAR_ICON_SIZE);
331 wxBitmap calib_bitmap_inactive = create_scaled_bitmap("calib_sf_inactive", nullptr, TOPBAR_ICON_SIZE);
332 m_calib_item = this->AddTool(ID_CALIB, _L("Calibration"), calib_bitmap);
333 m_calib_item->SetDisabledBitmap(calib_bitmap_inactive);
334
335 this->AddSpacer(FromDIP(25));
336 //this->AddStretchSpacer(1);
337
338 m_title_ctrl = new CenteredTitle(this);
340 wxAuiToolBarItem* title_item = this->AddControl(m_title_ctrl, "");
341 title_item->SetProportion(1);
342
343 this->AddSpacer(FromDIP(25));
344 //this->AddStretchSpacer(1);
345
346 //this->EnableTool(m_publish_item->GetId(), false);
347 //this->AddSpacer(FromDIP(4));
348
349 /*wxBitmap model_store_bitmap = create_scaled_bitmap("topbar_store", nullptr, TOPBAR_ICON_SIZE);
350 m_model_store_item = this->AddTool(ID_MODEL_STORE, "", model_store_bitmap);
351 this->AddSpacer(12);
352 */
353
354 //this->AddSeparator();
355 //this->AddSpacer(FromDIP(4));
356
357 if(!window_btns_on_left){
358 wxBitmap iconize_bitmap = create_scaled_bitmap("topbar_min", nullptr, TOPBAR_ICON_SIZE);
359 wxAuiToolBarItem* iconize_btn = this->AddTool(wxID_ICONIZE_FRAME, "", iconize_bitmap);
360
361 this->AddSpacer(FromDIP(4));
362
363 maximize_bitmap = create_scaled_bitmap("topbar_max", nullptr, TOPBAR_ICON_SIZE);
364 window_bitmap = create_scaled_bitmap("topbar_win", nullptr, TOPBAR_ICON_SIZE);
365 if (m_frame->IsMaximized()) {
366 maximize_btn = this->AddTool(wxID_MAXIMIZE_FRAME, "", window_bitmap);
367 }
368 else {
369 maximize_btn = this->AddTool(wxID_MAXIMIZE_FRAME, "", maximize_bitmap);
370 }
371
372 this->AddSpacer(FromDIP(4));
373
374 wxBitmap close_bitmap = create_scaled_bitmap("topbar_close", nullptr, TOPBAR_ICON_SIZE);
375 wxAuiToolBarItem* close_btn = this->AddTool(wxID_CLOSE_FRAME, "", close_bitmap);
376 }
377
378 Realize();
379 // m_toolbar_h = this->GetSize().GetHeight();
380 m_toolbar_h = FromDIP(30);
381
382 int client_w = parent->GetClientSize().GetWidth();
383 this->SetSize(client_w, m_toolbar_h);
384
385 this->Bind(wxEVT_MOTION, &BBLTopbar::OnMouseMotion, this);
386 this->Bind(wxEVT_MOUSE_CAPTURE_LOST, &BBLTopbar::OnMouseCaptureLost, this);
387 this->Bind(wxEVT_MENU_CLOSE, &BBLTopbar::OnMenuClose, this);
388 this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnFileToolItem, this, ID_TOP_FILE_MENU);
389 this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnDropdownToolItem, this, ID_TOP_DROPDOWN_MENU);
390 this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnCalibToolItem, this, ID_CALIB);
391 this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnIconize, this, wxID_ICONIZE_FRAME);
392 this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnFullScreen, this, wxID_MAXIMIZE_FRAME);
393 this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnCloseFrame, this, wxID_CLOSE_FRAME);
394 this->Bind(wxEVT_LEFT_DCLICK, &BBLTopbar::OnMouseLeftDClock, this);
395 this->Bind(wxEVT_LEFT_DOWN, &BBLTopbar::OnMouseLeftDown, this);
396 this->Bind(wxEVT_LEFT_UP, &BBLTopbar::OnMouseLeftUp, this);
397 this->Bind(wxEVT_LEAVE_WINDOW, [this](wxMouseEvent& event) {
398 m_last_mouse_position = wxDefaultPosition;
399 event.Skip();
400 });
401 this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnOpenProject, this, wxID_OPEN);
402 this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnSaveProject, this, wxID_SAVE);
403 this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnRedo, this, wxID_REDO);
404 this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnUndo, this, wxID_UNDO);
405 //this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnModelStoreClicked, this, ID_MODEL_STORE);
406}
#define TOPBAR_ICON_SIZE
Definition BBLTopbar.cpp:40
@ ID_TOP_DROPDOWN_MENU
Definition BBLTopbar.cpp:51
@ ID_TOP_FILE_MENU
Definition BBLTopbar.cpp:50
@ ID_CALIB
Definition BBLTopbar.cpp:54
#define _L(s)
Definition OBJ.cpp:34
void OnFileToolItem(wxAuiToolBarEvent &evt)
Definition BBLTopbar.cpp:647
void OnUndo(wxAuiToolBarEvent &event)
Definition BBLTopbar.cpp:429
void OnSaveProject(wxAuiToolBarEvent &event)
Definition BBLTopbar.cpp:422
CenteredTitle * m_title_ctrl
Definition BBLTopbar.hpp:100
bool m_skip_popup_file_menu
Definition BBLTopbar.hpp:114
void OnRedo(wxAuiToolBarEvent &event)
Definition BBLTopbar.cpp:439
void OnMouseLeftUp(wxMouseEvent &event)
Definition BBLTopbar.cpp:733
bool m_skip_popup_dropdown_menu
Definition BBLTopbar.hpp:115
bool m_skip_popup_calib_menu
Definition BBLTopbar.hpp:116
void OnMouseMotion(wxMouseEvent &event)
Definition BBLTopbar.cpp:745
void OnOpenProject(wxAuiToolBarEvent &event)
Definition BBLTopbar.cpp:415
void OnMenuClose(wxMenuEvent &event)
Definition BBLTopbar.cpp:781
wxBitmap window_bitmap
Definition BBLTopbar.hpp:111
void OnMouseCaptureLost(wxMouseCaptureLostEvent &event)
Definition BBLTopbar.cpp:777
void OnIconize(wxAuiToolBarEvent &event)
Definition BBLTopbar.cpp:595
void OnDropdownToolItem(wxAuiToolBarEvent &evt)
Definition BBLTopbar.cpp:665
void OnCloseFrame(wxAuiToolBarEvent &event)
Definition BBLTopbar.cpp:623
wxFrame * m_frame
Definition BBLTopbar.hpp:90
int m_toolbar_h
Definition BBLTopbar.hpp:113
wxBitmap maximize_bitmap
Definition BBLTopbar.hpp:110
void OnFullScreen(wxAuiToolBarEvent &event)
Definition BBLTopbar.cpp:600
void OnMouseLeftDClock(wxMouseEvent &mouse)
Definition BBLTopbar.cpp:628
wxAuiToolBarItem * maximize_btn
Definition BBLTopbar.hpp:107
void OnMouseLeftDown(wxMouseEvent &event)
Definition BBLTopbar.cpp:700
void OnCalibToolItem(wxAuiToolBarEvent &evt)
Definition BBLTopbar.cpp:683
static wxFont Body_12
Definition Label.hpp:55
wxMouseEvent
Definition CameraPopup.cpp:47
wxBitmap create_scaled_bitmap(const std::string &bmp_name_in, wxWindow *win, const int px_cnt, const bool grayscale, const std::string &new_color, const bool menu_bitmap, const bool resize, const bool bitmap2, const std::vector< std::string > &array_new_color)
Definition wxExtensions.cpp:448

References _L, Label::Body_12, create_scaled_bitmap(), ID_CALIB, ID_TOP_DROPDOWN_MENU, ID_TOP_FILE_MENU, m_calib_item, m_dropdown_menu_item, m_file_menu_item, m_frame, m_last_mouse_position, m_redo_item, m_skip_popup_calib_menu, m_skip_popup_dropdown_menu, m_skip_popup_file_menu, m_title_ctrl, m_toolbar_h, m_undo_item, maximize_bitmap, maximize_btn, OnCalibToolItem(), OnCloseFrame(), OnDropdownToolItem(), OnFileToolItem(), OnFullScreen(), OnIconize(), OnMenuClose(), OnMouseCaptureLost(), OnMouseLeftDClock(), OnMouseLeftDown(), OnMouseLeftUp(), OnMouseMotion(), OnOpenProject(), OnRedo(), OnSaveProject(), OnUndo(), TOPBAR_ICON_SIZE, window_bitmap, and Slic3r::GUI::wxMouseEvent.

Referenced by BBLTopbar(), and BBLTopbar().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnCalibToolItem()

void BBLTopbar::OnCalibToolItem ( wxAuiToolBarEvent & evt)
684{
685 wxAuiToolBar *tb = static_cast<wxAuiToolBar *>(evt.GetEventObject());
686
687 tb->SetToolSticky(evt.GetId(), true);
688
690 auto rec = this->GetToolRect(ID_CALIB);
691 GetParent()->PopupMenu(&m_calib_menu, wxPoint(rec.GetLeft(), this->GetSize().GetHeight() - 2));
692 } else {
694 }
695
696 // make sure the button is "un-stuck"
697 tb->SetToolSticky(evt.GetId(), false);
698}

References ID_CALIB, m_calib_menu, and m_skip_popup_calib_menu.

Referenced by Init().

Here is the caller graph for this function:

◆ OnCloseFrame()

void BBLTopbar::OnCloseFrame ( wxAuiToolBarEvent & event)
624{
625 m_frame->Close();
626}

References m_frame.

Referenced by Init().

Here is the caller graph for this function:

◆ OnDropdownToolItem()

void BBLTopbar::OnDropdownToolItem ( wxAuiToolBarEvent & evt)
666{
667 wxAuiToolBar* tb = static_cast<wxAuiToolBar*>(evt.GetEventObject());
668
669 tb->SetToolSticky(evt.GetId(), true);
670
672 auto rec = this->GetToolRect(ID_TOP_DROPDOWN_MENU);
673 GetParent()->PopupMenu(&m_top_menu, wxPoint(rec.GetLeft(), this->GetSize().GetHeight() - 2));
674 }
675 else {
677 }
678
679 // make sure the button is "un-stuck"
680 tb->SetToolSticky(evt.GetId(), false);
681}

References ID_TOP_DROPDOWN_MENU, m_skip_popup_dropdown_menu, and m_top_menu.

Referenced by Init().

Here is the caller graph for this function:

◆ OnFileToolItem()

void BBLTopbar::OnFileToolItem ( wxAuiToolBarEvent & evt)
648{
649 wxAuiToolBar* tb = static_cast<wxAuiToolBar*>(evt.GetEventObject());
650
651 tb->SetToolSticky(evt.GetId(), true);
652
654 auto rec = this->GetToolRect(ID_TOP_FILE_MENU);
655 GetParent()->PopupMenu(m_file_menu, wxPoint(rec.GetLeft(), this->GetSize().GetHeight() - 2));
656 }
657 else {
659 }
660
661 // make sure the button is "un-stuck"
662 tb->SetToolSticky(evt.GetId(), false);
663}

References ID_TOP_FILE_MENU, m_file_menu, and m_skip_popup_file_menu.

Referenced by Init().

Here is the caller graph for this function:

◆ OnFullScreen()

void BBLTopbar::OnFullScreen ( wxAuiToolBarEvent & event)
601{
602#ifdef __WXGTK__
603 GtkWindow* gtk_window = GTK_WINDOW(m_frame->m_widget);
604 if (gtk_window_is_maximized(gtk_window)) {
605 gtk_window_unmaximize(gtk_window);
606 }
607 else {
608 m_normalRect = m_frame->GetRect();
609 gtk_window_maximize(gtk_window);
610 }
611 return;
612#endif
613
614 if (m_frame->IsMaximized()) {
615 m_frame->Restore();
616 }
617 else {
618 m_normalRect = m_frame->GetRect();
619 m_frame->Maximize();
620 }
621}
wxRect m_normalRect
Definition BBLTopbar.hpp:93

References m_frame, and m_normalRect.

Referenced by Init(), and OnMouseLeftDClock().

Here is the caller graph for this function:

◆ OnIconize()

void BBLTopbar::OnIconize ( wxAuiToolBarEvent & event)
596{
597 m_frame->Iconize();
598}

References m_frame.

Referenced by Init().

Here is the caller graph for this function:

◆ OnMenuClose()

void BBLTopbar::OnMenuClose ( wxMenuEvent & event)
782{
783 wxAuiToolBarItem* item = this->FindToolByCurrentPosition();
784 if (item == m_file_menu_item) {
786 }
787 else if (item == m_dropdown_menu_item) {
789 }
790}
wxAuiToolBarItem * FindToolByCurrentPosition()
Definition BBLTopbar.cpp:792

References FindToolByCurrentPosition(), m_dropdown_menu_item, m_file_menu_item, m_skip_popup_dropdown_menu, and m_skip_popup_file_menu.

Referenced by Init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnModelStoreClicked()

void BBLTopbar::OnModelStoreClicked ( wxAuiToolBarEvent & event)
487{
488 //GUI::wxGetApp().load_url(wxString(wxGetApp().app_config->get_web_host_url() + MODEL_STORE_URL));
489}

◆ OnMouseCaptureLost()

void BBLTopbar::OnMouseCaptureLost ( wxMouseCaptureLostEvent & event)
778{
779}

Referenced by Init().

Here is the caller graph for this function:

◆ OnMouseLeftDClock()

void BBLTopbar::OnMouseLeftDClock ( wxMouseEvent & mouse)
629{
630 m_last_mouse_position = mouse.GetPosition();
631 wxPoint mouse_pos = this->ClientToScreen(mouse.GetPosition());
632 wxAuiToolBarItem* item = this->FindToolByPosition(mouse.GetX(), mouse.GetY());
633 // check whether mouse is not on any tool item
634 if (item != NULL && item->GetWindow() != m_title_ctrl) {
635 mouse.Skip();
636 return;
637 }
638#ifdef __W1XMSW__
639 ::PostMessage((HWND) m_frame->GetHandle(), WM_NCLBUTTONDBLCLK, HTCAPTION, MAKELPARAM(mouse_pos.x, mouse_pos.y));
640 return;
641#endif // __WXMSW__
642
643 wxAuiToolBarEvent evt;
644 OnFullScreen(evt);
645}

References m_frame, m_last_mouse_position, m_title_ctrl, OnFullScreen(), and Slic3r::GUI::wxMouseEvent.

Referenced by Init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnMouseLeftDown()

void BBLTopbar::OnMouseLeftDown ( wxMouseEvent & event)
701{
702 m_last_mouse_position = event.GetPosition();
703 // Use event-relative coords converted to screen, instead of wxGetMousePosition()
704 // which returns (0,0) on Wayland for global screen coordinates.
705 wxPoint mouse_pos = this->ClientToScreen(event.GetPosition());
706 wxPoint frame_pos = m_frame->GetScreenPosition();
707 wxAuiToolBarItem* item = this->FindToolByPosition(event.GetX(), event.GetY());
708 m_delta = mouse_pos - frame_pos;
709
710 if (item == NULL || item->GetWindow() == m_title_ctrl)
711 {
712#ifdef __WXMSW__
713 CaptureMouse();
714 ReleaseMouse();
715 ::PostMessage((HWND) m_frame->GetHandle(), WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(mouse_pos.x, mouse_pos.y));
716 return;
717#elif defined(__WXGTK__)
718 // Use WM-integrated drag for smoother window movement on Linux.
719 gtk_window_begin_move_drag(
720 GTK_WINDOW(m_frame->m_widget),
721 1, // left mouse button
722 mouse_pos.x, mouse_pos.y,
723 gtk_get_current_event_time());
724 return;
725#else
726 CaptureMouse();
727#endif
728 }
729
730 event.Skip();
731}
wxPoint m_delta
Definition BBLTopbar.hpp:94

References m_delta, m_frame, m_last_mouse_position, m_title_ctrl, and Slic3r::GUI::wxMouseEvent.

Referenced by Init().

Here is the caller graph for this function:

◆ OnMouseLeftUp()

void BBLTopbar::OnMouseLeftUp ( wxMouseEvent & event)
734{
735 m_last_mouse_position = event.GetPosition();
736 wxPoint mouse_pos = this->ClientToScreen(event.GetPosition());
737 if (HasCapture())
738 {
739 ReleaseMouse();
740 }
741
742 event.Skip();
743}

References m_last_mouse_position, and Slic3r::GUI::wxMouseEvent.

Referenced by Init().

Here is the caller graph for this function:

◆ OnMouseMotion()

void BBLTopbar::OnMouseMotion ( wxMouseEvent & event)
746{
747 m_last_mouse_position = event.GetPosition();
748 // Use event-relative coords converted to screen, instead of wxGetMousePosition()
749 // which returns (0,0) on Wayland for global screen coordinates.
750 wxPoint mouse_pos = this->ClientToScreen(event.GetPosition());
751
752 if (!HasCapture()) {
753 //m_frame->OnMouseMotion(event);
754
755 event.Skip();
756 return;
757 }
758
759 if (event.Dragging() && event.LeftIsDown())
760 {
761 // leave max state and adjust position
762 if (m_frame->IsMaximized()) {
763 wxRect rect = m_frame->GetRect();
764 // Filter unexcept mouse move
765 if (m_delta + rect.GetLeftTop() != mouse_pos) {
766 m_delta = mouse_pos - rect.GetLeftTop();
767 m_delta.x = m_delta.x * m_normalRect.width / rect.width;
768 m_delta.y = m_delta.y * m_normalRect.height / rect.height;
769 m_frame->Restore();
770 }
771 }
772 m_frame->Move(mouse_pos - m_delta);
773 }
774 event.Skip();
775}

References m_delta, m_frame, m_last_mouse_position, m_normalRect, and Slic3r::GUI::wxMouseEvent.

Referenced by Init().

Here is the caller graph for this function:

◆ OnOpenProject()

void BBLTopbar::OnOpenProject ( wxAuiToolBarEvent & event)
416{
417 MainFrame* main_frame = dynamic_cast<MainFrame*>(m_frame);
418 Plater* plater = main_frame->plater();
420}
Plater * plater()
Definition MainFrame.hpp:363
void load_project(wxString const &filename="", wxString const &originfile="-")
Definition Plater.cpp:16144
static Plater * plater()
Definition GUI_Factories.cpp:400
@ Plater
Definition Shortcuts.hpp:21

References m_frame, Slic3r::GUI::MainFrame::plater(), and Slic3r::GUI::plater().

Referenced by Init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnRedo()

void BBLTopbar::OnRedo ( wxAuiToolBarEvent & event)
440{
441 MainFrame* main_frame = dynamic_cast<MainFrame*>(m_frame);
442#ifdef SLIC3R_CAD
443 if (DesignPanel* design = main_frame->shown_design_panel()) { design->menu_undo_redo(true); return; }
444#endif
445 Plater* plater = main_frame->plater();
446 plater->redo();
447}
void redo()
Definition Plater.cpp:21297

References m_frame, Slic3r::GUI::MainFrame::plater(), and Slic3r::GUI::plater().

Referenced by Init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnSaveProject()

void BBLTopbar::OnSaveProject ( wxAuiToolBarEvent & event)
423{
424 MainFrame* main_frame = dynamic_cast<MainFrame*>(m_frame);
425 Plater* plater = main_frame->plater();
427}
int save_project(bool saveAs=false)
Definition Plater.cpp:16296

References m_frame, Slic3r::GUI::MainFrame::plater(), and Slic3r::GUI::plater().

Referenced by Init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnUndo()

void BBLTopbar::OnUndo ( wxAuiToolBarEvent & event)
430{
431 MainFrame* main_frame = dynamic_cast<MainFrame*>(m_frame);
432#ifdef SLIC3R_CAD
433 if (DesignPanel* design = main_frame->shown_design_panel()) { design->menu_undo_redo(false); return; }
434#endif
435 Plater* plater = main_frame->plater();
436 plater->undo();
437}
void undo()
Definition Plater.cpp:21296

References m_frame, Slic3r::GUI::MainFrame::plater(), and Slic3r::GUI::plater().

Referenced by Init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Rescale()

void BBLTopbar::Rescale ( )
538 {
539 int em = em_unit(this);
540 wxAuiToolBarItem* item;
541
542 /*item = this->FindTool(ID_LOGO);
543 item->SetBitmap(create_scaled_bitmap("topbar_logo", nullptr, TOPBAR_ICON_SIZE));*/
544
545 item = this->FindTool(ID_TOP_FILE_MENU);
546 item->SetBitmap(create_scaled_bitmap("topbar_file", this, TOPBAR_ICON_SIZE));
547
548 item = this->FindTool(ID_TOP_DROPDOWN_MENU);
549 item->SetBitmap(create_scaled_bitmap("topbar_dropdown", this, TOPBAR_ICON_SIZE));
550
551 //item = this->FindTool(wxID_OPEN);
552 //item->SetBitmap(create_scaled_bitmap("topbar_open", nullptr, TOPBAR_ICON_SIZE));
553
554 item = this->FindTool(wxID_SAVE);
555 item->SetBitmap(create_scaled_bitmap("topbar_save", this, TOPBAR_ICON_SIZE));
556
557 item = this->FindTool(wxID_UNDO);
558 item->SetBitmap(create_scaled_bitmap("topbar_undo", this, TOPBAR_ICON_SIZE));
559 item->SetDisabledBitmap(create_scaled_bitmap("topbar_undo_inactive", this, TOPBAR_ICON_SIZE));
560
561 item = this->FindTool(wxID_REDO);
562 item->SetBitmap(create_scaled_bitmap("topbar_redo", this, TOPBAR_ICON_SIZE));
563 item->SetDisabledBitmap(create_scaled_bitmap("topbar_redo_inactive", this, TOPBAR_ICON_SIZE));
564
565 item = this->FindTool(ID_CALIB);
566 item->SetBitmap(create_scaled_bitmap("calib_sf", this, TOPBAR_ICON_SIZE));
567 item->SetDisabledBitmap(create_scaled_bitmap("calib_sf_inactive", this, TOPBAR_ICON_SIZE));
568
569 if (m_title_ctrl)
570 m_title_ctrl->SetTitle(m_titleText);
571
572 /*item = this->FindTool(ID_MODEL_STORE);
573 item->SetBitmap(create_scaled_bitmap("topbar_store", this, TOPBAR_ICON_SIZE));
574 */
575
576 item = this->FindTool(wxID_ICONIZE_FRAME);
577 item->SetBitmap(create_scaled_bitmap("topbar_min", this, TOPBAR_ICON_SIZE));
578
579 item = this->FindTool(wxID_MAXIMIZE_FRAME);
582 if (m_frame->IsMaximized()) {
583 item->SetBitmap(window_bitmap);
584 }
585 else {
586 item->SetBitmap(maximize_bitmap);
587 }
588
589 item = this->FindTool(wxID_CLOSE_FRAME);
590 item->SetBitmap(create_scaled_bitmap("topbar_close", this, TOPBAR_ICON_SIZE));
591
592 Realize();
593}
wxString m_titleText
Definition BBLTopbar.hpp:101
int em_unit(wxWindow *win)
Definition wxExtensions.cpp:424

References create_scaled_bitmap(), em_unit(), ID_CALIB, ID_TOP_DROPDOWN_MENU, ID_TOP_FILE_MENU, m_frame, m_title_ctrl, m_titleText, maximize_bitmap, TOPBAR_ICON_SIZE, and window_bitmap.

Here is the call graph for this function:

◆ SaveNormalRect()

void BBLTopbar::SaveNormalRect ( )
473{
474 m_normalRect = m_frame->GetRect();
475}

References m_frame, and m_normalRect.

◆ SetFileMenu()

void BBLTopbar::SetFileMenu ( wxMenu * file_menu)
492{
493 m_file_menu = file_menu;
494}

References m_file_menu.

◆ SetMaximizedSize()

void BBLTopbar::SetMaximizedSize ( )
524{
525 maximize_btn->SetBitmap(maximize_bitmap);
526}

References maximize_bitmap, and maximize_btn.

◆ SetTitle()

void BBLTopbar::SetTitle ( wxString title)
517{
518 m_titleText = title;
519 if (m_title_ctrl)
520 m_title_ctrl->SetTitle(title);
521}

References m_title_ctrl, and m_titleText.

◆ SetWindowSize()

void BBLTopbar::SetWindowSize ( )
529{
530 maximize_btn->SetBitmap(window_bitmap);
531}

References maximize_btn, and window_bitmap.

◆ ShowCalibrationButton()

void BBLTopbar::ShowCalibrationButton ( bool show = true)
478{
479 m_calib_item->GetSizerItem()->Show(show);
480 m_sizer->Layout();
481 if (!show)
482 m_calib_item->GetSizerItem()->SetDimension({-1000, 0}, {0, 0});
483 Refresh();
484}

References m_calib_item.

◆ UpdateToolbarWidth()

void BBLTopbar::UpdateToolbarWidth ( int width)
534{
535 this->SetSize(width, m_toolbar_h);
536}

References m_toolbar_h.

Member Data Documentation

◆ m_calib_item

wxAuiToolBarItem* BBLTopbar::m_calib_item
private

◆ m_calib_menu

wxMenu BBLTopbar::m_calib_menu
private

Referenced by GetCalibMenu(), and OnCalibToolItem().

◆ m_delta

wxPoint BBLTopbar::m_delta
private

Referenced by OnMouseLeftDown(), and OnMouseMotion().

◆ m_dropdown_menu_item

wxAuiToolBarItem* BBLTopbar::m_dropdown_menu_item
private

Referenced by ~BBLTopbar(), Init(), and OnMenuClose().

◆ m_file_menu

wxMenu* BBLTopbar::m_file_menu
private

◆ m_file_menu_item

wxAuiToolBarItem* BBLTopbar::m_file_menu_item
private

Referenced by ~BBLTopbar(), Init(), and OnMenuClose().

◆ m_frame

◆ m_last_mouse_position

wxPoint BBLTopbar::m_last_mouse_position {wxDefaultPosition}
private

◆ m_normalRect

wxRect BBLTopbar::m_normalRect
private

◆ m_redo_item

wxAuiToolBarItem* BBLTopbar::m_redo_item
private

◆ m_skip_popup_calib_menu

bool BBLTopbar::m_skip_popup_calib_menu
private

Referenced by Init(), and OnCalibToolItem().

◆ m_skip_popup_dropdown_menu

bool BBLTopbar::m_skip_popup_dropdown_menu
private

◆ m_skip_popup_file_menu

bool BBLTopbar::m_skip_popup_file_menu
private

Referenced by Init(), OnFileToolItem(), and OnMenuClose().

◆ m_title_ctrl

CenteredTitle* BBLTopbar::m_title_ctrl { nullptr }
private
100{ nullptr };

Referenced by Init(), OnMouseLeftDClock(), OnMouseLeftDown(), Rescale(), and SetTitle().

◆ m_titleText

wxString BBLTopbar::m_titleText
private

Referenced by Rescale(), and SetTitle().

◆ m_toolbar_h

int BBLTopbar::m_toolbar_h
private

Referenced by Init(), and UpdateToolbarWidth().

◆ m_top_menu

wxMenu BBLTopbar::m_top_menu
private

◆ m_undo_item

wxAuiToolBarItem* BBLTopbar::m_undo_item
private

◆ maximize_bitmap

wxBitmap BBLTopbar::maximize_bitmap
private

Referenced by Init(), Rescale(), and SetMaximizedSize().

◆ maximize_btn

wxAuiToolBarItem* BBLTopbar::maximize_btn
private

◆ window_bitmap

wxBitmap BBLTopbar::window_bitmap
private

Referenced by Init(), Rescale(), and SetWindowSize().


The documentation for this class was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/BBLTopbar.hpp
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/BBLTopbar.cpp