54{
55 Tab *tab = wxGetApp().get_tab(
m_type);
56 assert(tab);
58
60 std::string
preset_name = sel_preset.is_default ?
_u8L(
"Untitled") : sel_preset.is_system ? (boost::
format((
"%1% - %2%")) % sel_preset.name % suffix).str() : sel_preset.is_from_bundle() && !sel_preset.alias.
empty() ? sel_preset.alias : sel_preset.name;
61
62
66 }
67
68 std::vector<std::string> values;
70
71 if (preset.is_default || preset.is_system)
72
73 continue;
74 values.push_back(preset.name);
75 }
76
79 label_top->SetForegroundColour(wxColour(38,46,48));
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100 wxBoxSizer *input_sizer_h = new wxBoxSizer(wxHORIZONTAL);
101 wxBoxSizer *input_sizer_v = new wxBoxSizer(wxVERTICAL);
102
103
104
105
112
113
115 input_sizer_h->Add(input_sizer_v, 1, wxALIGN_CENTER, 0);
116 input_sizer_h->Layout();
117
120
121 sizer->Add(label_top, 0, wxEXPAND | wxLEFT | wxTOP | wxBOTTOM,
BORDER_W);
122 sizer->Add(input_sizer_h, 0, wxALIGN_CENTER|wxLEFT|wxRIGHT,
BORDER_W);
124
126
127
130 _L(
"Preset Inside Project")
131 }, wxVERTICAL);
132
134
136
137 const std::string parent_name = sel_preset.is_system ? sel_preset.name : sel_preset.inherits();
138 const bool has_parent = !parent_name.empty();
139
140 wxBoxSizer *detach_sizer = new wxBoxSizer(wxHORIZONTAL);
141
142 auto detach_tooltip =
_L(
"Copies all inherited values from the parent into this preset and removes the parent relationship. Presets compatible only with the parent may become unsupported.");
143
144 auto detach_checkbox = new ::CheckBox(parent);
145 detach_checkbox->SetToolTip(detach_tooltip);
146
147 auto detach_label =
new wxStaticText(parent, wxID_ANY, has_parent ?
_L(
"Detach from parent") :
_L(
"Save without parent"));
149 detach_label->SetForegroundColour(wxColour("#363636"));
150 detach_label->SetToolTip(detach_tooltip);
151
152 detach_sizer->Add(detach_checkbox, 0, wxALIGN_LEFT | wxLEFT,
BORDER_W);
153 detach_sizer->Add(detach_label , 0, wxALIGN_CENTRE_VERTICAL | wxLEFT, FromDIP(5));
154 sizer->Add(detach_sizer, 0, wxEXPAND | wxTOP,
BORDER_W);
155 sizer->AddSpacer(FromDIP(5));
156
157 const wxString parent_text = has_parent ?
from_u8(parent_name) :
_L(
"Unique preset");
158 auto parent_label =
new wxStaticText(parent, wxID_ANY, parent_text);
160 parent_label->SetForegroundColour(wxColour("#6B6B6B"));
161 parent_label->SetToolTip(has_parent ?
_L(
"Parent preset") :
_L(
"This preset does not inherit from another preset."));
162 sizer->Add(parent_label, 0, wxEXPAND | wxLEFT,
BORDER_W + FromDIP(24));
163
164 sizer->AddSpacer(FromDIP(5));
165
166
167 detach_checkbox->SetValue(
m_detach);
168
169 detach_checkbox->Bind(wxEVT_TOGGLEBUTTON, [this, detach_checkbox](wxCommandEvent& event) {
170 m_detach = detach_checkbox->GetValue();
171 event.Skip();
172 });
173
174 auto on_toggle = [detach_checkbox]() {
175 detach_checkbox->SetValue(!detach_checkbox->GetValue());
176 wxCommandEvent ev(wxEVT_TOGGLEBUTTON, detach_checkbox->GetId());
177 ev.SetEventObject(detach_checkbox);
178 detach_checkbox->GetEventHandler()->ProcessEvent(ev);
179 };
180 detach_label->Bind(wxEVT_LEFT_DOWN, [on_toggle](
wxMouseEvent& e) {
if(!e.LeftDClick()) on_toggle();});
181 detach_label->Bind(wxEVT_LEFT_DCLICK, [on_toggle](
wxMouseEvent& e) {on_toggle();});
182 }
183
184 m_radio_group->Bind(wxEVT_COMMAND_RADIOBOX_SELECTED, [
this](wxCommandEvent &e) {
186 });
187
188 bool is_project_embedded =
m_presets->get_edited_preset().is_project_embedded;
190
192 << ", is_project_embedded = " << is_project_embedded;
194}
#define BORDER_W
Definition BitmapComboBox.cpp:48
#define L(s)
Definition ExtrusionEntity.cpp:25
#define _L(s)
Definition OBJ.cpp:34
class WXDLLIMPEXP_FWD_CORE wxStaticText
Definition ProgressDialog.hpp:30
#define SAVE_PRESET_DIALOG_INPUT_SIZE
Definition SavePresetDialog.hpp:25
static wxFont Body_12
Definition Label.hpp:55
static wxFont Body_14
Definition Label.hpp:53
bool m_save_to_project
Definition SavePresetDialog.hpp:79
wxStaticText * m_valid_label
Definition SavePresetDialog.hpp:74
Preset::Type type() const
Definition SavePresetDialog.hpp:58
bool m_detach
Definition SavePresetDialog.hpp:81
PresetCollection * m_presets
Definition SavePresetDialog.hpp:76
Preset::Type m_type
Definition SavePresetDialog.hpp:66
void update()
Definition SavePresetDialog.cpp:196
SavePresetDialog * m_parent
Definition SavePresetDialog.hpp:70
TextInput * m_input_ctrl
Definition SavePresetDialog.hpp:73
RadioGroup * m_radio_group
Definition SavePresetDialog.hpp:80
std::string m_preset_name
Definition SavePresetDialog.hpp:68
std::string preset_name() const
Definition SavePresetDialog.hpp:59
static std::string get_type_string(Preset::Type type)
Definition Preset.cpp:590
@ TYPE_PRINTER
Definition Preset.hpp:250
@ Disabled
Definition StateColor.hpp:22
@ Enabled
Definition StateColor.hpp:17
wxMouseEvent
Definition CameraPopup.cpp:47
std::string format(const char *fmt, TArgs &&... args)
Definition format.hpp:36
std::string into_u8(const wxString &str)
Definition GUI.cpp:549
wxString from_u8(const std::string &str)
Definition GUI.cpp:544
@ comDevelop
Definition Config.hpp:225
@ Preset
Definition calib.hpp:39
bool empty(const BoundingBoxBase< PointType, PointsType > &bb)
Definition BoundingBox.hpp:273
#define _utf8(s)
Definition I18N.hpp:10
#define _u8L(s)
Definition I18N.hpp:11