1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
#ifndef slic3r_OG_CustomCtrl_hpp_
#define slic3r_OG_CustomCtrl_hpp_
#include <wx/stattext.h>
#include <wx/settings.h>
#include <map>
#include <functional>
#include "libslic3r/Config.hpp"
#include "libslic3r/PrintConfig.hpp"
#include "OptionsGroup.hpp"
#include "I18N.hpp"
// Translate the ifdef
#ifdef __WXOSX__
#define wxOSX true
#else
#define wxOSX false
#endif
namespace Slic3r { namespace GUI {
// Static text shown among the options.
class OG_CustomCtrl :public wxPanel
{
static int m_has_icon;
wxFont m_font;
int m_v_gap;
int m_h_gap;
int m_em_unit;
wxSize m_bmp_mode_sz;
wxSize m_bmp_blinking_sz;
struct CtrlLine {
wxCoord height { wxDefaultCoord };
OG_CustomCtrl* ctrl { nullptr };
const Line& og_line;
bool draw_just_act_buttons { false };
std::vector<bool> is_visible;
bool is_line_visible { true };
bool draw_mode_bitmap { true };
bool is_focused { false };
CtrlLine( wxCoord height,
OG_CustomCtrl* ctrl,
const Line& og_line,
bool draw_just_act_buttons = false,
bool draw_mode_bitmap = true);
~CtrlLine() { ctrl = nullptr; }
void correct_items_positions();
void msw_rescale();
void update_visibility(ConfigOptionMode mode);
void render(wxDC& dc, wxCoord v_pos);
wxCoord draw_mode_bmp(wxDC& dc, wxCoord v_pos);
wxCoord draw_text (wxDC& dc, wxPoint pos, const wxString& text, const wxColour* color, int width, bool is_url = false, bool align_right = false);
wxPoint draw_blinking_bmp(wxDC& dc, wxPoint pos, bool is_blinking);
wxCoord draw_act_bmps(wxDC& dc, wxPoint pos, const wxBitmap& bmp_undo_to_sys, const wxBitmap& bmp_undo, bool is_blinking, size_t rect_id = 0);
bool launch_browser() const;
std::vector<wxRect> rects_undo_icon;
std::vector<wxRect> rects_undo_to_sys_icon;
wxRect rect_label;
};
std::vector<CtrlLine> ctrl_lines;
public:
OG_CustomCtrl( wxWindow* parent,
OptionsGroup* og,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
const wxValidator& val = wxDefaultValidator,
const wxString& name = wxEmptyString);
~OG_CustomCtrl() {}
void OnPaint(wxPaintEvent&);
void OnMotion(wxMouseEvent& event);
void OnLeftDown(wxMouseEvent& event);
void OnLeaveWin(wxMouseEvent& event);
void init_ctrl_lines();
bool update_visibility(ConfigOptionMode mode);
void correct_window_position(wxWindow* win, const Line& line, Field* field = nullptr);
void correct_widgets_position(wxSizer* widget, const Line& line, Field* field = nullptr);
void msw_rescale();
void sys_color_changed();
wxPoint get_pos(const Line& line, Field* field = nullptr);
int get_height(const Line& line);
OptionsGroup* opt_group;
};
//-----------------------------------------------
// RememberChoiceDialog
//-----------------------------------------------
class RememberChoiceDialog : public wxDialog
{
wxCheckBox* m_remember_choice;
public:
RememberChoiceDialog(wxWindow* parent, const wxString& msg_text, const wxString& caption);
~RememberChoiceDialog() {}
bool remember_choice() const { return m_remember_choice->GetValue(); }
};
}}
#endif /* slic3r_OG_CustomCtrl_hpp_ */
|