Squash bug 1345 in the 14x tree: xforms frontend doesn't have

%theight or %pheight as a graphics sizing choice.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8603 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2004-04-05 14:05:03 +00:00
parent 65aa219f2e
commit 90e427465d
10 changed files with 52 additions and 20 deletions

View File

@ -1,4 +1,8 @@
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:

View File

@ -1,3 +1,7 @@
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

View File

@ -109,7 +109,7 @@ int getItemNo(vector<string> v, string const & s) {
// 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;

View File

@ -1,3 +1,14 @@
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:

View File

@ -422,11 +422,11 @@ void FormExternal::build()
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.");

View File

@ -130,10 +130,11 @@ void FormGraphics::build()
_("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.");

View File

@ -14,6 +14,7 @@
#include "debug.h"
#include "gettext.h"
#include "lengthcommon.h"
#include "lyxgluelength.h"
#include "lyxlex.h"
@ -43,6 +44,18 @@ using std::vector;
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;

View File

@ -29,11 +29,10 @@ std::pair<std::string, std::string> parse_shortcut(std::string const & str);
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);

View File

@ -26,14 +26,14 @@ int const num_units = LyXLength::UNIT_NONE;
// 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
@ -44,7 +44,7 @@ char const * unit_name_ltx[num_units + 1] = {
"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%"),

View File

@ -26,9 +26,9 @@ extern int const num_units;
*
* 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);