1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 2000-2001 The LyX Team.
8 * ======================================================
10 * \file FormGraphics.C
11 * \author Baruch Even, baruch.even@writeme.com
12 * \author Herbert Voss, voss@perce.de
18 #pragma implementation
22 #include "ControlGraphics.h"
23 #include "FormGraphics.h"
24 #include "form_graphics.h"
26 #include "xforms_helpers.h"
27 #include "input_validators.h"
28 #include "debug.h" // for lyxerr
29 #include "support/lstrings.h" // for strToDbl & tostr
30 #include "support/FileInfo.h"
31 #include "support/filetools.h" // for MakeAbsPath etc
32 #include "insets/insetgraphicsParams.h"
33 #include "lyxrc.h" // for lyxrc.display_graphics
39 // Bound the number of input characters
40 int const SCALE_MAXDIGITS = 3;
41 int const WIDTH_MAXDIGITS = 10;
42 int const HEIGHT_MAXDIGITS = 10;
43 int const ROTATE_MAXCHARS = 4;
44 int const FILENAME_MAXCHARS = 1024;
45 string defaultUnit = "cm";
50 typedef FormCB<ControlGraphics, FormDB<FD_form_graphics> > base_class;
52 FormGraphics::FormGraphics(ControlGraphics & c)
53 : base_class(c, _("Graphics"), false)
57 void FormGraphics::redraw()
59 if(form() && form()->visible)
60 fl_redraw_form(form());
63 FL_FORM * outer_form = fl_get_active_folder(dialog_->tabFolder);
64 if (outer_form && outer_form->visible)
65 fl_redraw_form(outer_form);
69 void FormGraphics::build()
71 dialog_.reset(build_graphics());
73 // Manage the ok, apply, restore and cancel/close buttons
74 bc().setOK(dialog_->button_ok);
75 bc().setApply(dialog_->button_apply);
76 bc().setCancel(dialog_->button_cancel);
77 bc().setRestore(dialog_->button_restore);
80 file_.reset(build_file());
82 fl_set_input_return (file_->input_filename, FL_RETURN_CHANGED);
83 fl_set_input_return (file_->input_subcaption, FL_RETURN_CHANGED);
84 fl_set_input_return (file_->input_rotate_angle, FL_RETURN_CHANGED);
85 fl_set_input_maxchars(file_->input_filename, FILENAME_MAXCHARS);
86 fl_set_input_maxchars(file_->input_rotate_angle, ROTATE_MAXCHARS);
87 fl_set_input_filter(file_->input_rotate_angle, fl_float_filter);
89 string const choice_origin =
91 "leftTop|leftBottom|leftBaseline|" // lt lb lB
92 "centerTop|centerBottom|centerBaseline|" // ct cb cB
93 "rightTop|rightBottom|rightBaseline"; // rt rb rB
94 fl_addto_choice(file_->choice_origin, choice_origin.c_str());
96 bc().addReadOnly(file_->button_browse);
97 bc().addReadOnly(file_->check_subcaption);
98 bc().addReadOnly(file_->check_rotate);
99 bc().addReadOnly(file_->button_draft);
100 bc().addReadOnly(file_->button_nounzip);
102 // the lyxview section
103 lyxview_.reset(build_lyxview());
105 fl_set_input_return (lyxview_->input_lyxwidth, FL_RETURN_CHANGED);
106 fl_set_input_return (lyxview_->input_lyxheight, FL_RETURN_CHANGED);
107 fl_set_input_return (lyxview_->input_lyxscale, FL_RETURN_CHANGED);
109 fl_addto_choice(lyxview_->choice_width_lyxwidth, choice_Length_WithUnit.c_str());
110 fl_addto_choice(lyxview_->choice_width_lyxheight, choice_Length_WithUnit.c_str());
112 bc().addReadOnly(lyxview_->radio_pref);
113 bc().addReadOnly(lyxview_->radio_mono);
114 bc().addReadOnly(lyxview_->radio_gray);
115 bc().addReadOnly(lyxview_->radio_color);
116 bc().addReadOnly(lyxview_->radio_nodisplay);
119 size_.reset(build_size());
121 fl_set_input_return (size_->input_scale, FL_RETURN_CHANGED);
122 fl_set_input_return (size_->input_width, FL_RETURN_CHANGED);
123 fl_set_input_return (size_->input_height, FL_RETURN_CHANGED);
125 fl_set_input_maxchars(size_->input_scale, SCALE_MAXDIGITS);
126 fl_set_input_maxchars(size_->input_width, WIDTH_MAXDIGITS);
127 fl_set_input_maxchars(size_->input_height, HEIGHT_MAXDIGITS);
129 fl_set_input_filter(size_->input_scale, fl_unsigned_float_filter);
131 fl_addto_choice(size_->choice_width_units, choice_Length_All.c_str());
132 fl_addto_choice(size_->choice_height_units, choice_Length_All.c_str());
134 bc().addReadOnly(size_->button_asis);
135 bc().addReadOnly(size_->button_wh);
136 bc().addReadOnly(size_->button_scale);
137 bc().addReadOnly(size_->check_aspectratio);
139 // the bounding box selection
140 bbox_.reset(build_bbox());
141 fl_set_input_return (bbox_->input_bb_x0, FL_RETURN_CHANGED);
142 fl_set_input_return (bbox_->input_bb_y0, FL_RETURN_CHANGED);
143 fl_set_input_return (bbox_->input_bb_x1, FL_RETURN_CHANGED);
144 fl_set_input_return (bbox_->input_bb_y1, FL_RETURN_CHANGED);
146 string const bb_units = "pt|cm|in";
147 fl_addto_choice(bbox_->choice_bb_units, bb_units.c_str());
148 bc().addReadOnly(bbox_->button_getBB);
149 bc().addReadOnly(bbox_->button_clip);
151 // the rotate section
152 special_.reset(build_special());
154 fl_set_input_return (special_->input_special, FL_RETURN_CHANGED);
156 // add the different tabfolders
157 fl_addto_tabfolder(dialog_->tabFolder, _("File"), file_->form);
158 fl_addto_tabfolder(dialog_->tabFolder, _("LyX View"), lyxview_->form);
159 fl_addto_tabfolder(dialog_->tabFolder, _("LaTeX Size"), size_->form);
160 fl_addto_tabfolder(dialog_->tabFolder, _("Bounding Box"), bbox_->form);
161 fl_addto_tabfolder(dialog_->tabFolder, _("Extras"), special_->form);
165 void FormGraphics::apply()
167 // Create the parameters structure and fill the data from the dialog.
168 InsetGraphicsParams & igp = controller().params();
171 igp.filename = getStringFromInput(file_->input_filename);
172 igp.subcaption = fl_get_button(file_->check_subcaption);
173 igp.subcaptionText = getStringFromInput(file_->input_subcaption);
174 igp.rotate = fl_get_button(file_->check_rotate);
176 strToDbl(getStringFromInput(file_->input_rotate_angle));
177 while (igp.rotateAngle < 0.0 || igp.rotateAngle > 360.0) {
178 if (igp.rotateAngle < 0.0) {
179 igp.rotateAngle += 360.0;
180 } else if (igp.rotateAngle > 360.0) {
181 igp.rotateAngle -= 360.0;
184 if (fl_get_choice(file_->choice_origin) > 0)
185 igp.rotateOrigin = fl_get_choice_text(file_->choice_origin);
187 igp.rotateOrigin = string();
188 igp.draft = fl_get_button(file_->button_draft);
189 igp.noUnzip = fl_get_button(file_->button_nounzip);
191 // the lyxview section
192 if (fl_get_button(lyxview_->radio_pref))
193 igp.display = InsetGraphicsParams::DEFAULT;
194 else if (fl_get_button(lyxview_->radio_mono))
195 igp.display = InsetGraphicsParams::MONOCHROME;
196 else if (fl_get_button(lyxview_->radio_gray))
197 igp.display = InsetGraphicsParams::GRAYSCALE;
198 else if (fl_get_button(lyxview_->radio_color))
199 igp.display = InsetGraphicsParams::COLOR;
200 else if (fl_get_button(lyxview_->radio_nodisplay))
201 igp.display = InsetGraphicsParams::NONE;
203 if (fl_get_button(lyxview_->button_lyxasis))
204 igp.lyxsize_type = InsetGraphicsParams::DEFAULT_SIZE;
205 else if (fl_get_button(lyxview_->button_lyxwh))
206 igp.lyxsize_type = InsetGraphicsParams::WH;
208 igp.lyxsize_type = InsetGraphicsParams::SCALE;
209 igp.lyxwidth = LyXLength(getLengthFromWidgets(lyxview_->input_lyxwidth,
210 lyxview_->choice_width_lyxwidth));
211 igp.lyxheight = LyXLength(getLengthFromWidgets(lyxview_->input_lyxheight,
212 lyxview_->choice_width_lyxheight));
213 igp.lyxscale = strToInt(getStringFromInput(lyxview_->input_lyxscale));
216 if (fl_get_button(size_->button_asis))
217 igp.size_type = InsetGraphicsParams::DEFAULT_SIZE;
218 else if (fl_get_button(size_->button_wh))
219 igp.size_type = InsetGraphicsParams::WH;
221 igp.size_type = InsetGraphicsParams::SCALE;
222 igp.width = LyXLength(getLengthFromWidgets(size_->input_width,
223 size_->choice_width_units));
224 igp.height = LyXLength(getLengthFromWidgets(size_->input_height,
225 size_->choice_height_units));
226 igp.scale = strToInt(getStringFromInput(size_->input_scale));
227 igp.keepAspectRatio = fl_get_button(size_->check_aspectratio);
230 if (!controller().bbChanged) // different to the original one?
231 igp.bb = string(); // don't write anything
234 if (getStringFromInput(bbox_->input_bb_x0).empty())
237 bb = getLengthFromWidgets(bbox_->input_bb_x0,
238 bbox_->choice_bb_units)+" ";
239 if (getStringFromInput(bbox_->input_bb_y0).empty())
242 bb += (getLengthFromWidgets(bbox_->input_bb_y0,
243 bbox_->choice_bb_units)+" ");
244 if (getStringFromInput(bbox_->input_bb_x1).empty())
247 bb += (getLengthFromWidgets(bbox_->input_bb_x1,
248 bbox_->choice_bb_units)+" ");
249 if (getStringFromInput(bbox_->input_bb_y1).empty())
252 bb += (getLengthFromWidgets(bbox_->input_bb_y1,
253 bbox_->choice_bb_units)+" ");
256 igp.clip = fl_get_button(bbox_->button_clip);
258 // the special section
259 igp.special = getStringFromInput(special_->input_special);
263 void FormGraphics::update() {
264 if (lyxrc.default_papersize < 3)
265 defaultUnit = string("in");
266 // Update dialog with details from inset
267 InsetGraphicsParams & igp = controller().params();
270 fl_set_input(file_->input_filename, igp.filename.c_str());
271 fl_set_button(file_->check_subcaption, igp.subcaption);
272 fl_set_input(file_->input_subcaption, igp.subcaptionText.c_str());
273 setEnabled(file_->input_subcaption,
274 fl_get_button(file_->check_subcaption));
275 fl_set_button(file_->check_rotate, igp.rotate);
276 fl_set_input(file_->input_rotate_angle,
277 tostr(igp.rotateAngle).c_str());
278 if (igp.rotateOrigin.empty())
279 fl_set_choice(file_->choice_origin,0);
281 fl_set_choice_text(file_->choice_origin,igp.rotateOrigin.c_str());
282 setEnabled(file_->input_rotate_angle,
283 fl_get_button(file_->check_rotate));
284 setEnabled(file_->choice_origin,
285 fl_get_button(file_->check_rotate));
286 fl_set_button(file_->button_draft, igp.draft);
287 fl_set_button(file_->button_nounzip, igp.noUnzip);
289 // the lyxview section
290 switch (igp.display) {
291 case InsetGraphicsParams::DEFAULT:
292 fl_set_button(lyxview_->radio_pref, 1);
294 case InsetGraphicsParams::MONOCHROME:
295 fl_set_button(lyxview_->radio_mono, 1);
297 case InsetGraphicsParams::GRAYSCALE:
298 fl_set_button(lyxview_->radio_gray, 1);
300 case InsetGraphicsParams::COLOR:
301 fl_set_button(lyxview_->radio_color, 1);
303 case InsetGraphicsParams::NONE:
304 fl_set_button(lyxview_->radio_nodisplay, 1);
307 updateWidgetsFromLength(lyxview_->input_lyxwidth,
308 lyxview_->choice_width_lyxwidth, igp.lyxwidth,defaultUnit);
309 updateWidgetsFromLength(lyxview_->input_lyxheight,
310 lyxview_->choice_width_lyxheight, igp.lyxheight,defaultUnit);
311 fl_set_input(lyxview_->input_lyxscale, tostr(igp.lyxscale).c_str());
312 switch (igp.lyxsize_type) {
313 case InsetGraphicsParams::DEFAULT_SIZE: {
314 fl_set_button(lyxview_->button_lyxasis,1);
315 setEnabled(lyxview_->input_lyxwidth, 0);
316 setEnabled(lyxview_->choice_width_lyxwidth, 0);
317 setEnabled(lyxview_->input_lyxheight, 0);
318 setEnabled(lyxview_->choice_width_lyxheight, 0);
319 setEnabled(lyxview_->input_lyxscale, 0);
322 case InsetGraphicsParams::WH: {
323 fl_set_button(lyxview_->button_lyxwh, 1);
324 setEnabled(lyxview_->input_lyxwidth, 1);
325 setEnabled(lyxview_->choice_width_lyxwidth, 1);
326 setEnabled(lyxview_->input_lyxheight, 1);
327 setEnabled(lyxview_->choice_width_lyxheight, 1);
328 setEnabled(lyxview_->input_lyxscale, 0);
331 case InsetGraphicsParams::SCALE: {
332 fl_set_button(lyxview_->button_lyxscale, 1);
333 setEnabled(lyxview_->input_lyxwidth, 0);
334 setEnabled(lyxview_->choice_width_lyxwidth, 0);
335 setEnabled(lyxview_->input_lyxheight, 0);
336 setEnabled(lyxview_->choice_width_lyxheight, 0);
337 setEnabled(lyxview_->input_lyxscale, 1);
343 // Update the draft and clip mode
344 updateWidgetsFromLength(size_->input_width,
345 size_->choice_width_units,igp.width,defaultUnit);
346 updateWidgetsFromLength(size_->input_height,
347 size_->choice_height_units,igp.height,defaultUnit);
348 fl_set_input(size_->input_scale, tostr(igp.scale).c_str());
349 switch (igp.size_type) {
350 case InsetGraphicsParams::DEFAULT_SIZE: {
351 fl_set_button(size_->button_asis,1);
352 setEnabled(size_->input_width, 0);
353 setEnabled(size_->choice_width_units, 0);
354 setEnabled(size_->input_height, 0);
355 setEnabled(size_->choice_height_units, 0);
356 setEnabled(size_->check_aspectratio, 0);
357 setEnabled(size_->input_scale, 0);
360 case InsetGraphicsParams::WH: {
361 fl_set_button(size_->button_wh, 1);
362 setEnabled(size_->input_width, 1);
363 setEnabled(size_->choice_width_units, 1);
364 setEnabled(size_->input_height, 1);
365 setEnabled(size_->choice_height_units, 1);
366 setEnabled(size_->check_aspectratio, 1);
367 setEnabled(size_->input_scale, 0);
370 case InsetGraphicsParams::SCALE: {
371 fl_set_button(size_->button_scale, 1);
372 setEnabled(size_->input_width, 0);
373 setEnabled(size_->choice_width_units, 0);
374 setEnabled(size_->input_height, 0);
375 setEnabled(size_->choice_height_units, 0);
376 setEnabled(size_->check_aspectratio, 0);
377 setEnabled(size_->input_scale, 1);
381 fl_set_button(size_->check_aspectratio, igp.keepAspectRatio);
384 // set the bounding box values, if exists. First we need the whole
385 // path, because the controller knows nothing about the doc-dir
386 controller().bbChanged = false;
387 if (igp.bb.empty()) {
388 string const fileWithAbsPath =
389 MakeAbsPath(igp.filename, OnlyPath(igp.filename));
390 string const bb = controller().readBB(fileWithAbsPath);
392 // get the values from the file
393 // in this case we always have the point-unit
394 fl_set_input(bbox_->input_bb_x0, token(bb,' ',0).c_str());
395 fl_set_input(bbox_->input_bb_y0, token(bb,' ',1).c_str());
396 fl_set_input(bbox_->input_bb_x1, token(bb,' ',2).c_str());
397 fl_set_input(bbox_->input_bb_y1, token(bb,' ',3).c_str());
398 } else { // no bb from file
399 fl_set_input(bbox_->input_bb_x0, bb.c_str());
400 fl_set_input(bbox_->input_bb_y0, bb.c_str());
401 fl_set_input(bbox_->input_bb_x1, bb.c_str());
402 fl_set_input(bbox_->input_bb_y1, bb.c_str());
404 string const unit("pt");
405 fl_set_choice_text(bbox_->choice_bb_units, unit.c_str());
406 } else { // get the values from the inset
407 controller().bbChanged = true;
409 anyLength = LyXLength(token(igp.bb,' ',0));
410 updateWidgetsFromLength(bbox_->input_bb_x0,
411 bbox_->choice_bb_units,anyLength,"pt");
412 anyLength = LyXLength(token(igp.bb,' ',1));
413 updateWidgetsFromLength(bbox_->input_bb_y0,
414 bbox_->choice_bb_units,anyLength,"pt");
415 anyLength = LyXLength(token(igp.bb,' ',2));
416 updateWidgetsFromLength(bbox_->input_bb_x1,
417 bbox_->choice_bb_units,anyLength,"pt");
418 anyLength = LyXLength(token(igp.bb,' ',3));
419 updateWidgetsFromLength(bbox_->input_bb_y1,
420 bbox_->choice_bb_units,anyLength,"pt");
422 fl_set_button(bbox_->button_clip, igp.clip);
424 // the special section
425 fl_set_input(special_->input_special, igp.special.c_str());
431 bool isValid(FL_OBJECT * ob)
433 string const input = getStringFromInput(ob);
434 return input.empty() || isValidLength(input) || isStrDbl(input);
441 ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
444 if (ob == file_->button_browse) {
445 // Get the filename from the dialog
446 string const in_name = getStringFromInput(file_->input_filename);
447 string const out_name = controller().Browse(in_name);
448 if (out_name != in_name && !out_name.empty()) {
449 fl_set_input(file_->input_filename, out_name.c_str());
451 } else if (ob == file_->check_subcaption) {
452 setEnabled(file_->input_subcaption,
453 fl_get_button(file_->check_subcaption));
454 } else if (ob == file_->check_rotate) {
455 setEnabled(file_->input_rotate_angle,
456 fl_get_button(file_->check_rotate));
457 setEnabled(file_->choice_origin,
458 fl_get_button(file_->check_rotate));
460 // the lyxview section
461 } else if (ob == lyxview_->button_lyxasis) {
462 setEnabled(lyxview_->input_lyxwidth, 0);
463 setEnabled(lyxview_->choice_width_lyxwidth, 0);
464 setEnabled(lyxview_->input_lyxheight, 0);
465 setEnabled(lyxview_->choice_width_lyxheight, 0);
466 setEnabled(lyxview_->input_lyxscale, 0);
467 } else if (ob == lyxview_->button_lyxwh) {
468 setEnabled(lyxview_->input_lyxwidth, 1);
469 setEnabled(lyxview_->choice_width_lyxwidth, 1);
470 setEnabled(lyxview_->input_lyxheight, 1);
471 setEnabled(lyxview_->choice_width_lyxheight, 1);
472 setEnabled(lyxview_->input_lyxscale, 0);
473 } else if (ob == lyxview_->button_lyxscale) {
474 setEnabled(lyxview_->input_lyxwidth, 0);
475 setEnabled(lyxview_->choice_width_lyxwidth, 0);
476 setEnabled(lyxview_->input_lyxheight, 0);
477 setEnabled(lyxview_->choice_width_lyxheight, 0);
478 setEnabled(lyxview_->input_lyxscale, 1);
479 } else if (ob == lyxview_->button_latex_values) {
480 LyXLength dummy = LyXLength(getLengthFromWidgets(size_->input_width,
481 size_->choice_width_units));
482 updateWidgetsFromLength(lyxview_->input_lyxwidth,
483 lyxview_->choice_width_lyxwidth, dummy, defaultUnit);
484 dummy = LyXLength(getLengthFromWidgets(size_->input_height,
485 size_->choice_width_units));
486 updateWidgetsFromLength(lyxview_->input_lyxheight,
487 lyxview_->choice_width_lyxheight, dummy, defaultUnit);
488 string const scale = getStringFromInput(size_->input_scale);
489 fl_set_input(lyxview_->input_lyxscale, scale.c_str());
492 } else if (!controller().bbChanged &&
493 (ob == bbox_->choice_bb_units ||
494 ob == bbox_->input_bb_x0 || ob == bbox_->input_bb_y0 ||
495 ob == bbox_->input_bb_x1 || ob == bbox_->input_bb_y1)) {
496 controller().bbChanged = true;
497 } else if (ob == bbox_->button_getBB) {
498 string const filename = getStringFromInput(file_->input_filename);
499 if (!filename.empty()) {
500 string const fileWithAbsPath = MakeAbsPath(filename, OnlyPath(filename));
501 string bb = controller().readBB(fileWithAbsPath);
503 fl_set_input(bbox_->input_bb_x0, token(bb,' ',0).c_str());
504 fl_set_input(bbox_->input_bb_y0, token(bb,' ',1).c_str());
505 fl_set_input(bbox_->input_bb_x1, token(bb,' ',2).c_str());
506 fl_set_input(bbox_->input_bb_y1, token(bb,' ',3).c_str());
507 string const unit("pt");
508 fl_set_choice_text(bbox_->choice_bb_units, unit.c_str());
510 controller().bbChanged = false;
512 fl_set_input(bbox_->input_bb_x0, "");
513 fl_set_input(bbox_->input_bb_y0, "");
514 fl_set_input(bbox_->input_bb_x1, "");
515 fl_set_input(bbox_->input_bb_y1, "");
516 fl_set_choice_text(bbox_->choice_bb_units, "pt");
520 } else if (ob == size_->button_asis) {
521 setEnabled(size_->input_width, 0);
522 setEnabled(size_->choice_width_units, 0);
523 setEnabled(size_->input_height, 0);
524 setEnabled(size_->choice_height_units, 0);
525 setEnabled(size_->check_aspectratio, 0);
526 setEnabled(size_->input_scale, 0);
527 } else if (ob == size_->button_wh) {
528 setEnabled(size_->input_width, 1);
529 setEnabled(size_->choice_width_units, 1);
530 setEnabled(size_->input_height, 1);
531 setEnabled(size_->choice_height_units, 1);
532 setEnabled(size_->check_aspectratio, 1);
533 setEnabled(size_->input_scale, 0);
534 } else if (ob == size_->button_scale) {
535 setEnabled(size_->input_width, 0);
536 setEnabled(size_->choice_width_units, 0);
537 setEnabled(size_->input_height, 0);
538 setEnabled(size_->choice_height_units, 0);
539 setEnabled(size_->check_aspectratio, 0);
540 setEnabled(size_->input_scale, 1);
541 } else if (ob == size_->button_lyx_values) {
542 LyXLength dummy = LyXLength(getLengthFromWidgets(
543 lyxview_->input_lyxwidth, lyxview_->choice_width_lyxwidth));
544 updateWidgetsFromLength(size_->input_width,
545 size_->choice_width_units, dummy, defaultUnit);
546 dummy = LyXLength(getLengthFromWidgets(lyxview_->input_lyxheight,
547 lyxview_->choice_width_lyxheight));
548 updateWidgetsFromLength(size_->input_height,
549 size_->choice_height_units, dummy, defaultUnit);
550 string const scale = getStringFromInput(lyxview_->input_lyxscale);
551 fl_set_input(size_->input_scale, scale.c_str());
554 // check if the input is valid
555 bool invalid = !isValid(bbox_->input_bb_x0);
556 invalid = invalid || !isValid(bbox_->input_bb_x1);
557 invalid = invalid || !isValid(bbox_->input_bb_y0);
558 invalid = invalid || !isValid(bbox_->input_bb_y1);
559 invalid = invalid || !isValid(size_->input_width);
560 invalid = invalid || !isValid(size_->input_height);
561 invalid = invalid || !isValid(lyxview_->input_lyxwidth);
562 invalid = invalid || !isValid(lyxview_->input_lyxheight);
564 // deactivate OK/ Apply buttons and
565 // spit out warnings if invalid
566 if (ob == bbox_->input_bb_x0 || ob == bbox_->input_bb_x1 ||
567 ob == bbox_->input_bb_y0 || ob == bbox_->input_bb_y1 ||
568 ob == size_->input_width || ob == size_->input_height ||
569 ob == lyxview_->input_lyxwidth || ob == lyxview_->input_lyxheight) {
571 fl_set_object_label(dialog_->text_warning,
572 _("Warning: Invalid Length!"));
573 fl_show_object(dialog_->text_warning);
574 return ButtonPolicy::SMI_INVALID;
576 fl_hide_object(dialog_->text_warning);
580 return ButtonPolicy::SMI_VALID;