]> git.lyx.org Git - features.git/commitdiff
graphics fixes from herbert and me
authorJohn Levon <levon@movementarian.org>
Sun, 17 Nov 2002 11:24:08 +0000 (11:24 +0000)
committerJohn Levon <levon@movementarian.org>
Sun, 17 Nov 2002 11:24:08 +0000 (11:24 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5660 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt2/ChangeLog
src/frontends/qt2/QGraphics.C
src/frontends/qt2/QGraphicsDialog.C
src/frontends/qt2/lengthcombo.C
src/frontends/qt2/lengthcombo.h
src/frontends/qt2/ui/QGraphicsDialog.ui
src/lengthcommon.C
src/lengthcommon.h

index bbe23aa462829c6546fc2cce32a9ac5f886755f4..2ba6fd50ea86ca4ddd0f7a05c8f334c95f4cdcc0 100644 (file)
@@ -1,3 +1,7 @@
+2002-11-17  John Levon  <levon@movementarian.org>
+
+       * QGraphics.C: some fixes from Herbert & me
 2002-11-15  Juergen Spitzmueller  <j.spitzmueller@gmx.de>
  
        * FileDialog.C: fix empty mask string
index 4be626a1cec7270d9d1342ab2f54fb56b017e2f2..bdc1810a1af437f84f82577b23f022c741f38283 100644 (file)
@@ -44,6 +44,7 @@
 #include "Qt2BC.h"
 
 using std::vector;
+using std::endl;
 
 typedef Qt2CB<ControlGraphics, Qt2DB<QGraphicsDialog> > base_class;
 
@@ -97,51 +98,23 @@ void QGraphics::build_dialog()
        bc().addReadOnly(dialog_->origin);
        bc().addReadOnly(dialog_->latexoptions);
        bc().addReadOnly(dialog_->getPB);
-       using namespace frnt;
-       vector<RotationOriginPair> origindata = getRotationOriginData();
-       vector<string> const origin_lang = getFirst(origindata);
-       origin_ltx = getSecond(origindata);
-       // build the list
-       for (vector<string>::const_iterator it = origin_lang.begin();
-           it != origin_lang.end(); ++it) {
-               dialog_->origin->insertItem((*it).c_str(), -1);
-       } 
-       // clear and fill in the comboboxes
-       vector<string> const bb_units = getBBUnits();
-       dialog_->lbXunit->clear();
-       dialog_->lbYunit->clear();
-       dialog_->rtXunit->clear();
-       dialog_->rtYunit->clear();
-       for (vector<string>::const_iterator it = bb_units.begin();
-           it != bb_units.end(); ++it) {
-               dialog_->lbXunit->insertItem((*it).c_str(), -1);
-               dialog_->lbYunit->insertItem((*it).c_str(), -1);
-               dialog_->rtXunit->insertItem((*it).c_str(), -1);
-               dialog_->rtYunit->insertItem((*it).c_str(), -1);
-       }
-       
 }
 
 
 namespace {
+
 // returns the number of the string s in the vector v
 int getItemNo(vector<string> v, string const & s) {
        vector<string>::const_iterator cit =
                    find(v.begin(), v.end(), s);
-       if (cit != v.end())
-               return int(cit - v.begin());
-       return 0;
+       return (cit != v.end()) ? int(cit - v.begin()) : 0;
 }
  
 // returns the number of the unit in the array unit_name,
 // which is defined in lengthcommon.C
-int getUnitNo(string const & s) {
+int getUnitNo(char const * c[], string const & s) {
        int i = 0;
-       while (i < num_units && s != unit_name[i])
+       while (i < num_units && s != c[i])
                ++i;
        return (i < num_units) ? i : 0;
 }
@@ -151,24 +124,38 @@ int getUnitNo(string const & s) {
 
 void QGraphics::update_contents()
 {
+       // clear and fill in the comboboxes
+       vector<string> const bb_units = frnt::getBBUnits();
+       dialog_->lbXunit->clear();
+       dialog_->lbYunit->clear();
+       dialog_->rtXunit->clear();
+       dialog_->rtYunit->clear();
+       for (vector<string>::const_iterator it = bb_units.begin();
+           it != bb_units.end(); ++it) {
+               dialog_->lbXunit->insertItem((*it).c_str(), -1);
+               dialog_->lbYunit->insertItem((*it).c_str(), -1);
+               dialog_->rtXunit->insertItem((*it).c_str(), -1);
+               dialog_->rtYunit->insertItem((*it).c_str(), -1);
+       }
+       
        InsetGraphicsParams & igp = controller().params();
 
        // set the right default unit
-       string unitDefault("cm");
+       LyXLength::UNIT unitDefault = LyXLength::CM;
        switch (lyxrc.default_papersize) {
                case BufferParams::PAPER_DEFAULT: break;
 
                case BufferParams::PAPER_USLETTER:
                case BufferParams::PAPER_LEGALPAPER:
                case BufferParams::PAPER_EXECUTIVEPAPER:
-                       unitDefault = "in";
+                       unitDefault = LyXLength::IN;
                        break;
 
                case BufferParams::PAPER_A3PAPER:
                case BufferParams::PAPER_A4PAPER:
                case BufferParams::PAPER_A5PAPER:
                case BufferParams::PAPER_B5PAPER:
-                       unitDefault = "cm";
+                       unitDefault = LyXLength::CM;
                        break;
        }
 
@@ -176,17 +163,19 @@ void QGraphics::update_contents()
 
        // set the bounding box values
        if (igp.bb.empty()) {
-               controller().bbChanged = false;
                string const bb = controller().readBB(igp.filename);
-               // the values from the file always have the point-unit
+               // the values from the file always have the bigpoint-unit bp
                dialog_->lbX->setText(token(bb, ' ', 0).c_str());
                dialog_->lbY->setText(token(bb, ' ', 1).c_str());
                dialog_->rtX->setText(token(bb, ' ', 2).c_str());
                dialog_->rtY->setText(token(bb, ' ', 3).c_str());
+               dialog_->lbXunit->setCurrentItem(0);
+               dialog_->lbYunit->setCurrentItem(0);
+               dialog_->rtXunit->setCurrentItem(0);
+               dialog_->rtYunit->setCurrentItem(0);
+               controller().bbChanged = false;
        } else {
                // get the values from the inset
-               controller().bbChanged = true;
-               vector<string> const bb_units = frnt::getBBUnits();
                LyXLength anyLength;
                string const xl(token(igp.bb,' ',0));
                string const yl(token(igp.bb,' ',1));
@@ -220,6 +209,7 @@ void QGraphics::update_contents()
                } else {
                        dialog_->rtY->setText(xl.c_str());
                }
+               controller().bbChanged = true;
        }
 
        // Update the draft and clip mode
@@ -245,15 +235,16 @@ void QGraphics::update_contents()
        dialog_->displayscale->setEnabled(igp.display != grfx::NoDisplay && !readOnly());
        dialog_->displayscale->setText(tostr(igp.lyxscale).c_str());
 
-       // the output section
+       //// the output section (width/height)
        // set the length combo boxes
        // only the width has the possibility for scale%. The original
        // units are defined in lengthcommon.C 
-       dialog_->widthUnit->insertItem("Scale%");
-       for (int i = 0; i < num_units; i++) {
-               dialog_->widthUnit->insertItem(unit_name[i], -1);
-               dialog_->heightUnit->insertItem(unit_name[i], -1);
-       }
+       // 1. the width (a listttype)
+       dialog_->widthUnit->clear();
+       dialog_->widthUnit->insertItem(_("Scale%"));
+       for (int i = 0; i < num_units; i++) 
+               dialog_->widthUnit->insertItem(unit_name_gui[i], -1);
+
        if (!lyx::float_equal(igp.scale, 0.0, 0.05)) {
                // there is a scale value > 0.05
                dialog_->width->setText(tostr(igp.scale).c_str());
@@ -261,15 +252,17 @@ void QGraphics::update_contents()
        } else {
                // no scale means default width/height
                dialog_->width->setText(tostr(igp.width.value()).c_str());
-               string const widthUnit = (igp.width.value() > 0.0) ?
-                       unit_name[igp.width.unit()] : unitDefault;
-                       // +1 instead of the "Scale%" option
-               dialog_->widthUnit->setCurrentItem(getUnitNo(widthUnit) + 1);
+               // the width cannot have a unitDefault, because
+               // it is a "Scale%" or another user defined unit!
+               // +1 instead of the "Scale%" option
+               int unit_ = igp.width.unit();
+               dialog_->widthUnit->setCurrentItem(unit_ + 1);
        }
+       // 2. the height (a lengthgcombo type)
        dialog_->height->setText(tostr(igp.height.value()).c_str());
-       string const heightUnit = (igp.height.value() > 0.0) ?
-                       unit_name[igp.height.unit()] : unitDefault;
-       dialog_->heightUnit->setCurrentItem(getUnitNo(heightUnit));
+       LyXLength::UNIT unit_ = (igp.height.value() > 0.0) ?
+               igp.height.unit() : unitDefault;
+       dialog_->heightUnit->setCurrentItem(unit_);
 
        // enable height input in case of non "Scale%" as width-unit
        bool use_height = (dialog_->widthUnit->currentItem() > 0);
@@ -280,9 +273,22 @@ void QGraphics::update_contents()
 
        dialog_->angle->setText(tostr(igp.rotateAngle).c_str());
 
+       dialog_->origin->clear();
+       using namespace frnt;
+       vector<RotationOriginPair> origindata = getRotationOriginData();
+       vector<string> const origin_lang = getFirst(origindata);
+       QGraphics::origin_ltx = getSecond(origindata);
+
+       for (vector<string>::const_iterator it = origin_lang.begin();
+           it != origin_lang.end(); ++it)
+               dialog_->origin->insertItem((*it).c_str(), -1);
        if (!igp.rotateOrigin.empty())
                dialog_->origin->setCurrentItem(
                        ::getItemNo(origin_ltx, igp.rotateOrigin));
+       else
+               dialog_->origin->setCurrentItem(0);
 
        //// latex section 
        dialog_->latexoptions->setText(igp.special.c_str());
@@ -296,33 +302,35 @@ void QGraphics::apply()
        igp.filename = dialog_->filename->text();
 
        // the bb section
-       if (!controller().bbChanged) {
-               // don't write anything         
-               igp.bb.erase();
-       } else if (dialog_->clip->isChecked()) {
+       igp.bb.erase();
+       if (controller().bbChanged) {
                string bb;
                string lbX(dialog_->lbX->text());
                string lbY(dialog_->lbY->text());
                string rtX(dialog_->rtX->text());
                string rtY(dialog_->rtY->text());
-
-               if (lbX.empty())
-                       bb = "0 ";
-               else
-                       bb = lbX + dialog_->lbXunit->currentText().latin1() + ' ';
-               if (lbY.empty())
-                       bb += "0 ";
-               else 
-                       bb += (lbY + dialog_->lbYunit->currentText().latin1() + ' ');
-               if (rtX.empty())
-                       bb += "0 ";
-               else 
-                       bb += (rtX + dialog_->rtXunit->currentText().latin1() + ' ');
-               if (rtY.empty())
-                       bb += "0";
-               else 
-                       bb += (rtY + dialog_->rtYunit->currentText().latin1());
-               igp.bb = bb;
+               int bb_sum = 
+                       strToInt(lbX) + strToInt(lbY) + 
+                       strToInt(rtX) + strToInt(rtX);
+               if (bb_sum) {
+                       if (lbX.empty())
+                               bb = "0 ";
+                       else
+                               bb = lbX + dialog_->lbXunit->currentText().latin1() + ' ';
+                       if (lbY.empty())
+                               bb += "0 ";
+                       else 
+                               bb += (lbY + dialog_->lbYunit->currentText().latin1() + ' ');
+                       if (rtX.empty())
+                               bb += "0 ";
+                       else 
+                               bb += (rtX + dialog_->rtXunit->currentText().latin1() + ' ');
+                       if (rtY.empty())
+                               bb += "0";
+                       else 
+                               bb += (rtY + dialog_->rtYunit->currentText().latin1());
+                       igp.bb = bb;
+               }
        }
 
        igp.draft = dialog_->draftCB->isChecked();
@@ -344,8 +352,9 @@ void QGraphics::apply()
        string value(dialog_->width->text());
        if (dialog_->widthUnit->currentItem() > 0) {
                // width/height combination
-               string const unit(dialog_->widthUnit->currentText());   
-               igp.width = LyXLength(value + unit); 
+               int const unitNo = getUnitNo(unit_name_gui, 
+                       string(dialog_->widthUnit->currentText()));
+               igp.width = LyXLength(value + unit_name_ltx[unitNo]);
                igp.scale = 0.0; 
        } else {
                // scaling instead of a width
@@ -353,8 +362,9 @@ void QGraphics::apply()
                igp.width = LyXLength(); 
        }
        value = string(dialog_->height->text());
-       string const unit = string(dialog_->heightUnit->currentText());
-       igp.height = LyXLength(value + unit);
+       int const unitNo = getUnitNo(unit_name_gui, 
+               string(dialog_->heightUnit->currentText()));
+       igp.height = LyXLength(value + unit_name_ltx[unitNo]);
 
        igp.keepAspectRatio = dialog_->aspectratio->isChecked();
 
@@ -370,8 +380,9 @@ void QGraphics::apply()
 
        // save the latex name for the origin. If it is the default
        // then origin_ltx returns ""
-       igp.rotateOrigin = origin_ltx[dialog_->origin->currentItem()];
-       
+       igp.rotateOrigin = 
+               QGraphics::origin_ltx[dialog_->origin->currentItem()];
+
        // more latex options
        igp.special = dialog_->latexoptions->text();
 }
index a391702110b239e1fabbff96e5df5059cca34542..33c6e8b42edfec7445b6278025debc1b2f43246c 100644 (file)
@@ -27,6 +27,8 @@
 #include <qfiledialog.h>
 #include <qcombobox.h>
 
+#include "lengthcombo.h"
+
 #include "QGraphicsDialog.h"
 #include "QGraphics.h"
 
@@ -64,6 +66,8 @@ void QGraphicsDialog::change_adaptor()
 void QGraphicsDialog::change_bb()
 {
        form_->controller().bbChanged = true;
+       lyxerr[Debug::GRAPHICS] 
+               << "[controller().bb_Changed set to true]\n";
        form_->changed();
 }
 
@@ -73,6 +77,7 @@ void QGraphicsDialog::change_WUnit()
        bool useHeight = (widthUnit->currentItem() > 0);
        height->setEnabled(useHeight);
        heightUnit->setEnabled(useHeight);
+       form_->changed();
 }
 
 
index 5a726bf1194d4831d5203d2078a3249310ec4622..cb442cdf84d58ec3d287460c467d6988f73d78c3 100644 (file)
@@ -4,6 +4,7 @@
  * Licence details can be found in the file COPYING.
  *
  * \author John Levon
+ * \author Herbert Voss
  *
  * Full author contact details are available in file CREDITS
  */
 #pragma implementation
 #endif
 
-#include "gettext.h"
-
 #include "lengthcombo.h"
-
 #include <qwhatsthis.h>
 
+#include "lengthcommon.h"
+#include "gettext.h"
+
 
 LengthCombo::LengthCombo(QWidget * parent, char * name)
        : QComboBox(parent, name)
 {
-       // FIXME: check these should all be here, I think not
-       insertItem(_("cm"));
-       insertItem(_("in"));
-       insertItem(_("pt"));
-       insertItem(_("mm"));
-       insertItem(_("pc"));
-       insertItem(_("ex"));
-       insertItem(_("em"));
-       insertItem(_("sp"));
-       insertItem(_("bp"));
-       insertItem(_("dd"));
-       insertItem(_("cc"));
-       insertItem(_("mu"));
-       insertItem(_("%p"));
-       insertItem(_("%c"));
-       insertItem(_("%l"));
+       for (int i=0; i < num_units; i++)
+               insertItem(unit_name_gui[i]);
 
        connect(this, SIGNAL(activated(int)),
                this, SLOT(has_activated(int)));
 
-       QWhatsThis::add(this, _("FIXME - describe the units."));
+       QWhatsThis::add(this, _("Choose one of the units or relative lengths"));
 }
 
 
 LyXLength::UNIT LengthCombo::currentLengthItem() const
 {
-       LyXLength::UNIT unit;
-       int i = currentItem();
-       switch (i) {
-               default:
-               case 0: unit = LyXLength::CM; break;
-               case 1: unit = LyXLength::IN; break;
-               case 2: unit = LyXLength::PT; break;
-               case 3: unit = LyXLength::MM; break;
-               case 4: unit = LyXLength::PC; break;
-               case 5: unit = LyXLength::EX; break;
-               case 6: unit = LyXLength::EM; break;
-               case 7: unit = LyXLength::SP; break;
-               case 8: unit = LyXLength::BP; break;
-               case 9: unit = LyXLength::DD; break;
-               case 10: unit = LyXLength::CC; break;
-               case 11: unit = LyXLength::MU; break;
-               case 12: unit = LyXLength::PPW; break;
-               case 13: unit = LyXLength::PCW; break;
-               case 14: unit = LyXLength::PLW; break;
-               // FIXME: LyXLength::PTW ?
-       };
-       return unit;
+       return static_cast<LyXLength::UNIT>(currentItem());
 }
 
 
@@ -83,25 +49,12 @@ void LengthCombo::has_activated(int)
 
 void LengthCombo::setCurrentItem(LyXLength::UNIT unit)
 {
-       int i;
-       switch (unit) {
-               default:
-               case LyXLength::CM: i = 0; break;
-               case LyXLength::IN: i = 1; break;
-               case LyXLength::PT: i = 2; break;
-               case LyXLength::MM: i = 3; break;
-               case LyXLength::PC: i = 4; break;
-               case LyXLength::EX: i = 5; break;
-               case LyXLength::EM: i = 6; break;
-               case LyXLength::SP: i = 7; break;
-               case LyXLength::BP: i = 8; break;
-               case LyXLength::DD: i = 9; break;
-               case LyXLength::CC: i = 10; break;
-               case LyXLength::MU: i = 11; break;
-               case LyXLength::PPW: i = 12; break;
-               case LyXLength::PCW: i = 13; break;
-               case LyXLength::PLW: i = 14; break;
-               // FIXME: LyXLength::PTW ?
-       }
-       QComboBox::setCurrentItem(i);
+       QComboBox::setCurrentItem(int(unit));
 }
+
+
+void LengthCombo::setEnabled(bool b)
+{
+       QComboBox::setEnabled(b);
+}
+
index 93b8b64f48d1c560fced80b98606040f83e80dcc..239070a69226651ab9a88d5121ae70d90ad35b72 100644 (file)
@@ -30,9 +30,11 @@ public:
 
        /// set the current item
        virtual void setCurrentItem(LyXLength::UNIT unit);
-
        /// get the current item
        LyXLength::UNIT currentLengthItem() const;
+       /// enable the widget
+       virtual void setEnabled(bool b);
+
 protected slots:
        virtual void has_activated(int index);
 signals:
index d75210e025cc5f3e7d56b20bcb5b429747e00b39..b6fb8e5debe7ea2d43e8521b8b9bfe94e9b0698f 100644 (file)
                                                 </property>
                                             </widget>
                                             <widget>
-                                                <class>QComboBox</class>
+                                                <class>LengthCombo</class>
                                                 <property stdset="1">
                                                     <name>name</name>
                                                     <cstring>heightUnit</cstring>
                                                 </property>
+                                                <property stdset="1">
+                                                    <name>sizePolicy</name>
+                                                    <sizepolicy>
+                                                        <hsizetype>3</hsizetype>
+                                                        <vsizetype>0</vsizetype>
+                                                    </sizepolicy>
+                                                </property>
+                                                <property stdset="1">
+                                                    <name>minimumSize</name>
+                                                    <size>
+                                                        <width>80</width>
+                                                        <height>22</height>
+                                                    </size>
+                                                </property>
+                                                <property stdset="1">
+                                                    <name>focusPolicy</name>
+                                                    <enum>StrongFocus</enum>
+                                                </property>
+                                                <property>
+                                                    <name>toolTip</name>
+                                                    <string>Units of height value</string>
+                                                </property>
                                             </widget>
                                         </hbox>
                                     </widget>
                                 </property>
                                 <property>
                                     <name>toolTip</name>
-                                    <string>Clip to bounding box (FIXME: what ??)</string>
+                                    <string>Clip to bounding box values</string>
                                 </property>
                             </widget>
                             <spacer>
         </widget>
     </vbox>
 </widget>
+<customwidgets>
+    <customwidget>
+        <class>LengthCombo</class>
+        <header location="local">lengthcombo.h</header>
+        <sizehint>
+            <width>-1</width>
+            <height>-1</height>
+        </sizehint>
+        <container>0</container>
+        <sizepolicy>
+            <hordata>5</hordata>
+            <verdata>5</verdata>
+        </sizepolicy>
+        <pixmap>image0</pixmap>
+        <signal>selectionChanged(LyXLength::UNIT)</signal>
+    </customwidget>
+</customwidgets>
+<images>
+    <image>
+        <name>image0</name>
+        <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
+    </image>
+</images>
 <connections>
     <connection>
         <sender>subfigure</sender>
         <receiver>QGraphicsDialogBase</receiver>
         <slot>change_bb()</slot>
     </connection>
-    <connection>
-        <sender>lbY</sender>
-        <signal>textChanged(const QString&amp;)</signal>
-        <receiver>QGraphicsDialogBase</receiver>
-        <slot>change_bb()</slot>
-    </connection>
-    <connection>
-        <sender>rtX</sender>
-        <signal>textChanged(const QString&amp;)</signal>
-        <receiver>QGraphicsDialogBase</receiver>
-        <slot>change_bb()</slot>
-    </connection>
-    <connection>
-        <sender>rtY</sender>
-        <signal>textChanged(const QString&amp;)</signal>
-        <receiver>QGraphicsDialogBase</receiver>
-        <slot>change_bb()</slot>
-    </connection>
-    <connection>
-        <sender>lbXunit</sender>
-        <signal>activated(int)</signal>
-        <receiver>QGraphicsDialogBase</receiver>
-        <slot>change_bb()</slot>
-    </connection>
-    <connection>
-        <sender>lbYunit</sender>
-        <signal>activated(int)</signal>
-        <receiver>QGraphicsDialogBase</receiver>
-        <slot>change_bb()</slot>
-    </connection>
-    <connection>
-        <sender>rtXunit</sender>
-        <signal>activated(int)</signal>
-        <receiver>QGraphicsDialogBase</receiver>
-        <slot>change_bb()</slot>
-    </connection>
-    <connection>
-        <sender>rtYunit</sender>
-        <signal>activated(int)</signal>
-        <receiver>QGraphicsDialogBase</receiver>
-        <slot>change_bb()</slot>
-    </connection>
     <connection>
         <sender>showCB</sender>
         <signal>activated(int)</signal>
         <receiver>QGraphicsDialogBase</receiver>
         <slot>change_adaptor()</slot>
     </connection>
-    <connection>
-        <sender>heightUnit</sender>
-        <signal>activated(int)</signal>
-        <receiver>QGraphicsDialogBase</receiver>
-        <slot>change_adaptor()</slot>
-    </connection>
     <connection>
         <sender>angle</sender>
         <signal>textChanged(const QString&amp;)</signal>
         <receiver>QGraphicsDialogBase</receiver>
         <slot>change_adaptor()</slot>
     </connection>
+    <connection>
+        <sender>getPB</sender>
+        <signal>clicked()</signal>
+        <receiver>QGraphicsDialogBase</receiver>
+        <slot>getBB_clicked()</slot>
+    </connection>
+    <connection>
+        <sender>getPB</sender>
+        <signal>clicked()</signal>
+        <receiver>QGraphicsDialogBase</receiver>
+        <slot>change_adaptor()</slot>
+    </connection>
+    <connection>
+        <sender>lbY</sender>
+        <signal>textChanged(const QString&amp;)</signal>
+        <receiver>QGraphicsDialogBase</receiver>
+        <slot>change_bb()</slot>
+    </connection>
     <connection>
         <sender>rtX</sender>
         <signal>textChanged(const QString&amp;)</signal>
         <receiver>QGraphicsDialogBase</receiver>
-        <slot>change_adaptor()</slot>
+        <slot>change_bb()</slot>
     </connection>
     <connection>
         <sender>rtY</sender>
         <signal>textChanged(const QString&amp;)</signal>
         <receiver>QGraphicsDialogBase</receiver>
-        <slot>change_adaptor()</slot>
+        <slot>change_bb()</slot>
     </connection>
     <connection>
-        <sender>lbY</sender>
-        <signal>textChanged(const QString&amp;)</signal>
+        <sender>lbXunit</sender>
+        <signal>activated(int)</signal>
         <receiver>QGraphicsDialogBase</receiver>
-        <slot>change_adaptor()</slot>
+        <slot>change_bb()</slot>
     </connection>
     <connection>
-        <sender>getPB</sender>
-        <signal>clicked()</signal>
+        <sender>lbYunit</sender>
+        <signal>activated(int)</signal>
         <receiver>QGraphicsDialogBase</receiver>
-        <slot>getBB_clicked()</slot>
+        <slot>change_bb()</slot>
     </connection>
     <connection>
-        <sender>getPB</sender>
-        <signal>clicked()</signal>
+        <sender>rtXunit</sender>
+        <signal>activated(int)</signal>
         <receiver>QGraphicsDialogBase</receiver>
-        <slot>change_adaptor()</slot>
+        <slot>change_bb()</slot>
+    </connection>
+    <connection>
+        <sender>rtYunit</sender>
+        <signal>activated(int)</signal>
+        <receiver>QGraphicsDialogBase</receiver>
+        <slot>change_bb()</slot>
     </connection>
     <slot access="protected">browse_clicked()</slot>
     <slot access="protected">getBB_clicked()</slot>
index cc35cef07c3536f3bd77a56421cbbfcda4e073bc..071cda6e4438d97a128f790982a6d5e1986a9e82 100644 (file)
@@ -2,15 +2,48 @@
 
 #include "lengthcommon.h"
 
+#include "gettext.h"
+
+
 int const num_units = LyXLength::UNIT_NONE;
 
 // I am not sure if "mu" should be possible to select (Lgb)
+
+// 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] = { 
-       "sp", "pt", "bp", "dd", "mm", "pc", "cc", "cm",
-       "in", "ex", "em", "mu", 
+       "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] = { 
+       "sp", "pt", "bp", "dd", "mm", "pc", 
+       "cc", "cm", "in", "ex", "em", "mu", 
+       // in 1.4 the following names should be used. then no
+       // translation into the latex ones are needed
+//     "textheight",  "columnwidth", "pagewidth", "linewidth",
+//     "textheight", "pageheight" };
+       "text%",  "col%", "page%", "line%",
+       "theight%", "pheight%" };
+
+// the LyX gui units
+char const * unit_name_gui[num_units] = { 
+       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%"),
+       N_("theight%"), N_("pheight%") };
+
+       // this one maybe better ???? but there can be problems with
+       // xforms (Herbert)
+//     N_("textwidth%"), N_("columnwidth%"), N_("pagewidth%"), N_("linewidth%"),
+//     N_("textheight%"), N_("pageheight%") };
+
+       // or altenative this ones
+//     N_("twidth%"), N_("cwidth%"), N_("pwidth%"), N_("lwidth%"),
+//     N_("theight%"), N_("pheight%") };
 
 LyXLength::UNIT unitFromString(string const & data)
 {
@@ -19,3 +52,4 @@ LyXLength::UNIT unitFromString(string const & data)
                ++i;
        return static_cast<LyXLength::UNIT>(i);
 }
+
index 57095514ba55c9b0df78c44e7b763f67885e3dbc..ac4eec1670bf35f03e273f42fedafafd5aa1b762 100644 (file)
@@ -15,8 +15,11 @@ 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[];
 
 /// return the unit given a string representation such as "cm"
 LyXLength::UNIT unitFromString(string const & data);
 
+
 #endif // LENGTH_COMMON_H