VSpace const setVSpaceFromWidgets(FL_OBJECT * choice_type,
FL_OBJECT * input_length,
- FL_OBJECT * choice_length)
+ FL_OBJECT * choice_length,
+ bool keep)
{
// Paranoia check!
BOOST_ASSERT(choice_type && choice_type->objclass == FL_CHOICE &&
input_length && input_length->objclass == FL_INPUT &&
choice_length && choice_length->objclass == FL_CHOICE);
+ VSpace space = VSpace(VSpace::NONE);
+
switch (fl_get_choice(choice_type)) {
case 1:
- return VSpace(VSpace::NONE);
+ space = VSpace(VSpace::NONE);
+ break;
case 2:
- return VSpace(VSpace::DEFSKIP);
+ space = VSpace(VSpace::DEFSKIP);
+ break;
case 3:
- return VSpace(VSpace::SMALLSKIP);
+ space = VSpace(VSpace::SMALLSKIP);
+ break;
case 4:
- return VSpace(VSpace::MEDSKIP);
+ space = VSpace(VSpace::MEDSKIP);
+ break;
case 5:
- return VSpace(VSpace::BIGSKIP);
+ space = VSpace(VSpace::BIGSKIP);
+ break;
case 6:
- return VSpace(VSpace::VFILL);
+ space = VSpace(VSpace::VFILL);
+ break;
case 7:
- return VSpace(LyXGlueLength(
- getLengthFromWidgets(input_length, choice_length)));
+ space = VSpace(LyXGlueLength(
+ getLengthFromWidgets(input_length, choice_length)));
+ break;
}
- return VSpace(VSpace::NONE);
+ space.setKeep(keep);
+ return space;
}
void setWidgetsFromVSpace(VSpace const & space,
FL_OBJECT * choice_type,
FL_OBJECT * input_length,
- FL_OBJECT * choice_length)
+ FL_OBJECT * choice_length,
+ FL_OBJECT * check_keep)
{
// Paranoia check!
BOOST_ASSERT(choice_type && choice_type->objclass == FL_CHOICE &&
input_length && input_length->objclass == FL_INPUT &&
- choice_length && choice_length->objclass == FL_CHOICE);
+ choice_length && choice_length->objclass == FL_CHOICE &&
+ check_keep && check_keep->objclass == FL_CHECKBUTTON);
int pos = 1;
switch (space.kind()) {
break;
}
fl_set_choice(choice_type, pos);
+ fl_set_button(check_keep, space.keep());
bool const custom_vspace = space.kind() == VSpace::LENGTH;
if (custom_vspace) {
bcview().addReadOnly(dialog_->choice_unit_space);
// check validity of "length + unit" input.
- // If invalid, the label of choice_space is displayed in red.
+ // If invalid, the label of input_space is displayed in red.
addCheckedGlueLength(bcview(),
dialog_->input_space,
- dialog_->choice_space);
+ dialog_->input_space);
// trigger an input event for cut&paste with middle mouse button.
setPrehandler(dialog_->input_space);
VSpace const space =
setVSpaceFromWidgets(dialog_->choice_space,
dialog_->input_space,
- dialog_->choice_unit_space);
+ dialog_->choice_unit_space,
+ fl_get_button(dialog_->check_keep));
controller().params() = space;
}
setWidgetsFromVSpace(controller().params(),
dialog_->choice_space,
dialog_->input_space,
- dialog_->choice_unit_space);
+ dialog_->choice_unit_space,
+ dialog_->check_keep);
bool const custom_length =
fl_get_choice(dialog_->choice_space) == 7;
=============== FORM ===============
Name: form_vspace
Width: 395
-Height: 105
-Number of Objects: 8
+Height: 125
+Number of Objects: 9
--------------------
class: FL_BOX
type: FLAT_BOX
-box: 0 0 395 105
+box: 0 0 395 125
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
-box: 230 20 120 25
+box: 160 15 120 25
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Vertical space:|#V
+label: Spacing:|#S
shortcut:
resize: FL_RESIZE_X
gravity: FL_West FL_East
--------------------
class: FL_INPUT
type: NORMAL_INPUT
-box: 230 45 70 25
+box: 160 40 70 25
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label:
+label: Value:|#V
shortcut:
resize: FL_RESIZE_NONE
gravity: FL_West FL_East
callback: C_FormDialogView_InputCB
argument: 0
+--------------------
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 230 40 50 25
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label:
+shortcut:
+resize: FL_RESIZE_NONE
+gravity: FL_East FL_East
+name: choice_unit_space
+callback: C_FormDialogView_InputCB
+argument: 0
+
+--------------------
+class: FL_CHECKBUTTON
+type: PUSH_BUTTON
+box: 160 65 25 25
+boxtype: FL_NO_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Protect:|#P
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: check_keep
+callback: C_FormDialogView_InputCB
+argument: 0
+
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
-box: 5 75 90 25
+box: 5 95 90 25
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
--------------------
class: FL_BUTTON
type: RETURN_BUTTON
-box: 110 75 90 25
+box: 110 95 90 25
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
-box: 205 75 90 25
+box: 205 95 90 25
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
-box: 300 75 90 25
+box: 300 95 90 25
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
callback: C_FormDialogView_CancelCB
argument: 0
---------------------
-class: FL_CHOICE
-type: NORMAL_CHOICE
-box: 300 45 50 25
-boxtype: FL_FRAME_BOX
-colors: FL_COL1 FL_BLACK
-alignment: FL_ALIGN_LEFT
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label:
-shortcut:
-resize: FL_RESIZE_NONE
-gravity: FL_East FL_East
-name: choice_unit_space
-callback: C_FormDialogView_InputCB
-argument: 0
-
==============================
create_the_forms