]> git.lyx.org Git - features.git/commitdiff
GuiBox.cpp: fix update of height checkbox
authorUwe Stöhr <uwestoehr@web.de>
Fri, 5 Oct 2007 00:36:38 +0000 (00:36 +0000)
committerUwe Stöhr <uwestoehr@web.de>
Fri, 5 Oct 2007 00:36:38 +0000 (00:36 +0000)
BoxUi.ui: fix the ui according to r20727
InsetBox.cpp: fix that e.g. "1\width" wasn't output to TeX

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20739 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiBox.cpp
src/frontends/qt4/GuiBox.h
src/frontends/qt4/ui/BoxUi.ui
src/insets/InsetBox.cpp

index a90238b3cddb829de3ae9966cce66040a29bcd65..afc8b16a56b1ca1cada0086c38965612ca1e3777 100644 (file)
@@ -72,7 +72,6 @@ GuiBoxDialog::GuiBoxDialog(LyXView & lv)
        connect(restorePB, SIGNAL(clicked()), this, SLOT(restoreClicked()));
        connect(typeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
        connect(typeCO, SIGNAL(activated(int)), this, SLOT(typeChanged(int)));
-       connect(heightCB, SIGNAL(stateChanged(int)), this, SLOT(heightChecked(int)));
        connect(halignCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
        connect(ialignCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
        connect(innerBoxCO, SIGNAL(activated(const QString&)),
@@ -157,17 +156,6 @@ void GuiBoxDialog::typeChanged(int index)
 }
 
 
-void GuiBoxDialog::heightChecked(int checkState)
-{
-       if (checkState == Qt::Unchecked) {
-               heightED->setEnabled(false);
-               heightUnitsLC->setEnabled(false);
-       } else { 
-               heightED->setEnabled(true);
-               heightUnitsLC->setEnabled(true);
-       }
-}
-
 void GuiBoxDialog::restoreClicked()
 {
        setInnerType(true, 2);
@@ -235,7 +223,7 @@ void GuiBoxDialog::updateContents()
 
        lengthToWidgets(heightED, heightUnitsLC,
                (controller().params().height).asString(), default_unit);
-
+       
        string const height_special = controller().params().height_special;
        if (!height_special.empty() && height_special != "none") {
                QString hspc;
@@ -250,6 +238,14 @@ void GuiBoxDialog::updateContents()
                        }
                }
        }
+       // set no optional height when the value is the default "1\height"
+       // (special units like \height are handled as "in",
+       if (height_special == "totalheight" &&  
+               controller().params().height == Length("1in"))
+               heightCB->setCheckState(Qt::Unchecked);
+       else
+               heightCB->setCheckState(Qt::Checked);
+
        heightCB->setEnabled(ibox);
 }
 
index d3513cf7ab5d553cec208256de0f512fbd7f7207..938721a285d744fe5c320898fcd372414f600624 100644 (file)
@@ -33,7 +33,6 @@ private Q_SLOTS:
        void change_adaptor();
        void innerBoxChanged(const QString &);
        void typeChanged(int);
-       void heightChecked(int);
        void restoreClicked();
 
 private:
index 327ffcf7e9f3285e528205d9ec69ed520956265d..30a0e8b9e1800f4b5b5d29eecbeb6b874180de0e 100644 (file)
        <string>&amp;Height (optional):</string>
       </property>
       <property name="checked" >
-       <bool>true</bool>
+       <bool>false</bool>
       </property>
       <property name="tristate" >
        <bool>false</bool>
     </item>
     <item>
      <widget class="QLineEdit" name="heightED" >
+      <property name="enabled" >
+       <bool>false</bool>
+      </property>
       <property name="sizePolicy" >
        <sizepolicy>
         <hsizetype>1</hsizetype>
      </widget>
     </item>
     <item>
-     <widget class="LengthCombo" name="heightUnitsLC" />
+     <widget class="LengthCombo" name="heightUnitsLC" >
+      <property name="enabled" >
+       <bool>false</bool>
+      </property>
+     </widget>
     </item>
    </layout>
   </widget>
   <include location="local" >qt_helpers.h</include>
  </includes>
  <resources/>
- <connections/>
+ <connections>
+  <connection>
+   <sender>heightCB</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>heightED</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>75</x>
+     <y>83</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>171</x>
+     <y>83</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>heightCB</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>heightUnitsLC</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>86</x>
+     <y>100</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>283</x>
+     <y>100</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
 </ui>
index fadc13b4b03ff81967b18aa11004f2486863b96a..2b10cd663d6e75229cb49fcd5fcb105cb837b28f 100644 (file)
@@ -340,7 +340,8 @@ int InsetBox::latex(Buffer const & buf, odocstream & os,
                        // (special units like \height are handled as "in")
                        // but when the user has chosen a non-default inner_pos, the height
                        // must be given: \minipage[pos][height][inner-pos]{width}
-                       if (params_.height != Length("1in") ||
+                       if ((params_.height != Length("1in") ||
+                                params_.height_special != "totalheight") ||
                                params_.inner_pos != params_.pos) {
                                // FIXME UNICODE
                                os << "[" << params_.height.value()