Am Montag, 5. Juni 2006 20:20 schrieb Edwin Leuven:
> what ever happened to that one?
> 
> georg, i guess you know?

Yes, I do. The branch 
svn://svn.lyx.org/lyx/lyx-devel/branches/BooktabBranch does still exist. 
I just merged the latest changes from trunk to the branch.

Remaining tasks: Add support for interline space (half finished, see 
attached) and testing.


Georg
Index: src/insets/insettabular.C
===================================================================
--- src/insets/insettabular.C	(Revision 14014)
+++ src/insets/insettabular.C	(Arbeitskopie)
@@ -133,6 +133,9 @@ TabularFeature tabularFeature[] =
 	{ LyXTabular::SET_SPECIAL_MULTI, "set-special-multi" },
 	{ LyXTabular::SET_BOOKTABS, "set-booktabs" },
 	{ LyXTabular::UNSET_BOOKTABS, "unset-booktabs" },
+	{ LyXTabular::SET_TOP_SPACE, "set-top-space" },
+	{ LyXTabular::SET_BOTTOM_SPACE, "set-bottom-space" },
+	{ LyXTabular::SET_INTERLINE_SPACE, "set-interline-space" },
 	{ LyXTabular::LAST_ACTION, "" }
 };
 
@@ -268,8 +271,10 @@ void InsetTabular::metrics(MetricsInfo &
 			tabular.setWidthOfCell(cell, dim.wid);
 			++cell;
 		}
-		tabular.setAscentOfRow(i, maxAsc + ADD_TO_HEIGHT);
-		tabular.setDescentOfRow(i, maxDesc + ADD_TO_HEIGHT);
+		tabular.setAscentOfRow(i, maxAsc + ADD_TO_HEIGHT +
+			tabular.row_info[i].top_space.inPixels(mi.base.textwidth));
+		tabular.setDescentOfRow(i, maxDesc + ADD_TO_HEIGHT +
+			tabular.row_info[i].bottom_space.inPixels(mi.base.textwidth));
 	}
 
 	dim.asc = tabular.getAscentOfRow(0);
