]> git.lyx.org Git - features.git/commitdiff
fileformat incremented to 317:
authorUwe Stöhr <uwestoehr@web.de>
Sun, 2 Mar 2008 17:12:22 +0000 (17:12 +0000)
committerUwe Stöhr <uwestoehr@web.de>
Sun, 2 Mar 2008 17:12:22 +0000 (17:12 +0000)
support for floating placement settings for wrap floats

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

development/FORMAT
lib/lyx2lyx/LyX.py
lib/lyx2lyx/lyx_1_6.py
src/Buffer.cpp
src/frontends/qt4/GuiWrap.cpp
src/frontends/qt4/ui/WrapUi.ui

index 1c8ea98d8443b612324c098142ce9125a5ec0c16..eced9bc1552725b9c03bce8ed18230140e8c4255 100644 (file)
@@ -1,8 +1,11 @@
 LyX file-format changes
 -----------------------
 
-2008-03-01 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
-       * Format incremented to 316: support for subfloats (subfig package).
+2008-03-02 Uwe Stöhr <uwestoehr@web.de>
+       * Format incremented to 317: support floating placements for wrap floats
+
+2008-03-02 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
+       * Format incremented to 316: support for subfloats (subfig package)
 
 2008-02-18 Richard Heck <rgheck@comcast.net>
        * Format incremented to 315: support for column separation in page margins
@@ -30,7 +33,7 @@ LyX file-format changes
        * Format incremented to 308: support for Serbian (Latin)
 
 2007-12-05 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
-       * Format incremented to 307: support for \slash and \nobreakdash.
+       * Format incremented to 307: support for \slash and \nobreakdash
 
 2007-12-05 Uwe Stöhr <uwestoehr@web.de>
        * Format incremented to 306: support for Interlingua
@@ -89,7 +92,7 @@ LyX file-format changes
        * Format incremented to 291: Support for Vietnamese.
 
 2007-10-03 Uwe Stöhr <uwestoehr@web.de>
-       * Format incremented to 290: Add table wrap floats.
+       * Format incremented to 290: Add table wrap floats
 
 2007-10-03 Martin Vermeer <martin.vermeer@tkk.fi>
        * Format incremented to 289: make Index a collapsable inset.
@@ -107,7 +110,7 @@ LyX file-format changes
          of its options.
 
 2007-09-11 Bo Peng <ben.bob@gmail.com>
-       * Format incremented to 285: Tweaks to embedded file format.
+       * Format incremented to 285: Tweaks to embedded file format
          Remove inzip parameter from graphics insets.
 
 2007-09-09 Helge Hafting <helge.hafting@aitel.hist.no>
@@ -130,7 +133,7 @@ LyX file-format changes
 
 2007-08-29 Richard Heck <rgheck@comcast.net>
 
-       * format incremented to 281: allow modules for layout files.
+       * format incremented to 281: allow modules for layout files
 
 2007-08-17 Martin Vermeer <martin.vermeer@tkk.fi>
 
index 99e8399f39152aa0823223f601101f7ada9ce77e..1a2f0c7ea6be0ac7477fdfdf43329156b12f693c 100644 (file)
@@ -80,7 +80,7 @@ format_relation = [("0_06",    [200], minor_versions("0.6" , 4)),
                    ("1_3",     [221], minor_versions("1.3" , 7)),
                    ("1_4", range(222,246), minor_versions("1.4" , 5)),
                    ("1_5", range(246,277), minor_versions("1.5" , 2)),
-                   ("1_6", range(277,317), minor_versions("1.6" , 0))] # jspitzm: subfig
+                   ("1_6", range(277,318), minor_versions("1.6" , 0))] # Uwe: wrap placement
 
 
 def formats_list():
index 28dc0bce6a7d95193dc7c310064529c5c8f3f6ea..7c675133306e38d2072085c2a3bcf462e3835990 100644 (file)
@@ -1362,6 +1362,24 @@ def revert_subfig(document):
         i = i + 1
 
 
+def revert_wrapplacement(document):
+    "Revert placement options wrap floats (wrapfig)."
+    i = 0
+    while True:
+        i = find_token(document.body, "lines", i)
+        if i == -1:
+            return
+        j = find_token(document.body, "placement", i+1)
+        if j != i + 1:
+            document.warning("Malformed LyX document: Couldn't find placement parameter of wrap float.")
+            return
+        document.body[j] = document.body[j].replace("placement O", "placement o")
+        document.body[j] = document.body[j].replace("placement I", "placement i")
+        document.body[j] = document.body[j].replace("placement L", "placement l")
+        document.body[j] = document.body[j].replace("placement R", "placement r")
+        i = i + 1
+
+
 ##
 # Conversion hub
 #
@@ -1406,10 +1424,12 @@ convert = [[277, [fix_wrong_tables]],
            [313, [convert_module_names]],
            [314, []],
            [315, []],
-           [316, [convert_subfig]]
+           [316, [convert_subfig]],
+           [317, []]
           ]
 
-revert =  [[315, [revert_subfig]],
+revert =  [[316, [revert_wrapplacement]],
+           [315, [revert_subfig]],
            [314, [revert_colsep]],
            [313, []],
            [312, [revert_module_names]],
index 4519737d6bf8f005b09e81ac2fcf4fca43720bfe..cf8d6a0124aa9cf47b5d53fd58c03042df292fe6 100644 (file)
@@ -117,7 +117,7 @@ namespace os = support::os;
 
 namespace {
 
-int const LYX_FORMAT = 316; // JSpitzm: subfig support
+int const LYX_FORMAT = 317; // Uwe Stöhr: float placement support for wrap floats
 
 typedef map<string, bool> DepClean;
 typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;
index 7b6106bd1765bb8b401f9ea93b860bcb3499ee43..253c042d845ae6f05d359663605051105db9cb2b 100644 (file)
@@ -40,12 +40,14 @@ GuiWrap::GuiWrap(GuiView & lv)
        connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply()));
        connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
 
+       connect(valignCO, SIGNAL(highlighted(QString)),
+               this, SLOT(change_adaptor()));
+       connect(floatCB, SIGNAL(stateChanged(int)),
+               this, SLOT(change_adaptor()));
        connect(widthED, SIGNAL(textChanged(QString)),
                this, SLOT(change_adaptor()));
        connect(widthUnitLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
                this, SLOT(change_adaptor()));
-       connect(valignCO, SIGNAL(highlighted(QString)),
-               this, SLOT(change_adaptor()));
        connect(overhangCB, SIGNAL(stateChanged(int)),
                this, SLOT(change_adaptor()));
        connect(overhangED, SIGNAL(textChanged(QString)),
@@ -68,9 +70,10 @@ GuiWrap::GuiWrap(GuiView & lv)
        bc().setApply(applyPB);
        bc().setCancel(closePB);
 
+       bc().addReadOnly(valignCO);
+       bc().addReadOnly(floatCB);
        bc().addReadOnly(widthED);
        bc().addReadOnly(widthUnitLC);
-       bc().addReadOnly(valignCO);
        bc().addReadOnly(overhangCB);
        bc().addReadOnly(overhangED);
        bc().addReadOnly(overhangUnitLC);
@@ -116,18 +119,33 @@ void GuiWrap::applyView()
                // in InsetWrap.cpp
                params_.lines = 0;
 
+       bool floatOn = false;
+       if (floatCB->checkState() == Qt::Checked)
+               floatOn = true;
        switch (valignCO->currentIndex()) {
        case 0:
-               params_.placement = "o";
+               if (floatOn)
+                       params_.placement = "O";
+               else
+                       params_.placement = "o";
                break;
        case 1:
-               params_.placement = "i";
+               if (floatOn)
+                       params_.placement = "I";
+               else
+                       params_.placement = "i";
                break;
        case 2:
-               params_.placement = "l";
+               if (floatOn)
+                       params_.placement = "L";
+               else
+                       params_.placement = "l";
                break;
        case 3:
-               params_.placement = "r";
+               if (floatOn)
+                       params_.placement = "R";
+               else
+                       params_.placement = "r";
                break;
        }
 }
@@ -156,14 +174,18 @@ void GuiWrap::updateContents()
                linesCB->setCheckState(Qt::Checked);
 
        int item = 0;
-       if (params_.placement == "i")
+       if (params_.placement == "i" || params_.placement == "I")
                item = 1;
-       else if (params_.placement == "l")
+       else if (params_.placement == "l" || params_.placement == "L")
                item = 2;
-       else if (params_.placement == "r")
+       else if (params_.placement == "r" || params_.placement == "R")
                item = 3;
 
        valignCO->setCurrentIndex(item);
+
+       if (params_.placement == "O" || params_.placement == "I"
+               || params_.placement == "L" || params_.placement == "R")
+               floatCB->setCheckState(Qt::Checked);
 }
 
 
index 48723ed7fbd7d9e2482de9248508ab55ef3f4d7f..e7223e4870abb26eb7d230944546f7ea410bd66c 100644 (file)
    <bool>true</bool>
   </property>
   <layout class="QGridLayout" >
-   <property name="margin" >
+   <property name="leftMargin" >
     <number>9</number>
    </property>
-   <property name="spacing" >
+   <property name="topMargin" >
+    <number>9</number>
+   </property>
+   <property name="rightMargin" >
+    <number>9</number>
+   </property>
+   <property name="bottomMargin" >
+    <number>9</number>
+   </property>
+   <property name="horizontalSpacing" >
+    <number>6</number>
+   </property>
+   <property name="verticalSpacing" >
     <number>6</number>
    </property>
    <item row="3" column="2" >
@@ -58,9 +70,7 @@
    <item row="1" column="3" >
     <widget class="LengthCombo" name="widthUnitLC" >
      <property name="sizePolicy" >
-      <sizepolicy>
-       <hsizetype>3</hsizetype>
-       <vsizetype>0</vsizetype>
+      <sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
        <horstretch>0</horstretch>
        <verstretch>0</verstretch>
       </sizepolicy>
    <item row="1" column="1" colspan="2" >
     <widget class="QLineEdit" name="widthED" >
      <property name="sizePolicy" >
-      <sizepolicy>
-       <hsizetype>1</hsizetype>
-       <vsizetype>0</vsizetype>
+      <sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
        <horstretch>0</horstretch>
        <verstretch>0</verstretch>
       </sizepolicy>
    </item>
    <item row="4" column="0" colspan="4" >
     <layout class="QHBoxLayout" >
-     <property name="margin" >
-      <number>0</number>
-     </property>
      <property name="spacing" >
       <number>6</number>
      </property>
+     <property name="leftMargin" >
+      <number>0</number>
+     </property>
+     <property name="topMargin" >
+      <number>0</number>
+     </property>
+     <property name="rightMargin" >
+      <number>0</number>
+     </property>
+     <property name="bottomMargin" >
+      <number>0</number>
+     </property>
      <item>
       <widget class="QPushButton" name="restorePB" >
        <property name="toolTip" >
       <bool>false</bool>
      </property>
      <property name="sizePolicy" >
-      <sizepolicy>
-       <hsizetype>1</hsizetype>
-       <vsizetype>0</vsizetype>
+      <sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
        <horstretch>0</horstretch>
        <verstretch>0</verstretch>
       </sizepolicy>
       <bool>false</bool>
      </property>
      <property name="sizePolicy" >
-      <sizepolicy>
-       <hsizetype>13</hsizetype>
-       <vsizetype>13</vsizetype>
+      <sizepolicy vsizetype="Ignored" hsizetype="Ignored" >
        <horstretch>0</horstretch>
        <verstretch>0</verstretch>
       </sizepolicy>
      </property>
     </widget>
    </item>
+   <item row="0" column="3" >
+    <widget class="QCheckBox" name="floatCB" >
+     <property name="toolTip" >
+      <string>by checking this the placement can float</string>
+     </property>
+     <property name="text" >
+      <string>&amp;float</string>
+     </property>
+    </widget>
+   </item>
   </layout>
  </widget>
  <customwidgets>
  </customwidgets>
  <tabstops>
   <tabstop>valignCO</tabstop>
+  <tabstop>floatCB</tabstop>
   <tabstop>widthED</tabstop>
   <tabstop>widthUnitLC</tabstop>
   <tabstop>overhangCB</tabstop>
   <tabstop>overhangUnitLC</tabstop>
   <tabstop>linesCB</tabstop>
   <tabstop>linesSB</tabstop>
-  <tabstop>restorePB</tabstop>
   <tabstop>okPB</tabstop>
-  <tabstop>closePB</tabstop>
   <tabstop>applyPB</tabstop>
+  <tabstop>closePB</tabstop>
+  <tabstop>restorePB</tabstop>
  </tabstops>
  <includes>
   <include location="local" >qt_helpers.h</include>
      <y>93</y>
     </hint>
     <hint type="destinationlabel" >
-     <x>164</x>
-     <y>101</y>
+     <x>132</x>
+     <y>108</y>
     </hint>
    </hints>
   </connection>