mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 05:55:34 +00:00
* InsetTabular cleanup:
- proper message passing for all tabular features - properly define which feature needs an argument * replace LFUN_TABULAR_FEATURE with LFUN_INSET_MODIFY - The math tables are also affected. In the future a common base class between math and text table will solve this inconsistency. - There is a hack in GuiApplication in order to not rename the toolbar icons. This will have to be cleaned up with a general icon naming for LFUN_INSET_MODIFY... to be discussed. * Tabular Dialog: - big cleanup, lots and lots of bug fixing here - migrated to InsetParamsWidget git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33495 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
8613f66a1d
commit
b5049e769b
@ -87,28 +87,28 @@
|
||||
\bind "M-~S-e x l" "primary-selection-paste"
|
||||
\bind "M-~S-e x p" "primary-selection-paste paragraph"
|
||||
|
||||
\bind "M-~S-e t m" "tabular-feature multicolumn"
|
||||
\bind "M-~S-e t t" "tabular-feature toggle-line-top"
|
||||
\bind "M-~S-e t b" "tabular-feature toggle-line-bottom"
|
||||
\bind "M-~S-e t l" "tabular-feature toggle-line-left"
|
||||
\bind "M-~S-e t r" "tabular-feature toggle-line-right"
|
||||
\bind "M-~S-e t e" "tabular-feature align-left"
|
||||
\bind "M-~S-e t c" "tabular-feature align-center"
|
||||
\bind "M-~S-e t i" "tabular-feature align-right"
|
||||
\bind "M-~S-e t o" "tabular-feature valign-top"
|
||||
\bind "M-~S-e t n" "tabular-feature valign-center"
|
||||
\bind "M-~S-e t v" "tabular-feature valign-bottom"
|
||||
\bind "M-~S-e t a" "tabular-feature append-row"
|
||||
\bind "M-~S-e t w" "tabular-feature delete-row"
|
||||
\bind "M-~S-e t u" "tabular-feature append-column"
|
||||
\bind "M-~S-e t d" "tabular-feature delete-column"
|
||||
\bind "M-~S-e t m" "inset-modify tabular multicolumn"
|
||||
\bind "M-~S-e t t" "inset-modify tabular toggle-line-top"
|
||||
\bind "M-~S-e t b" "inset-modify tabular toggle-line-bottom"
|
||||
\bind "M-~S-e t l" "inset-modify tabular toggle-line-left"
|
||||
\bind "M-~S-e t r" "inset-modify tabular toggle-line-right"
|
||||
\bind "M-~S-e t e" "inset-modify tabular align-left"
|
||||
\bind "M-~S-e t c" "inset-modify tabular align-center"
|
||||
\bind "M-~S-e t i" "inset-modify tabular align-right"
|
||||
\bind "M-~S-e t o" "inset-modify tabular valign-top"
|
||||
\bind "M-~S-e t n" "inset-modify tabular valign-center"
|
||||
\bind "M-~S-e t v" "inset-modify tabular valign-bottom"
|
||||
\bind "M-~S-e t a" "inset-modify tabular append-row"
|
||||
\bind "M-~S-e t w" "inset-modify tabular delete-row"
|
||||
\bind "M-~S-e t u" "inset-modify tabular append-column"
|
||||
\bind "M-~S-e t d" "inset-modify tabular delete-column"
|
||||
|
||||
\bind "M-~S-e m n" "math-number-toggle"
|
||||
\bind "M-~S-e m u" "math-number-line-toggle"
|
||||
\bind "M-~S-e m r" "tabular-feature append-row"
|
||||
\bind "M-~S-e m d" "tabular-feature delete-row"
|
||||
\bind "M-~S-e m c" "tabular-feature append-column"
|
||||
\bind "M-~S-e m e" "tabular-feature delete-column"
|
||||
\bind "M-~S-e m r" "inset-modify tabular append-row"
|
||||
\bind "M-~S-e m d" "inset-modify tabular delete-row"
|
||||
\bind "M-~S-e m c" "inset-modify tabular append-column"
|
||||
\bind "M-~S-e m e" "inset-modify tabular delete-column"
|
||||
|
||||
\bind "M-~S-e m l t" "math-limits empty"
|
||||
\bind "M-~S-e m l d" "math-limits limits"
|
||||
@ -120,12 +120,12 @@
|
||||
\bind "M-~S-e m f a" "math-mutate align"
|
||||
\bind "M-~S-e m f f" "math-mutate flalign"
|
||||
|
||||
\bind "M-~S-e m a l" "tabular-feature align-left"
|
||||
\bind "M-~S-e m a c" "tabular-feature align-center"
|
||||
\bind "M-~S-e m a r" "tabular-feature align-right"
|
||||
\bind "M-~S-e m a t" "tabular-feature valign-top"
|
||||
\bind "M-~S-e m a e" "tabular-feature valign-center"
|
||||
\bind "M-~S-e m a b" "tabular-feature valign-bottom"
|
||||
\bind "M-~S-e m a l" "inset-modify tabular align-left"
|
||||
\bind "M-~S-e m a c" "inset-modify tabular align-center"
|
||||
\bind "M-~S-e m a r" "inset-modify tabular align-right"
|
||||
\bind "M-~S-e m a t" "inset-modify tabular valign-top"
|
||||
\bind "M-~S-e m a e" "inset-modify tabular valign-center"
|
||||
\bind "M-~S-e m a b" "inset-modify tabular valign-bottom"
|
||||
|
||||
\bind "M-~S-v l" "latex-view-log"
|
||||
\bind "M-~S-v t" "toc-view"
|
||||
|
@ -73,30 +73,30 @@
|
||||
\bind "M-m t e" "math-mutate eqnarray"
|
||||
\bind "M-m t m" "math-mutate multline"
|
||||
|
||||
\bind "M-m c i" "tabular-feature append-column"
|
||||
\bind "M-m c d" "tabular-feature delete-column"
|
||||
\bind "M-m c c" "tabular-feature copy-column"
|
||||
\bind "M-m c s" "tabular-feature swap-column"
|
||||
\bind "M-m c a" "tabular-feature add-vline-left"
|
||||
\bind "M-m c e" "tabular-feature delete-vline-left"
|
||||
\bind "M-m c z" "tabular-feature add-vline-right"
|
||||
\bind "M-m c x" "tabular-feature delete-vline-right"
|
||||
\bind "M-m c i" "inset-modify tabular append-column"
|
||||
\bind "M-m c d" "inset-modify tabular delete-column"
|
||||
\bind "M-m c c" "inset-modify tabular copy-column"
|
||||
\bind "M-m c s" "inset-modify tabular swap-column"
|
||||
\bind "M-m c a" "inset-modify tabular add-vline-left"
|
||||
\bind "M-m c e" "inset-modify tabular delete-vline-left"
|
||||
\bind "M-m c z" "inset-modify tabular add-vline-right"
|
||||
\bind "M-m c x" "inset-modify tabular delete-vline-right"
|
||||
|
||||
\bind "M-m w i" "tabular-feature append-row"
|
||||
\bind "M-m w d" "tabular-feature delete-row"
|
||||
\bind "M-m w c" "tabular-feature copy-row"
|
||||
\bind "M-m w s" "tabular-feature swap-row"
|
||||
\bind "M-m w a" "tabular-feature add-hline-above"
|
||||
\bind "M-m w e" "tabular-feature delete-hline-above"
|
||||
\bind "M-m w z" "tabular-feature add-hline-below"
|
||||
\bind "M-m w x" "tabular-feature delete-hline-below"
|
||||
\bind "M-m w i" "inset-modify tabular append-row"
|
||||
\bind "M-m w d" "inset-modify tabular delete-row"
|
||||
\bind "M-m w c" "inset-modify tabular copy-row"
|
||||
\bind "M-m w s" "inset-modify tabular swap-row"
|
||||
\bind "M-m w a" "inset-modify tabular add-hline-above"
|
||||
\bind "M-m w e" "inset-modify tabular delete-hline-above"
|
||||
\bind "M-m w z" "inset-modify tabular add-hline-below"
|
||||
\bind "M-m w x" "inset-modify tabular delete-hline-below"
|
||||
|
||||
\bind "M-m w t" "tabular-feature valign-top"
|
||||
\bind "M-m w m" "tabular-feature valign-middle"
|
||||
\bind "M-m w b" "tabular-feature valign-bottom"
|
||||
\bind "M-m c l" "tabular-feature align-left"
|
||||
\bind "M-m c m" "tabular-feature align-center"
|
||||
\bind "M-m c r" "tabular-feature align-right"
|
||||
\bind "M-m w t" "inset-modify tabular valign-top"
|
||||
\bind "M-m w m" "inset-modify tabular valign-middle"
|
||||
\bind "M-m w b" "inset-modify tabular valign-bottom"
|
||||
\bind "M-m c l" "inset-modify tabular align-left"
|
||||
\bind "M-m c m" "inset-modify tabular align-center"
|
||||
\bind "M-m c r" "inset-modify tabular align-right"
|
||||
|
||||
# Decoration accents
|
||||
|
||||
|
@ -137,31 +137,31 @@ ToolbarSet
|
||||
End
|
||||
|
||||
Toolbar "table" "Table"
|
||||
Item "Add row" "tabular-feature append-row"
|
||||
Item "Add column" "tabular-feature append-column"
|
||||
Item "Delete row" "tabular-feature delete-row"
|
||||
Item "Delete column" "tabular-feature delete-column"
|
||||
Item "Add row" "inset-modify tabular append-row"
|
||||
Item "Add column" "inset-modify tabular append-column"
|
||||
Item "Delete row" "inset-modify tabular delete-row"
|
||||
Item "Delete column" "inset-modify tabular delete-column"
|
||||
Separator
|
||||
Item "Set top line" "tabular-feature toggle-line-top"
|
||||
Item "Set bottom line" "tabular-feature toggle-line-bottom"
|
||||
Item "Set left line" "tabular-feature toggle-line-left"
|
||||
Item "Set right line" "tabular-feature toggle-line-right"
|
||||
Item "Set border lines" "tabular-feature set-border-lines"
|
||||
Item "Set all lines" "tabular-feature set-all-lines"
|
||||
Item "Unset all lines" "tabular-feature unset-all-lines"
|
||||
Item "Set top line" "inset-modify tabular toggle-line-top"
|
||||
Item "Set bottom line" "inset-modify tabular toggle-line-bottom"
|
||||
Item "Set left line" "inset-modify tabular toggle-line-left"
|
||||
Item "Set right line" "inset-modify tabular toggle-line-right"
|
||||
Item "Set border lines" "inset-modify tabular set-border-lines"
|
||||
Item "Set all lines" "inset-modify tabular set-all-lines"
|
||||
Item "Unset all lines" "inset-modify tabular unset-all-lines"
|
||||
Separator
|
||||
Item "Align left" "command-alternatives tabular-feature m-align-left;tabular-feature align-left"
|
||||
Item "Align center" "command-alternatives tabular-feature m-align-center;tabular-feature align-center"
|
||||
Item "Align right" "command-alternatives tabular-feature m-align-right;tabular-feature align-right"
|
||||
Item "Align left" "command-alternatives inset-modify tabular m-align-left;inset-modify tabular align-left"
|
||||
Item "Align center" "command-alternatives inset-modify tabular m-align-center;inset-modify tabular align-center"
|
||||
Item "Align right" "command-alternatives inset-modify tabular m-align-right;inset-modify tabular align-right"
|
||||
Separator
|
||||
Item "Align top" "command-alternatives tabular-feature m-valign-top;tabular-feature valign-top"
|
||||
Item "Align middle" "command-alternatives tabular-feature m-valign-middle;tabular-feature valign-middle"
|
||||
Item "Align bottom" "command-alternatives tabular-feature m-valign-bottom;tabular-feature valign-bottom"
|
||||
Item "Align top" "command-alternatives inset-modify tabular m-valign-top;inset-modify tabular valign-top"
|
||||
Item "Align middle" "command-alternatives inset-modify tabular m-valign-middle;inset-modify tabular valign-middle"
|
||||
Item "Align bottom" "command-alternatives inset-modify tabular m-valign-bottom;inset-modify tabular valign-bottom"
|
||||
Separator
|
||||
Item "Rotate cell" "tabular-feature toggle-rotate-cell"
|
||||
Item "Rotate table" "tabular-feature toggle-rotate-tabular"
|
||||
Item "Set multi-column" "tabular-feature multicolumn"
|
||||
Item "Set multi-row" "tabular-feature multirow"
|
||||
Item "Rotate cell" "inset-modify tabular toggle-rotate-cell"
|
||||
Item "Rotate table" "inset-modify tabular toggle-rotate-tabular"
|
||||
Item "Set multi-column" "inset-modify tabular multicolumn"
|
||||
Item "Set multi-row" "inset-modify tabular multirow"
|
||||
End
|
||||
|
||||
Toolbar "math" "Math"
|
||||
@ -183,10 +183,10 @@ ToolbarSet
|
||||
Separator
|
||||
Item "Insert matrix" "dialog-show mathmatrix"
|
||||
Item "Insert cases environment" "math-insert \cases"
|
||||
Item "Add row" "tabular-feature append-row"
|
||||
Item "Add column" "tabular-feature append-column"
|
||||
Item "Delete row" "tabular-feature delete-row"
|
||||
Item "Delete column" "tabular-feature delete-column"
|
||||
Item "Add row" "inset-modify tabular append-row"
|
||||
Item "Add column" "inset-modify tabular append-column"
|
||||
Item "Delete row" "inset-modify tabular delete-row"
|
||||
Item "Delete column" "inset-modify tabular delete-column"
|
||||
Separator
|
||||
Item "Toggle math panels" "toolbar-toggle math_panels"
|
||||
End
|
||||
|
@ -258,7 +258,7 @@ enum FuncCode
|
||||
LFUN_CAPTION_INSERT, // Lgb 20000718; inactive as of 20060905
|
||||
LFUN_BUFFER_SWITCH,
|
||||
// 190
|
||||
LFUN_TABULAR_FEATURE, // Jug 20000728
|
||||
LFUN_BUFFER_CHKTEX, // Asger 971030
|
||||
LFUN_LAYOUT_TABULAR, // Jug 20000731
|
||||
LFUN_BUFFER_UPDATE, // Dekel 20000805
|
||||
LFUN_INDEX_INSERT, // Angus 20000803
|
||||
@ -445,7 +445,6 @@ enum FuncCode
|
||||
LFUN_SPELLING_ADD, // spitz 20100118
|
||||
// 345
|
||||
LFUN_SPELLING_IGNORE, // spitz 20100118
|
||||
LFUN_BUFFER_CHKTEX, // Asger 971030
|
||||
|
||||
LFUN_LASTACTION // end of the table
|
||||
};
|
||||
|
@ -2080,7 +2080,10 @@ void LyXAction::init()
|
||||
* \li Origin: Jug, 28 Jul 2000
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_TABULAR_FEATURE, "tabular-feature", Noop, Edit },
|
||||
// FIXME: This LFUN has been replaced with LFUN_INSET_MODIFY with the
|
||||
// "tabular" argument. How to insert above documentation into LFUN_INSET_MODIFY doc?
|
||||
// { LFUN_TABULAR_FEATURE, "tabular-feature", Noop, Edit },
|
||||
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_CELL_BACKWARD
|
||||
* \li Action: Moves the cursor to the previous cell inside the table.
|
||||
|
@ -331,9 +331,24 @@ QString iconName(FuncRequest const & f, bool unknown)
|
||||
docstring firstcom;
|
||||
docstring dummy = split(f.argument(), firstcom, ';');
|
||||
name1 = toqstr(firstcom);
|
||||
// FIXME: we should rename the icons to tabular-xxx instead of
|
||||
// "tabular-feature-xxx"
|
||||
name1.replace("inset-modify tabular", "tabular-feature");
|
||||
name1.replace(' ', '_');
|
||||
break;
|
||||
}
|
||||
case LFUN_INSET_MODIFY: {
|
||||
// FIXME: we should rename the icons to tabular-xxx instead of
|
||||
// "tabular-feature-xxx" and generalize this naming to all
|
||||
// insets, not to tabular using ones.
|
||||
string inset_name;
|
||||
string const command = split(to_utf8(f.argument()), inset_name, ' ');
|
||||
if (insetCode(inset_name) == TABULAR_CODE) {
|
||||
name1 = "tabular-feature "+ toqstr(command);
|
||||
name1.replace(' ', '_');
|
||||
break;
|
||||
}
|
||||
}
|
||||
default:
|
||||
name2 = toqstr(lyxaction.getActionName(f.action));
|
||||
name1 = name2;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -15,118 +15,39 @@
|
||||
#ifndef GUITABULAR_H
|
||||
#define GUITABULAR_H
|
||||
|
||||
#include "GuiDialog.h"
|
||||
#include "InsetParamsWidget.h"
|
||||
#include "ui_TabularUi.h"
|
||||
#include "insets/InsetTabular.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class GuiTabular : public GuiDialog, public Ui::TabularUi
|
||||
class GuiTabular : public InsetParamsWidget, public Ui::TabularUi
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GuiTabular(GuiView & lv);
|
||||
~GuiTabular();
|
||||
GuiTabular(QWidget * parent = 0);
|
||||
|
||||
private Q_SLOTS:
|
||||
void change_adaptor();
|
||||
|
||||
void topspace_changed();
|
||||
void bottomspace_changed();
|
||||
void interlinespace_changed();
|
||||
void booktabsChanged(bool);
|
||||
void close_clicked();
|
||||
void checkEnabled();
|
||||
void borderSet_clicked();
|
||||
void borderUnset_clicked();
|
||||
void leftBorder_changed();
|
||||
void rightBorder_changed();
|
||||
void topBorder_changed();
|
||||
void bottomBorder_changed();
|
||||
void multicolumn_clicked();
|
||||
void multirow_clicked();
|
||||
void rotateTabular();
|
||||
void rotateCell();
|
||||
void hAlign_changed(int align);
|
||||
void vAlign_changed(int align);
|
||||
void tableAlignment_changed(int align);
|
||||
void specialAlignment_changed();
|
||||
void width_changed();
|
||||
void longTabular();
|
||||
void ltNewpage_clicked();
|
||||
void ltHeaderStatus_clicked();
|
||||
void ltHeaderBorderAbove_clicked();
|
||||
void ltHeaderBorderBelow_clicked();
|
||||
void ltFirstHeaderStatus_clicked();
|
||||
void ltFirstHeaderBorderAbove_clicked();
|
||||
void ltFirstHeaderBorderBelow_clicked();
|
||||
void ltFirstHeaderEmpty_clicked();
|
||||
void ltFooterStatus_clicked();
|
||||
void ltFooterBorderAbove_clicked();
|
||||
void ltFooterBorderBelow_clicked();
|
||||
void ltLastFooterStatus_clicked();
|
||||
void ltLastFooterBorderAbove_clicked();
|
||||
void ltLastFooterBorderBelow_clicked();
|
||||
void ltLastFooterEmpty_clicked();
|
||||
void ltAlignment_clicked();
|
||||
void on_captionStatusCB_toggled();
|
||||
|
||||
private:
|
||||
///
|
||||
bool isValid() { return true; }
|
||||
/// update borders
|
||||
void updateBorders(Tabular const & tabular);
|
||||
/// update
|
||||
void updateContents();
|
||||
///
|
||||
void paramsToDialog(Tabular const & tabular);
|
||||
/// save some values before closing the gui
|
||||
void closeGUI(Tabular const & tabular);
|
||||
///
|
||||
bool initialiseParams(std::string const & data);
|
||||
/// clean-up on hide.
|
||||
void clearParams();
|
||||
/// We use set() instead.
|
||||
void dispatchParams() {};
|
||||
///
|
||||
bool isBufferDependent() const { return true; }
|
||||
///
|
||||
FuncCode getLfun() const { return LFUN_TABULAR_FEATURE; }
|
||||
/// \name InsetParamsWidget inherited methods
|
||||
//@{
|
||||
InsetCode insetCode() const { return TABULAR_CODE; }
|
||||
FuncCode creationCode() const { return LFUN_TABULAR_INSERT; }
|
||||
void paramsToDialog(Inset const *);
|
||||
docstring dialogToParams() const;
|
||||
//@}
|
||||
|
||||
///
|
||||
Tabular::idx_type getActiveCell() const;
|
||||
/// set a parameter
|
||||
void set(Tabular::Feature, std::string const & arg = std::string());
|
||||
|
||||
void setSpecial(Tabular const & tabular, std::string const & special);
|
||||
|
||||
void setWidth(Tabular const & tabular, std::string const & width);
|
||||
|
||||
void toggleMultiColumn();
|
||||
void toggleMultiRow();
|
||||
|
||||
void rotateTabular(bool yes);
|
||||
void rotateCell(bool yes);
|
||||
|
||||
enum HALIGN { LEFT, RIGHT, CENTER, BLOCK };
|
||||
|
||||
void halign(Tabular const & tabular, HALIGN h);
|
||||
|
||||
enum VALIGN { TOP, MIDDLE, BOTTOM };
|
||||
|
||||
void valign(Tabular const & tabular, VALIGN h);
|
||||
|
||||
void booktabs(bool yes);
|
||||
|
||||
void longTabular(bool yes);
|
||||
|
||||
bool funcEnabled(Tabular::Feature f) const;
|
||||
|
||||
void setHAlign(std::string & param_str) const;
|
||||
///
|
||||
Tabular::idx_type active_cell_;
|
||||
void setVAlign(std::string & param_str) const;
|
||||
///
|
||||
Tabular tabular_;
|
||||
void setTableAlignment(std::string & param_str) const;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
|
@ -3476,7 +3476,6 @@ Dialog * createGuiShowFile(GuiView & lv);
|
||||
Dialog * createGuiSpellchecker(GuiView & lv);
|
||||
Dialog * createGuiSymbols(GuiView & lv);
|
||||
Dialog * createGuiTabularCreate(GuiView & lv);
|
||||
Dialog * createGuiTabular(GuiView & lv);
|
||||
Dialog * createGuiTexInfo(GuiView & lv);
|
||||
Dialog * createGuiTextHSpace(GuiView & lv);
|
||||
Dialog * createGuiToc(GuiView & lv);
|
||||
@ -3570,8 +3569,6 @@ Dialog * GuiView::build(string const & name)
|
||||
return createGuiSpellchecker(*this);
|
||||
if (name == "symbols")
|
||||
return createGuiSymbols(*this);
|
||||
if (name == "tabular")
|
||||
return createGuiTabular(*this);
|
||||
if (name == "tabularcreate")
|
||||
return createGuiTabularCreate(*this);
|
||||
if (name == "texinfo")
|
||||
|
@ -195,12 +195,9 @@ Dialog * createDialog(GuiView & lv, InsetCode code)
|
||||
case INFO_CODE:
|
||||
widget = new GuiInfo;
|
||||
break;
|
||||
//FIXME: not ready yet.
|
||||
/*
|
||||
case TABULAR_CODE:
|
||||
widget = new GuiTabular;
|
||||
break;
|
||||
*/
|
||||
case VSPACE_CODE:
|
||||
widget = new GuiVSpace;
|
||||
break;
|
||||
|
@ -1,18 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TabularUi</class>
|
||||
<widget class="QDialog" name="TabularUi">
|
||||
<widget class="QWidget" name="TabularUi">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>378</width>
|
||||
<height>401</height>
|
||||
<width>397</width>
|
||||
<height>429</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="sizeGripEnabled">
|
||||
<property name="sizeGripEnabled" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
@ -97,22 +98,6 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="closePB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
@ -1519,7 +1504,6 @@
|
||||
<tabstop>multirowCB</tabstop>
|
||||
<tabstop>rotateCellCB</tabstop>
|
||||
<tabstop>specialAlignmentED</tabstop>
|
||||
<tabstop>closePB</tabstop>
|
||||
<tabstop>borderSetPB</tabstop>
|
||||
<tabstop>borderUnsetPB</tabstop>
|
||||
<tabstop>borderDefaultRB</tabstop>
|
||||
|
@ -298,7 +298,7 @@ bool Inset::showInsetDialog(BufferView * bv) const
|
||||
case BOX_CODE:
|
||||
case INFO_CODE:
|
||||
//FIXME: not ready yet.
|
||||
//case TABULAR_CODE:
|
||||
case TABULAR_CODE:
|
||||
case VSPACE_CODE:
|
||||
bv->showDialog(insetName(code));
|
||||
break;
|
||||
|
@ -101,75 +101,76 @@ boost::scoped_ptr<Tabular> paste_tabular;
|
||||
struct TabularFeature {
|
||||
Tabular::Feature action;
|
||||
string feature;
|
||||
bool need_value;
|
||||
};
|
||||
|
||||
|
||||
TabularFeature tabularFeature[] =
|
||||
{
|
||||
{ Tabular::APPEND_ROW, "append-row" },
|
||||
{ Tabular::APPEND_COLUMN, "append-column" },
|
||||
{ Tabular::DELETE_ROW, "delete-row" },
|
||||
{ Tabular::DELETE_COLUMN, "delete-column" },
|
||||
{ Tabular::COPY_ROW, "copy-row" },
|
||||
{ Tabular::COPY_COLUMN, "copy-column" },
|
||||
{ Tabular::TOGGLE_LINE_TOP, "toggle-line-top" },
|
||||
{ Tabular::TOGGLE_LINE_BOTTOM, "toggle-line-bottom" },
|
||||
{ Tabular::TOGGLE_LINE_LEFT, "toggle-line-left" },
|
||||
{ Tabular::TOGGLE_LINE_RIGHT, "toggle-line-right" },
|
||||
{ Tabular::ALIGN_LEFT, "align-left" },
|
||||
{ Tabular::ALIGN_RIGHT, "align-right" },
|
||||
{ Tabular::ALIGN_CENTER, "align-center" },
|
||||
{ Tabular::ALIGN_BLOCK, "align-block" },
|
||||
{ Tabular::VALIGN_TOP, "valign-top" },
|
||||
{ Tabular::VALIGN_BOTTOM, "valign-bottom" },
|
||||
{ Tabular::VALIGN_MIDDLE, "valign-middle" },
|
||||
{ Tabular::M_ALIGN_LEFT, "m-align-left" },
|
||||
{ Tabular::M_ALIGN_RIGHT, "m-align-right" },
|
||||
{ Tabular::M_ALIGN_CENTER, "m-align-center" },
|
||||
{ Tabular::M_VALIGN_TOP, "m-valign-top" },
|
||||
{ Tabular::M_VALIGN_BOTTOM, "m-valign-bottom" },
|
||||
{ Tabular::M_VALIGN_MIDDLE, "m-valign-middle" },
|
||||
{ Tabular::MULTICOLUMN, "multicolumn" },
|
||||
{ Tabular::MULTIROW, "multirow" },
|
||||
{ Tabular::SET_ALL_LINES, "set-all-lines" },
|
||||
{ Tabular::UNSET_ALL_LINES, "unset-all-lines" },
|
||||
{ Tabular::SET_LONGTABULAR, "set-longtabular" },
|
||||
{ Tabular::UNSET_LONGTABULAR, "unset-longtabular" },
|
||||
{ Tabular::SET_PWIDTH, "set-pwidth" },
|
||||
{ Tabular::SET_MPWIDTH, "set-mpwidth" },
|
||||
{ Tabular::SET_ROTATE_TABULAR, "set-rotate-tabular" },
|
||||
{ Tabular::UNSET_ROTATE_TABULAR, "unset-rotate-tabular" },
|
||||
{ Tabular::TOGGLE_ROTATE_TABULAR, "toggle-rotate-tabular" },
|
||||
{ Tabular::SET_ROTATE_CELL, "set-rotate-cell" },
|
||||
{ Tabular::UNSET_ROTATE_CELL, "unset-rotate-cell" },
|
||||
{ Tabular::TOGGLE_ROTATE_CELL, "toggle-rotate-cell" },
|
||||
{ Tabular::SET_USEBOX, "set-usebox" },
|
||||
{ Tabular::SET_LTHEAD, "set-lthead" },
|
||||
{ Tabular::UNSET_LTHEAD, "unset-lthead" },
|
||||
{ Tabular::SET_LTFIRSTHEAD, "set-ltfirsthead" },
|
||||
{ Tabular::UNSET_LTFIRSTHEAD, "unset-ltfirsthead" },
|
||||
{ Tabular::SET_LTFOOT, "set-ltfoot" },
|
||||
{ Tabular::UNSET_LTFOOT, "unset-ltfoot" },
|
||||
{ Tabular::SET_LTLASTFOOT, "set-ltlastfoot" },
|
||||
{ Tabular::UNSET_LTLASTFOOT, "unset-ltlastfoot" },
|
||||
{ Tabular::SET_LTNEWPAGE, "set-ltnewpage" },
|
||||
{ Tabular::TOGGLE_LTCAPTION, "toggle-ltcaption" },
|
||||
{ Tabular::SET_SPECIAL_COLUMN, "set-special-column" },
|
||||
{ Tabular::SET_SPECIAL_MULTICOLUMN, "set-special-multicolumn" },
|
||||
{ Tabular::SET_SPECIAL_MULTIROW, "set-special-multirow" },
|
||||
{ Tabular::SET_BOOKTABS, "set-booktabs" },
|
||||
{ Tabular::UNSET_BOOKTABS, "unset-booktabs" },
|
||||
{ Tabular::SET_TOP_SPACE, "set-top-space" },
|
||||
{ Tabular::SET_BOTTOM_SPACE, "set-bottom-space" },
|
||||
{ Tabular::SET_INTERLINE_SPACE, "set-interline-space" },
|
||||
{ Tabular::SET_BORDER_LINES, "set-border-lines" },
|
||||
{ Tabular::APPEND_ROW, "append-row", false },
|
||||
{ Tabular::APPEND_COLUMN, "append-column", false },
|
||||
{ Tabular::DELETE_ROW, "delete-row", false },
|
||||
{ Tabular::DELETE_COLUMN, "delete-column", false },
|
||||
{ Tabular::COPY_ROW, "copy-row", false },
|
||||
{ Tabular::COPY_COLUMN, "copy-column", false },
|
||||
{ Tabular::TOGGLE_LINE_TOP, "toggle-line-top", false },
|
||||
{ Tabular::TOGGLE_LINE_BOTTOM, "toggle-line-bottom", false },
|
||||
{ Tabular::TOGGLE_LINE_LEFT, "toggle-line-left", false },
|
||||
{ Tabular::TOGGLE_LINE_RIGHT, "toggle-line-right", false },
|
||||
{ Tabular::ALIGN_LEFT, "align-left", false },
|
||||
{ Tabular::ALIGN_RIGHT, "align-right", false },
|
||||
{ Tabular::ALIGN_CENTER, "align-center", false },
|
||||
{ Tabular::ALIGN_BLOCK, "align-block", false },
|
||||
{ Tabular::VALIGN_TOP, "valign-top", false },
|
||||
{ Tabular::VALIGN_BOTTOM, "valign-bottom", false },
|
||||
{ Tabular::VALIGN_MIDDLE, "valign-middle", false },
|
||||
{ Tabular::M_ALIGN_LEFT, "m-align-left", false },
|
||||
{ Tabular::M_ALIGN_RIGHT, "m-align-right", false },
|
||||
{ Tabular::M_ALIGN_CENTER, "m-align-center", false },
|
||||
{ Tabular::M_VALIGN_TOP, "m-valign-top", false },
|
||||
{ Tabular::M_VALIGN_BOTTOM, "m-valign-bottom", false },
|
||||
{ Tabular::M_VALIGN_MIDDLE, "m-valign-middle", false },
|
||||
{ Tabular::MULTICOLUMN, "multicolumn", false },
|
||||
{ Tabular::MULTIROW, "multirow", false },
|
||||
{ Tabular::SET_ALL_LINES, "set-all-lines", false },
|
||||
{ Tabular::UNSET_ALL_LINES, "unset-all-lines", false },
|
||||
{ Tabular::SET_LONGTABULAR, "set-longtabular", false },
|
||||
{ Tabular::UNSET_LONGTABULAR, "unset-longtabular", false },
|
||||
{ Tabular::SET_PWIDTH, "set-pwidth", true },
|
||||
{ Tabular::SET_MPWIDTH, "set-mpwidth", true },
|
||||
{ Tabular::SET_ROTATE_TABULAR, "set-rotate-tabular", false },
|
||||
{ Tabular::UNSET_ROTATE_TABULAR, "unset-rotate-tabular", false },
|
||||
{ Tabular::TOGGLE_ROTATE_TABULAR, "toggle-rotate-tabular", false },
|
||||
{ Tabular::SET_ROTATE_CELL, "set-rotate-cell", false },
|
||||
{ Tabular::UNSET_ROTATE_CELL, "unset-rotate-cell", false },
|
||||
{ Tabular::TOGGLE_ROTATE_CELL, "toggle-rotate-cell", false },
|
||||
{ Tabular::SET_USEBOX, "set-usebox", true },
|
||||
{ Tabular::SET_LTHEAD, "set-lthead", true },
|
||||
{ Tabular::UNSET_LTHEAD, "unset-lthead", true },
|
||||
{ Tabular::SET_LTFIRSTHEAD, "set-ltfirsthead", true },
|
||||
{ Tabular::UNSET_LTFIRSTHEAD, "unset-ltfirsthead", true },
|
||||
{ Tabular::SET_LTFOOT, "set-ltfoot", true },
|
||||
{ Tabular::UNSET_LTFOOT, "unset-ltfoot", true },
|
||||
{ Tabular::SET_LTLASTFOOT, "set-ltlastfoot", true },
|
||||
{ Tabular::UNSET_LTLASTFOOT, "unset-ltlastfoot", true },
|
||||
{ Tabular::SET_LTNEWPAGE, "set-ltnewpage", false },
|
||||
{ Tabular::TOGGLE_LTCAPTION, "toggle-ltcaption", false },
|
||||
{ Tabular::SET_SPECIAL_COLUMN, "set-special-column", true },
|
||||
{ Tabular::SET_SPECIAL_MULTICOLUMN, "set-special-multicolumn", true },
|
||||
{ Tabular::SET_SPECIAL_MULTIROW, "set-special-multirow", false },
|
||||
{ Tabular::SET_BOOKTABS, "set-booktabs", false },
|
||||
{ Tabular::UNSET_BOOKTABS, "unset-booktabs", false },
|
||||
{ Tabular::SET_TOP_SPACE, "set-top-space", true },
|
||||
{ Tabular::SET_BOTTOM_SPACE, "set-bottom-space", true },
|
||||
{ Tabular::SET_INTERLINE_SPACE, "set-interline-space", true },
|
||||
{ Tabular::SET_BORDER_LINES, "set-border-lines", false },
|
||||
{ Tabular::TABULAR_VALIGN_TOP, "tabular-valign-top"},
|
||||
{ Tabular::TABULAR_VALIGN_MIDDLE, "tabular-valign-middle"},
|
||||
{ Tabular::TABULAR_VALIGN_BOTTOM, "tabular-valign-bottom"},
|
||||
{ Tabular::LONGTABULAR_ALIGN_LEFT, "longtabular-align-left" },
|
||||
{ Tabular::LONGTABULAR_ALIGN_CENTER, "longtabular-align-center" },
|
||||
{ Tabular::LONGTABULAR_ALIGN_RIGHT, "longtabular-align-right" },
|
||||
{ Tabular::LAST_ACTION, "" }
|
||||
{ Tabular::LONGTABULAR_ALIGN_LEFT, "longtabular-align-left", false },
|
||||
{ Tabular::LONGTABULAR_ALIGN_CENTER, "longtabular-align-center", false },
|
||||
{ Tabular::LONGTABULAR_ALIGN_RIGHT, "longtabular-align-right", false },
|
||||
{ Tabular::LAST_ACTION, "", false }
|
||||
};
|
||||
|
||||
|
||||
@ -3858,14 +3859,10 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
// }
|
||||
|
||||
case LFUN_LAYOUT_TABULAR:
|
||||
cur.bv().showDialog("tabular", params2string(*this), this);
|
||||
cur.bv().showDialog("tabular");
|
||||
break;
|
||||
|
||||
case LFUN_INSET_DIALOG_UPDATE:
|
||||
cur.bv().updateDialog("tabular", params2string(*this));
|
||||
break;
|
||||
|
||||
case LFUN_TABULAR_FEATURE:
|
||||
case LFUN_INSET_MODIFY:
|
||||
if (!tabularFeatures(cur, to_utf8(cmd.argument())))
|
||||
cur.undispatched();
|
||||
break;
|
||||
@ -4032,12 +4029,22 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
FuncStatus & status) const
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_TABULAR_FEATURE: {
|
||||
case LFUN_INSET_MODIFY: {
|
||||
istringstream is(to_utf8(cmd.argument()));
|
||||
string s;
|
||||
is >> s;
|
||||
if (insetCode(s) != TABULAR_CODE) {
|
||||
status.clear();
|
||||
status.setEnabled(false);
|
||||
break;
|
||||
}
|
||||
is >> s;
|
||||
// FIXME: We only check for the very first argument...
|
||||
int action = Tabular::LAST_ACTION;
|
||||
int i = 0;
|
||||
for (; tabularFeature[i].action != Tabular::LAST_ACTION; ++i) {
|
||||
string const tmp = tabularFeature[i].feature;
|
||||
if (tmp == to_utf8(cmd.argument()).substr(0, tmp.length())) {
|
||||
if (tmp == s.substr(0, tmp.length())) {
|
||||
action = tabularFeature[i].action;
|
||||
break;
|
||||
}
|
||||
@ -4049,7 +4056,7 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
}
|
||||
|
||||
string const argument
|
||||
= ltrim(to_utf8(cmd.argument()).substr(tabularFeature[i].feature.length()));
|
||||
= ltrim(s.substr(tabularFeature[i].feature.length()));
|
||||
|
||||
row_type sel_row_start = 0;
|
||||
row_type sel_row_end = 0;
|
||||
@ -4365,17 +4372,11 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
// relay this lfun to Inset, not to the cell.
|
||||
return Inset::getStatus(cur, cmd, status);
|
||||
|
||||
case LFUN_INSET_MODIFY:
|
||||
if (insetCode(cmd.getArg(0)) == TABULAR_CODE) {
|
||||
status.setEnabled(true);
|
||||
return true;
|
||||
}
|
||||
// Fall through
|
||||
|
||||
default:
|
||||
// we try to handle this event in the insets dispatch function.
|
||||
return cell(cur.idx())->getStatus(cur, cmd, status);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -4732,27 +4733,45 @@ void InsetTabular::movePrevCell(Cursor & cur, EntryDirection entry_from)
|
||||
}
|
||||
|
||||
|
||||
bool InsetTabular::tabularFeatures(Cursor & cur, string const & what)
|
||||
bool InsetTabular::tabularFeatures(Cursor & cur, string const & argument)
|
||||
{
|
||||
Tabular::Feature action = Tabular::LAST_ACTION;
|
||||
istringstream is(argument);
|
||||
string s;
|
||||
is >> s;
|
||||
if (insetCode(s) != TABULAR_CODE)
|
||||
return false;
|
||||
|
||||
int i = 0;
|
||||
for (; tabularFeature[i].action != Tabular::LAST_ACTION; ++i) {
|
||||
string const tmp = tabularFeature[i].feature;
|
||||
// Safe guard.
|
||||
size_t safe_guard = 0;
|
||||
for (;;) {
|
||||
safe_guard++;
|
||||
if (safe_guard > 1000) {
|
||||
LYXERR0("parameter max count reached!");
|
||||
break;
|
||||
}
|
||||
is >> s;
|
||||
if (is.eof())
|
||||
break;
|
||||
Tabular::Feature action = Tabular::LAST_ACTION;
|
||||
|
||||
size_t i = 0;
|
||||
for (; tabularFeature[i].action != Tabular::LAST_ACTION; ++i) {
|
||||
if (s != tabularFeature[i].feature)
|
||||
continue;
|
||||
|
||||
if (tmp == what.substr(0, tmp.length())) {
|
||||
//if (!compare(tabularFeatures[i].feature.c_str(), what.c_str(),
|
||||
//tabularFeatures[i].feature.length()))
|
||||
action = tabularFeature[i].action;
|
||||
break;
|
||||
}
|
||||
if (action == Tabular::LAST_ACTION) {
|
||||
LYXERR0("Feature not found " << s);
|
||||
continue;
|
||||
}
|
||||
string val;
|
||||
if (tabularFeature[i].need_value)
|
||||
is >> val;
|
||||
LYXERR(Debug::DEBUG, "Feature: " << s << "\t\tvalue: " << val);
|
||||
tabularFeatures(cur, action, val);
|
||||
}
|
||||
if (action == Tabular::LAST_ACTION)
|
||||
return false;
|
||||
|
||||
string const val =
|
||||
ltrim(what.substr(tabularFeature[i].feature.length()));
|
||||
tabularFeatures(cur, action, val);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -4866,7 +4885,10 @@ void InsetTabular::tabularFeatures(Cursor & cur,
|
||||
|
||||
case Tabular::SET_SPECIAL_COLUMN:
|
||||
case Tabular::SET_SPECIAL_MULTICOLUMN:
|
||||
tabular.setAlignSpecial(cur.idx(), from_utf8(value), feature);
|
||||
if (value == "none")
|
||||
tabular.setAlignSpecial(cur.idx(), docstring(), feature);
|
||||
else
|
||||
tabular.setAlignSpecial(cur.idx(), from_utf8(value), feature);
|
||||
break;
|
||||
|
||||
case Tabular::APPEND_ROW:
|
||||
@ -5192,12 +5214,12 @@ void InsetTabular::tabularFeatures(Cursor & cur,
|
||||
if (value == "default")
|
||||
for (row_type i = sel_row_start; i <= sel_row_end; ++i)
|
||||
tabular.row_info[i].top_space_default = true;
|
||||
else if (isValidLength(value, &len))
|
||||
else if (value == "none")
|
||||
for (row_type i = sel_row_start; i <= sel_row_end; ++i) {
|
||||
tabular.row_info[i].top_space_default = false;
|
||||
tabular.row_info[i].top_space = len;
|
||||
}
|
||||
else
|
||||
else if (isValidLength(value, &len))
|
||||
for (row_type i = sel_row_start; i <= sel_row_end; ++i) {
|
||||
tabular.row_info[i].top_space_default = false;
|
||||
tabular.row_info[i].top_space = len;
|
||||
@ -5210,12 +5232,12 @@ void InsetTabular::tabularFeatures(Cursor & cur,
|
||||
if (value == "default")
|
||||
for (row_type i = sel_row_start; i <= sel_row_end; ++i)
|
||||
tabular.row_info[i].bottom_space_default = true;
|
||||
else if (isValidLength(value, &len))
|
||||
else if (value == "none")
|
||||
for (row_type i = sel_row_start; i <= sel_row_end; ++i) {
|
||||
tabular.row_info[i].bottom_space_default = false;
|
||||
tabular.row_info[i].bottom_space = len;
|
||||
}
|
||||
else
|
||||
else if (isValidLength(value, &len))
|
||||
for (row_type i = sel_row_start; i <= sel_row_end; ++i) {
|
||||
tabular.row_info[i].bottom_space_default = false;
|
||||
tabular.row_info[i].bottom_space = len;
|
||||
@ -5228,12 +5250,12 @@ void InsetTabular::tabularFeatures(Cursor & cur,
|
||||
if (value == "default")
|
||||
for (row_type i = sel_row_start; i <= sel_row_end; ++i)
|
||||
tabular.row_info[i].interline_space_default = true;
|
||||
else if (isValidLength(value, &len))
|
||||
else if (value == "none")
|
||||
for (row_type i = sel_row_start; i <= sel_row_end; ++i) {
|
||||
tabular.row_info[i].interline_space_default = false;
|
||||
tabular.row_info[i].interline_space = len;
|
||||
}
|
||||
else
|
||||
else if (isValidLength(value, &len))
|
||||
for (row_type i = sel_row_start; i <= sel_row_end; ++i) {
|
||||
tabular.row_info[i].interline_space_default = false;
|
||||
tabular.row_info[i].interline_space = len;
|
||||
@ -5248,21 +5270,6 @@ void InsetTabular::tabularFeatures(Cursor & cur,
|
||||
}
|
||||
|
||||
|
||||
bool InsetTabular::showInsetDialog(BufferView * bv) const
|
||||
{
|
||||
bv->showDialog("tabular", params2string(*this),
|
||||
const_cast<InsetTabular *>(this));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void InsetTabular::openLayoutDialog(BufferView * bv) const
|
||||
{
|
||||
bv->showDialog("tabular", params2string(*this),
|
||||
const_cast<InsetTabular *>(this));
|
||||
}
|
||||
|
||||
|
||||
bool InsetTabular::copySelection(Cursor & cur)
|
||||
{
|
||||
if (!cur.selection())
|
||||
|
@ -803,10 +803,6 @@ public:
|
||||
///
|
||||
void tabularFeatures(Cursor & cur, Tabular::Feature feature,
|
||||
std::string const & val = std::string());
|
||||
///
|
||||
void openLayoutDialog(BufferView *) const;
|
||||
///
|
||||
bool showInsetDialog(BufferView *) const;
|
||||
/// number of cells
|
||||
size_t nargs() const { return tabular.numberofcells; }
|
||||
///
|
||||
|
@ -24,12 +24,14 @@
|
||||
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <ostream>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
using namespace std;
|
||||
using namespace lyx::support;
|
||||
|
||||
using support::bformat;
|
||||
namespace lyx {
|
||||
|
||||
|
||||
InsetMathAMSArray::InsetMathAMSArray(Buffer * buf, docstring const & name,
|
||||
@ -105,19 +107,26 @@ bool InsetMathAMSArray::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
FuncStatus & flag) const
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_TABULAR_FEATURE: {
|
||||
docstring const & s = cmd.argument();
|
||||
case LFUN_INSET_MODIFY: {
|
||||
istringstream is(to_utf8(cmd.argument()));
|
||||
string s;
|
||||
is >> s;
|
||||
if (s != "tabular")
|
||||
break;
|
||||
is >> s;
|
||||
if (s == "add-vline-left" || s == "add-vline-right") {
|
||||
flag.message(bformat(
|
||||
from_utf8(N_("Can't add vertical grid lines in '%1$s'")), name_));
|
||||
from_utf8(N_("Can't add vertical grid lines in '%1$s'")),
|
||||
name_));
|
||||
flag.setEnabled(false);
|
||||
return true;
|
||||
}
|
||||
return InsetMathGrid::getStatus(cur, cmd, flag);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return InsetMathGrid::getStatus(cur, cmd, flag);
|
||||
break;
|
||||
}
|
||||
return InsetMathGrid::getStatus(cur, cmd, flag);
|
||||
}
|
||||
|
||||
|
||||
|
@ -71,19 +71,25 @@ void InsetMathCases::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
{
|
||||
//lyxerr << "*** InsetMathCases: request: " << cmd << endl;
|
||||
switch (cmd.action) {
|
||||
case LFUN_TABULAR_FEATURE: {
|
||||
docstring const & s = cmd.argument();
|
||||
case LFUN_INSET_MODIFY: {
|
||||
istringstream is(to_utf8(cmd.argument()));
|
||||
string s;
|
||||
is >> s;
|
||||
if (s != "tabular")
|
||||
break;
|
||||
is >> s;
|
||||
// vertical lines and adding/deleting columns is not allowed for \cases
|
||||
if (s == "append-column" || s == "delete-column"
|
||||
|| s == "add-vline-left" || s == "add-vline-right") {
|
||||
|| s == "add-vline-left" || s == "add-vline-right") {
|
||||
cur.undispatched();
|
||||
break;
|
||||
}
|
||||
cur.recordUndo();
|
||||
}
|
||||
default:
|
||||
InsetMathGrid::doDispatch(cur, cmd);
|
||||
break;
|
||||
}
|
||||
InsetMathGrid::doDispatch(cur, cmd);
|
||||
}
|
||||
|
||||
|
||||
@ -91,26 +97,33 @@ bool InsetMathCases::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
FuncStatus & flag) const
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_TABULAR_FEATURE: {
|
||||
docstring const & s = cmd.argument();
|
||||
case LFUN_INSET_MODIFY: {
|
||||
istringstream is(to_utf8(cmd.argument()));
|
||||
string s;
|
||||
is >> s;
|
||||
if (s != "tabular")
|
||||
break;
|
||||
is >> s;
|
||||
if (s == "add-vline-left" || s == "add-vline-right") {
|
||||
flag.setEnabled(false);
|
||||
flag.message(bformat(
|
||||
from_utf8(N_("No vertical grid lines in 'cases': feature %1$s")),
|
||||
s));
|
||||
from_utf8(s)));
|
||||
return true;
|
||||
}
|
||||
if (s == "append-column" || s == "delete-column") {
|
||||
flag.setEnabled(false);
|
||||
flag.message(bformat(
|
||||
from_utf8(N_("Changing number of columns not allowed in "
|
||||
"'cases': feature %1$s")), s));
|
||||
"'cases': feature %1$s")), from_utf8(s)));
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return InsetMathGrid::getStatus(cur, cmd, flag);
|
||||
break;
|
||||
}
|
||||
return InsetMathGrid::getStatus(cur, cmd, flag);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1161,12 +1161,17 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_TABULAR_FEATURE: {
|
||||
case LFUN_INSET_MODIFY: {
|
||||
cur.recordUndoInset();
|
||||
//lyxerr << "handling tabular-feature " << to_utf8(cmd.argument()) << endl;
|
||||
istringstream is(to_utf8(cmd.argument()));
|
||||
string s;
|
||||
is >> s;
|
||||
if (s != "tabular") {
|
||||
InsetMathNest::doDispatch(cur, cmd);
|
||||
return;
|
||||
}
|
||||
is >> s;
|
||||
if (s == "valign-top")
|
||||
setVerticalAlignment('t');
|
||||
else if (s == "valign-middle")
|
||||
@ -1398,8 +1403,13 @@ bool InsetMathGrid::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
FuncStatus & status) const
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_TABULAR_FEATURE: {
|
||||
string const s = cmd.getArg(0);
|
||||
case LFUN_INSET_MODIFY: {
|
||||
istringstream is(to_utf8(cmd.argument()));
|
||||
string s;
|
||||
is >> s;
|
||||
if (s != "tabular")
|
||||
return InsetMathNest::getStatus(cur, cmd, status);
|
||||
is >> s;
|
||||
if (nrows() <= 1 && (s == "delete-row" || s == "swap-row")) {
|
||||
status.setEnabled(false);
|
||||
status.message(from_utf8(N_("Only one row")));
|
||||
|
@ -1487,10 +1487,13 @@ bool InsetMathHull::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
}
|
||||
return InsetMathGrid::getStatus(cur, cmd, status);
|
||||
|
||||
case LFUN_TABULAR_FEATURE: {
|
||||
case LFUN_INSET_MODIFY: {
|
||||
istringstream is(to_utf8(cmd.argument()));
|
||||
string s;
|
||||
is >> s;
|
||||
if (s != "tabular")
|
||||
return InsetMathGrid::getStatus(cur, cmd, status);
|
||||
is >> s;
|
||||
if (!rowChangeOK()
|
||||
&& (s == "append-row"
|
||||
|| s == "delete-row"
|
||||
|
@ -1266,11 +1266,11 @@ bool InsetMathNest::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
bool ret = true;
|
||||
string const arg = to_utf8(cmd.argument());
|
||||
switch (cmd.action) {
|
||||
case LFUN_TABULAR_FEATURE:
|
||||
case LFUN_INSET_MODIFY:
|
||||
flag.setEnabled(false);
|
||||
break;
|
||||
#if 0
|
||||
case LFUN_TABULAR_FEATURE:
|
||||
case LFUN_INSET_MODIFY:
|
||||
// FIXME: check temporarily disabled
|
||||
// valign code
|
||||
char align = mathcursor::valign();
|
||||
|
@ -70,19 +70,25 @@ bool InsetMathSplit::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
FuncStatus & flag) const
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_TABULAR_FEATURE: {
|
||||
docstring const & s = cmd.argument();
|
||||
case LFUN_INSET_MODIFY: {
|
||||
istringstream is(to_utf8(cmd.argument()));
|
||||
string s;
|
||||
is >> s;
|
||||
if (s != "tabular")
|
||||
break;
|
||||
is >> s;
|
||||
if (s == "add-vline-left" || s == "add-vline-right") {
|
||||
flag.message(bformat(
|
||||
from_utf8(N_("Can't add vertical grid lines in '%1$s'")), name_));
|
||||
flag.setEnabled(false);
|
||||
return true;
|
||||
}
|
||||
return InsetMathGrid::getStatus(cur, cmd, flag);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return InsetMathGrid::getStatus(cur, cmd, flag);
|
||||
break;
|
||||
}
|
||||
return InsetMathGrid::getStatus(cur, cmd, flag);
|
||||
}
|
||||
|
||||
|
||||
|
@ -63,9 +63,14 @@ bool InsetMathSubstack::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
FuncStatus & flag) const
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_TABULAR_FEATURE: {
|
||||
case LFUN_INSET_MODIFY: {
|
||||
istringstream is(to_utf8(cmd.argument()));
|
||||
string s;
|
||||
is >> s;
|
||||
if (s != "tabular")
|
||||
break;
|
||||
is >> s;
|
||||
string const name = "substack";
|
||||
docstring const & s = cmd.argument();
|
||||
if (s == "add-vline-left" || s == "add-vline-right") {
|
||||
flag.message(bformat(
|
||||
from_utf8(N_("Can't add vertical grid lines in '%1$s'")),
|
||||
@ -73,11 +78,12 @@ bool InsetMathSubstack::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
flag.setEnabled(false);
|
||||
return true;
|
||||
}
|
||||
return InsetMathGrid::getStatus(cur, cmd, flag);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return InsetMathGrid::getStatus(cur, cmd, flag);
|
||||
break;
|
||||
}
|
||||
return InsetMathGrid::getStatus(cur, cmd, flag);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user