mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
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:
parent
c8089f8bf9
commit
67fbbc0fb2
@ -4,6 +4,13 @@
|
||||
|
||||
* 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>
|
||||
|
||||
* FormGraphics.C (input): don't activate the Ok, Apply buttons if the
|
||||
|
@ -118,8 +118,8 @@ void FormGraphics::build()
|
||||
setPrehandler(lyxview_->input_lyxheight);
|
||||
setPrehandler(lyxview_->input_lyxscale);
|
||||
|
||||
fl_addto_choice(lyxview_->choice_width_lyxwidth, choice_Length_WithUnit.c_str());
|
||||
fl_addto_choice(lyxview_->choice_width_lyxheight, choice_Length_WithUnit.c_str());
|
||||
fl_addto_choice(lyxview_->choice_lyxwidth, 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_mono);
|
||||
@ -144,8 +144,8 @@ void FormGraphics::build()
|
||||
|
||||
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_height_units, choice_Length_All.c_str());
|
||||
fl_addto_choice(size_->choice_width, 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_wh);
|
||||
@ -238,10 +238,10 @@ void FormGraphics::apply()
|
||||
igp.lyxsize_type = InsetGraphicsParams::SCALE;
|
||||
|
||||
igp.lyxwidth = getLyXLengthFromWidgets(lyxview_->input_lyxwidth,
|
||||
lyxview_->choice_width_lyxwidth);
|
||||
lyxview_->choice_lyxwidth);
|
||||
|
||||
igp.lyxheight = getLyXLengthFromWidgets(lyxview_->input_lyxheight,
|
||||
lyxview_->choice_width_lyxheight);
|
||||
lyxview_->choice_lyxheight);
|
||||
|
||||
igp.lyxscale = strToInt(getStringFromInput(lyxview_->input_lyxscale));
|
||||
|
||||
@ -254,10 +254,10 @@ void FormGraphics::apply()
|
||||
igp.size_type = InsetGraphicsParams::SCALE;
|
||||
|
||||
igp.width = getLyXLengthFromWidgets(size_->input_width,
|
||||
size_->choice_width_units);
|
||||
size_->choice_width);
|
||||
|
||||
igp.height = getLyXLengthFromWidgets(size_->input_height,
|
||||
size_->choice_height_units);
|
||||
size_->choice_height);
|
||||
|
||||
igp.scale = strToInt(getStringFromInput(size_->input_scale));
|
||||
igp.keepAspectRatio = fl_get_button(size_->check_aspectratio);
|
||||
@ -339,35 +339,35 @@ void FormGraphics::update() {
|
||||
break;
|
||||
}
|
||||
updateWidgetsFromLength(lyxview_->input_lyxwidth,
|
||||
lyxview_->choice_width_lyxwidth, igp.lyxwidth, defaultUnit);
|
||||
lyxview_->choice_lyxwidth, igp.lyxwidth, defaultUnit);
|
||||
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());
|
||||
switch (igp.lyxsize_type) {
|
||||
case InsetGraphicsParams::DEFAULT_SIZE: {
|
||||
fl_set_button(lyxview_->radio_lyxasis,1);
|
||||
setEnabled(lyxview_->input_lyxwidth, 0);
|
||||
setEnabled(lyxview_->choice_width_lyxwidth, 0);
|
||||
setEnabled(lyxview_->choice_lyxwidth, 0);
|
||||
setEnabled(lyxview_->input_lyxheight, 0);
|
||||
setEnabled(lyxview_->choice_width_lyxheight, 0);
|
||||
setEnabled(lyxview_->choice_lyxheight, 0);
|
||||
setEnabled(lyxview_->input_lyxscale, 0);
|
||||
break;
|
||||
}
|
||||
case InsetGraphicsParams::WH: {
|
||||
fl_set_button(lyxview_->radio_lyxwh, 1);
|
||||
setEnabled(lyxview_->input_lyxwidth, 1);
|
||||
setEnabled(lyxview_->choice_width_lyxwidth, 1);
|
||||
setEnabled(lyxview_->choice_lyxwidth, 1);
|
||||
setEnabled(lyxview_->input_lyxheight, 1);
|
||||
setEnabled(lyxview_->choice_width_lyxheight, 1);
|
||||
setEnabled(lyxview_->choice_lyxheight, 1);
|
||||
setEnabled(lyxview_->input_lyxscale, 0);
|
||||
break;
|
||||
}
|
||||
case InsetGraphicsParams::SCALE: {
|
||||
fl_set_button(lyxview_->radio_lyxscale, 1);
|
||||
setEnabled(lyxview_->input_lyxwidth, 0);
|
||||
setEnabled(lyxview_->choice_width_lyxwidth, 0);
|
||||
setEnabled(lyxview_->choice_lyxwidth, 0);
|
||||
setEnabled(lyxview_->input_lyxheight, 0);
|
||||
setEnabled(lyxview_->choice_width_lyxheight, 0);
|
||||
setEnabled(lyxview_->choice_lyxheight, 0);
|
||||
setEnabled(lyxview_->input_lyxscale, 1);
|
||||
break;
|
||||
}
|
||||
@ -376,17 +376,17 @@ void FormGraphics::update() {
|
||||
// the size section
|
||||
// Update the draft and clip mode
|
||||
updateWidgetsFromLength(size_->input_width,
|
||||
size_->choice_width_units, igp.width, defaultUnit);
|
||||
size_->choice_width, igp.width, defaultUnit);
|
||||
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());
|
||||
switch (igp.size_type) {
|
||||
case InsetGraphicsParams::DEFAULT_SIZE: {
|
||||
fl_set_button(size_->radio_asis,1);
|
||||
setEnabled(size_->input_width, 0);
|
||||
setEnabled(size_->choice_width_units, 0);
|
||||
setEnabled(size_->choice_width, 0);
|
||||
setEnabled(size_->input_height, 0);
|
||||
setEnabled(size_->choice_height_units, 0);
|
||||
setEnabled(size_->choice_height, 0);
|
||||
setEnabled(size_->check_aspectratio, 0);
|
||||
setEnabled(size_->input_scale, 0);
|
||||
break;
|
||||
@ -394,9 +394,9 @@ void FormGraphics::update() {
|
||||
case InsetGraphicsParams::WH: {
|
||||
fl_set_button(size_->radio_wh, 1);
|
||||
setEnabled(size_->input_width, 1);
|
||||
setEnabled(size_->choice_width_units, 1);
|
||||
setEnabled(size_->choice_width, 1);
|
||||
setEnabled(size_->input_height, 1);
|
||||
setEnabled(size_->choice_height_units, 1);
|
||||
setEnabled(size_->choice_height, 1);
|
||||
setEnabled(size_->check_aspectratio, 1);
|
||||
setEnabled(size_->input_scale, 0);
|
||||
break;
|
||||
@ -404,9 +404,9 @@ void FormGraphics::update() {
|
||||
case InsetGraphicsParams::SCALE: {
|
||||
fl_set_button(size_->radio_scale, 1);
|
||||
setEnabled(size_->input_width, 0);
|
||||
setEnabled(size_->choice_width_units, 0);
|
||||
setEnabled(size_->choice_width, 0);
|
||||
setEnabled(size_->input_height, 0);
|
||||
setEnabled(size_->choice_height_units, 0);
|
||||
setEnabled(size_->choice_height, 0);
|
||||
setEnabled(size_->check_aspectratio, 0);
|
||||
setEnabled(size_->input_scale, 1);
|
||||
break;
|
||||
@ -503,62 +503,62 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
|
||||
// the lyxview section
|
||||
} else if (ob == lyxview_->radio_lyxasis) {
|
||||
setEnabled(lyxview_->input_lyxwidth, 0);
|
||||
setEnabled(lyxview_->choice_width_lyxwidth, 0);
|
||||
setEnabled(lyxview_->choice_lyxwidth, 0);
|
||||
setEnabled(lyxview_->input_lyxheight, 0);
|
||||
setEnabled(lyxview_->choice_width_lyxheight, 0);
|
||||
setEnabled(lyxview_->choice_lyxheight, 0);
|
||||
setEnabled(lyxview_->input_lyxscale, 0);
|
||||
} else if (ob == lyxview_->radio_lyxwh) {
|
||||
setEnabled(lyxview_->input_lyxwidth, 1);
|
||||
setEnabled(lyxview_->choice_width_lyxwidth, 1);
|
||||
setEnabled(lyxview_->choice_lyxwidth, 1);
|
||||
setEnabled(lyxview_->input_lyxheight, 1);
|
||||
setEnabled(lyxview_->choice_width_lyxheight, 1);
|
||||
setEnabled(lyxview_->choice_lyxheight, 1);
|
||||
setEnabled(lyxview_->input_lyxscale, 0);
|
||||
} else if (ob == lyxview_->radio_lyxscale) {
|
||||
setEnabled(lyxview_->input_lyxwidth, 0);
|
||||
setEnabled(lyxview_->choice_width_lyxwidth, 0);
|
||||
setEnabled(lyxview_->choice_lyxwidth, 0);
|
||||
setEnabled(lyxview_->input_lyxheight, 0);
|
||||
setEnabled(lyxview_->choice_width_lyxheight, 0);
|
||||
setEnabled(lyxview_->choice_lyxheight, 0);
|
||||
setEnabled(lyxview_->input_lyxscale, 1);
|
||||
} 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!"),
|
||||
_("The units t%, p%, c% and l% are not allowed here."),
|
||||
_("Cannot use the values from LaTeX size!"));
|
||||
else {
|
||||
LyXLength dummy =
|
||||
getLyXLengthFromWidgets(size_->input_width,
|
||||
size_->choice_width_units);
|
||||
size_->choice_width);
|
||||
updateWidgetsFromLength(lyxview_->input_lyxwidth,
|
||||
lyxview_->choice_width_lyxwidth,
|
||||
lyxview_->choice_lyxwidth,
|
||||
dummy, defaultUnit);
|
||||
|
||||
dummy = getLyXLengthFromWidgets(size_->input_height,
|
||||
size_->choice_height_units);
|
||||
size_->choice_height);
|
||||
updateWidgetsFromLength(lyxview_->input_lyxheight,
|
||||
lyxview_->choice_width_lyxheight,
|
||||
lyxview_->choice_lyxheight,
|
||||
dummy, defaultUnit);
|
||||
string const scale = getStringFromInput(size_->input_scale);
|
||||
fl_set_input(lyxview_->input_lyxscale, scale.c_str());
|
||||
if (fl_get_button (size_->radio_asis) == 1) {
|
||||
fl_set_button (lyxview_->radio_lyxasis, 1);
|
||||
setEnabled(lyxview_->input_lyxwidth, 0);
|
||||
setEnabled(lyxview_->choice_width_lyxwidth, 0);
|
||||
setEnabled(lyxview_->choice_lyxwidth, 0);
|
||||
setEnabled(lyxview_->input_lyxheight, 0);
|
||||
setEnabled(lyxview_->choice_width_lyxheight, 0);
|
||||
setEnabled(lyxview_->choice_lyxheight, 0);
|
||||
setEnabled(lyxview_->input_lyxscale, 0);
|
||||
} else if (fl_get_button (size_->radio_wh) == 1) {
|
||||
fl_set_button (lyxview_->radio_lyxwh, 1);
|
||||
setEnabled(lyxview_->input_lyxwidth, 1);
|
||||
setEnabled(lyxview_->choice_width_lyxwidth, 1);
|
||||
setEnabled(lyxview_->choice_lyxwidth, 1);
|
||||
setEnabled(lyxview_->input_lyxheight, 1);
|
||||
setEnabled(lyxview_->choice_width_lyxheight, 1);
|
||||
setEnabled(lyxview_->choice_lyxheight, 1);
|
||||
setEnabled(lyxview_->input_lyxscale, 0);
|
||||
} else if (fl_get_button (size_->radio_scale) ==1) {
|
||||
fl_set_button (lyxview_->radio_lyxscale, 1);
|
||||
setEnabled(lyxview_->input_lyxwidth, 0);
|
||||
setEnabled(lyxview_->choice_width_lyxwidth, 0);
|
||||
setEnabled(lyxview_->choice_lyxwidth, 0);
|
||||
setEnabled(lyxview_->input_lyxheight, 0);
|
||||
setEnabled(lyxview_->choice_width_lyxheight, 0);
|
||||
setEnabled(lyxview_->choice_lyxheight, 0);
|
||||
setEnabled(lyxview_->input_lyxscale, 1);
|
||||
}
|
||||
}
|
||||
@ -594,60 +594,60 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
|
||||
// the size section
|
||||
} else if (ob == size_->radio_asis) {
|
||||
setEnabled(size_->input_width, 0);
|
||||
setEnabled(size_->choice_width_units, 0);
|
||||
setEnabled(size_->choice_width, 0);
|
||||
setEnabled(size_->input_height, 0);
|
||||
setEnabled(size_->choice_height_units, 0);
|
||||
setEnabled(size_->choice_height, 0);
|
||||
setEnabled(size_->check_aspectratio, 0);
|
||||
setEnabled(size_->input_scale, 0);
|
||||
} else if (ob == size_->radio_wh) {
|
||||
setEnabled(size_->input_width, 1);
|
||||
setEnabled(size_->choice_width_units, 1);
|
||||
setEnabled(size_->choice_width, 1);
|
||||
setEnabled(size_->input_height, 1);
|
||||
setEnabled(size_->choice_height_units, 1);
|
||||
setEnabled(size_->choice_height, 1);
|
||||
setEnabled(size_->check_aspectratio, 1);
|
||||
setEnabled(size_->input_scale, 0);
|
||||
} else if (ob == size_->radio_scale) {
|
||||
setEnabled(size_->input_width, 0);
|
||||
setEnabled(size_->choice_width_units, 0);
|
||||
setEnabled(size_->choice_width, 0);
|
||||
setEnabled(size_->input_height, 0);
|
||||
setEnabled(size_->choice_height_units, 0);
|
||||
setEnabled(size_->choice_height, 0);
|
||||
setEnabled(size_->check_aspectratio, 0);
|
||||
setEnabled(size_->input_scale, 1);
|
||||
} else if (ob == size_->button_lyx_values) {
|
||||
LyXLength dummy = getLyXLengthFromWidgets(lyxview_->input_lyxwidth,
|
||||
lyxview_->choice_width_lyxwidth);
|
||||
lyxview_->choice_lyxwidth);
|
||||
updateWidgetsFromLength(size_->input_width,
|
||||
size_->choice_width_units,
|
||||
size_->choice_width,
|
||||
dummy, defaultUnit);
|
||||
dummy = getLyXLengthFromWidgets(lyxview_->input_lyxheight,
|
||||
lyxview_->choice_width_lyxheight);
|
||||
lyxview_->choice_lyxheight);
|
||||
updateWidgetsFromLength(size_->input_height,
|
||||
size_->choice_height_units,
|
||||
size_->choice_height,
|
||||
dummy, defaultUnit);
|
||||
string const scale = getStringFromInput(lyxview_->input_lyxscale);
|
||||
fl_set_input(size_->input_scale, scale.c_str());
|
||||
if (fl_get_button (lyxview_->radio_lyxasis) == 1) {
|
||||
fl_set_button (size_->radio_asis, 1);
|
||||
setEnabled(size_->input_width, 0);
|
||||
setEnabled(size_->choice_width_units, 0);
|
||||
setEnabled(size_->choice_width, 0);
|
||||
setEnabled(size_->input_height, 0);
|
||||
setEnabled(size_->choice_height_units, 0);
|
||||
setEnabled(size_->choice_height, 0);
|
||||
setEnabled(size_->check_aspectratio, 0);
|
||||
setEnabled(size_->input_scale, 0);
|
||||
} else if (fl_get_button (lyxview_->radio_lyxwh) == 1) {
|
||||
fl_set_button (size_->radio_wh, 1);
|
||||
setEnabled(size_->input_width, 1);
|
||||
setEnabled(size_->choice_width_units, 1);
|
||||
setEnabled(size_->choice_width, 1);
|
||||
setEnabled(size_->input_height, 1);
|
||||
setEnabled(size_->choice_height_units, 1);
|
||||
setEnabled(size_->choice_height, 1);
|
||||
setEnabled(size_->check_aspectratio, 1);
|
||||
setEnabled(size_->input_scale, 0);
|
||||
} else if (fl_get_button (lyxview_->radio_lyxscale) ==1) {
|
||||
fl_set_button (size_->radio_scale, 1);
|
||||
setEnabled(size_->input_width, 0);
|
||||
setEnabled(size_->choice_width_units, 0);
|
||||
setEnabled(size_->choice_width, 0);
|
||||
setEnabled(size_->input_height, 0);
|
||||
setEnabled(size_->choice_height_units, 0);
|
||||
setEnabled(size_->choice_height, 0);
|
||||
setEnabled(size_->check_aspectratio, 0);
|
||||
setEnabled(size_->input_scale, 1);
|
||||
}
|
||||
|
@ -80,29 +80,22 @@ void FormPrint::build()
|
||||
fl_set_input_maxchars(dialog_->input_count, 4); // 9999
|
||||
|
||||
target_.reset();
|
||||
target_.registerRadioButton(dialog_->radio_printer,
|
||||
PrinterParams::PRINTER);
|
||||
target_.registerRadioButton(dialog_->radio_file,
|
||||
PrinterParams::FILE);
|
||||
target_.init(dialog_->radio_printer, PrinterParams::PRINTER);
|
||||
target_.init(dialog_->radio_file, PrinterParams::FILE);
|
||||
order_.reset();
|
||||
order_.registerRadioButton(dialog_->radio_order_reverse,
|
||||
true);
|
||||
order_.registerRadioButton(dialog_->radio_order_normal,
|
||||
false);
|
||||
order_.init(dialog_->radio_order_reverse, true);
|
||||
order_.init(dialog_->radio_order_normal, false);
|
||||
which_.reset();
|
||||
which_.registerRadioButton(dialog_->radio_odd_pages,
|
||||
PrinterParams::ODD);
|
||||
which_.registerRadioButton(dialog_->radio_even_pages,
|
||||
PrinterParams::EVEN);
|
||||
which_.registerRadioButton(dialog_->radio_all_pages,
|
||||
PrinterParams::ALL);
|
||||
which_.init(dialog_->radio_odd_pages, PrinterParams::ODD);
|
||||
which_.init(dialog_->radio_even_pages, PrinterParams::EVEN);
|
||||
which_.init(dialog_->radio_all_pages, PrinterParams::ALL);
|
||||
}
|
||||
|
||||
|
||||
void FormPrint::apply()
|
||||
{
|
||||
PrinterParams::WhichPages
|
||||
wp(static_cast<PrinterParams::WhichPages>(which_.getButton()));
|
||||
wp(static_cast<PrinterParams::WhichPages>(which_.get()));
|
||||
|
||||
string from;
|
||||
int to(0);
|
||||
@ -116,13 +109,13 @@ void FormPrint::apply()
|
||||
}
|
||||
|
||||
PrinterParams::Target
|
||||
t(static_cast<PrinterParams::Target>(target_.getButton()));
|
||||
t(static_cast<PrinterParams::Target>(target_.get()));
|
||||
|
||||
PrinterParams const pp(t,
|
||||
string(fl_get_input(dialog_->input_printer)),
|
||||
string(fl_get_input(dialog_->input_file)),
|
||||
wp, from, to,
|
||||
static_cast<bool>(order_.getButton()),
|
||||
static_cast<bool>(order_.get()),
|
||||
!static_cast<bool>(fl_get_button(dialog_->check_collated)),
|
||||
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_file, pp.file_name.c_str());
|
||||
|
||||
target_.setButton(pp.target);
|
||||
order_.setButton(pp.reverse_order);
|
||||
which_.setButton(pp.which_pages);
|
||||
target_.set(pp.target);
|
||||
order_.set(pp.reverse_order);
|
||||
which_.set(pp.which_pages);
|
||||
|
||||
// hmmm... maybe a bit weird but maybe not
|
||||
// we might just be remembering the last
|
||||
|
@ -28,7 +28,7 @@ using std::find_if;
|
||||
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));
|
||||
}
|
||||
@ -40,43 +40,11 @@ void RadioButtonGroup::reset()
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
// 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
|
||||
void RadioButtonGroup::set(size_type value)
|
||||
{
|
||||
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 =
|
||||
find_if(map.begin(), map.end(),
|
||||
lyx::equal_2nd_in_pair<ButtonValuePair>(value));
|
||||
#endif
|
||||
|
||||
// If we found nothing, report it and return
|
||||
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
|
||||
ButtonValueMap::iterator it =
|
||||
ButtonValueMap::const_iterator it =
|
||||
find_if(map.begin(), map.end(),
|
||||
is_set_button<ButtonValuePair> ());
|
||||
|
||||
|
@ -12,15 +12,14 @@
|
||||
#ifndef RADIOBUTTONGROUP_H
|
||||
#define RADIOBUTTONGROUP_H
|
||||
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "support/types.h"
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include FORMS_H_LOCATION
|
||||
|
||||
/** 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
|
||||
@ -29,23 +28,26 @@
|
||||
*/
|
||||
class RadioButtonGroup {
|
||||
public:
|
||||
///
|
||||
typedef lyx::size_type size_type;
|
||||
|
||||
/// Constructor. Allocate space for 'n' items in the group.
|
||||
RadioButtonGroup(unsigned n = 5) : map(n) {};
|
||||
|
||||
/// 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.
|
||||
void reset();
|
||||
|
||||
// Set the active button.
|
||||
void setButton(int value);
|
||||
void set(size_type value);
|
||||
|
||||
// Get the active button.
|
||||
int getButton();
|
||||
size_type get() const;
|
||||
|
||||
private:
|
||||
///
|
||||
typedef std::pair<FL_OBJECT *, int> ButtonValuePair;
|
||||
typedef std::pair<FL_OBJECT *, size_type> ButtonValuePair;
|
||||
///
|
||||
typedef std::vector<ButtonValuePair> ButtonValueMap;
|
||||
///
|
||||
|
@ -234,7 +234,7 @@ FD_form_size * FormGraphics::build_size()
|
||||
}
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
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_lsize(obj, FL_NORMAL_SIZE);
|
||||
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_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_lsize(obj, FL_NORMAL_SIZE);
|
||||
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_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_lsize(obj, FL_NORMAL_SIZE);
|
||||
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_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_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
|
@ -57,9 +57,9 @@ struct FD_form_size {
|
||||
FL_OBJECT *radio_wh;
|
||||
FL_OBJECT *input_scale;
|
||||
FL_OBJECT *input_width;
|
||||
FL_OBJECT *choice_width_units;
|
||||
FL_OBJECT *choice_width;
|
||||
FL_OBJECT *input_height;
|
||||
FL_OBJECT *choice_height_units;
|
||||
FL_OBJECT *choice_height;
|
||||
FL_OBJECT *check_aspectratio;
|
||||
FL_OBJECT *button_lyx_values;
|
||||
};
|
||||
@ -95,9 +95,9 @@ struct FD_form_lyxview {
|
||||
FL_OBJECT *radio_color;
|
||||
FL_OBJECT *radio_nodisplay;
|
||||
FL_OBJECT *input_lyxwidth;
|
||||
FL_OBJECT *choice_width_lyxwidth;
|
||||
FL_OBJECT *choice_lyxwidth;
|
||||
FL_OBJECT *input_lyxheight;
|
||||
FL_OBJECT *choice_width_lyxheight;
|
||||
FL_OBJECT *choice_lyxheight;
|
||||
FL_OBJECT *button_latex_values;
|
||||
};
|
||||
|
||||
|
@ -597,7 +597,7 @@ label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: choice_width_units
|
||||
name: choice_width
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
|
||||
@ -633,7 +633,7 @@ label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: choice_height_units
|
||||
name: choice_height
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
|
||||
@ -1281,7 +1281,7 @@ label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: choice_width_lyxwidth
|
||||
name: choice_lyxwidth
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
|
||||
@ -1317,7 +1317,7 @@ label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: choice_width_lyxheight
|
||||
name: choice_lyxheight
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user