Change the name of some methods and some widgets.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3822 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2002-03-25 11:16:15 +00:00
parent c8089f8bf9
commit 67fbbc0fb2
8 changed files with 104 additions and 134 deletions

View File

@ -4,6 +4,13 @@
* xforms_helpers.C: rearrange #includes. * xforms_helpers.C: rearrange #includes.
* RadioButtonGroup.[Ch]: rename some of the methods. Remove #if 0 code.
* FormPrint.C: changes associated with changes to RadioButtonGroup.
* FormGraphics.C:
* forms/form_graphics.fd: rename some of the widgets.
2002-03-22 Angus Leeming <a.leeming@ic.ac.uk> 2002-03-22 Angus Leeming <a.leeming@ic.ac.uk>
* FormGraphics.C (input): don't activate the Ok, Apply buttons if the * FormGraphics.C (input): don't activate the Ok, Apply buttons if the

View File

@ -118,8 +118,8 @@ void FormGraphics::build()
setPrehandler(lyxview_->input_lyxheight); setPrehandler(lyxview_->input_lyxheight);
setPrehandler(lyxview_->input_lyxscale); setPrehandler(lyxview_->input_lyxscale);
fl_addto_choice(lyxview_->choice_width_lyxwidth, choice_Length_WithUnit.c_str()); fl_addto_choice(lyxview_->choice_lyxwidth, choice_Length_WithUnit.c_str());
fl_addto_choice(lyxview_->choice_width_lyxheight, choice_Length_WithUnit.c_str()); fl_addto_choice(lyxview_->choice_lyxheight, choice_Length_WithUnit.c_str());
bc().addReadOnly(lyxview_->radio_pref); bc().addReadOnly(lyxview_->radio_pref);
bc().addReadOnly(lyxview_->radio_mono); bc().addReadOnly(lyxview_->radio_mono);
@ -144,8 +144,8 @@ void FormGraphics::build()
fl_set_input_filter(size_->input_scale, fl_unsigned_float_filter); fl_set_input_filter(size_->input_scale, fl_unsigned_float_filter);
fl_addto_choice(size_->choice_width_units, choice_Length_All.c_str()); fl_addto_choice(size_->choice_width, choice_Length_All.c_str());
fl_addto_choice(size_->choice_height_units, choice_Length_All.c_str()); fl_addto_choice(size_->choice_height, choice_Length_All.c_str());
bc().addReadOnly(size_->radio_asis); bc().addReadOnly(size_->radio_asis);
bc().addReadOnly(size_->radio_wh); bc().addReadOnly(size_->radio_wh);
@ -238,10 +238,10 @@ void FormGraphics::apply()
igp.lyxsize_type = InsetGraphicsParams::SCALE; igp.lyxsize_type = InsetGraphicsParams::SCALE;
igp.lyxwidth = getLyXLengthFromWidgets(lyxview_->input_lyxwidth, igp.lyxwidth = getLyXLengthFromWidgets(lyxview_->input_lyxwidth,
lyxview_->choice_width_lyxwidth); lyxview_->choice_lyxwidth);
igp.lyxheight = getLyXLengthFromWidgets(lyxview_->input_lyxheight, igp.lyxheight = getLyXLengthFromWidgets(lyxview_->input_lyxheight,
lyxview_->choice_width_lyxheight); lyxview_->choice_lyxheight);
igp.lyxscale = strToInt(getStringFromInput(lyxview_->input_lyxscale)); igp.lyxscale = strToInt(getStringFromInput(lyxview_->input_lyxscale));
@ -254,10 +254,10 @@ void FormGraphics::apply()
igp.size_type = InsetGraphicsParams::SCALE; igp.size_type = InsetGraphicsParams::SCALE;
igp.width = getLyXLengthFromWidgets(size_->input_width, igp.width = getLyXLengthFromWidgets(size_->input_width,
size_->choice_width_units); size_->choice_width);
igp.height = getLyXLengthFromWidgets(size_->input_height, igp.height = getLyXLengthFromWidgets(size_->input_height,
size_->choice_height_units); size_->choice_height);
igp.scale = strToInt(getStringFromInput(size_->input_scale)); igp.scale = strToInt(getStringFromInput(size_->input_scale));
igp.keepAspectRatio = fl_get_button(size_->check_aspectratio); igp.keepAspectRatio = fl_get_button(size_->check_aspectratio);
@ -339,35 +339,35 @@ void FormGraphics::update() {
break; break;
} }
updateWidgetsFromLength(lyxview_->input_lyxwidth, updateWidgetsFromLength(lyxview_->input_lyxwidth,
lyxview_->choice_width_lyxwidth, igp.lyxwidth, defaultUnit); lyxview_->choice_lyxwidth, igp.lyxwidth, defaultUnit);
updateWidgetsFromLength(lyxview_->input_lyxheight, updateWidgetsFromLength(lyxview_->input_lyxheight,
lyxview_->choice_width_lyxheight, igp.lyxheight, defaultUnit); lyxview_->choice_lyxheight, igp.lyxheight, defaultUnit);
fl_set_input(lyxview_->input_lyxscale, tostr(igp.lyxscale).c_str()); fl_set_input(lyxview_->input_lyxscale, tostr(igp.lyxscale).c_str());
switch (igp.lyxsize_type) { switch (igp.lyxsize_type) {
case InsetGraphicsParams::DEFAULT_SIZE: { case InsetGraphicsParams::DEFAULT_SIZE: {
fl_set_button(lyxview_->radio_lyxasis,1); fl_set_button(lyxview_->radio_lyxasis,1);
setEnabled(lyxview_->input_lyxwidth, 0); setEnabled(lyxview_->input_lyxwidth, 0);
setEnabled(lyxview_->choice_width_lyxwidth, 0); setEnabled(lyxview_->choice_lyxwidth, 0);
setEnabled(lyxview_->input_lyxheight, 0); setEnabled(lyxview_->input_lyxheight, 0);
setEnabled(lyxview_->choice_width_lyxheight, 0); setEnabled(lyxview_->choice_lyxheight, 0);
setEnabled(lyxview_->input_lyxscale, 0); setEnabled(lyxview_->input_lyxscale, 0);
break; break;
} }
case InsetGraphicsParams::WH: { case InsetGraphicsParams::WH: {
fl_set_button(lyxview_->radio_lyxwh, 1); fl_set_button(lyxview_->radio_lyxwh, 1);
setEnabled(lyxview_->input_lyxwidth, 1); setEnabled(lyxview_->input_lyxwidth, 1);
setEnabled(lyxview_->choice_width_lyxwidth, 1); setEnabled(lyxview_->choice_lyxwidth, 1);
setEnabled(lyxview_->input_lyxheight, 1); setEnabled(lyxview_->input_lyxheight, 1);
setEnabled(lyxview_->choice_width_lyxheight, 1); setEnabled(lyxview_->choice_lyxheight, 1);
setEnabled(lyxview_->input_lyxscale, 0); setEnabled(lyxview_->input_lyxscale, 0);
break; break;
} }
case InsetGraphicsParams::SCALE: { case InsetGraphicsParams::SCALE: {
fl_set_button(lyxview_->radio_lyxscale, 1); fl_set_button(lyxview_->radio_lyxscale, 1);
setEnabled(lyxview_->input_lyxwidth, 0); setEnabled(lyxview_->input_lyxwidth, 0);
setEnabled(lyxview_->choice_width_lyxwidth, 0); setEnabled(lyxview_->choice_lyxwidth, 0);
setEnabled(lyxview_->input_lyxheight, 0); setEnabled(lyxview_->input_lyxheight, 0);
setEnabled(lyxview_->choice_width_lyxheight, 0); setEnabled(lyxview_->choice_lyxheight, 0);
setEnabled(lyxview_->input_lyxscale, 1); setEnabled(lyxview_->input_lyxscale, 1);
break; break;
} }
@ -376,17 +376,17 @@ void FormGraphics::update() {
// the size section // the size section
// Update the draft and clip mode // Update the draft and clip mode
updateWidgetsFromLength(size_->input_width, updateWidgetsFromLength(size_->input_width,
size_->choice_width_units, igp.width, defaultUnit); size_->choice_width, igp.width, defaultUnit);
updateWidgetsFromLength(size_->input_height, updateWidgetsFromLength(size_->input_height,
size_->choice_height_units, igp.height, defaultUnit); size_->choice_height, igp.height, defaultUnit);
fl_set_input(size_->input_scale, tostr(igp.scale).c_str()); fl_set_input(size_->input_scale, tostr(igp.scale).c_str());
switch (igp.size_type) { switch (igp.size_type) {
case InsetGraphicsParams::DEFAULT_SIZE: { case InsetGraphicsParams::DEFAULT_SIZE: {
fl_set_button(size_->radio_asis,1); fl_set_button(size_->radio_asis,1);
setEnabled(size_->input_width, 0); setEnabled(size_->input_width, 0);
setEnabled(size_->choice_width_units, 0); setEnabled(size_->choice_width, 0);
setEnabled(size_->input_height, 0); setEnabled(size_->input_height, 0);
setEnabled(size_->choice_height_units, 0); setEnabled(size_->choice_height, 0);
setEnabled(size_->check_aspectratio, 0); setEnabled(size_->check_aspectratio, 0);
setEnabled(size_->input_scale, 0); setEnabled(size_->input_scale, 0);
break; break;
@ -394,9 +394,9 @@ void FormGraphics::update() {
case InsetGraphicsParams::WH: { case InsetGraphicsParams::WH: {
fl_set_button(size_->radio_wh, 1); fl_set_button(size_->radio_wh, 1);
setEnabled(size_->input_width, 1); setEnabled(size_->input_width, 1);
setEnabled(size_->choice_width_units, 1); setEnabled(size_->choice_width, 1);
setEnabled(size_->input_height, 1); setEnabled(size_->input_height, 1);
setEnabled(size_->choice_height_units, 1); setEnabled(size_->choice_height, 1);
setEnabled(size_->check_aspectratio, 1); setEnabled(size_->check_aspectratio, 1);
setEnabled(size_->input_scale, 0); setEnabled(size_->input_scale, 0);
break; break;
@ -404,9 +404,9 @@ void FormGraphics::update() {
case InsetGraphicsParams::SCALE: { case InsetGraphicsParams::SCALE: {
fl_set_button(size_->radio_scale, 1); fl_set_button(size_->radio_scale, 1);
setEnabled(size_->input_width, 0); setEnabled(size_->input_width, 0);
setEnabled(size_->choice_width_units, 0); setEnabled(size_->choice_width, 0);
setEnabled(size_->input_height, 0); setEnabled(size_->input_height, 0);
setEnabled(size_->choice_height_units, 0); setEnabled(size_->choice_height, 0);
setEnabled(size_->check_aspectratio, 0); setEnabled(size_->check_aspectratio, 0);
setEnabled(size_->input_scale, 1); setEnabled(size_->input_scale, 1);
break; break;
@ -503,62 +503,62 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
// the lyxview section // the lyxview section
} else if (ob == lyxview_->radio_lyxasis) { } else if (ob == lyxview_->radio_lyxasis) {
setEnabled(lyxview_->input_lyxwidth, 0); setEnabled(lyxview_->input_lyxwidth, 0);
setEnabled(lyxview_->choice_width_lyxwidth, 0); setEnabled(lyxview_->choice_lyxwidth, 0);
setEnabled(lyxview_->input_lyxheight, 0); setEnabled(lyxview_->input_lyxheight, 0);
setEnabled(lyxview_->choice_width_lyxheight, 0); setEnabled(lyxview_->choice_lyxheight, 0);
setEnabled(lyxview_->input_lyxscale, 0); setEnabled(lyxview_->input_lyxscale, 0);
} else if (ob == lyxview_->radio_lyxwh) { } else if (ob == lyxview_->radio_lyxwh) {
setEnabled(lyxview_->input_lyxwidth, 1); setEnabled(lyxview_->input_lyxwidth, 1);
setEnabled(lyxview_->choice_width_lyxwidth, 1); setEnabled(lyxview_->choice_lyxwidth, 1);
setEnabled(lyxview_->input_lyxheight, 1); setEnabled(lyxview_->input_lyxheight, 1);
setEnabled(lyxview_->choice_width_lyxheight, 1); setEnabled(lyxview_->choice_lyxheight, 1);
setEnabled(lyxview_->input_lyxscale, 0); setEnabled(lyxview_->input_lyxscale, 0);
} else if (ob == lyxview_->radio_lyxscale) { } else if (ob == lyxview_->radio_lyxscale) {
setEnabled(lyxview_->input_lyxwidth, 0); setEnabled(lyxview_->input_lyxwidth, 0);
setEnabled(lyxview_->choice_width_lyxwidth, 0); setEnabled(lyxview_->choice_lyxwidth, 0);
setEnabled(lyxview_->input_lyxheight, 0); setEnabled(lyxview_->input_lyxheight, 0);
setEnabled(lyxview_->choice_width_lyxheight, 0); setEnabled(lyxview_->choice_lyxheight, 0);
setEnabled(lyxview_->input_lyxscale, 1); setEnabled(lyxview_->input_lyxscale, 1);
} else if (ob == lyxview_->button_latex_values) { } else if (ob == lyxview_->button_latex_values) {
if (contains(fl_get_choice_text(size_->choice_width_units),'%')) if (contains(fl_get_choice_text(size_->choice_width),'%'))
Alert::alert(_("Warning!"), Alert::alert(_("Warning!"),
_("The units t%, p%, c% and l% are not allowed here."), _("The units t%, p%, c% and l% are not allowed here."),
_("Cannot use the values from LaTeX size!")); _("Cannot use the values from LaTeX size!"));
else { else {
LyXLength dummy = LyXLength dummy =
getLyXLengthFromWidgets(size_->input_width, getLyXLengthFromWidgets(size_->input_width,
size_->choice_width_units); size_->choice_width);
updateWidgetsFromLength(lyxview_->input_lyxwidth, updateWidgetsFromLength(lyxview_->input_lyxwidth,
lyxview_->choice_width_lyxwidth, lyxview_->choice_lyxwidth,
dummy, defaultUnit); dummy, defaultUnit);
dummy = getLyXLengthFromWidgets(size_->input_height, dummy = getLyXLengthFromWidgets(size_->input_height,
size_->choice_height_units); size_->choice_height);
updateWidgetsFromLength(lyxview_->input_lyxheight, updateWidgetsFromLength(lyxview_->input_lyxheight,
lyxview_->choice_width_lyxheight, lyxview_->choice_lyxheight,
dummy, defaultUnit); dummy, defaultUnit);
string const scale = getStringFromInput(size_->input_scale); string const scale = getStringFromInput(size_->input_scale);
fl_set_input(lyxview_->input_lyxscale, scale.c_str()); fl_set_input(lyxview_->input_lyxscale, scale.c_str());
if (fl_get_button (size_->radio_asis) == 1) { if (fl_get_button (size_->radio_asis) == 1) {
fl_set_button (lyxview_->radio_lyxasis, 1); fl_set_button (lyxview_->radio_lyxasis, 1);
setEnabled(lyxview_->input_lyxwidth, 0); setEnabled(lyxview_->input_lyxwidth, 0);
setEnabled(lyxview_->choice_width_lyxwidth, 0); setEnabled(lyxview_->choice_lyxwidth, 0);
setEnabled(lyxview_->input_lyxheight, 0); setEnabled(lyxview_->input_lyxheight, 0);
setEnabled(lyxview_->choice_width_lyxheight, 0); setEnabled(lyxview_->choice_lyxheight, 0);
setEnabled(lyxview_->input_lyxscale, 0); setEnabled(lyxview_->input_lyxscale, 0);
} else if (fl_get_button (size_->radio_wh) == 1) { } else if (fl_get_button (size_->radio_wh) == 1) {
fl_set_button (lyxview_->radio_lyxwh, 1); fl_set_button (lyxview_->radio_lyxwh, 1);
setEnabled(lyxview_->input_lyxwidth, 1); setEnabled(lyxview_->input_lyxwidth, 1);
setEnabled(lyxview_->choice_width_lyxwidth, 1); setEnabled(lyxview_->choice_lyxwidth, 1);
setEnabled(lyxview_->input_lyxheight, 1); setEnabled(lyxview_->input_lyxheight, 1);
setEnabled(lyxview_->choice_width_lyxheight, 1); setEnabled(lyxview_->choice_lyxheight, 1);
setEnabled(lyxview_->input_lyxscale, 0); setEnabled(lyxview_->input_lyxscale, 0);
} else if (fl_get_button (size_->radio_scale) ==1) { } else if (fl_get_button (size_->radio_scale) ==1) {
fl_set_button (lyxview_->radio_lyxscale, 1); fl_set_button (lyxview_->radio_lyxscale, 1);
setEnabled(lyxview_->input_lyxwidth, 0); setEnabled(lyxview_->input_lyxwidth, 0);
setEnabled(lyxview_->choice_width_lyxwidth, 0); setEnabled(lyxview_->choice_lyxwidth, 0);
setEnabled(lyxview_->input_lyxheight, 0); setEnabled(lyxview_->input_lyxheight, 0);
setEnabled(lyxview_->choice_width_lyxheight, 0); setEnabled(lyxview_->choice_lyxheight, 0);
setEnabled(lyxview_->input_lyxscale, 1); setEnabled(lyxview_->input_lyxscale, 1);
} }
} }
@ -594,60 +594,60 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
// the size section // the size section
} else if (ob == size_->radio_asis) { } else if (ob == size_->radio_asis) {
setEnabled(size_->input_width, 0); setEnabled(size_->input_width, 0);
setEnabled(size_->choice_width_units, 0); setEnabled(size_->choice_width, 0);
setEnabled(size_->input_height, 0); setEnabled(size_->input_height, 0);
setEnabled(size_->choice_height_units, 0); setEnabled(size_->choice_height, 0);
setEnabled(size_->check_aspectratio, 0); setEnabled(size_->check_aspectratio, 0);
setEnabled(size_->input_scale, 0); setEnabled(size_->input_scale, 0);
} else if (ob == size_->radio_wh) { } else if (ob == size_->radio_wh) {
setEnabled(size_->input_width, 1); setEnabled(size_->input_width, 1);
setEnabled(size_->choice_width_units, 1); setEnabled(size_->choice_width, 1);
setEnabled(size_->input_height, 1); setEnabled(size_->input_height, 1);
setEnabled(size_->choice_height_units, 1); setEnabled(size_->choice_height, 1);
setEnabled(size_->check_aspectratio, 1); setEnabled(size_->check_aspectratio, 1);
setEnabled(size_->input_scale, 0); setEnabled(size_->input_scale, 0);
} else if (ob == size_->radio_scale) { } else if (ob == size_->radio_scale) {
setEnabled(size_->input_width, 0); setEnabled(size_->input_width, 0);
setEnabled(size_->choice_width_units, 0); setEnabled(size_->choice_width, 0);
setEnabled(size_->input_height, 0); setEnabled(size_->input_height, 0);
setEnabled(size_->choice_height_units, 0); setEnabled(size_->choice_height, 0);
setEnabled(size_->check_aspectratio, 0); setEnabled(size_->check_aspectratio, 0);
setEnabled(size_->input_scale, 1); setEnabled(size_->input_scale, 1);
} else if (ob == size_->button_lyx_values) { } else if (ob == size_->button_lyx_values) {
LyXLength dummy = getLyXLengthFromWidgets(lyxview_->input_lyxwidth, LyXLength dummy = getLyXLengthFromWidgets(lyxview_->input_lyxwidth,
lyxview_->choice_width_lyxwidth); lyxview_->choice_lyxwidth);
updateWidgetsFromLength(size_->input_width, updateWidgetsFromLength(size_->input_width,
size_->choice_width_units, size_->choice_width,
dummy, defaultUnit); dummy, defaultUnit);
dummy = getLyXLengthFromWidgets(lyxview_->input_lyxheight, dummy = getLyXLengthFromWidgets(lyxview_->input_lyxheight,
lyxview_->choice_width_lyxheight); lyxview_->choice_lyxheight);
updateWidgetsFromLength(size_->input_height, updateWidgetsFromLength(size_->input_height,
size_->choice_height_units, size_->choice_height,
dummy, defaultUnit); dummy, defaultUnit);
string const scale = getStringFromInput(lyxview_->input_lyxscale); string const scale = getStringFromInput(lyxview_->input_lyxscale);
fl_set_input(size_->input_scale, scale.c_str()); fl_set_input(size_->input_scale, scale.c_str());
if (fl_get_button (lyxview_->radio_lyxasis) == 1) { if (fl_get_button (lyxview_->radio_lyxasis) == 1) {
fl_set_button (size_->radio_asis, 1); fl_set_button (size_->radio_asis, 1);
setEnabled(size_->input_width, 0); setEnabled(size_->input_width, 0);
setEnabled(size_->choice_width_units, 0); setEnabled(size_->choice_width, 0);
setEnabled(size_->input_height, 0); setEnabled(size_->input_height, 0);
setEnabled(size_->choice_height_units, 0); setEnabled(size_->choice_height, 0);
setEnabled(size_->check_aspectratio, 0); setEnabled(size_->check_aspectratio, 0);
setEnabled(size_->input_scale, 0); setEnabled(size_->input_scale, 0);
} else if (fl_get_button (lyxview_->radio_lyxwh) == 1) { } else if (fl_get_button (lyxview_->radio_lyxwh) == 1) {
fl_set_button (size_->radio_wh, 1); fl_set_button (size_->radio_wh, 1);
setEnabled(size_->input_width, 1); setEnabled(size_->input_width, 1);
setEnabled(size_->choice_width_units, 1); setEnabled(size_->choice_width, 1);
setEnabled(size_->input_height, 1); setEnabled(size_->input_height, 1);
setEnabled(size_->choice_height_units, 1); setEnabled(size_->choice_height, 1);
setEnabled(size_->check_aspectratio, 1); setEnabled(size_->check_aspectratio, 1);
setEnabled(size_->input_scale, 0); setEnabled(size_->input_scale, 0);
} else if (fl_get_button (lyxview_->radio_lyxscale) ==1) { } else if (fl_get_button (lyxview_->radio_lyxscale) ==1) {
fl_set_button (size_->radio_scale, 1); fl_set_button (size_->radio_scale, 1);
setEnabled(size_->input_width, 0); setEnabled(size_->input_width, 0);
setEnabled(size_->choice_width_units, 0); setEnabled(size_->choice_width, 0);
setEnabled(size_->input_height, 0); setEnabled(size_->input_height, 0);
setEnabled(size_->choice_height_units, 0); setEnabled(size_->choice_height, 0);
setEnabled(size_->check_aspectratio, 0); setEnabled(size_->check_aspectratio, 0);
setEnabled(size_->input_scale, 1); setEnabled(size_->input_scale, 1);
} }

View File

@ -80,29 +80,22 @@ void FormPrint::build()
fl_set_input_maxchars(dialog_->input_count, 4); // 9999 fl_set_input_maxchars(dialog_->input_count, 4); // 9999
target_.reset(); target_.reset();
target_.registerRadioButton(dialog_->radio_printer, target_.init(dialog_->radio_printer, PrinterParams::PRINTER);
PrinterParams::PRINTER); target_.init(dialog_->radio_file, PrinterParams::FILE);
target_.registerRadioButton(dialog_->radio_file,
PrinterParams::FILE);
order_.reset(); order_.reset();
order_.registerRadioButton(dialog_->radio_order_reverse, order_.init(dialog_->radio_order_reverse, true);
true); order_.init(dialog_->radio_order_normal, false);
order_.registerRadioButton(dialog_->radio_order_normal,
false);
which_.reset(); which_.reset();
which_.registerRadioButton(dialog_->radio_odd_pages, which_.init(dialog_->radio_odd_pages, PrinterParams::ODD);
PrinterParams::ODD); which_.init(dialog_->radio_even_pages, PrinterParams::EVEN);
which_.registerRadioButton(dialog_->radio_even_pages, which_.init(dialog_->radio_all_pages, PrinterParams::ALL);
PrinterParams::EVEN);
which_.registerRadioButton(dialog_->radio_all_pages,
PrinterParams::ALL);
} }
void FormPrint::apply() void FormPrint::apply()
{ {
PrinterParams::WhichPages PrinterParams::WhichPages
wp(static_cast<PrinterParams::WhichPages>(which_.getButton())); wp(static_cast<PrinterParams::WhichPages>(which_.get()));
string from; string from;
int to(0); int to(0);
@ -116,13 +109,13 @@ void FormPrint::apply()
} }
PrinterParams::Target PrinterParams::Target
t(static_cast<PrinterParams::Target>(target_.getButton())); t(static_cast<PrinterParams::Target>(target_.get()));
PrinterParams const pp(t, PrinterParams const pp(t,
string(fl_get_input(dialog_->input_printer)), string(fl_get_input(dialog_->input_printer)),
string(fl_get_input(dialog_->input_file)), string(fl_get_input(dialog_->input_file)),
wp, from, to, wp, from, to,
static_cast<bool>(order_.getButton()), static_cast<bool>(order_.get()),
!static_cast<bool>(fl_get_button(dialog_->check_collated)), !static_cast<bool>(fl_get_button(dialog_->check_collated)),
strToInt(fl_get_input(dialog_->input_count))); strToInt(fl_get_input(dialog_->input_count)));
@ -137,9 +130,9 @@ void FormPrint::update()
fl_set_input(dialog_->input_printer, pp.printer_name.c_str()); fl_set_input(dialog_->input_printer, pp.printer_name.c_str());
fl_set_input(dialog_->input_file, pp.file_name.c_str()); fl_set_input(dialog_->input_file, pp.file_name.c_str());
target_.setButton(pp.target); target_.set(pp.target);
order_.setButton(pp.reverse_order); order_.set(pp.reverse_order);
which_.setButton(pp.which_pages); which_.set(pp.which_pages);
// hmmm... maybe a bit weird but maybe not // hmmm... maybe a bit weird but maybe not
// we might just be remembering the last // we might just be remembering the last

View File

@ -28,7 +28,7 @@ using std::find_if;
using std::endl; using std::endl;
void RadioButtonGroup::registerRadioButton(FL_OBJECT *button, int value) void RadioButtonGroup::init(FL_OBJECT *button, size_type value)
{ {
map.push_back(ButtonValuePair(button, value)); map.push_back(ButtonValuePair(button, value));
} }
@ -40,43 +40,11 @@ void RadioButtonGroup::reset()
} }
#if 0 void RadioButtonGroup::set(size_type value)
// Functor to help us in our work, we should try to find how to achieve
// this with only STL predicates, but its easier to write this than to
// dig. If you can find the equivalent STL predicate combination, let me
// know.
//
// The idea is to take a pair and a value and return true when the second
// element in the pair equals the value.
template < typename T >
struct equal_to_second_in_pair
{ {
typedef bool result_type;
typedef T first_argument_type;
typedef typename T::second_type second_argument_type;
bool operator() (
pair < typename T::first_type, typename T::second_type > const & left,
typename T::second_type const & right) const
{
return left.second == right;
}
};
#endif
void RadioButtonGroup::setButton(int value)
{
#if 0
ButtonValueMap::const_iterator it =
find_if(map.begin(), map.end(),
bind2nd(equal_to_second_in_pair<ButtonValuePair>(),
value));
#else
ButtonValueMap::const_iterator it = ButtonValueMap::const_iterator it =
find_if(map.begin(), map.end(), find_if(map.begin(), map.end(),
lyx::equal_2nd_in_pair<ButtonValuePair>(value)); lyx::equal_2nd_in_pair<ButtonValuePair>(value));
#endif
// If we found nothing, report it and return // If we found nothing, report it and return
if (it == map.end()) { if (it == map.end()) {
@ -99,10 +67,10 @@ struct is_set_button {
}; };
int RadioButtonGroup::getButton() RadioButtonGroup::size_type RadioButtonGroup::get() const
{ {
// Find the first button that is active // Find the first button that is active
ButtonValueMap::iterator it = ButtonValueMap::const_iterator it =
find_if(map.begin(), map.end(), find_if(map.begin(), map.end(),
is_set_button<ButtonValuePair> ()); is_set_button<ButtonValuePair> ());

View File

@ -12,15 +12,14 @@
#ifndef RADIOBUTTONGROUP_H #ifndef RADIOBUTTONGROUP_H
#define RADIOBUTTONGROUP_H #define RADIOBUTTONGROUP_H
#include <vector>
#include <utility>
#include FORMS_H_LOCATION
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface
#endif #endif
#include "support/types.h"
#include <vector>
#include <utility>
#include FORMS_H_LOCATION
/** This class simplifies the work with a group of radio buttons, /** This class simplifies the work with a group of radio buttons,
* the idea is that you register a bunch of radio buttons with the accompanying * the idea is that you register a bunch of radio buttons with the accompanying
@ -29,23 +28,26 @@
*/ */
class RadioButtonGroup { class RadioButtonGroup {
public: public:
///
typedef lyx::size_type size_type;
/// Constructor. Allocate space for 'n' items in the group. /// Constructor. Allocate space for 'n' items in the group.
RadioButtonGroup(unsigned n = 5) : map(n) {}; RadioButtonGroup(unsigned n = 5) : map(n) {};
/// Register a radio button with it's corresponding value. /// Register a radio button with it's corresponding value.
void registerRadioButton(FL_OBJECT * button, int value); void init(FL_OBJECT * button, size_type value);
/// Reset registrations. /// Reset registrations.
void reset(); void reset();
// Set the active button. // Set the active button.
void setButton(int value); void set(size_type value);
// Get the active button. // Get the active button.
int getButton(); size_type get() const;
private: private:
/// ///
typedef std::pair<FL_OBJECT *, int> ButtonValuePair; typedef std::pair<FL_OBJECT *, size_type> ButtonValuePair;
/// ///
typedef std::vector<ButtonValuePair> ButtonValueMap; typedef std::vector<ButtonValuePair> ButtonValueMap;
/// ///

View File

@ -234,7 +234,7 @@ FD_form_size * FormGraphics::build_size()
} }
fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0); fl_set_object_callback(obj, C_FormBaseInputCB, 0);
fdui->choice_width_units = obj = fl_add_choice(FL_NORMAL_CHOICE, 290, 130, 60, 30, ""); fdui->choice_width = obj = fl_add_choice(FL_NORMAL_CHOICE, 290, 130, 60, 30, "");
fl_set_object_boxtype(obj, FL_FRAME_BOX); fl_set_object_boxtype(obj, FL_FRAME_BOX);
fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0); fl_set_object_callback(obj, C_FormBaseInputCB, 0);
@ -245,7 +245,7 @@ FD_form_size * FormGraphics::build_size()
} }
fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0); fl_set_object_callback(obj, C_FormBaseInputCB, 0);
fdui->choice_height_units = obj = fl_add_choice(FL_NORMAL_CHOICE, 290, 165, 60, 30, ""); fdui->choice_height = obj = fl_add_choice(FL_NORMAL_CHOICE, 290, 165, 60, 30, "");
fl_set_object_boxtype(obj, FL_FRAME_BOX); fl_set_object_boxtype(obj, FL_FRAME_BOX);
fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0); fl_set_object_callback(obj, C_FormBaseInputCB, 0);
@ -494,7 +494,7 @@ FD_form_lyxview * FormGraphics::build_lyxview()
} }
fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0); fl_set_object_callback(obj, C_FormBaseInputCB, 0);
fdui->choice_width_lyxwidth = obj = fl_add_choice(FL_NORMAL_CHOICE, 425, 155, 50, 30, ""); fdui->choice_lyxwidth = obj = fl_add_choice(FL_NORMAL_CHOICE, 425, 155, 50, 30, "");
fl_set_object_boxtype(obj, FL_FRAME_BOX); fl_set_object_boxtype(obj, FL_FRAME_BOX);
fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0); fl_set_object_callback(obj, C_FormBaseInputCB, 0);
@ -505,7 +505,7 @@ FD_form_lyxview * FormGraphics::build_lyxview()
} }
fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0); fl_set_object_callback(obj, C_FormBaseInputCB, 0);
fdui->choice_width_lyxheight = obj = fl_add_choice(FL_NORMAL_CHOICE, 425, 190, 50, 30, ""); fdui->choice_lyxheight = obj = fl_add_choice(FL_NORMAL_CHOICE, 425, 190, 50, 30, "");
fl_set_object_boxtype(obj, FL_FRAME_BOX); fl_set_object_boxtype(obj, FL_FRAME_BOX);
fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0); fl_set_object_callback(obj, C_FormBaseInputCB, 0);

View File

@ -57,9 +57,9 @@ struct FD_form_size {
FL_OBJECT *radio_wh; FL_OBJECT *radio_wh;
FL_OBJECT *input_scale; FL_OBJECT *input_scale;
FL_OBJECT *input_width; FL_OBJECT *input_width;
FL_OBJECT *choice_width_units; FL_OBJECT *choice_width;
FL_OBJECT *input_height; FL_OBJECT *input_height;
FL_OBJECT *choice_height_units; FL_OBJECT *choice_height;
FL_OBJECT *check_aspectratio; FL_OBJECT *check_aspectratio;
FL_OBJECT *button_lyx_values; FL_OBJECT *button_lyx_values;
}; };
@ -95,9 +95,9 @@ struct FD_form_lyxview {
FL_OBJECT *radio_color; FL_OBJECT *radio_color;
FL_OBJECT *radio_nodisplay; FL_OBJECT *radio_nodisplay;
FL_OBJECT *input_lyxwidth; FL_OBJECT *input_lyxwidth;
FL_OBJECT *choice_width_lyxwidth; FL_OBJECT *choice_lyxwidth;
FL_OBJECT *input_lyxheight; FL_OBJECT *input_lyxheight;
FL_OBJECT *choice_width_lyxheight; FL_OBJECT *choice_lyxheight;
FL_OBJECT *button_latex_values; FL_OBJECT *button_latex_values;
}; };

View File

@ -597,7 +597,7 @@ label:
shortcut: shortcut:
resize: FL_RESIZE_ALL resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
name: choice_width_units name: choice_width
callback: C_FormBaseInputCB callback: C_FormBaseInputCB
argument: 0 argument: 0
@ -633,7 +633,7 @@ label:
shortcut: shortcut:
resize: FL_RESIZE_ALL resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
name: choice_height_units name: choice_height
callback: C_FormBaseInputCB callback: C_FormBaseInputCB
argument: 0 argument: 0
@ -1281,7 +1281,7 @@ label:
shortcut: shortcut:
resize: FL_RESIZE_ALL resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
name: choice_width_lyxwidth name: choice_lyxwidth
callback: C_FormBaseInputCB callback: C_FormBaseInputCB
argument: 0 argument: 0
@ -1317,7 +1317,7 @@ label:
shortcut: shortcut:
resize: FL_RESIZE_ALL resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
name: choice_width_lyxheight name: choice_lyxheight
callback: C_FormBaseInputCB callback: C_FormBaseInputCB
argument: 0 argument: 0