Files
OrcaSlicer-KX/src/slic3r/GUI/MultiMachinePage.hpp
Ocraftyone dab6fa4db2 Fix Compile Warnings (#5963)
* Fix calls to depreciated wxPen constructor

* Fix use of wxTimerEvent

* Fix unrecognized character escape sequence

* Fix signed/unsigned mismatch

At least as much as possible without significantly altering parts of the application

* Clean unreferenced variables

* fix mistyped namespace selector

* Update deprecated calls

* Fix preprocessor statement

* Remove empty switch statements

* Change int vector used as bool to bool vector

* Remove empty control statements and related unused code

* Change multi character constant to string constant

* Fix discarded return value

json::parse was being called on the object, rather than statically like it should be. Also, the value was not being captured.

* Rename ICON_SIZE def used by MultiMachine

By having the definition in the header, it causes issues when other files define ICON_SIZE. By renaming it to MM_ICON_SIZE, this lessens the issue. It would probably be ideal to have the definitions in the respective .cpp that use them, but it would make it less convenient to update the values if needed in the future.

* Remove unused includes

* Fix linux/macOS compilation

* Hide unused-function errors on non-Windows systems

* Disable signed/unsigned comparison mismatch error

* Remove/Disable more unused variables

Still TODO: check double for loop in Print.cpp

* Remove unused variable that was missed

* Remove unused variables in libraries in the src folder

* Apply temporary fix for subobject linkage error

* Remove/Disable last set of unused variables reported by GCC

* remove redundant for loop

* fix misspelled ifdef check

* Update message on dialog

* Fix hard-coded platform specific modifier keys

* Remove duplicate for loop

* Disable -Wmisleading-indentation warning

* disable -Wswitch warning

* Remove unused local typedefs

* Fix -Wunused-value

* Fix pragma error on Windows from subobject linkage fix

* Fix -Waddress

* Fix null conversions (-Wconversion-null)

---------

Co-authored-by: SoftFever <softfeverever@gmail.com>
2024-07-29 21:00:26 +08:00

105 lines
2.9 KiB
C++

#ifndef slic3r_MultiMachinePage_hpp_
#define slic3r_MultiMachinePage_hpp_
#include "libslic3r/libslic3r.h"
#include "GUI_App.hpp"
#include "GUI_Utils.hpp"
#include "MultiTaskManagerPage.hpp"
#include "MultiMachineManagerPage.hpp"
#include "Tabbook.hpp"
#include "wx/button.h"
namespace Slic3r {
namespace GUI {
#define PICK_LEFT_PADDING_LEFT 15
#define PICK_LEFT_PRINTABLE 40
#define PICK_LEFT_DEV_NAME 250
#define PICK_LEFT_DEV_STATUS 250
#define PICK_DEVICE_MAX 6
class MultiMachinePage : public wxPanel
{
private:
wxTimer* m_refresh_timer = nullptr;
wxSizer* m_main_sizer{ nullptr };
LocalTaskManagerPage* m_local_task_manager{ nullptr };
CloudTaskManagerPage* m_cloud_task_manager{ nullptr };
MultiMachineManagerPage* m_machine_manager{ nullptr };
Tabbook* m_tabpanel{ nullptr };
public:
MultiMachinePage(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
~MultiMachinePage();
void jump_to_send_page();
void on_sys_color_changed();
void msw_rescale();
bool Show(bool show);
void init_tabpanel();
void init_timer();
void on_timer();
void clear_page();
};
class DevicePickItem : public DeviceItem
{
public:
DevicePickItem(wxWindow* parent, MachineObject* obj);
~DevicePickItem() {};
void DrawTextWithEllipsis(wxDC& dc, const wxString& text, int maxWidth, int left, int top = 0);
void OnEnterWindow(wxMouseEvent& evt);
void OnLeaveWindow(wxMouseEvent& evt);
void OnSelectedDevice(wxCommandEvent& evt);
void OnLeftDown(wxMouseEvent& evt);
void OnMove(wxMouseEvent& evt);
void paintEvent(wxPaintEvent& evt);
void render(wxDC& dc);
void doRender(wxDC& dc);
void post_event(wxCommandEvent&& event);
virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
public:
bool m_hover{ false };
ScalableBitmap m_bitmap_check_disable;
ScalableBitmap m_bitmap_check_off;
ScalableBitmap m_bitmap_check_on;
};
class MultiMachinePickPage : public DPIDialog
{
private:
AppConfig* app_config;
Label* m_label{ nullptr };
wxScrolledWindow* scroll_macine_list{ nullptr };
wxBoxSizer* m_sizer_body{ nullptr };
wxBoxSizer* sizer_machine_list{ nullptr };
std::map<std::string, DevicePickItem*> m_device_items;
int m_selected_count{0};
public:
MultiMachinePickPage(Plater* plater = nullptr);
~MultiMachinePickPage();
int get_selected_count();
void update_selected_count();
void on_dpi_changed(const wxRect& suggested_rect);
void on_sys_color_changed();
void refresh_user_device();
void on_confirm(wxCommandEvent& event);
bool Show(bool show);
};
} // namespace GUI
} // namespace Slic3r
#endif