Same arrowfills and bracefills, but now the context menu works also.
I have incremented the format and added lyx2lyx conversion too, but ran
into some trouble during testing:
First test:
Ran from the build directory. Loading old documents did not work, because
format 329 is unknown. strange, for format 329 is the new format I
introduced
so it looks like the conversion happened
Second test:
Reconfigured with a different version-suffix, thinking that I needed a
proper
install do do this. tried to compile, but now I get a stupid error in
the po/ directory.
Well, I didn't change anything in po/, so this is clearly impossible.
Unfortunately, it seems I don't have time until monday.
If anyone bothers looking at the patch anyway, and if it turns out to be
fine, please
consider applying it. That way, there won't be a format collision as
others work.
Otherwise, I'll look more at this later.
The only things I haven't done is improving the looks of fills in
menus and the main window. I hope that can go in a later patch, as
it only is cosmetics. Unfortunately, time for this comes in bits and pieces.
Helge Hafting
Index: development/FORMAT
===================================================================
--- development/FORMAT (revision 24476)
+++ development/FORMAT (working copy)
@@ -1,6 +1,11 @@
LyX file-format changes
-----------------------
+2008-25-04 Helge Hafting <[EMAIL PROTECTED]>
+ * Format incremented to 329: More horizontal fills
+ - \leftarrowfill, \rightarrowfill
+ - \upbracefill, \downbracefill
+
2008-04-18 Bo Peng <[EMAIL PROTECTED]>
* Format incremented to 328: Revert the support for embedding
Index: src/insets/InsetSpace.cpp
===================================================================
--- src/insets/InsetSpace.cpp (revision 24476)
+++ src/insets/InsetSpace.cpp (working copy)
@@ -102,6 +102,18 @@
case InsetSpaceParams::HRULEFILL:
message = _("Horizontal Fill (Rule)");
break;
+ case InsetSpaceParams::LEFTARROWFILL:
+ message = _("Horizontal Fill (Left Arrow)");
+ break;
+ case InsetSpaceParams::RIGHTARROWFILL:
+ message = _("Horizontal Fill (Right Arrow)");
+ break;
+ case InsetSpaceParams::UPBRACEFILL:
+ message = _("Horizontal Fill (Up Brace)");
+ break;
+ case InsetSpaceParams::DOWNBRACEFILL:
+ message = _("Horizontal Fill (Down Brace)");
+ break;
case InsetSpaceParams::CUSTOM:
message = support::bformat(_("Horizontal Space (%1$s)"),
params_.length.asDocstring());
@@ -202,6 +214,10 @@
case InsetSpaceParams::HFILL_PROTECTED:
case InsetSpaceParams::DOTFILL:
case InsetSpaceParams::HRULEFILL:
+ case InsetSpaceParams::LEFTARROWFILL:
+ case InsetSpaceParams::RIGHTARROWFILL:
+ case InsetSpaceParams::UPBRACEFILL:
+ case InsetSpaceParams::DOWNBRACEFILL:
// shut up compiler
break;
}
@@ -222,6 +238,9 @@
int const y0 = y + desc;
int const y1 = y - asc;
int const y2 = y - asc / 2;
+ int const xoffset = (y0 - y1) / 2;
+ int const x2 = x0 + xoffset;
+ int const x3 = x1 - xoffset;
if (params_.kind == InsetSpaceParams::HFILL) {
pi.pain.line(x0, y1, x0, y0, Color_added_space);
@@ -238,10 +257,26 @@
pi.pain.line(x0, y, x1, y, Color_special,
frontend::Painter::line_onoffdash);
pi.pain.line(x1, y1, x1, y0, Color_special);
- } if (params_.kind == InsetSpaceParams::HRULEFILL) {
+ } else if (params_.kind == InsetSpaceParams::HRULEFILL) {
pi.pain.line(x0, y1, x0, y0, Color_special);
pi.pain.line(x0, y, x1, y, Color_special);
pi.pain.line(x1, y1, x1, y0, Color_special);
+ } else if (params_.kind == InsetSpaceParams::LEFTARROWFILL) {
+ pi.pain.line(x2, y1 , x0, y2, Color_special);
+ pi.pain.line(x0, y2 , x2, y0, Color_special);
+ pi.pain.line(x0, y2 , x1, y2, Color_special);
+ } else if (params_.kind == InsetSpaceParams::RIGHTARROWFILL) {
+ pi.pain.line(x3, y1 , x1, y2, Color_special);
+ pi.pain.line(x1, y2 , x3, y0, Color_special);
+ pi.pain.line(x0, y2 , x1, y2, Color_special);
+ } else if (params_.kind == InsetSpaceParams::UPBRACEFILL) {
+ pi.pain.line(x0, y1 , x2, y2, Color_special);
+ pi.pain.line(x3, y2 , x1, y1, Color_special);
+ pi.pain.line(x2, y2 , x3, y2, Color_special);
+ } else if (params_.kind == InsetSpaceParams::DOWNBRACEFILL) {
+ pi.pain.line(x0, y0 , x2, y2, Color_special);
+ pi.pain.line(x3, y2 , x1, y0, Color_special);
+ pi.pain.line(x2, y2 , x3, y2, Color_special);
}
return;
}
@@ -313,7 +348,19 @@
case InsetSpaceParams::HRULEFILL:
os << "\\hrulefill{}";
break;
- case InsetSpaceParams::CUSTOM:
+ case InsetSpaceParams::LEFTARROWFILL:
+ os << "\\leftarrowfill{}";
+ break;
+ case InsetSpaceParams::RIGHTARROWFILL:
+ os << "\\rightarrowfill{}";
+ break;
+ case InsetSpaceParams::UPBRACEFILL:
+ os << "\\upbracefill{}";
+ break;
+ case InsetSpaceParams::DOWNBRACEFILL:
+ os << "\\downbracefill{}";
+ break;
+case InsetSpaceParams::CUSTOM:
os << "\\hspace{}";
break;
case InsetSpaceParams::CUSTOM_PROTECTED:
@@ -358,6 +405,14 @@
kind = InsetSpaceParams::HRULEFILL;
else if (command == "\\hspace{}")
kind = InsetSpaceParams::CUSTOM;
+ else if (command == "\\leftarrowfill{}")
+ kind = InsetSpaceParams::LEFTARROWFILL;
+ else if (command == "\\rightarrowfill{}")
+ kind = InsetSpaceParams::RIGHTARROWFILL;
+ else if (command == "\\upbracefill{}")
+ kind = InsetSpaceParams::UPBRACEFILL;
+ else if (command == "\\downbracefill{}")
+ kind = InsetSpaceParams::DOWNBRACEFILL;
else if (command == "\\hspace*{}")
kind = InsetSpaceParams::CUSTOM_PROTECTED;
else
@@ -421,6 +476,18 @@
case InsetSpaceParams::HRULEFILL:
os << (runparams.free_spacing ? " " : "\\hrulefill{}");
break;
+ case InsetSpaceParams::LEFTARROWFILL:
+ os << (runparams.free_spacing ? " " : "\\leftarrowfill{}");
+ break;
+ case InsetSpaceParams::RIGHTARROWFILL:
+ os << (runparams.free_spacing ? " " : "\\rightarrowfill{}");
+ break;
+ case InsetSpaceParams::UPBRACEFILL:
+ os << (runparams.free_spacing ? " " : "\\upbracefill{}");
+ break;
+ case InsetSpaceParams::DOWNBRACEFILL:
+ os << (runparams.free_spacing ? " " : "\\downbracefill{}");
+ break;
case InsetSpaceParams::CUSTOM:
if (runparams.free_spacing)
os << " ";
@@ -451,6 +518,18 @@
case InsetSpaceParams::HRULEFILL:
os << "_____";
return 5;
+ case InsetSpaceParams::LEFTARROWFILL:
+ os << "<----";
+ return 5;
+ case InsetSpaceParams::RIGHTARROWFILL:
+ os << "---->";
+ return 5;
+ case InsetSpaceParams::UPBRACEFILL:
+ os << "\\-v-/";
+ return 5;
+ case InsetSpaceParams::DOWNBRACEFILL:
+ os << "/-^-\\";
+ return 5;
default:
os << ' ';
return 1;
@@ -482,6 +561,10 @@
case InsetSpaceParams::HRULEFILL:
// FIXME
os << '\n';
+ case InsetSpaceParams::LEFTARROWFILL:
+ case InsetSpaceParams::RIGHTARROWFILL:
+ case InsetSpaceParams::UPBRACEFILL:
+ case InsetSpaceParams::DOWNBRACEFILL:
case InsetSpaceParams::CUSTOM:
case InsetSpaceParams::CUSTOM_PROTECTED:
// FIXME
@@ -502,7 +585,11 @@
return params_.kind == InsetSpaceParams::HFILL
|| params_.kind == InsetSpaceParams::HFILL_PROTECTED
|| params_.kind == InsetSpaceParams::DOTFILL
- || params_.kind == InsetSpaceParams::HRULEFILL;
+ || params_.kind == InsetSpaceParams::HRULEFILL
+ || params_.kind == InsetSpaceParams::LEFTARROWFILL
+ || params_.kind == InsetSpaceParams::RIGHTARROWFILL
+ || params_.kind == InsetSpaceParams::UPBRACEFILL
+ || params_.kind == InsetSpaceParams::DOWNBRACEFILL;
}
Index: src/insets/InsetSpace.h
===================================================================
--- src/insets/InsetSpace.h (revision 24476)
+++ src/insets/InsetSpace.h (working copy)
@@ -51,6 +51,14 @@
DOTFILL,
/// rubber length, filled with a rule
HRULEFILL,
+ /// rubber length, filled with a left arrow
+ LEFTARROWFILL,
+ /// rubber length, filled with a right arrow
+ RIGHTARROWFILL,
+ // rubber length, filled with an up brace
+ UPBRACEFILL,
+ // rubber length, filled with a down brace
+ DOWNBRACEFILL,
/// \hspace{length}
CUSTOM,
/// \hspace*{length}
Index: src/frontends/qt4/ui/HSpaceUi.ui
===================================================================
--- src/frontends/qt4/ui/HSpaceUi.ui (revision 24476)
+++ src/frontends/qt4/ui/HSpaceUi.ui (working copy)
@@ -6,7 +6,7 @@
<x>0</x>
<y>0</y>
<width>259</width>
- <height>146</height>
+ <height>160</height>
</rect>
</property>
<property name="windowTitle" >
@@ -16,12 +16,24 @@
<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="2" column="1" >
<widget class="QComboBox" name="fillPatternCO" >
<property name="toolTip" >
@@ -42,6 +54,26 @@
<string>________</string>
</property>
</item>
+ <item>
+ <property name="text" >
+ <string><-----------</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>-----------></string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>\-----v-----/</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>/-----^-----\</string>
+ </property>
+ </item>
</widget>
</item>
<item row="0" column="0" >
@@ -159,12 +191,21 @@
</item>
<item row="4" column="0" colspan="3" >
<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="okPB" >
<property name="text" >
Index: src/frontends/qt4/GuiHSpace.cpp
===================================================================
--- src/frontends/qt4/GuiHSpace.cpp (revision 24476)
+++ src/frontends/qt4/GuiHSpace.cpp (working copy)
@@ -165,6 +165,22 @@
item = 6;
pattern = 2;
break;
+ case InsetSpaceParams::LEFTARROWFILL:
+ item = 6;
+ pattern = 3;
+ break;
+ case InsetSpaceParams::RIGHTARROWFILL:
+ item = 6;
+ pattern = 4;
+ break;
+ case InsetSpaceParams::UPBRACEFILL:
+ item = 6;
+ pattern = 5;
+ break;
+ case InsetSpaceParams::DOWNBRACEFILL:
+ item = 6;
+ pattern = 6;
+ break;
case InsetSpaceParams::CUSTOM:
item = 7;
break;
@@ -220,6 +236,14 @@
params.kind = InsetSpaceParams::DOTFILL;
else if (fill == 2)
params.kind = InsetSpaceParams::HRULEFILL;
+ else if (fill == 3)
+ params.kind = InsetSpaceParams::LEFTARROWFILL;
+ else if (fill == 4)
+ params.kind = InsetSpaceParams::RIGHTARROWFILL;
+ else if (fill == 5)
+ params.kind = InsetSpaceParams::UPBRACEFILL;
+ else if (fill == 6)
+ params.kind = InsetSpaceParams::DOWNBRACEFILL;
else if (keep)
params.kind = InsetSpaceParams::HFILL_PROTECTED;
else
Index: src/Buffer.cpp
===================================================================
--- src/Buffer.cpp (revision 24476)
+++ src/Buffer.cpp (working copy)
@@ -116,7 +116,7 @@
namespace {
-int const LYX_FORMAT = 328;
+int const LYX_FORMAT = 329;
typedef map<string, bool> DepClean;
typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;
Index: lib/lyx2lyx/lyx_1_6.py
===================================================================
--- lib/lyx2lyx/lyx_1_6.py (revision 24476)
+++ lib/lyx2lyx/lyx_1_6.py (working copy)
@@ -1751,6 +1751,27 @@
'hrulefill{}\n\\end_layout\n\n\\end_inset\n\n')
+def revert_arrowbracefills(document):
+ ' Revert rightarrowfill leftarrowfill upbracefill downbracefill '
+ for i in range(len(document.body)):
+ document.body[i] = document.body[i].replace('\\InsetSpace \\leftarrowfill{}', \
+ '\\begin_inset ERT\nstatus collapsed\n\n' \
+ '\\begin_layout Standard\n\n\n\\backslash\n' \
+ 'leftarrowfill{}\n\\end_layout\n\n\\end_inset\n\n')
+ document.body[i] = document.body[i].replace('\\InsetSpace \\rightarrowfill{}', \
+ '\\begin_inset ERT\nstatus collapsed\n\n' \
+ '\\begin_layout Standard\n\n\n\\backslash\n' \
+ 'rightarrowfill{}\n\\end_layout\n\n\\end_inset\n\n')
+ document.body[i] = document.body[i].replace('\\InsetSpace \\upbracefill{}', \
+ '\\begin_inset ERT\nstatus collapsed\n\n' \
+ '\\begin_layout Standard\n\n\n\\backslash\n' \
+ 'upbracefill{}\n\\end_layout\n\n\\end_inset\n\n')
+ document.body[i] = document.body[i].replace('\\InsetSpace \\downbracefill{}', \
+ '\\begin_inset ERT\nstatus collapsed\n\n' \
+ '\\begin_layout Standard\n\n\n\\backslash\n' \
+ 'downbracefill{}\n\\end_layout\n\n\\end_inset\n\n')
+
+
def revert_hspace(document):
' Revert \\InsetSpace \\hspace{} to ERT '
i = 0
@@ -2058,9 +2079,11 @@
[326, []],
[327, []],
[328, [remove_embedding, remove_extra_embedded_files, remove_inzip_options]],
+ [329, []],
]
-revert = [[327, []],
+revert = [328, [revert_arrowbracefills]],
+ [327, []],
[326, [revert_mexican]],
[325, [revert_pdfpages]],
[324, []],
Index: lib/ui/stdcontext.inc
===================================================================
--- lib/ui/stdcontext.inc (revision 24476)
+++ lib/ui/stdcontext.inc (working copy)
@@ -162,6 +162,10 @@
Item "Protected Horizontal Fill|i" "next-inset-modify space \hspace*{\fill}"
Item "Horizontal Fill (Dots)|D" "next-inset-modify space \dotfill{}"
Item "Horizontal Fill (Rule)|R" "next-inset-modify space \hrulefill{}"
+ Item "Horizontal Fill (Left Arrow)" "next-inset-modify space \leftarrowfill{}"
+ Item "Horizontal Fill (Right Arrow)" "next-inset-modify space \rightarrowfill{}"
+ Item "Horizontal Fill (Up Brace)" "next-inset-modify space \upbracefill{}"
+ Item "Horizontal Fill (Down Brace)" "next-inset-modify space \downbracefill{}"
Item "Custom Length|C" "command-sequence next-inset-modify space \hspace{} \length 1in; next-inset-toggle"
Separator
Item "Settings...|S" "next-inset-toggle"