Use getBBUnits in both frontends.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5580 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2002-11-04 14:53:03 +00:00
parent 56bde5cedb
commit a8987d0697
7 changed files with 28 additions and 26 deletions

View File

@ -1,3 +1,8 @@
2002-11-04 Angus Leeming <leeming@lyx.org>
* ControlGraphics.[Ch] (getUnits): moved out of class and into
frnt::getBBUnits(). Code cleaned also.
2002-11-04 Lars Gullik Bjønnes <larsbj@gullik.net> 2002-11-04 Lars Gullik Bjønnes <larsbj@gullik.net>
* biblio.C (regexSearch): STRCONV * biblio.C (regexSearch): STRCONV

View File

@ -133,32 +133,13 @@ bool ControlGraphics::isFilenameValid(string const & fname) const
} }
namespace {
static char const * bb_units[] = { "bp", "cm", "mm", "in"};
size_t const bb_size = sizeof(bb_units) / sizeof(char *);
}
vector<string> const ControlGraphics::getUnits()
{
static vector<string> data;
if (!data.empty())
return data;
data.resize(bb_size);
for (lyx::size_type i = 0; i < bb_size; ++i) {
data[i] = bb_units[i];
}
return data;
}
namespace frnt { namespace frnt {
namespace { namespace {
char const * const bb_units[] = { "bp", "cm", "mm", "in" };
size_t const bb_size = sizeof(bb_units) / sizeof(char *);
// These are the strings that are stored in the LyX file and which // These are the strings that are stored in the LyX file and which
// correspond to the LaTeX identifiers shown in the comments at the // correspond to the LaTeX identifiers shown in the comments at the
// end of each line. // end of each line.
@ -180,6 +161,12 @@ size_t const rorigin_size = sizeof(rorigin_lyx_strs) / sizeof(char *);
} // namespace anon } // namespace anon
vector<string> const getBBUnits()
{
return vector<string> (bb_units, bb_units + bb_size);
}
vector<RotationOriginPair> getRotationOriginData() vector<RotationOriginPair> getRotationOriginData()
{ {
static vector<RotationOriginPair> data; static vector<RotationOriginPair> data;

View File

@ -47,8 +47,6 @@ public:
bool bbChanged; bool bbChanged;
/// test if file exist /// test if file exist
bool isFilenameValid(string const & fname) const; bool isFilenameValid(string const & fname) const;
/// get the units for the bb
std::vector<string> const getUnits();
private: private:
/// Dispatch the changed parameters to the kernel. /// Dispatch the changed parameters to the kernel.
@ -63,6 +61,9 @@ private:
namespace frnt { namespace frnt {
/// get the units for the bounding box
std::vector<string> const getBBUnits();
/// The (tranlated) GUI string and it's LaTeX equivalent. /// The (tranlated) GUI string and it's LaTeX equivalent.
typedef std::pair<string, string> RotationOriginPair; typedef std::pair<string, string> RotationOriginPair;
/// ///

View File

@ -1,3 +1,8 @@
2002-11-04 Angus Leeming <leeming@lyx.org>
* QGraphics.C (update_contents): controller.getUnits() ->
frnt::getBBUnits().
2002-11-04 Lars Gullik Bjønnes <larsbj@gullik.net> 2002-11-04 Lars Gullik Bjønnes <larsbj@gullik.net>
* QAbout.C (build_dialog): do not use str().c_str() when not needed. * QAbout.C (build_dialog): do not use str().c_str() when not needed.

View File

@ -114,7 +114,7 @@ int getItemNo(vector<string> v, string const & s) {
void QGraphics::update_contents() void QGraphics::update_contents()
{ {
// clear and fill in the comboboxes // clear and fill in the comboboxes
vector<string> const bb_units = controller().getUnits(); vector<string> const bb_units = frnt::getBBUnits();
dialog_->lbXunit->clear(); dialog_->lbXunit->clear();
dialog_->lbYunit->clear(); dialog_->lbYunit->clear();
dialog_->rtXunit->clear(); dialog_->rtXunit->clear();

View File

@ -1,3 +1,7 @@
2002-11-04 Angus Leeming <leeming@lyx.org>
* FormGraphics.C (build): Use frnt::getBBUnits().
2002-11-04 Rob Lahaye <lahaye@snu.ac.kr> 2002-11-04 Rob Lahaye <lahaye@snu.ac.kr>
* FormSpellchecker.C (input): fix label of spellchecker progress bar. * FormSpellchecker.C (input): fix label of spellchecker progress bar.

View File

@ -183,7 +183,7 @@ void FormGraphics::build()
fl_set_input_filter(bbox_->input_bb_y0, fl_unsigned_float_filter); fl_set_input_filter(bbox_->input_bb_y0, fl_unsigned_float_filter);
fl_set_input_filter(bbox_->input_bb_y1, fl_unsigned_float_filter); fl_set_input_filter(bbox_->input_bb_y1, fl_unsigned_float_filter);
string const bb_units = "bp|cm|mm|in"; string const bb_units = getStringFromVector(frnt::getBBUnits(), "|");
fl_addto_choice(bbox_->choice_bb_units, bb_units.c_str()); fl_addto_choice(bbox_->choice_bb_units, bb_units.c_str());
// set up the tooltips for the bounding-box-section // set up the tooltips for the bounding-box-section