> The buttons should be disabled if necessary > (e.g valign in non-fixed width)
see attached > I need "toggle-longtable", "toggle-rotate-cell" and > "toggle-rotate-tabular" instead of (additional to) > "[set/unset]-rotate-cell" etc. I guess these could be added to insettabular. In fact couldn't we just replace "[set/unset]-rotate-cell" with "toggle-rotate-cell" etc? > I have not yet implemented the multicolumns stuff (m-align-left > and friends). Don't know what's the best way to deal with them maybe we should rename ALIGN_X to C_ALIGN_X TOGGLE_LINE_Y to C_TOGGLE_LINE_Y and implement ALIGN_X and TOGGLE_LINE_Y such as to take into account whether the cell is multicolumn or not like in the qt dialog > Where do I have to set the text for the tooltips? Perhaps we could put them in default.ui: - Icon "tabular-feature toggle-line-left" + Icon "Set left border" "tabular-feature toggle-line-left" otherwise let the inset handle it. I don't know what would be the best way ahead... > It would be very cool if the user could set a mode, where the > tabular toolbar automatically displays when entering a table > (like in klyx). as in attached? Best, Ed.
Index: lib/ui/default.ui =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/ui/default.ui,v retrieving revision 1.106 diff -u -p -r1.106 default.ui --- lib/ui/default.ui 30 Oct 2002 02:08:51 -0000 1.106 +++ lib/ui/default.ui 15 Jan 2003 10:24:00 -0000 @@ -426,4 +426,32 @@ Toolbar Separator Icon "graphics-insert" Icon "tabular-insert" + + # The Tabular Toolbar + + Tabular + Icon "tabular-feature append-column" + Icon "tabular-feature delete-column" + Icon "tabular-feature append-row" + Icon "tabular-feature delete-row" + Separator + Icon "tabular-feature align-left" + Icon "tabular-feature align-center" + Icon "tabular-feature align-right" + Separator + Icon "tabular-feature set-all-lines" + Icon "tabular-feature unset-all-lines" + Icon "tabular-feature toggle-line-left" + Icon "tabular-feature toggle-line-right" + Icon "tabular-feature toggle-line-bottom" + Icon "tabular-feature toggle-line-top" + Separator + Icon "tabular-feature valign-top" + Icon "tabular-feature valign-center" + Icon "tabular-feature valign-bottom" + Separator + Icon "tabular-feature multicolumn" + Icon "tabular-feature rotate-cell" + Icon "tabular-feature rotate-tabular" + Icon "tabular-feature longtabular" End Index: src/ToolbarDefaults.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ToolbarDefaults.C,v retrieving revision 1.33 diff -u -p -r1.33 ToolbarDefaults.C --- src/ToolbarDefaults.C 27 Nov 2002 10:30:05 -0000 1.33 +++ src/ToolbarDefaults.C 15 Jan 2003 10:24:00 -0000 @@ -34,6 +34,7 @@ enum _tooltags { TO_SEPARATOR, TO_LAYOUTS, TO_NEWLINE, + TO_TABULAR, TO_LAST }; @@ -43,7 +44,8 @@ struct keyword_item toolTags[TO_LAST - 1 { "icon", TO_ADD }, { "layouts", TO_LAYOUTS }, { "newline", TO_NEWLINE }, - { "separator", TO_SEPARATOR } + { "separator", TO_SEPARATOR }, + { "tabular", TO_TABULAR } }; } // end of anon namespace @@ -135,6 +137,10 @@ void ToolbarDefaults::read(LyXLex & lex) add(NEWLINE); break; + case TO_TABULAR: + add(TABULAR); + break; + case TO_ENDTOOLBAR: quit = true; break; Index: src/ToolbarDefaults.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ToolbarDefaults.h,v retrieving revision 1.9 diff -u -p -r1.9 ToolbarDefaults.h --- src/ToolbarDefaults.h 11 Aug 2002 16:27:09 -0000 1.9 +++ src/ToolbarDefaults.h 15 Jan 2003 10:24:00 -0000 @@ -29,6 +29,8 @@ class ToolbarDefaults { public: /// The special toolbar actions enum ItemType { + /// adds tabular toolbar + TABULAR = -4, /// adds space between buttons in the toolbar SEPARATOR = -3, /// a special combox insead of a button Index: src/frontends/qt2/Toolbar_pimpl.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/Toolbar_pimpl.C,v retrieving revision 1.30 diff -u -p -r1.30 Toolbar_pimpl.C --- src/frontends/qt2/Toolbar_pimpl.C 17 Dec 2002 20:37:11 -0000 1.30 +++ src/frontends/qt2/Toolbar_pimpl.C 15 Jan 2003 10:24:00 -0000 @@ -52,6 +52,9 @@ QPixmap getIconPixmap(int action) if (f.action == LFUN_INSERT_MATH && !f.argument.empty()) { fullname = find_xpm(f.argument.substr(1)); + } else if (f.action == LFUN_TABULAR_FEATURE && !f.argument.empty()) { + string xpm_name = "tabular/" + subst(f.argument, ' ','_'); + fullname = LibFileSearch("images", xpm_name, "xpm"); } else { string const name = lyxaction.getActionName(f.action); string xpm_name(name); @@ -90,7 +93,7 @@ public: Toolbar::Pimpl::Pimpl(LyXView * o, int, int) : owner_(static_cast<QtView *>(o)), - combo_(0) + combo_(0), tabletoolbar_(0) { proxy_.reset(new ToolbarProxy(*this)); } @@ -120,6 +123,14 @@ void Toolbar::Pimpl::update() if (combo_) combo_->setEnabled(!owner_->getLyXFunc().getStatus(LFUN_LAYOUT).disabled()); + + if (tabletoolbar_) { + if (owner_->getLyXFunc().getStatus(LFUN_LAYOUT_TABULAR).disabled()) { + tabletoolbar_->hide(); + } else { + tabletoolbar_->show(); + } + } } @@ -235,6 +246,10 @@ void Toolbar::Pimpl::add(int action) break; case ToolbarDefaults::NEWLINE: toolbars_.push_back(new QToolBar(owner_)); + break; + case ToolbarDefaults::TABULAR: + toolbars_.push_back(new QToolBar(owner_)); + tabletoolbar_ = toolbars_.back(); break; case ToolbarDefaults::LAYOUTS: { combo_ = new QLComboBox(toolbars_.back()); Index: src/frontends/qt2/Toolbar_pimpl.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/Toolbar_pimpl.h,v retrieving revision 1.14 diff -u -p -r1.14 Toolbar_pimpl.h --- src/frontends/qt2/Toolbar_pimpl.h 17 Dec 2002 20:37:11 -0000 1.14 +++ src/frontends/qt2/Toolbar_pimpl.h 15 Jan 2003 10:24:00 -0000 @@ -67,6 +67,8 @@ private: QLComboBox * combo_; + QToolBar * tabletoolbar_; + typedef std::map<QToolButton *, int> ButtonMap; ButtonMap map_; Index: src/insets/insettabular.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettabular.C,v retrieving revision 1.234 diff -u -p -r1.234 insettabular.C --- src/insets/insettabular.C 24 Nov 2002 15:19:56 -0000 1.234 +++ src/insets/insettabular.C 15 Jan 2003 10:24:00 -0000 @@ -2439,16 +2439,19 @@ FuncStatus InsetTabular::getStatus(strin case LyXTabular::M_VALIGN_TOP: flag = false; case LyXTabular::VALIGN_TOP: + status.disabled(tabular->GetColumnPWidth(actcell).zero()); status.setOnOff(tabular->GetVAlignment(actcell, flag) == LyXTabular::LYX_VALIGN_TOP); break; case LyXTabular::M_VALIGN_BOTTOM: flag = false; case LyXTabular::VALIGN_BOTTOM: + status.disabled(tabular->GetColumnPWidth(actcell).zero()); status.setOnOff(tabular->GetVAlignment(actcell, flag) == LyXTabular::LYX_VALIGN_BOTTOM); break; case LyXTabular::M_VALIGN_CENTER: flag = false; case LyXTabular::VALIGN_CENTER: + status.disabled(tabular->GetColumnPWidth(actcell).zero()); status.setOnOff(tabular->GetVAlignment(actcell, flag) == LyXTabular::LYX_VALIGN_CENTER); break; case LyXTabular::SET_LONGTABULAR: