From eab8eaec5cf75c2fa6ffab3a9d314ec34c0c8594 Mon Sep 17 00:00:00 2001 From: John Levon Date: Sat, 26 Apr 2003 19:01:33 +0000 Subject: [PATCH] inset-settings LFUN and a bugfix git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6862 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/ChangeLog | 4 ++++ lib/ui/stdmenus.ui | 6 ++++-- src/ChangeLog | 10 ++++++++++ src/LyXAction.C | 1 + src/lfuns.h | 2 ++ src/lyxfunc.C | 47 ++++++++++++++++++++++++++++++++++++++++++++-- src/text3.C | 5 +++++ 7 files changed, 71 insertions(+), 4 deletions(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index 5d3039b093..eb300c0966 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,7 @@ +2003-04-26 John Levon + + * ui/stdmenus.ui: Make table settings use old layout-tabular LFUN + 2003-04-26 John Levon * ui/stdmenus.ui: remove shortcuts for cut,copy,paste diff --git a/lib/ui/stdmenus.ui b/lib/ui/stdmenus.ui index 99626132ac..cc18482611 100644 --- a/lib/ui/stdmenus.ui +++ b/lib/ui/stdmenus.ui @@ -86,12 +86,15 @@ Menuset # only appear when relevant (getStatus). Only stuff that needs # a right-click to bring up the dialog should appear here (it is not # obvious what the context is for the others) - OptItem "Table Settings...|a" "inset-settings tabular" OptItem "TeX Code Settings...|C" "inset-settings ert" # 'a' shortcut to match Insert entry, shouldn't clash with Table Settings OptItem "Float Settings...|a" "inset-settings float" OptItem "Minipage Settings...|M" "inset-settings minipage" OptItem "Text Wrap Settings...|W" "inset-settings wrap" +# Hey, guess what's broken ? Surprise surprise, it's tabular stuff +# This is in the Table submenu instead for now. +# OptItem "Table Settings...|a" "inset-settings tabular" + OptItem "Table Settings...|a" "layout-tabular" End # not much we can do to help here @@ -112,7 +115,6 @@ Menuset Item "Left aligned|e" "tabular-feature align-left" Item "Centered|C" "tabular-feature align-center" Item "Right aligned|i" "tabular-feature align-right" - Separator Item "Top aligned|o" "tabular-feature valign-top" Item "Vertically Centered|V" "tabular-feature valign-center" Item "Bottom aligned|g" "tabular-feature valign-bottom" diff --git a/src/ChangeLog b/src/ChangeLog index b79f2a365f..6ce644e56b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2003-04-26 John Levon + + * text3.C: + * lyxfunc.C: + * lfuns.h: + * LyXAction.C: add LFUN_INSET_SETTINGS + + * lyxfunc.C: don't enable tabular-feature when there's + just any locking inset + 2003-04-26 John Levon * bufferlist.C: re-add Cancel to buffer close question diff --git a/src/LyXAction.C b/src/LyXAction.C index d5994c64d4..de47ef4085 100644 --- a/src/LyXAction.C +++ b/src/LyXAction.C @@ -324,6 +324,7 @@ void LyXAction::init() { LFUN_INSET_INSERT, "inset-insert", Noop }, { LFUN_INSET_MODIFY, "", Noop }, { LFUN_INSET_DIALOG_UPDATE, "", Noop }, + { LFUN_INSET_SETTINGS, "inset-settings", ReadOnly }, { LFUN_PARAGRAPH_APPLY, "paragraph-params-apply", Noop }, { LFUN_PARAGRAPH_UPDATE, "", Noop }, { LFUN_NOACTION, "", Noop } diff --git a/src/lfuns.h b/src/lfuns.h index c31b843e97..d078ebcf78 100644 --- a/src/lfuns.h +++ b/src/lfuns.h @@ -10,6 +10,7 @@ * - add a new enum constant immediately before LFUN_LASTACTION * - add an appropriate line in LyXAction.C * - add a branch to the suitable ::dispatch() methods + * - add correct test in LyXFunc::getStatus() */ #ifndef LFUNS_H @@ -333,6 +334,7 @@ enum kb_action { LFUN_INSET_MODIFY, // 255 LFUN_INSET_DIALOG_UPDATE, + LFUN_INSET_SETTINGS, LFUN_PARAGRAPH_APPLY, LFUN_PARAGRAPH_UPDATE, diff --git a/src/lyxfunc.C b/src/lyxfunc.C index ad401a4e35..849ff72571 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -430,13 +430,17 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const if (tli->lyxCode() == Inset::TABULAR_CODE) { ret = static_cast(tli) ->getStatus(ev.argument); + flag |= ret; + disable = false; } else if (tli->getFirstLockingInsetOfType(Inset::TABULAR_CODE)) { ret = static_cast (tli->getFirstLockingInsetOfType(Inset::TABULAR_CODE)) ->getStatus(ev.argument); + flag |= ret; + disable = false; + } else { + disable = true; } - flag |= ret; - disable = false; } else { static InsetTabular inset(*owner->buffer(), 1, 1); FuncStatus ret; @@ -484,6 +488,45 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const && lt->inset_owner->owner()->isOpen())); break; } + + case LFUN_INSET_SETTINGS: { + disable = true; + UpdatableInset * inset = view()->theLockingInset(); + + if (!inset) + break; + + // get the innermost inset + inset = inset->getLockingInset(); + + // jump back to owner if an InsetText, so + // we get back to the InsetTabular or whatever + if (inset->lyxCode() == Inset::TEXT_CODE) + inset = static_cast(inset->owner()); + + Inset::Code code = inset->lyxCode(); + switch (code) { + case Inset::TABULAR_CODE: + disable = ev.argument != "tabular"; + break; + case Inset::ERT_CODE: + disable = ev.argument != "ert"; + break; + case Inset::FLOAT_CODE: + disable = ev.argument != "float"; + break; + case Inset::MINIPAGE_CODE: + disable = ev.argument != "minipage"; + break; + case Inset::WRAP_CODE: + disable = ev.argument != "wrap"; + break; + default: + break; + } + break; + } + case LFUN_LATEX_LOG: disable = !IsFileReadable(buf->getLogName().second); break; diff --git a/src/text3.C b/src/text3.C index 65993269ca..1df3ba307d 100644 --- a/src/text3.C +++ b/src/text3.C @@ -917,6 +917,11 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd) break; } + case LFUN_INSET_SETTINGS: + lyx::Assert(bv->theLockingInset()); + bv->theLockingInset()->getLockingInset()->showInsetDialog(bv); + break; + case LFUN_INSET_TOGGLE: bv->hideCursor(); bv->beforeChange(this); -- 2.39.5