@@ -804,6 +809,9 @@ bool InsetTabular::getStatus(LCursor & c
 		case LyXTabular::DELETE_COLUMN:
 		case LyXTabular::SET_ALL_LINES:
 		case LyXTabular::UNSET_ALL_LINES:
+		case LyXTabular::SET_TOP_SPACE:
+		case LyXTabular::SET_BOTTOM_SPACE:
+		case LyXTabular::SET_INTERLINE_SPACE:
 			status.clear();
 			return true;
 
@@ -1131,11 +1139,10 @@ int InsetTabular::dist(idx_type const ce
 	Point o = theCoords.getInsets().xy(&inset);
 	int const xbeg = o.x_ - tabular.getBeginningOfTextInCell(cell);
 	int const xend = xbeg + tabular.getWidthOfColumn(cell);
-	int const ybeg = o.y_ - inset.ascent();
 	row_type const row = tabular.row_of_cell(cell);
-	int const rowheight = tabular.getAscentOfRow(row)
-			+ tabular.getDescentOfRow(row);
-	int const yend = ybeg + rowheight;
+	int const ybeg = o.y_ - tabular.getAscentOfRow(row) -
+	                 tabular.getAdditionalHeight(row);
+	int const yend = o.y_ + tabular.getDescentOfRow(row);
 
 	if (x < xbeg)
 		xx = xbeg - x;
@@ -1646,6 +1653,33 @@ void InsetTabular::tabularFeatures(LCurs
 		tabular.setBookTabs(false);
 		break;
 
+	case LyXTabular::SET_TOP_SPACE: {
+		LyXLength len;
+		if (isValidLength(value, &len)) {
+			for (row_type i = sel_row_start; i <= sel_row_end; ++i)
+				tabular.row_info[i].top_space = len;
+		}
+		break;
+	}
+
+	case LyXTabular::SET_BOTTOM_SPACE: {
+		LyXLength len;
+		if (isValidLength(value, &len)) {
+			for (row_type i = sel_row_start; i <= sel_row_end; ++i)
+				tabular.row_info[i].bottom_space = len;
+		}
+		break;
+	}
+
+	case LyXTabular::SET_INTERLINE_SPACE: {
+		LyXLength len;
+		if (isValidLength(value, &len)) {
+			for (row_type i = sel_row_start; i <= sel_row_end; ++i)
+				tabular.row_info[i].interline_space = len;
+		}
+		break;
+	}
+
 	// dummy stuff just to avoid warnings
 	case LyXTabular::LAST_ACTION:
 		break;
Index: src/frontends/qt3/QTabularDialog.C
===================================================================
--- src/frontends/qt3/QTabularDialog.C	(Revision 14014)
+++ src/frontends/qt3/QTabularDialog.C	(Arbeitskopie)
@@ -37,6 +37,9 @@ QTabularDialog::QTabularDialog(QTabular 
 		form, SLOT(slotClose()));
 
 	widthED->setValidator(unsignedLengthValidator(widthED));
+	topspaceED->setValidator(new LengthValidator(topspaceED));
+	bottomspaceED->setValidator(new LengthValidator(bottomspaceED));
+	interlinespaceED->setValidator(new LengthValidator(interlinespaceED));
 }
 
 
@@ -119,6 +122,30 @@ void QTabularDialog::width_changed()
 }
 
 
+void QTabularDialog::topspace_changed()
+{
+	form_->changed();
+	string const topspace = widgetsToLength(topspaceED, topspaceUnit);
+	form_->controller().set(LyXTabular::SET_TOP_SPACE, topspace);
+}
+
+
+void QTabularDialog::bottomspace_changed()
+{
+	form_->changed();
+	string const bottomspace = widgetsToLength(bottomspaceED, bottomspaceUnit);
+	form_->controller().set(LyXTabular::SET_BOTTOM_SPACE, bottomspace);
+}
+
+
+void QTabularDialog::interlinespace_changed()
+{
+	form_->changed();
+	string const interlinespace = widgetsToLength(interlinespaceED, interlinespaceUnit);
+	form_->controller().set(LyXTabular::SET_INTERLINE_SPACE, interlinespace);
+}
+
+
 void QTabularDialog::multicolumn_clicked()
 {
 	form_->controller().toggleMultiColumn();
Index: src/frontends/qt3/ui/QTabularDialogBase.ui
===================================================================
--- src/frontends/qt3/ui/QTabularDialogBase.ui	(Revision 14014)
+++ src/frontends/qt3/ui/QTabularDialogBase.ui	(Arbeitskopie)
@@ -306,6 +306,187 @@
                     </widget>
                 </grid>
             </widget>
+
+            <widget class="QWidget">
+                <property name="name">
+                    <cstring>tab</cstring>
+                </property>
+                <attribute name="title">
+                    <string>&amp;Row Settings</string>
+                </attribute>
+                <grid>
+                    <property name="margin">
+                        <number>11</number>
+                    </property>
+                    <property name="spacing">
+                        <number>6</number>
+                    </property>
+                    <widget class="LengthCombo" row="0"  column="2" >
+                        <property name="name">
+                            <cstring>topspaceUnit</cstring>
+                        </property>
+                        <property name="enabled">
+                            <bool>true</bool>
+                        </property>
+                        <property name="minimumSize">
+                            <size>
+                                <width>50</width>
+                                <height>0</height>
+                            </size>
+                        </property>
+                        <property name="focusPolicy">
+                            <enum>StrongFocus</enum>
+                        </property>
+                        <property>
+                            <name>toolTip</name>
+                            <string>Topspace unit</string>
+                        </property>
+                    </widget>
+                    <widget class="QLineEdit" row="0"  column="1" >
+                        <property name="name">
+                            <cstring>topspaceED</cstring>
+                        </property>
+                        <property name="enabled">
+                            <bool>true</bool>
+                        </property>
+                        <property name="text">
+                            <string></string>
+                        </property>
+                        <property>
+                            <name>toolTip</name>
+                            <string>Extra space above the row</string>
+                        </property>
+                    </widget>
+                    <widget class="QLabel" row="0"  column="0" >
+                        <property name="name">
+                            <cstring>topspaceLA</cstring>
+                        </property>
+                        <property name="text">
+                            <string>&amp;Top space:</string>
+                        </property>
+                        <property>
+                            <name>buddy</name>
+                            <cstring>topspaceED</cstring>
+                        </property>
+                    </widget>
+                    <widget class="LengthCombo" row="1"  column="2" >
+                        <property name="name">
+                            <cstring>bottomspaceUnit</cstring>
+                        </property>
+                        <property name="enabled">
+                            <bool>true</bool>
+                        </property>
+                        <property name="minimumSize">
+                            <size>
+                                <width>50</width>
+                                <height>0</height>
+                            </size>
+                        </property>
+                        <property name="focusPolicy">
+                            <enum>StrongFocus</enum>
+                        </property>
+                        <property>
+                            <name>toolTip</name>
+                            <string>Bottomspace unit</string>
+                        </property>
+                    </widget>
+                    <widget class="QLineEdit" row="1"  column="1" >
+                        <property name="name">
+                            <cstring>bottomspaceED</cstring>
+                        </property>
+                        <property name="enabled">
+                            <bool>true</bool>
+                        </property>
+                        <property name="text">
+                            <string></string>
+                        </property>
+                        <property>
+                            <name>toolTip</name>
+                            <string>Extra space below the row</string>
+                        </property>
+                    </widget>
+                    <widget class="QLabel" row="1"  column="0" >
+                        <property name="name">
+                            <cstring>bottomspaceLA</cstring>
+                        </property>
+                        <property name="text">
+                            <string>&amp;Bottom space:</string>
+                        </property>
+                        <property>
+                            <name>buddy</name>
+                            <cstring>bottomspaceED</cstring>
+                        </property>
+                    </widget>
+                    <widget class="LengthCombo" row="2"  column="2" >
+                        <property name="name">
+                            <cstring>interlinespaceUnit</cstring>
+                        </property>
+                        <property name="enabled">
+                            <bool>true</bool>
+                        </property>
+                        <property name="minimumSize">
+                            <size>
+                                <width>50</width>
+                                <height>0</height>
+                            </size>
+                        </property>
+                        <property name="focusPolicy">
+                            <enum>StrongFocus</enum>
+                        </property>
+                        <property>
+                            <name>toolTip</name>
+                            <string>Interlinespace unit</string>
+                        </property>
+                    </widget>
+                    <widget class="QLineEdit" row="2"  column="1" >
+                        <property name="name">
+                            <cstring>interlinespaceED</cstring>
+                        </property>
+                        <property name="enabled">
+                            <bool>true</bool>
+                        </property>
+                        <property name="text">
+                            <string></string>
+                        </property>
+                        <property>
+                            <name>toolTip</name>
+                            <string>Extra space below the bottom line</string>
+                        </property>
+                    </widget>
+                    <widget class="QLabel" row="2"  column="0" >
+                        <property name="name">
+                            <cstring>interlinespaceLA</cstring>
+                        </property>
+                        <property name="text">
+                            <string>&amp;Interline space:</string>
+                        </property>
+                        <property>
+                            <name>buddy</name>
+                            <cstring>interlinespaceED</cstring>
+                        </property>
+                    </widget>
+                    <spacer row="3"  column="0" >
+                        <property name="name">
+                            <cstring>Spacer8</cstring>
+                        </property>
+                        <property name="orientation">
+                            <enum>Vertical</enum>
+                        </property>
+                        <property name="sizeType">
+                            <enum>Expanding</enum>
+                        </property>
+                        <property>
+                            <name>sizeHint</name>
+                            <size>
+                                <width>20</width>
+                                <height>20</height>
+                            </size>
+                        </property>
+                    </spacer>
+                </grid>
+            </widget>
+
+
             <widget class="QWidget">
                 <property name="name">
                     <cstring>tab</cstring>
@@ -1297,6 +1478,42 @@
         <slot>width_changed()</slot>
     </connection>
     <connection>
+        <sender>topspaceED</sender>
+        <signal>returnPressed()</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>topspace_changed()</slot>
+    </connection>
+    <connection>
+        <sender>topspaceUnit</sender>
+        <signal>selectionChanged(LyXLength::UNIT)</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>topspace_changed()</slot>
+    </connection>
+    <connection>
+        <sender>bottomspaceED</sender>
+        <signal>returnPressed()</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>bottomspace_changed()</slot>
+    </connection>
+    <connection>
+        <sender>bottomspaceUnit</sender>
+        <signal>selectionChanged(LyXLength::UNIT)</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>bottomspace_changed()</slot>
+    </connection>
+    <connection>
+        <sender>interlinespaceED</sender>
+        <signal>returnPressed()</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>interlinespace_changed()</slot>
+    </connection>
+    <connection>
+        <sender>interlinespaceUnit</sender>
+        <signal>selectionChanged(LyXLength::UNIT)</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>interlinespace_changed()</slot>
+    </connection>
+    <connection>
         <sender>closePB</sender>
         <signal>clicked()</signal>
         <receiver>QTabularDialogBase</receiver>
@@ -1363,6 +1580,12 @@
     <tabstop>specialAlignmentED</tabstop>
     <tabstop>borderSetPB</tabstop>
     <tabstop>borderUnsetPB</tabstop>
+    <tabstop>topspaceED</tabstop>
+    <tabstop>topspaceUnit</tabstop>
+    <tabstop>bottomspaceED</tabstop>
+    <tabstop>bottomspaceUnit</tabstop>
+    <tabstop>interlinespaceED</tabstop>
+    <tabstop>interlinespaceUnit</tabstop>
     <tabstop>longTabularCB</tabstop>
     <tabstop>headerStatusCB</tabstop>
     <tabstop>headerBorderAboveCB</tabstop>
@@ -1418,6 +1641,9 @@
     <slot access="protected">topBorder_changed()</slot>
     <slot access="protected">vAlign_changed(int)</slot>
     <slot access="protected">width_changed()</slot>
+    <slot access="protected">topspace_changed()</slot>
+    <slot access="protected">bottomspace_changed()</slot>
+    <slot access="protected">interlinespace_changed()</slot>
 </slots>
 <layoutdefaults spacing="6" margin="11"/>
 <includehints>
Index: src/frontends/qt3/QTabularDialog.h
===================================================================
--- src/frontends/qt3/QTabularDialog.h	(Revision 14014)
+++ src/frontends/qt3/QTabularDialog.h	(Arbeitskopie)
@@ -43,6 +43,9 @@ protected slots:
 	virtual void vAlign_changed(int align);
 	virtual void specialAlignment_changed();
 	virtual void width_changed();
+	virtual void topspace_changed();
+	virtual void bottomspace_changed();
+	virtual void interlinespace_changed();
 	virtual void longTabular();
 	virtual void ltNewpage_clicked();
 	virtual void ltHeaderStatus_clicked();
Index: src/frontends/qt3/QTabular.C
===================================================================
--- src/frontends/qt3/QTabular.C	(Revision 14014)
+++ src/frontends/qt3/QTabular.C	(Arbeitskopie)
@@ -77,10 +77,22 @@ void QTabular::build_dialog()
 	bcview().addReadOnly(dialog_->lastfooterBorderBelowCB);
 	bcview().addReadOnly(dialog_->lastfooterNoContentsCB);
 	bcview().addReadOnly(dialog_->newpageCB);
+	bcview().addReadOnly(dialog_->topspaceED);
+	bcview().addReadOnly(dialog_->topspaceUnit);
+	bcview().addReadOnly(dialog_->bottomspaceED);
+	bcview().addReadOnly(dialog_->bottomspaceUnit);
+	bcview().addReadOnly(dialog_->interlinespaceED);
+	bcview().addReadOnly(dialog_->interlinespaceUnit);
 
 	// initialize the length validator
 	addCheckedLineEdit(bcview(), dialog_->widthED,
 		dialog_->fixedWidthColLA);
+	addCheckedLineEdit(bcview(), dialog_->topspaceED,
+		dialog_->topspaceLA);
+	addCheckedLineEdit(bcview(), dialog_->bottomspaceED,
+		dialog_->bottomspaceLA);
+	addCheckedLineEdit(bcview(), dialog_->interlinespaceED,
+		dialog_->interlinespaceLA);
 }
 
 
@@ -236,6 +248,21 @@ void QTabular::update_contents()
 	dialog_->hAlignCB->setEnabled(true);
 	dialog_->vAlignCB->setEnabled(!pwidth.zero());
 
+	lengthToWidgets(dialog_->topspaceED, dialog_->topspaceUnit,
+		tabular.row_info[row].top_space.asString(), default_unit);
+	dialog_->topspaceED->setEnabled(!isReadonly);
+	dialog_->topspaceUnit->setEnabled(!isReadonly);
+
+	lengthToWidgets(dialog_->bottomspaceED, dialog_->bottomspaceUnit,
+		tabular.row_info[row].bottom_space.asString(), default_unit);
+	dialog_->bottomspaceED->setEnabled(!isReadonly);
+	dialog_->bottomspaceUnit->setEnabled(!isReadonly);
+
+	lengthToWidgets(dialog_->bottomspaceED, dialog_->interlinespaceUnit,
+		tabular.row_info[row].interline_space.asString(), default_unit);
+	dialog_->interlinespaceED->setEnabled(!isReadonly);
+	dialog_->interlinespaceUnit->setEnabled(!isReadonly);
+
 	if (!tabular.isLongTabular()) {
 		dialog_->headerStatusCB->setChecked(false);
 		dialog_->headerBorderAboveCB->setChecked(false);
@@ -373,6 +400,13 @@ void QTabular::closeGUI()
 		else
 			controller().set(LyXTabular::SET_PWIDTH, width);
 	}
+
+	string const topspace = widgetsToLength(dialog_->topspaceED, dialog_->topspaceUnit);
+	controller().set(LyXTabular::SET_TOP_SPACE, topspace);
+	string const bottomspace = widgetsToLength(dialog_->bottomspaceED, dialog_->bottomspaceUnit);
+	controller().set(LyXTabular::SET_BOTTOM_SPACE, bottomspace);
+	string const interlinespace = widgetsToLength(dialog_->interlinespaceED, dialog_->interlinespaceUnit);
+	controller().set(LyXTabular::SET_INTERLINE_SPACE, interlinespace);
 }
 
 } // namespace frontend
Index: src/frontends/xforms/FormTabular.C
===================================================================
--- src/frontends/xforms/FormTabular.C	(Revision 14014)
+++ src/frontends/xforms/FormTabular.C	(Arbeitskopie)
@@ -100,15 +100,30 @@ void FormTabular::build()
 
 	fl_set_input_return(column_options_->input_column_width,
 			    FL_RETURN_END);
+	fl_set_input_return(column_options_->input_topspace,
+			    FL_RETURN_END);
+	fl_set_input_return(column_options_->input_bottomspace,
+			    FL_RETURN_END);
+	fl_set_input_return(column_options_->input_interlinespace,
+			    FL_RETURN_END);
 	fl_set_input_return(column_options_->input_special_alignment,
 			    FL_RETURN_END);
 
 	// trigger an input event for cut&paste with middle mouse button.
 	setPrehandler(column_options_->input_column_width);
+	setPrehandler(column_options_->input_topspace);
+	setPrehandler(column_options_->input_bottomspace);
+	setPrehandler(column_options_->input_interlinespace);
 	setPrehandler(column_options_->input_special_alignment);
 
 	fl_addto_choice(column_options_->choice_value_column_width,
 			units.c_str());
+	fl_addto_choice(column_options_->choice_value_topspace,
+			units.c_str());
+	fl_addto_choice(column_options_->choice_value_bottomspace,
+			units.c_str());
+	fl_addto_choice(column_options_->choice_value_interlinespace,
+			units.c_str());
 
 	// cell options form
 	cell_options_.reset(build_tabular_cell(this));
