[prev in list] [next in list] [prev in thread] [next in thread]
List: lyx-devel
Subject: [PATCH] more length-stuff
From: Herbert Voss <Herbert.Voss () alumni ! TU-Berlin ! DE>
Date: 2002-03-28 11:00:32
[Download RAW message or body]
the last one (hopefully):
1. simplifies the code: use always the choice from
xforms_helpers and don't build them everytime new
2. reorder the choicelist to get the most common length
first and move the excotic ones to the end
Herbert
--
http://www.lyx.org/help/
["length2.diff" (text/plain)]
Index: src/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.651
diff -u -r1.651 ChangeLog
--- src/ChangeLog 27 Mar 2002 23:27:12 -0000 1.651
+++ src/ChangeLog 28 Mar 2002 10:44:51 -0000
@@ -1,3 +1,8 @@
+2002-03-28 Herbert Voss <voss@lyx.org>
+
+ * lengthcommon.C: change the order of the length to get
+ a one which shows the most common ones first
+
2002-03-28 Herbert Voss <voss@lyx.org>
* lyxlength.C: compatibility stuff for "old" 1.2.0 files which
Index: src/lengthcommon.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lengthcommon.C,v
retrieving revision 1.3
diff -u -r1.3 lengthcommon.C
--- src/lengthcommon.C 27 Mar 2002 12:27:17 -0000 1.3
+++ src/lengthcommon.C 28 Mar 2002 10:44:51 -0000
@@ -6,9 +6,11 @@
// I am not sure if "mu" should be possible to select (Lgb)
char const * unit_name[num_units] = {
- "sp", "pt", "bp", "dd", "mm", "pc", "cc", "cm",
- "in", "ex", "em", "mu",
- "text%", "col%", "page%", "line%" };
+ "cm", "mm", "in", // standard
+ "col%", "line%", "text%", "page%", // relative
+ "ex", "em", // TeX
+ "pt", "sp", "bp", // other
+ "dd", "pc", "cc", "mu" }; // excotic
LyXLength::UNIT unitFromString(string const & data)
Index: src/frontends/xforms/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/ChangeLog,v
retrieving revision 1.338
diff -u -r1.338 ChangeLog
--- src/frontends/xforms/ChangeLog 27 Mar 2002 12:27:17 -0000 1.338
+++ src/frontends/xforms/ChangeLog 28 Mar 2002 10:44:53 -0000
@@ -1,3 +1,13 @@
+2002-03-28 Herbert Voss <voss@lyx.org>
+
+ * FormMinipage.C:
+ * FormDocument.C:
+ * FormParagraph.C: use the Length-choices from xforms_helpers.h
+ and don't build these new.
+
+ * xforms_helpers.h: change the order of the length to get
+ a one which shows the most common ones first
+
2002-03-27 Herbert Voss <voss@lyx.org>
* xforms_helpers.h:
Index: src/frontends/xforms/FormDocument.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormDocument.C,v
retrieving revision 1.93
diff -u -r1.93 FormDocument.C
--- src/frontends/xforms/FormDocument.C 21 Mar 2002 21:18:02 -0000 1.93
+++ src/frontends/xforms/FormDocument.C 28 Mar 2002 10:44:53 -0000
@@ -136,31 +136,24 @@
// Create the contents of the unit choices
// Don't include the "%" terms...
- vector<string> units_vec = getLatexUnits();
-#if 0
- for (vector<string>::iterator it = units_vec.begin();
- it != units_vec.end(); ++it) {
- if (contains(*it, "%"))
- it = units_vec.erase(it, it+1) - 1;
- }
-#else
- vector<string>::iterator ret =
- std::remove_if(units_vec.begin(),
- units_vec.end(),
- bind2nd(contains_functor(), "%"));
- units_vec.erase(ret, units_vec.end());
-#endif
- string units = getStringFromVector(units_vec, "|");
-
- fl_addto_choice(paper_->choice_custom_width_units, units.c_str());
- fl_addto_choice(paper_->choice_custom_height_units, units.c_str());
- fl_addto_choice(paper_->choice_top_margin_units, units.c_str());
- fl_addto_choice(paper_->choice_bottom_margin_units, units.c_str());
- fl_addto_choice(paper_->choice_inner_margin_units, units.c_str());
- fl_addto_choice(paper_->choice_outer_margin_units, units.c_str());
- fl_addto_choice(paper_->choice_head_height_units, units.c_str());
- fl_addto_choice(paper_->choice_head_sep_units, units.c_str());
- fl_addto_choice(paper_->choice_foot_skip_units, units.c_str());
+ fl_addto_choice(paper_->choice_custom_width_units,
+ choice_Length_WithUnit.c_str());
+ fl_addto_choice(paper_->choice_custom_height_units,
+ choice_Length_WithUnit.c_str());
+ fl_addto_choice(paper_->choice_top_margin_units,
+ choice_Length_WithUnit.c_str());
+ fl_addto_choice(paper_->choice_bottom_margin_units,
+ choice_Length_WithUnit.c_str());
+ fl_addto_choice(paper_->choice_inner_margin_units,
+ choice_Length_WithUnit.c_str());
+ fl_addto_choice(paper_->choice_outer_margin_units,
+ choice_Length_WithUnit.c_str());
+ fl_addto_choice(paper_->choice_head_height_units,
+ choice_Length_WithUnit.c_str());
+ fl_addto_choice(paper_->choice_head_sep_units,
+ choice_Length_WithUnit.c_str());
+ fl_addto_choice(paper_->choice_foot_skip_units,
+ choice_Length_WithUnit.c_str());
bc().addReadOnly (paper_->choice_paperpackage);
bc().addReadOnly (paper_->radio_portrait);
@@ -206,7 +199,8 @@
"default|empty|plain|headings|fancy");
fl_addto_choice(class_->choice_doc_skip,
_(" Smallskip | Medskip | Bigskip | Length "));
- fl_addto_choice(class_->choice_default_skip_units, units.c_str());
+ fl_addto_choice(class_->choice_default_skip_units,
+ choice_Length_WithUnit.c_str());
fl_set_input_return(class_->input_doc_extra, FL_RETURN_CHANGED);
fl_set_input_return(class_->input_doc_skip, FL_RETURN_CHANGED);
fl_set_input_return(class_->input_doc_spacing, FL_RETURN_CHANGED);
Index: src/frontends/xforms/FormMinipage.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormMinipage.C,v
retrieving revision 1.23
diff -u -r1.23 FormMinipage.C
--- src/frontends/xforms/FormMinipage.C 21 Mar 2002 21:18:03 -0000 1.23
+++ src/frontends/xforms/FormMinipage.C 28 Mar 2002 10:44:53 -0000
@@ -38,8 +38,8 @@
fl_set_input_return(dialog_->input_width, FL_RETURN_CHANGED);
setPrehandler(dialog_->input_width);
- string const choice = getStringFromVector(getLatexUnits(), "|");
- fl_addto_choice(dialog_->choice_width_units, subst(choice, "%", "%%").c_str());
+ fl_addto_choice(dialog_->choice_width_units,
+ choice_Length_All.c_str());
// Manage the ok, apply and cancel/close buttons
bc().setOK(dialog_->button_ok);
Index: src/frontends/xforms/FormParagraph.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormParagraph.C,v
retrieving revision 1.64
diff -u -r1.64 FormParagraph.C
--- src/frontends/xforms/FormParagraph.C 25 Mar 2002 11:00:17 -0000 1.64
+++ src/frontends/xforms/FormParagraph.C 28 Mar 2002 10:44:53 -0000
@@ -139,25 +139,10 @@
// Create the contents of the unit choices
// Don't include the "%" terms...
- vector<string> units_vec = getLatexUnits();
-#if 0
- for (vector<string>::iterator it = units_vec.begin();
- it != units_vec.end(); ++it) {
- if (contains(*it, "%"))
- it = units_vec.erase(it, it+1) - 1;
- }
-#else
- // Something similar to this is a better way to erase
- vector<string>::iterator del =
- remove_if(units_vec.begin(), units_vec.end(),
- bind2nd(contains_functor(), "%"));
- units_vec.erase(del, units_vec.end());
-#endif
-
- string units = getStringFromVector(units_vec, "|");
-
- fl_addto_choice(dialog_->choice_value_space_above, units.c_str());
- fl_addto_choice(dialog_->choice_value_space_below, units.c_str());
+ fl_addto_choice(dialog_->choice_value_space_above,
+ choice_Length_WithUnit.c_str());
+ fl_addto_choice(dialog_->choice_value_space_below,
+ choice_Length_WithUnit.c_str());
// Manage the ok, apply, restore and cancel/close buttons
bc_.setOK(dialog_->button_ok);
Index: src/frontends/xforms/xforms_helpers.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/xforms_helpers.h,v
retrieving revision 1.22
diff -u -r1.22 xforms_helpers.h
--- src/frontends/xforms/xforms_helpers.h 27 Mar 2002 12:27:17 -0000 1.22
+++ src/frontends/xforms/xforms_helpers.h 28 Mar 2002 10:44:53 -0000
@@ -25,7 +25,7 @@
// what we always need for lengths
string const choice_Length_All =
- "cm|mm|in|text%%|col%%|page%%|line%%|ex|em|pt|sp|bp|dd|pc|cc|mu";
+ "cm|mm|in|col%%|line%%|text%%|page%%|ex|em|pt|sp|bp|dd|pc|cc|mu";
string const choice_Length_WithUnit =
"cm|mm|in|ex|em|pt|sp|bp|dd|pc|cc|mu"; // all with a Unit
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic