mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 18:24:48 +00:00
Follow J�rgen Spitzm�ller's lead and add a 'keep' option to the xforms dialog.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8158 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d2eb113909
commit
e1515e6d78
@ -1,3 +1,9 @@
|
||||
2003-11-29 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* FormVSpace.C
|
||||
* forms/form_vspace.fd: follow Jürgen Spitzmüller's lead in QVSpace
|
||||
and add a 'keep' option.
|
||||
|
||||
2003-11-28 Michael Schmitt <michael.schmitt@teststep.org>
|
||||
|
||||
* src/frontends/xforms/forms/form_box.fd:
|
||||
|
@ -67,44 +67,57 @@ void validateVSpaceWidgets(FL_OBJECT * choice_type, FL_OBJECT * input_length)
|
||||
|
||||
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()) {
|
||||
@ -131,6 +144,7 @@ void setWidgetsFromVSpace(VSpace const & space,
|
||||
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) {
|
||||
@ -170,10 +184,10 @@ void FormVSpace::build()
|
||||
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);
|
||||
@ -229,7 +243,8 @@ void FormVSpace::apply()
|
||||
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;
|
||||
}
|
||||
@ -240,7 +255,8 @@ void FormVSpace::update()
|
||||
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;
|
||||
|
@ -10,13 +10,13 @@ SnapGrid: 5
|
||||
=============== 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
|
||||
@ -34,14 +34,14 @@ argument:
|
||||
--------------------
|
||||
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
|
||||
@ -52,14 +52,14 @@ argument: 0
|
||||
--------------------
|
||||
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
|
||||
@ -67,10 +67,46 @@ name: input_space
|
||||
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
|
||||
@ -88,7 +124,7 @@ argument: 0
|
||||
--------------------
|
||||
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
|
||||
@ -106,7 +142,7 @@ argument: 0
|
||||
--------------------
|
||||
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
|
||||
@ -124,7 +160,7 @@ argument: 0
|
||||
--------------------
|
||||
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
|
||||
@ -139,23 +175,5 @@ name: button_close
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user