@@ -164,6 +179,12 @@ void FormTabular::update()
 	fl_activate_object(cell_options_->input_special_multialign);
 	fl_activate_object(column_options_->input_column_width);
 	fl_activate_object(column_options_->choice_value_column_width);
+	fl_activate_object(column_options_->input_topspace);
+	fl_activate_object(column_options_->choice_value_topspace);
+	fl_activate_object(column_options_->input_bottomspace);
+	fl_activate_object(column_options_->choice_value_bottomspace);
+	fl_activate_object(column_options_->input_interlinespace);
+	fl_activate_object(column_options_->choice_value_interlinespace);
 	fl_set_input(dialog_->input_tabular_column,
 		     convert<string>(column).c_str());
 	fl_deactivate_object(dialog_->input_tabular_column);
@@ -323,6 +344,27 @@ void FormTabular::update()
 	setEnabled(column_options_->input_column_width, !isReadonly);
 	setEnabled(column_options_->choice_value_column_width, !isReadonly);
 
+	updateWidgetsFromLength(column_options_->input_topspace,
+				column_options_->choice_value_topspace,
+				tabular.row_info[row].top_space,
+	                        default_unit);
+	setEnabled(column_options_->input_topspace, !isReadonly);
+	setEnabled(column_options_->choice_value_topspace, !isReadonly);
+
+	updateWidgetsFromLength(column_options_->input_bottomspace,
+				column_options_->choice_value_bottomspace,
+				tabular.row_info[row].bottom_space,
+	                        default_unit);
+	setEnabled(column_options_->input_bottomspace, !isReadonly);
+	setEnabled(column_options_->choice_value_bottomspace, !isReadonly);
+
+	updateWidgetsFromLength(column_options_->input_interlinespace,
+				column_options_->choice_value_interlinespace,
+				tabular.row_info[row].interline_space,
+	                        default_unit);
+	setEnabled(column_options_->input_interlinespace, !isReadonly);
+	setEnabled(column_options_->choice_value_interlinespace, !isReadonly);
+
 	setEnabled(cell_options_->check_useminipage, !pwidth.zero());
 	if (!pwidth.zero()) {
 		if (tabular.getUsebox(cell) == 2)
@@ -570,6 +612,60 @@ ButtonPolicy::SMInput FormTabular::input
 		return ButtonPolicy::SMI_VALID;
 	}
 
