-2004-05-04 Angus Leeming <leeming@lyx.org>
+2004-04-05 Angus Leeming <leeming@lyx.org>
+
+ * lyxlength.[Ch] (unit_name et al.): const-correct.
+
+2004-04-05 Angus Leeming <leeming@lyx.org>
* BufferView_pimpl.C:
* buffer.C:
+2004-04-05 Angus Leeming <leeming@lyx.org>
+
+ * QGraphics.C (getUnitNo): const-correct.
+
2004-04-05 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* floatplacement.[Ch]: check whether we are in the float or
// returns the number of the unit in the array unit_name,
// which is defined in lengthcommon.C
-int getUnitNo(char const * c[], string const & s) {
+int getUnitNo(char const * const c[], string const & s) {
int i = 0;
while (i < num_units && s != c[i])
++i;
+2004-05-04 Angus Leeming <leeming@lyx.org>
+
+ * FormExternal.C (build):
+ * FormGraphics.C (build): use buildChoiceLengthString rather than
+ choice_Length_All.
+
+ * xforms_helpers.[Ch]: remove choice_Length_WithUnit (unused).
+ Replace choice_Length_All with buildChoiceLengthString,
+ which builds the string dynamically from lengthcommon.h's
+ unit_name_gui.
+
2004-03-31 Angus Leeming <leeming@lyx.org>
* Dialogs2.C:
fl_addto_choice(rotate_->choice_origin,
external::origin_gui_str(i).c_str());
- string const width_list = bformat(_("Scale%%%%|%1$s"),
- choice_Length_All);
- fl_addto_choice(scale_->choice_width, width_list.c_str());
+ string const height_list = buildChoiceLengthString();
+ string const width_list = bformat(_("Scale%%%%|%1$s"), height_list);
- fl_addto_choice(scale_->choice_height, choice_Length_All.c_str());
+ fl_addto_choice(scale_->choice_width, width_list.c_str());
+ fl_addto_choice(scale_->choice_height, height_list.c_str());
// Set up the tooltips.
string str = _("The file you want to insert.");
_("Default|Monochrome|Grayscale|Color|Do not display");
fl_addto_choice(file_->choice_display, display_List.c_str());
- string const width_list = bformat(_("Scale%%%%|%1$s"), choice_Length_All);
- fl_addto_choice(file_->choice_width, width_list.c_str());
+ string const height_list = buildChoiceLengthString();
+ string const width_list = bformat(_("Scale%%%%|%1$s"), height_list);
- fl_addto_choice(file_->choice_height, choice_Length_All.c_str());
+ fl_addto_choice(file_->choice_width, width_list.c_str());
+ fl_addto_choice(file_->choice_height, height_list.c_str());
// set up the tooltips for the filesection
string str = _("The file you want to insert.");
#include "debug.h"
#include "gettext.h"
+#include "lengthcommon.h"
#include "lyxgluelength.h"
#include "lyxlex.h"
using std::string;
+std::string const buildChoiceLengthString()
+{
+ string data;
+ for (int i = 0; i != num_units; ++i) {
+ if (i != 0)
+ data += "|";
+ data += subst(unit_name_gui[i], "%", "%%");
+ }
+ return data;
+}
+
+
bool isActive(FL_OBJECT * ob)
{
return ob && ob->active > 0;
unsigned long fl_getmcolor(int i, unsigned int * r, unsigned int * g,
unsigned int * b);
-// what we always need for lengths
-std::string const choice_Length_All =
- "cm|mm|in|text%%|col%%|page%%|line%%|ex|em|pt|sp|bp|dd|pc|cc|mu";
-std::string const choice_Length_WithUnit =
- "cm|mm|in|ex|em|pt|sp|bp|dd|pc|cc|mu"; // all with a Unit
+/** Generate a string of available length units with which to
+ * populate a choice widget.
+ */
+std::string const buildChoiceLengthString();
/// return the (in)active state of the object
bool isActive(FL_OBJECT * ob);
// unit_name is for compatibility. Can be deleted when all works well.
// means, when we have full language support for the lengths
// in all gui's (Herbert 2002-11-01)
-char const * unit_name[num_units + 1] = {
+char const * const unit_name[num_units + 1] = {
"sp", "pt", "bp", "dd", "mm", "pc",
"cc", "cm", "in", "ex", "em", "mu",
"text%", "col%", "page%", "line%",
"theight%", "pheight%", "" };
// the latex units
-char const * unit_name_ltx[num_units + 1] = {
+char const * const unit_name_ltx[num_units + 1] = {
"sp", "pt", "bp", "dd", "mm", "pc",
"cc", "cm", "in", "ex", "em", "mu",
// in 1.4 the following names should be used. then no
"theight%", "pheight%", "" };
// the LyX gui units
-char const * unit_name_gui[num_units + 1] = {
+char const * const unit_name_gui[num_units + 1] = {
N_("sp"), N_("pt"), N_("bp"), N_("dd"), N_("mm"), N_("pc"),
N_("cc"), N_("cm"), N_("in"), N_("ex"), N_("em"), N_("mu"),
N_("text%"), N_("col%"), N_("page%"), N_("line%"),
*
* FIXME: I am not sure if "mu" should be possible to select (Lgb)
*/
-extern char const * unit_name[];
-extern char const * unit_name_gui[];
-extern char const * unit_name_ltx[];
+extern char const * const unit_name[];
+extern char const * const unit_name_gui[];
+extern char const * const unit_name_ltx[];
/// return the unit given a string representation such as "cm"
LyXLength::UNIT unitFromString(std::string const & data);