inset-settings LFUN and a bugfix

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6862 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2003-04-26 19:01:33 +00:00
parent 77e1fac46e
commit eab8eaec5c
7 changed files with 71 additions and 4 deletions

View File

@ -1,3 +1,7 @@
2003-04-26 John Levon <levon@movementarian.org>
* ui/stdmenus.ui: Make table settings use old layout-tabular LFUN
2003-04-26 John Levon <levon@movementarian.org> 2003-04-26 John Levon <levon@movementarian.org>
* ui/stdmenus.ui: remove shortcuts for cut,copy,paste * ui/stdmenus.ui: remove shortcuts for cut,copy,paste

View File

@ -86,12 +86,15 @@ Menuset
# only appear when relevant (getStatus). Only stuff that needs # only appear when relevant (getStatus). Only stuff that needs
# a right-click to bring up the dialog should appear here (it is not # a right-click to bring up the dialog should appear here (it is not
# obvious what the context is for the others) # obvious what the context is for the others)
OptItem "Table Settings...|a" "inset-settings tabular"
OptItem "TeX Code Settings...|C" "inset-settings ert" OptItem "TeX Code Settings...|C" "inset-settings ert"
# 'a' shortcut to match Insert entry, shouldn't clash with Table Settings # 'a' shortcut to match Insert entry, shouldn't clash with Table Settings
OptItem "Float Settings...|a" "inset-settings float" OptItem "Float Settings...|a" "inset-settings float"
OptItem "Minipage Settings...|M" "inset-settings minipage" OptItem "Minipage Settings...|M" "inset-settings minipage"
OptItem "Text Wrap Settings...|W" "inset-settings wrap" 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 End
# not much we can do to help here # not much we can do to help here
@ -112,7 +115,6 @@ Menuset
Item "Left aligned|e" "tabular-feature align-left" Item "Left aligned|e" "tabular-feature align-left"
Item "Centered|C" "tabular-feature align-center" Item "Centered|C" "tabular-feature align-center"
Item "Right aligned|i" "tabular-feature align-right" Item "Right aligned|i" "tabular-feature align-right"
Separator
Item "Top aligned|o" "tabular-feature valign-top" Item "Top aligned|o" "tabular-feature valign-top"
Item "Vertically Centered|V" "tabular-feature valign-center" Item "Vertically Centered|V" "tabular-feature valign-center"
Item "Bottom aligned|g" "tabular-feature valign-bottom" Item "Bottom aligned|g" "tabular-feature valign-bottom"

View File

@ -1,3 +1,13 @@
2003-04-26 John Levon <levon@movementarian.org>
* 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 <levon@movementarian.org> 2003-04-26 John Levon <levon@movementarian.org>
* bufferlist.C: re-add Cancel to buffer close question * bufferlist.C: re-add Cancel to buffer close question

View File

@ -324,6 +324,7 @@ void LyXAction::init()
{ LFUN_INSET_INSERT, "inset-insert", Noop }, { LFUN_INSET_INSERT, "inset-insert", Noop },
{ LFUN_INSET_MODIFY, "", Noop }, { LFUN_INSET_MODIFY, "", Noop },
{ LFUN_INSET_DIALOG_UPDATE, "", Noop }, { LFUN_INSET_DIALOG_UPDATE, "", Noop },
{ LFUN_INSET_SETTINGS, "inset-settings", ReadOnly },
{ LFUN_PARAGRAPH_APPLY, "paragraph-params-apply", Noop }, { LFUN_PARAGRAPH_APPLY, "paragraph-params-apply", Noop },
{ LFUN_PARAGRAPH_UPDATE, "", Noop }, { LFUN_PARAGRAPH_UPDATE, "", Noop },
{ LFUN_NOACTION, "", Noop } { LFUN_NOACTION, "", Noop }

View File

@ -10,6 +10,7 @@
* - add a new enum constant immediately before LFUN_LASTACTION * - add a new enum constant immediately before LFUN_LASTACTION
* - add an appropriate line in LyXAction.C * - add an appropriate line in LyXAction.C
* - add a branch to the suitable ::dispatch() methods * - add a branch to the suitable ::dispatch() methods
* - add correct test in LyXFunc::getStatus()
*/ */
#ifndef LFUNS_H #ifndef LFUNS_H
@ -333,6 +334,7 @@ enum kb_action {
LFUN_INSET_MODIFY, LFUN_INSET_MODIFY,
// 255 // 255
LFUN_INSET_DIALOG_UPDATE, LFUN_INSET_DIALOG_UPDATE,
LFUN_INSET_SETTINGS,
LFUN_PARAGRAPH_APPLY, LFUN_PARAGRAPH_APPLY,
LFUN_PARAGRAPH_UPDATE, LFUN_PARAGRAPH_UPDATE,

View File

@ -430,13 +430,17 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
if (tli->lyxCode() == Inset::TABULAR_CODE) { if (tli->lyxCode() == Inset::TABULAR_CODE) {
ret = static_cast<InsetTabular *>(tli) ret = static_cast<InsetTabular *>(tli)
->getStatus(ev.argument); ->getStatus(ev.argument);
flag |= ret;
disable = false;
} else if (tli->getFirstLockingInsetOfType(Inset::TABULAR_CODE)) { } else if (tli->getFirstLockingInsetOfType(Inset::TABULAR_CODE)) {
ret = static_cast<InsetTabular *> ret = static_cast<InsetTabular *>
(tli->getFirstLockingInsetOfType(Inset::TABULAR_CODE)) (tli->getFirstLockingInsetOfType(Inset::TABULAR_CODE))
->getStatus(ev.argument); ->getStatus(ev.argument);
flag |= ret;
disable = false;
} else {
disable = true;
} }
flag |= ret;
disable = false;
} else { } else {
static InsetTabular inset(*owner->buffer(), 1, 1); static InsetTabular inset(*owner->buffer(), 1, 1);
FuncStatus ret; FuncStatus ret;
@ -484,6 +488,45 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
&& lt->inset_owner->owner()->isOpen())); && lt->inset_owner->owner()->isOpen()));
break; 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<UpdatableInset*>(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: case LFUN_LATEX_LOG:
disable = !IsFileReadable(buf->getLogName().second); disable = !IsFileReadable(buf->getLogName().second);
break; break;

View File

@ -917,6 +917,11 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
break; break;
} }
case LFUN_INSET_SETTINGS:
lyx::Assert(bv->theLockingInset());
bv->theLockingInset()->getLockingInset()->showInsetDialog(bv);
break;
case LFUN_INSET_TOGGLE: case LFUN_INSET_TOGGLE:
bv->hideCursor(); bv->hideCursor();
bv->beforeChange(this); bv->beforeChange(this);