+	if ((ob == column_options_->input_topspace) ||
+	    (ob == column_options_->choice_value_topspace)) {
+		string const str =
+			getLengthFromWidgets(column_options_->input_topspace,
+					     column_options_->choice_value_topspace);
+		controller().set(LyXTabular::SET_TOP_SPACE, str);
+
+		//check if the input is valid
+		string const input = getString(column_options_->input_topspace);
+		if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
+			postWarning(_("Invalid Length (valid example: 10mm)"));
+			return ButtonPolicy::SMI_INVALID;
+		}
+
+		update(); // update for alignment
+		return ButtonPolicy::SMI_VALID;
+	}
+
+	if ((ob == column_options_->input_bottomspace) ||
+	    (ob == column_options_->choice_value_bottomspace)) {
+		string const str =
+			getLengthFromWidgets(column_options_->input_bottomspace,
+					     column_options_->choice_value_bottomspace);
+		controller().set(LyXTabular::SET_BOTTOM_SPACE, str);
+
+		//check if the input is valid
+		string const input = getString(column_options_->input_bottomspace);
+		if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
+			postWarning(_("Invalid Length (valid example: 10mm)"));
+			return ButtonPolicy::SMI_INVALID;
+		}
+
+		update(); // update for alignment
+		return ButtonPolicy::SMI_VALID;
+	}
+
+	if ((ob == column_options_->input_interlinespace) ||
+	    (ob == column_options_->choice_value_interlinespace)) {
+		string const str =
+			getLengthFromWidgets(column_options_->input_interlinespace,
+					     column_options_->choice_value_interlinespace);
+		controller().set(LyXTabular::SET_BOTTOM_SPACE, str);
+
+		//check if the input is valid
+		string const input = getString(column_options_->input_interlinespace);
+		if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
+			postWarning(_("Invalid Length (valid example: 10mm)"));
+			return ButtonPolicy::SMI_INVALID;
+		}
+
+		update(); // update for alignment
+		return ButtonPolicy::SMI_VALID;
+	}
+
 	if ((ob == cell_options_->input_mcolumn_width) ||
 	    (ob == cell_options_->choice_value_mcolumn_width)) {
 		string const str =
Index: src/frontends/xforms/forms/form_tabular.fd
===================================================================
--- src/frontends/xforms/forms/form_tabular.fd	(Revision 14014)
+++ src/frontends/xforms/forms/form_tabular.fd	(Arbeitskopie)
@@ -10,13 +10,13 @@ SnapGrid: 5
 =============== FORM ===============
 Name: form_tabular
 Width: 510
-Height: 325
+Height: 400
 Number of Objects: 6
 
 --------------------
 class: FL_BOX
 type: FLAT_BOX
-box: 0 0 510 325
+box: 0 0 510 400
 boxtype: FL_FLAT_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -34,7 +34,7 @@ argument: 
 --------------------
 class: FL_TABFOLDER
 type: TOP_TABFOLDER
-box: 0 0 505 250
+box: 0 0 505 335
 boxtype: FL_UP_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_TOP_LEFT
@@ -52,7 +52,7 @@ argument: 
 --------------------
 class: FL_BUTTON
 type: NORMAL_BUTTON
-box: 415 290 90 30
+box: 415 365 90 30
 boxtype: FL_UP_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -70,7 +70,7 @@ argument: 0
 --------------------
 class: FL_INPUT
 type: NORMAL_INPUT
-box: 65 290 60 30
+box: 65 365 60 30
 boxtype: FL_DOWN_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_TOP_LEFT
@@ -88,7 +88,7 @@ argument: 
 --------------------
 class: FL_INPUT
 type: NORMAL_INPUT
-box: 5 290 60 30
+box: 5 365 60 30
 boxtype: FL_DOWN_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_TOP_LEFT
@@ -328,13 +328,13 @@ argument: 0
 =============== FORM ===============
 Name: form_tabular_column
 Width: 505
-Height: 225
-Number of Objects: 24
+Height: 315
+Number of Objects: 31
 
 --------------------
 class: FL_BOX
 type: FLAT_BOX
-box: 0 0 505 225
+box: 0 0 505 315
 boxtype: FL_FLAT_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -370,6 +370,24 @@ argument: 
 --------------------
 class: FL_LABELFRAME
 type: ENGRAVED_FRAME
+box: 20 230 475 75
+boxtype: FL_NO_BOX
+colors: FL_BLACK FL_COL1
+alignment: FL_ALIGN_TOP_LEFT
+style: FL_BOLD_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Vertical Space
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: 
+callback: 
+argument: 
+
+--------------------
+class: FL_LABELFRAME
+type: ENGRAVED_FRAME
 box: 20 20 170 105
 boxtype: FL_NO_BOX
 colors: FL_BLACK FL_COL1
@@ -765,6 +783,114 @@ name: radio_align_block
 callback: C_FormDialogView_InputCB
 argument: 0
 
+--------------------
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 30 270 75 30
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_TOP_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Top|#T
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: input_topspace
+callback: C_FormDialogView_InputCB
+argument: 0
+
+--------------------
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 110 270 60 30
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_TOP_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label:  |#L
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: choice_value_topspace
+callback: C_FormDialogView_InputCB
+argument: 0
+
+--------------------
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 190 270 75 30
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_TOP_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Bottom|#B
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: input_bottomspace
+callback: C_FormDialogView_InputCB
+argument: 0
+
+--------------------
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 270 270 60 30
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_TOP_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label:  |#L
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: choice_value_bottomspace
+callback: C_FormDialogView_InputCB
+argument: 0
+
+--------------------
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 350 270 75 30
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_TOP_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Interline|#I
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: input_interlinespace
+callback: C_FormDialogView_InputCB
+argument: 0
+
+--------------------
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 430 270 60 30
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_TOP_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label:  |#L
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: choice_value_interlinespace
+callback: C_FormDialogView_InputCB
+argument: 0
+
 =============== FORM ===============
 Name: form_tabular_cell
 Width: 505
Index: src/tabular.C
===================================================================
--- src/tabular.C	(Revision 14014)
+++ src/tabular.C	(Arbeitskopie)
@@ -727,9 +727,10 @@ int LyXTabular::getAdditionalHeight(row_
 			top = row_info[row].top_line;
 		}
 	}
