To correct translation by context have to use wxGETTEXT_IN_CONTEXT macro from wxWidget 3.1.1
146{
147
148 wxCoord v_pos = 0;
150
151 auto correct_line_height = [](int& line_height, wxWindow* win)
152 {
153 int win_height = win->GetSize().GetHeight();
154 if (line_height < win_height)
155 line_height = win_height;
156 };
157
158 auto correct_horiz_pos = [this](int& h_pos, Field* field) {
160 int win_width = field->getWindow()->GetSize().GetWidth();
161 if (dynamic_cast<CheckBox*>(field))
162 win_width *= 0.5;
164 }
165 };
166
167 auto add_label_width = [&h_pos,
this](
CtrlLine &ctrl_line, wxString
const & label,
int label_width) {
168 wxClientDC dc(this);
170 wxString multiline_text;
172 if (label_width > 0) size.x = label_width;
174 if (ctrl_line.height < size.y)
175 ctrl_line.height = size.y;
176 };
177
178 auto add_buttons_width = [&h_pos] (int blinking_button_width) {
179#ifndef DISABLE_BLINKING
180# ifndef DISABLE_UNDO_SYS
181 h_pos += 3 * blinking_button_width;
182# else
183 h_pos += 2 * blinking_button_width;
184# endif
185#else
186# ifndef DISABLE_UNDO_SYS
187 h_pos += 2 * blinking_button_width;
188# else
189 h_pos += 1 * blinking_button_width;
190# endif
191#endif
192 };
193
195 if (&ctrl_line.og_line == &line)
196 {
197
198
199 if (line.near_label_widget_win) {
200 wxSize near_label_widget_sz = line.near_label_widget_win->GetSize();
201 if (field_in)
202 h_pos += near_label_widget_sz.GetWidth() +
m_h_gap;
203 else {
205 break;
206 }
207 }
208 wxString label = line.label;
211
213
214 if (line.widget) {
215#ifndef DISABLE_BLINKING
216 h_pos += (line.has_undo_ui() ? 3 : 1) * blinking_button_width;
217#else
218
219
221 add_buttons_width(blinking_button_width);
222#endif
223
224 for (auto child : line.widget_sizer->GetChildren())
225 if (child->IsWindow())
226 correct_line_height(ctrl_line.height, child->GetWindow());
227 break;
228 }
229
231 add_buttons_width(blinking_button_width);
232
233
234 const std::vector<Option>& option_set = line.get_options();
235 if (option_set.size() == 1 && option_set.front().opt.sidetext.size() == 0 &&
236 option_set.front().side_widget == nullptr && line.get_extra_widgets().size() == 0)
237 {
238
239
240 Field* field =
opt_group->get_field(option_set.front().opt_id);
241 correct_line_height(ctrl_line.height, field->getWindow());
242 correct_horiz_pos(h_pos, field);
243 break;
244 }
245
246 bool is_multioption_line = option_set.size() > 1;
247 for (auto opt : option_set) {
248 Field* field =
opt_group->get_field(opt.opt_id);
249 correct_line_height(ctrl_line.height, field->getWindow());
250
252 ConfigOptionDef option = opt.opt;
253
254 if (is_multioption_line && !option.label.empty()) {
256 auto label = (option.label ==
L_CONTEXT(
"Top",
"Layers") || option.label ==
L_CONTEXT(
"Bottom",
"Layers")) ?
_L_CONTEXT(option.label,
"Layers") :
258
259
261 h_pos += 8;
262 }
263
264 }
265
266 if (field == field_in) {
267 correct_horiz_pos(h_pos, field);
268 break;
269 }
272 } else {
273
274 h_pos += field->getWindow()->GetSize().x;
275 add_buttons_width(blinking_button_width);
276 if (option_set.size() == 1 && option_set.front().opt.full_width)
277 break;
278
279
280 if (!field->combine_side_text() && (!opt.opt.sidetext.empty() ||
opt_group->sidetext_width > 0))
282
283 if (opt.opt_id != option_set.back().opt_id)
285 }
286 }
287 break;
288 }
289 if (ctrl_line.is_visible)
290 v_pos += ctrl_line.height;
291 }
292
293 return wxPoint(h_pos, v_pos);
294}
#define _(s)
Definition 3mf.cpp:306
#define L_CONTEXT(s, context)
Definition DesignOffer.hpp:17
static wxSize split_lines(wxDC &dc, int width, const wxString &text, wxString &multiline_text, int max_count=0)
Definition Label.cpp:293
int get_title_width()
Definition OG_CustomCtrl.cpp:593
#define _L_CONTEXT(s, ctx)
Definition I18N.hpp:15