OrcaSlicer/src/slic3r/GUI/BindDialog.hpp
Noisyfox 933aa3050b
Port Emboss & SVG gizmo from PrusaSlicer (#2819)
* Rework UI jobs to make them more understandable and flexible.

* Update Orca specific jobs

* Fix progress issue

* Fix dark mode and window radius

* Update cereal version from 1.2.2 to 1.3.0

(cherry picked from commit prusa3d/PrusaSlicer@057232a275)

* Initial port of Emboss gizmo

* Bump up CGAL version to 5.4

(cherry picked from commit prusa3d/PrusaSlicer@1bf9dee3e7)

* Fix text rotation

* Fix test dragging

* Add text gizmo to right click menu

* Initial port of SVG gizmo

* Fix text rotation

* Fix Linux build

* Fix "from surface"

* Fix -90 rotation

* Fix icon path

* Fix loading font with non-ascii name

* Fix storing non-utf8 font descriptor in 3mf file

* Fix filtering with non-utf8 characters

* Emboss: Use Orca style input dialog

* Fix build on macOS

* Fix tooltip color in light mode

* InputText: fixed incorrect padding when FrameBorder > 0. (ocornut/imgui#4794, ocornut/imgui#3781)
InputTextMultiline: fixed vertical tracking with large values of FramePadding.y. (ocornut/imgui#3781, ocornut/imgui#4794)

(cherry picked from commit ocornut/imgui@072caa4a90)
(cherry picked from commit ocornut/imgui@bdd2a94315)

* SVG: Use Orca style input dialog

* Fix job progress update

* Fix crash when select editing text in preview screen

* Use Orca checkbox style

* Fix issue that toolbar icons are kept regenerated

* Emboss: Fix text & icon alignment

* SVG: Fix text & icon alignment

* Emboss: fix toolbar icon mouse hover state

* Add a simple subtle outline effect by drawing back faces using wireframe mode

* Disable selection outlines

* Show outline in white if the model color is too dark

* Make the outline algorithm more reliable

* Enable cull face, which fix render on Linux

* Fix `disable_cullface`

* Post merge fix

* Optimize selection rendering

* Fix scale gizmo

* Emboss: Fix text rotation if base object is scaled

* Fix volume synchronize

* Fix emboss rotation

* Emboss: Fix advance toggle

* Fix text position after reopened the project

* Make font style preview darker

* Make font style preview selector height shorter

---------

Co-authored-by: tamasmeszaros <meszaros.q@gmail.com>
Co-authored-by: ocornut <omarcornut@gmail.com>
Co-authored-by: SoftFever <softfeverever@gmail.com>
2023-12-09 22:46:18 +08:00

128 lines
4 KiB
C++

#ifndef slic3r_BindDialog_hpp_
#define slic3r_BindDialog_hpp_
#include "I18N.hpp"
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/gauge.h>
#include <wx/button.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/dialog.h>
#include <curl/curl.h>
#include <wx/webrequest.h>
#include <wx/hyperlink.h>
#include "wxExtensions.hpp"
#include "Plater.hpp"
#include "Widgets/StepCtrl.hpp"
#include "Widgets/ProgressDialog.hpp"
#include "Widgets/Button.hpp"
#include "Widgets/ProgressBar.hpp"
#include "Widgets/RoundedRectangle.hpp"
#include "Jobs/BindJob.hpp"
#include "BBLStatusBar.hpp"
#include "BBLStatusBarBind.hpp"
#include "Jobs/Worker.hpp"
#define BIND_DIALOG_GREY200 wxColour(248, 248, 248)
#define BIND_DIALOG_GREY800 wxColour(50, 58, 61)
#define BIND_DIALOG_GREY900 wxColour(38, 46, 48)
#define BIND_DIALOG_BUTTON_SIZE wxSize(FromDIP(68), FromDIP(24))
#define BIND_DIALOG_BUTTON_PANEL_SIZE wxSize(FromDIP(450), FromDIP(30))
namespace Slic3r { namespace GUI {
struct MemoryStruct
{
char * memory;
size_t read_pos;
size_t size;
};
class BindMachineDialog : public DPIDialog
{
private:
wxWindow* m_panel_agreement;
wxStaticText * m_printer_name;
wxStaticText * m_user_name;
StaticBox * m_panel_left;
StaticBox * m_panel_right;
wxStaticText *m_status_text;
wxStaticText* m_link_show_error;
Button * m_button_bind;
Button * m_button_cancel;
wxSimplebook *m_simplebook;
wxStaticBitmap *m_avatar;
wxStaticBitmap *m_printer_img;
wxStaticBitmap *m_static_bitmap_show_error;
wxBitmap m_bitmap_show_error_close;
wxBitmap m_bitmap_show_error_open;
wxScrolledWindow* m_sw_bind_failed_info;
Label* m_bind_failed_info;
Label* m_st_txt_error_code{ nullptr };
Label* m_st_txt_error_desc{ nullptr };
Label* m_st_txt_extra_info{ nullptr };
wxHyperlinkCtrl* m_link_network_state{ nullptr };
wxString m_result_info;
wxString m_result_extra;
bool m_show_error_info_state = true;
bool m_allow_privacy{false};
bool m_allow_notice{false};
int m_result_code;
std::shared_ptr<int> m_tocken;
MachineObject * m_machine_info{nullptr};
std::shared_ptr<BBLStatusBarBind> m_status_bar;
std::unique_ptr<Worker> m_worker;
public:
BindMachineDialog(Plater *plater = nullptr);
~BindMachineDialog();
void show_bind_failed_info(bool show, int code = 0, wxString description = wxEmptyString, wxString extra = wxEmptyString);
void on_cancel(wxCommandEvent& event);
void on_bind_fail(wxCommandEvent &event);
void on_update_message(wxCommandEvent &event);
void on_bind_success(wxCommandEvent &event);
void on_bind_printer(wxCommandEvent &event);
void on_dpi_changed(const wxRect &suggested_rect) override;
void update_machine_info(MachineObject *info);
void on_show(wxShowEvent &event);
void on_close(wxCloseEvent& event);
void on_destroy();
wxString get_print_error(wxString str);
};
class UnBindMachineDialog : public DPIDialog
{
protected:
wxStaticText * m_printer_name;
wxStaticText * m_user_name;
wxStaticText *m_status_text;
Button * m_button_unbind;
Button * m_button_cancel;
MachineObject *m_machine_info{nullptr};
wxStaticBitmap *m_avatar;
wxStaticBitmap *m_printer_img;
std::shared_ptr<int> m_tocken;
public:
UnBindMachineDialog(Plater *plater = nullptr);
~UnBindMachineDialog();
void on_cancel(wxCommandEvent &event);
void on_unbind_printer(wxCommandEvent &event);
void on_dpi_changed(const wxRect &suggested_rect) override;
void update_machine_info(MachineObject *info) { m_machine_info = info; };
void on_show(wxShowEvent &event);
};
}} // namespace Slic3r::GUI
#endif /* slic3r_BindDialog_hpp_ */