+	int const h = row_info[row - 1].interline_space.inPixels(width_of_tabular);
 	if (top && bottom)
-		return WIDTH_OF_LINE;
-	return 0;
+		return h + WIDTH_OF_LINE;
+	return h;
 }
 
 
@@ -1226,6 +1227,9 @@ void LyXTabular::write(Buffer const & bu
 		os << "<row"
 		   << write_attribute("topline", row_info[i].top_line)
 		   << write_attribute("bottomline", row_info[i].bottom_line)
+		   << write_attribute("topspace", row_info[i].top_space)
+		   << write_attribute("bottomspace", row_info[i].bottom_space)
+		   << write_attribute("interlinespace", row_info[i].interline_space)
 		   << write_attribute("endhead", row_info[i].endhead)
 		   << write_attribute("endfirsthead", row_info[i].endfirsthead)
 		   << write_attribute("endfoot", row_info[i].endfoot)
@@ -1325,6 +1329,9 @@ void LyXTabular::read(Buffer const & buf
 		}
 		getTokenValue(line, "topline", row_info[i].top_line);
 		getTokenValue(line, "bottomline", row_info[i].bottom_line);
+		getTokenValue(line, "topspace", row_info[i].top_space);
+		getTokenValue(line, "bottomspace", row_info[i].bottom_space);
+		getTokenValue(line, "interlinespace", row_info[i].interline_space);
 		getTokenValue(line, "endfirsthead", row_info[i].endfirsthead);
 		getTokenValue(line, "endhead", row_info[i].endhead);
 		getTokenValue(line, "endfoot", row_info[i].endfoot);
@@ -1800,9 +1807,9 @@ int LyXTabular::TeXBottomHLine(ostream &
 			++tmp;
 	}
 	if (use_booktabs && row == rows_ - 1) {
-		os << "\\bottomrule ";
+		os << "\\bottomrule";
 	} else if (tmp == n - fcell) {
-		os << (use_booktabs ? "\\midrule " : "\\hline ");
+		os << (use_booktabs ? "\\midrule" : "\\hline");
 	} else if (tmp) {
 		for (idx_type i = fcell; i < n; ++i) {
 			if (bottomLine(i)) {
@@ -2037,8 +2044,18 @@ int LyXTabular::TeXRow(ostream & os, row
 		       OutputParams const & runparams) const
 {
 	idx_type cell = getCellNumber(i, 0);
-
 	int ret = TeXTopHLine(os, i);
+	if (!row_info[i].top_space.zero()) {
+		if (use_booktabs)
+			os << "\\addlinespace["
+			   << row_info[i].top_space.asLatexString() << "]\n";
+		else {
+			os << "\\noalign{\\vskip"
+			   << row_info[i].top_space.asLatexString() << "}\n";
+		}
+		++ret;
+	}
+	
 	for (col_type j = 0; j < columns_; ++j) {
 		if (isPartOfMultiColumn(i, j))
 			continue;
@@ -2063,9 +2080,26 @@ int LyXTabular::TeXRow(ostream & os, row
 		}
 		++cell;
 	}
-	os << "\\tabularnewline\n";
+	os << "\\tabularnewline";
+	if (!row_info[i].bottom_space.zero()) {
+		if (use_booktabs)
+			os << "\\addlinespace";
+		os << '[' << row_info[i].bottom_space.asLatexString() << ']';
+	}
+	os << '\n';
 	++ret;
 	ret += TeXBottomHLine(os, i);
+	if (!row_info[i].interline_space.zero()) {
+		if (use_booktabs)
+			os << "\\addlinespace["
+			   << row_info[i].interline_space.asLatexString()
+			   << "]\n";
+		else
+			os << "\\noalign{\\vskip"
+			   << row_info[i].interline_space.asLatexString()
+			   << "}\n";
+		++ret;
+	}
 	return ret;
 }
 
Index: src/tabular.h
===================================================================
--- src/tabular.h	(Revision 14014)
+++ src/tabular.h	(Arbeitskopie)
@@ -131,6 +131,12 @@ public:
 		///
 		UNSET_BOOKTABS,
 		///
+		SET_TOP_SPACE,
+		///
+		SET_BOTTOM_SPACE,
+		///
+		SET_INTERLINE_SPACE,
+		///
 		LAST_ACTION
 	};
 	///
@@ -207,7 +213,8 @@ public:
 	///
 	bool isLastRow(idx_type cell) const;
 
-	///
+	/// return space occupied by the second horizontal line and
+	/// interline space above row \p row in pixels
 	int getAdditionalHeight(row_type row) const;
 	///
 	int getAdditionalWidth(idx_type cell) const;
@@ -466,6 +473,12 @@ public:
 		bool top_line;
 		///
 		bool bottom_line;
+		/// Extra space between the top line and this row
+		LyXLength top_space;
+		/// Extra space between this row and the bottom line
+		LyXLength bottom_space;
+		/// Extra space between the bottom line and the next top line
+		LyXLength interline_space;
 		/// This are for longtabulars only
 		/// a row of endhead
 		bool endhead;
Index: lib/lyx2lyx/lyx_1_5.py
===================================================================
--- lib/lyx2lyx/lyx_1_5.py	(Revision 14015)
+++ lib/lyx2lyx/lyx_1_5.py	(Arbeitskopie)
@@ -39,6 +39,10 @@ def revert_framed(file):
 
 def revert_booktabs(file):
 # we just remove the booktabs flag, everything else will become a mess.
+    re_row = re.compile(r'^<row.*space="[^"]+".*>$')
+    re_tspace = re.compile(r'\s+topspace="[^"]+"')
+    re_bspace = re.compile(r'\s+bottomspace="[^"]+"')
+    re_ispace = re.compile(r'\s+interlinespace="[^"]+"')
     i = 0
     while 1:
         i = find_token(file.body, "\\begin_inset Tabular", i)
@@ -52,6 +56,11 @@ def revert_booktabs(file):
             if re.search('^<features.* booktabs="true".*>$', file.body[k]):
                 file.warning("Converting 'booktabs' table to normal table.")
                 file.body[k] = replace(file.body[k], ' booktabs="true"', '')
+            if re.search(re_row, file.body[k]):
+                file.warning("Removing extra row space.")
+                file.body[k] = re_tspace.sub('', file.body[k])
+                file.body[k] = re_bspace.sub('', file.body[k])
+                file.body[k] = re_ispace.sub('', file.body[k])
         i = i + 1
 
 

Reply via email to