]> git.lyx.org Git - features.git/commitdiff
float dialog fixes
authorJohn Levon <levon@movementarian.org>
Sun, 8 Sep 2002 06:16:40 +0000 (06:16 +0000)
committerJohn Levon <levon@movementarian.org>
Sun, 8 Sep 2002 06:16:40 +0000 (06:16 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5234 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt2/ChangeLog
src/frontends/qt2/QFloat.C
src/frontends/qt2/QFloatDialog.C
src/frontends/qt2/QFloatDialog.h
src/frontends/qt2/ui/QFloatDialog.ui

index 3029dbcdc468117d67fc57beaba0c8cffedbb9cb..ae7fb0ae0aa0d0eeab69b105e4fdd05a7fb3bbe8 100644 (file)
@@ -1,3 +1,11 @@
+2002-09-08  John Levon  <levon@movementarian.org>
+
+       * QFloat.h:
+       * QFloat.C:
+       * QFloatDialog.h:
+       * QFloatDialog.C:
+       * ui/QFloatDialog.ui: fix bug 527 and more 
 2002-09-08  John Levon  <levon@movementarian.org>
 
        * qfont_loader.C: fix bug 531 (emph())
index 7713d512bf7f4b1b42c30319d96ce50404f8ef3e..ca85bc9b5240e7595483f5d89cf826b01d074346 100644 (file)
 #include "QFloat.h"
 #include "Qt2BC.h"
 #include "gettext.h"
-#include "helper_funcs.h"
 
 #include "support/lstrings.h"
 
-#include <qradiobutton.h>
 #include <qpushbutton.h>
 #include <qcheckbox.h>
 
 typedef Qt2CB<ControlFloat, Qt2DB<QFloatDialog> > base_class;
 
 QFloat::QFloat()
-       : base_class(_("LaTeX Information"))
+       : base_class(_("Float Settings"))
 {
 }
 
@@ -41,22 +39,38 @@ void QFloat::build_dialog()
        bc().setApply(dialog_->applyPB);
        bc().setOK(dialog_->okPB);
        bc().setRestore(dialog_->restorePB);
+
+       bc().addReadOnly(dialog_->topCB);
+       bc().addReadOnly(dialog_->bottomCB);
+       bc().addReadOnly(dialog_->herepossiblyCB);
+       bc().addReadOnly(dialog_->heredefinitelyCB);
+       bc().addReadOnly(dialog_->pageCB);
+       bc().addReadOnly(dialog_->ignoreCB);
+       bc().addReadOnly(dialog_->defaultsCB);
+       bc().addReadOnly(dialog_->spanCB);
 }
 
 
 void QFloat::update_contents()
 {
+       bool def_placement = false;
        bool top = false;
        bool bottom = false;
        bool page = false;
        bool here = false;
-       bool forcehere = false;
+       bool force = false;
+       bool here_definitely = false;
 
-       string placement(controller().params().placement);
+       string const placement(controller().params().placement);
 
-       if (contains(placement, "H")) {
-               forcehere = true;
+       if (placement.empty()) {
+               def_placement = true;
+       } else if (contains(placement, "H")) {
+               here_definitely = true;
        } else {
+               if (contains(placement, "!")) {
+                       force = true;
+               }
                if (contains(placement, "t")) {
                        top = true;
                }
@@ -70,33 +84,48 @@ void QFloat::update_contents()
                        here = true;
                }
        }
-
-       dialog_->top->setChecked(top);
-       dialog_->bottom->setChecked(bottom);
-       dialog_->page->setChecked(page);
-       dialog_->here->setChecked(here);
-       dialog_->forcehere->setChecked(forcehere);
+       dialog_->defaultsCB->setChecked(def_placement);
+       dialog_->topCB->setChecked(top);
+       dialog_->bottomCB->setChecked(bottom);
+       dialog_->pageCB->setChecked(page);
+       dialog_->herepossiblyCB->setChecked(here);
+       dialog_->ignoreCB->setChecked(force);
+       dialog_->ignoreCB->setEnabled(top || bottom || page || here);
+       dialog_->heredefinitelyCB->setChecked(here_definitely);
+       if (controller().params().wide) {
+               dialog_->herepossiblyCB->setChecked(false);
+               dialog_->bottomCB->setChecked(false);
+       }
+       dialog_->spanCB->setChecked(controller().params().wide);
 }
 
 void QFloat::apply()
 {
        string placement;
 
-       if (dialog_->forcehere->isChecked()) {
+       if (dialog_->heredefinitelyCB->isChecked()) {
                placement += "H";
        } else {
-               if (dialog_->top->isChecked()) {
+               if (dialog_->ignoreCB->isChecked()) {
+                       placement += "!";
+               }
+               if (dialog_->topCB->isChecked()) {
                        placement += "t";
                }
-               if (dialog_->bottom->isChecked()) {
+               if (dialog_->bottomCB->isChecked()) {
                        placement += "b";
                }
-               if (dialog_->page->isChecked()) {
+               if (dialog_->pageCB->isChecked()) {
                        placement += "p";
                }
-               if (dialog_->here->isChecked()) {
+               if (dialog_->herepossiblyCB->isChecked()) {
                        placement += "h";
                }
        }
        controller().params().placement = placement;
+       controller().params().wide = dialog_->spanCB->isChecked(); 
 }
index 0dfc1755dc72f5e7fe76f31d0fd5646f9ec2f273..8efa34320ee25cd04f6eb705e02a4b39cef56775 100644 (file)
@@ -13,6 +13,7 @@
 #include "ControlFloat.h"
 
 #include <qpushbutton.h>
+#include <qcheckbox.h>
 
 #include "QFloatDialog.h"
 #include "QFloat.h"
@@ -43,3 +44,39 @@ void QFloatDialog::closeEvent(QCloseEvent * e)
        form_->slotWMHide();
        e->accept();
 }
+
+void QFloatDialog::tbhpClicked()
+{
+       heredefinitelyCB->setChecked(false);
+       bool allow(topCB->isChecked());
+       allow |= bottomCB->isChecked();
+       allow |= pageCB->isChecked();
+       allow |= herepossiblyCB->isChecked();
+       ignoreCB->setEnabled(allow);
+}
+
+void QFloatDialog::heredefinitelyClicked()
+{
+       topCB->setChecked(false);
+       bottomCB->setChecked(false);
+       pageCB->setChecked(false);
+       herepossiblyCB->setChecked(false);
+}
+
+
+void QFloatDialog::spanClicked()
+{
+       bool const span(spanCB->isChecked());
+       if (!defaultsCB->isChecked()) {
+               herepossiblyCB->setEnabled(!span);
+               heredefinitelyCB->setEnabled(!span);
+       }
+       if (!span)
+               return;
+       herepossiblyCB->setChecked(false);
+       heredefinitelyCB->setChecked(false);
+}
index e1a7e6817e1335715d55b3dd074f44dc020f35f3..7b1ad6213412a5d05123070829ed689b0b7a91c9 100644 (file)
@@ -23,7 +23,10 @@ public:
 
 protected slots:
        virtual void change_adaptor();
-
+       virtual void tbhpClicked();
+       virtual void heredefinitelyClicked();
+       virtual void spanClicked();
 protected:
        virtual void closeEvent(QCloseEvent * e);
 
index babeb1eea10409eec0d7d09032e62e74a2053824..d47b5489a7cb0e992a1e5dbce59b488d2c06229e 100644 (file)
@@ -14,7 +14,7 @@
             <x>0</x>
             <y>0</y>
             <width>369</width>
-            <height>169</height>
+            <height>259</height>
         </rect>
     </property>
     <property stdset="1">
@@ -25,7 +25,7 @@
         <name>sizeGripEnabled</name>
         <bool>true</bool>
     </property>
-    <grid>
+    <vbox>
         <property stdset="1">
             <name>margin</name>
             <number>11</number>
             <name>spacing</name>
             <number>6</number>
         </property>
-        <widget row="2"  column="0" >
+        <widget>
+            <class>QCheckBox</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>defaultsCB</cstring>
+            </property>
+            <property stdset="1">
+                <name>text</name>
+                <string>Use &amp;default placement</string>
+            </property>
+            <property>
+                <name>toolTip</name>
+                <string>Use LaTeX default settings</string>
+            </property>
+        </widget>
+        <widget>
+            <class>QGroupBox</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>placement</cstring>
+            </property>
+            <property stdset="1">
+                <name>title</name>
+                <string>Advanced placement options</string>
+            </property>
+            <hbox>
+                <property stdset="1">
+                    <name>margin</name>
+                    <number>11</number>
+                </property>
+                <property stdset="1">
+                    <name>spacing</name>
+                    <number>6</number>
+                </property>
+                <widget>
+                    <class>QLayoutWidget</class>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>Layout6</cstring>
+                    </property>
+                    <vbox>
+                        <property stdset="1">
+                            <name>margin</name>
+                            <number>0</number>
+                        </property>
+                        <property stdset="1">
+                            <name>spacing</name>
+                            <number>6</number>
+                        </property>
+                        <widget>
+                            <class>QCheckBox</class>
+                            <property stdset="1">
+                                <name>name</name>
+                                <cstring>topCB</cstring>
+                            </property>
+                            <property stdset="1">
+                                <name>text</name>
+                                <string>&amp;Top of page</string>
+                            </property>
+                            <property>
+                                <name>toolTip</name>
+                                <string>Prefer top of page</string>
+                            </property>
+                        </widget>
+                        <widget>
+                            <class>QCheckBox</class>
+                            <property stdset="1">
+                                <name>name</name>
+                                <cstring>bottomCB</cstring>
+                            </property>
+                            <property stdset="1">
+                                <name>text</name>
+                                <string>&amp;Bottom of page</string>
+                            </property>
+                            <property>
+                                <name>toolTip</name>
+                                <string>Prefer bottom of page</string>
+                            </property>
+                        </widget>
+                        <widget>
+                            <class>QCheckBox</class>
+                            <property stdset="1">
+                                <name>name</name>
+                                <cstring>pageCB</cstring>
+                            </property>
+                            <property stdset="1">
+                                <name>text</name>
+                                <string>&amp;Page of floats</string>
+                            </property>
+                            <property>
+                                <name>toolTip</name>
+                                <string>Separate page for multiple floats</string>
+                            </property>
+                        </widget>
+                        <widget>
+                            <class>QCheckBox</class>
+                            <property stdset="1">
+                                <name>name</name>
+                                <cstring>herepossiblyCB</cstring>
+                            </property>
+                            <property stdset="1">
+                                <name>text</name>
+                                <string>&amp;Here if possible</string>
+                            </property>
+                            <property>
+                                <name>toolTip</name>
+                                <string>Place float at current position if possible</string>
+                            </property>
+                        </widget>
+                        <widget>
+                            <class>QCheckBox</class>
+                            <property stdset="1">
+                                <name>name</name>
+                                <cstring>ignoreCB</cstring>
+                            </property>
+                            <property stdset="1">
+                                <name>text</name>
+                                <string>&amp;Ignore LaTeX rules</string>
+                            </property>
+                            <property>
+                                <name>toolTip</name>
+                                <string>Ignore the internal LaTeX placement rules</string>
+                            </property>
+                        </widget>
+                    </vbox>
+                </widget>
+                <widget>
+                    <class>QLayoutWidget</class>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>Layout7</cstring>
+                    </property>
+                    <vbox>
+                        <property stdset="1">
+                            <name>margin</name>
+                            <number>0</number>
+                        </property>
+                        <property stdset="1">
+                            <name>spacing</name>
+                            <number>6</number>
+                        </property>
+                        <widget>
+                            <class>QCheckBox</class>
+                            <property stdset="1">
+                                <name>name</name>
+                                <cstring>heredefinitelyCB</cstring>
+                            </property>
+                            <property stdset="1">
+                                <name>text</name>
+                                <string>Here definitely</string>
+                            </property>
+                            <property>
+                                <name>toolTip</name>
+                                <string>Place float at current position</string>
+                            </property>
+                        </widget>
+                        <spacer>
+                            <property>
+                                <name>name</name>
+                                <cstring>Spacer7</cstring>
+                            </property>
+                            <property stdset="1">
+                                <name>orientation</name>
+                                <enum>Vertical</enum>
+                            </property>
+                            <property stdset="1">
+                                <name>sizeType</name>
+                                <enum>Expanding</enum>
+                            </property>
+                            <property>
+                                <name>sizeHint</name>
+                                <size>
+                                    <width>20</width>
+                                    <height>20</height>
+                                </size>
+                            </property>
+                        </spacer>
+                    </vbox>
+                </widget>
+            </hbox>
+        </widget>
+        <widget>
+            <class>QCheckBox</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>spanCB</cstring>
+            </property>
+            <property stdset="1">
+                <name>text</name>
+                <string>&amp;Span columns</string>
+            </property>
+            <property>
+                <name>toolTip</name>
+                <string>Span columns in multi-column documents</string>
+            </property>
+        </widget>
+        <widget>
             <class>QLayoutWidget</class>
             <property stdset="1">
                 <name>name</name>
                 </widget>
             </hbox>
         </widget>
-        <widget row="0"  column="0" >
-            <class>QGroupBox</class>
-            <property stdset="1">
-                <name>name</name>
-                <cstring>placement</cstring>
-            </property>
-            <property stdset="1">
-                <name>title</name>
-                <string>Placement</string>
-            </property>
-            <grid>
-                <property stdset="1">
-                    <name>margin</name>
-                    <number>11</number>
-                </property>
-                <property stdset="1">
-                    <name>spacing</name>
-                    <number>6</number>
-                </property>
-                <widget row="1"  column="0" >
-                    <class>QRadioButton</class>
-                    <property stdset="1">
-                        <name>name</name>
-                        <cstring>bottom</cstring>
-                    </property>
-                    <property stdset="1">
-                        <name>text</name>
-                        <string>Bottom of the page</string>
-                    </property>
-                </widget>
-                <widget row="0"  column="0" >
-                    <class>QRadioButton</class>
-                    <property stdset="1">
-                        <name>name</name>
-                        <cstring>top</cstring>
-                    </property>
-                    <property stdset="1">
-                        <name>text</name>
-                        <string>Top of the page</string>
-                    </property>
-                </widget>
-                <widget row="0"  column="1" >
-                    <class>QRadioButton</class>
-                    <property stdset="1">
-                        <name>name</name>
-                        <cstring>page</cstring>
-                    </property>
-                    <property stdset="1">
-                        <name>text</name>
-                        <string>Page of floats</string>
-                    </property>
-                </widget>
-                <widget row="1"  column="1" >
-                    <class>QRadioButton</class>
-                    <property stdset="1">
-                        <name>name</name>
-                        <cstring>here</cstring>
-                    </property>
-                    <property stdset="1">
-                        <name>text</name>
-                        <string>Here, if possible</string>
-                    </property>
-                </widget>
-            </grid>
-        </widget>
-        <widget row="1"  column="0" >
-            <class>QCheckBox</class>
-            <property stdset="1">
-                <name>name</name>
-                <cstring>forcehere</cstring>
-            </property>
-            <property stdset="1">
-                <name>text</name>
-                <string>Here, definitely</string>
-            </property>
-        </widget>
-    </grid>
+    </vbox>
 </widget>
 <connections>
     <connection>
-        <sender>forcehere</sender>
+        <sender>defaultsCB</sender>
         <signal>toggled(bool)</signal>
         <receiver>placement</receiver>
         <slot>setDisabled(bool)</slot>
     </connection>
     <connection>
-        <sender>top</sender>
+        <sender>defaultsCB</sender>
         <signal>toggled(bool)</signal>
         <receiver>QFloatDialogBase</receiver>
         <slot>change_adaptor()</slot>
     </connection>
     <connection>
-        <sender>page</sender>
+        <sender>defaultsCB</sender>
+        <signal>toggled(bool)</signal>
+        <receiver>QFloatDialogBase</receiver>
+        <slot>tbhpClicked()</slot>
+    </connection>
+    <connection>
+        <sender>topCB</sender>
         <signal>toggled(bool)</signal>
         <receiver>QFloatDialogBase</receiver>
         <slot>change_adaptor()</slot>
     </connection>
     <connection>
-        <sender>bottom</sender>
+        <sender>topCB</sender>
+        <signal>clicked()</signal>
+        <receiver>QFloatDialogBase</receiver>
+        <slot>tbhpClicked()</slot>
+    </connection>
+    <connection>
+        <sender>bottomCB</sender>
+        <signal>toggled(bool)</signal>
+        <receiver>QFloatDialogBase</receiver>
+        <slot>change_adaptor()</slot>
+    </connection>
+    <connection>
+        <sender>bottomCB</sender>
+        <signal>clicked()</signal>
+        <receiver>QFloatDialogBase</receiver>
+        <slot>tbhpClicked()</slot>
+    </connection>
+    <connection>
+        <sender>pageCB</sender>
+        <signal>toggled(bool)</signal>
+        <receiver>QFloatDialogBase</receiver>
+        <slot>change_adaptor()</slot>
+    </connection>
+    <connection>
+        <sender>pageCB</sender>
+        <signal>clicked()</signal>
+        <receiver>QFloatDialogBase</receiver>
+        <slot>tbhpClicked()</slot>
+    </connection>
+    <connection>
+        <sender>herepossiblyCB</sender>
         <signal>toggled(bool)</signal>
         <receiver>QFloatDialogBase</receiver>
         <slot>change_adaptor()</slot>
     </connection>
     <connection>
-        <sender>here</sender>
-        <signal>stateChanged(int)</signal>
+        <sender>herepossiblyCB</sender>
+        <signal>clicked()</signal>
+        <receiver>QFloatDialogBase</receiver>
+        <slot>tbhpClicked()</slot>
+    </connection>
+    <connection>
+        <sender>ignoreCB</sender>
+        <signal>toggled(bool)</signal>
         <receiver>QFloatDialogBase</receiver>
         <slot>change_adaptor()</slot>
     </connection>
     <connection>
-        <sender>forcehere</sender>
+        <sender>spanCB</sender>
         <signal>toggled(bool)</signal>
         <receiver>QFloatDialogBase</receiver>
         <slot>change_adaptor()</slot>
     </connection>
+    <connection>
+        <sender>spanCB</sender>
+        <signal>clicked()</signal>
+        <receiver>QFloatDialogBase</receiver>
+        <slot>spanClicked()</slot>
+    </connection>
+    <connection>
+        <sender>heredefinitelyCB</sender>
+        <signal>toggled(bool)</signal>
+        <receiver>QFloatDialogBase</receiver>
+        <slot>change_adaptor()</slot>
+    </connection>
+    <connection>
+        <sender>heredefinitelyCB</sender>
+        <signal>clicked()</signal>
+        <receiver>QFloatDialogBase</receiver>
+        <slot>heredefinitelyClicked()</slot>
+    </connection>
     <slot access="protected">change_adaptor()</slot>
+    <slot access="public">heredefinitelyClicked()</slot>
+    <slot access="public">spanClicked()</slot>
+    <slot access="public">tbhpClicked()</slot>
 </connections>
 <tabstops>
-    <tabstop>top</tabstop>
-    <tabstop>bottom</tabstop>
-    <tabstop>page</tabstop>
-    <tabstop>here</tabstop>
-    <tabstop>forcehere</tabstop>
     <tabstop>restorePB</tabstop>
     <tabstop>okPB</tabstop>
     <tabstop>applyPB</tabstop>