From 9b35643f8ebefe14cc6b1ed4b91cc6abd927a609 Mon Sep 17 00:00:00 2001 From: Martin Vermeer Date: Wed, 7 Apr 2004 05:28:51 +0000 Subject: [PATCH] Use 'assign' as the name for the operation that opens/closes branch insets according to selection git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8616 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/controllers/ChangeLog | 5 +++++ src/frontends/controllers/ControlDocument.C | 2 +- src/insets/ChangeLog | 6 ++++++ src/insets/insetbranch.C | 13 ++++++++++--- src/insets/insetcollapsable.C | 3 ++- 5 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index 0729b3599b..ff80490396 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,8 @@ +2004-04-07 Martin Vermeer + + * ControlDocument.C: 'assign' for opening/closing branch insets + according to selection + 2004-04-05 Angus Leeming * ButtonPolicies.C (printState, printInput): human-readable output diff --git a/src/frontends/controllers/ControlDocument.C b/src/frontends/controllers/ControlDocument.C index 25c3212de7..5dc34b0095 100644 --- a/src/frontends/controllers/ControlDocument.C +++ b/src/frontends/controllers/ControlDocument.C @@ -115,7 +115,7 @@ void ControlDocument::dispatchParams() } // Open insets of selected branches, close deselected ones - kernel().dispatch(FuncRequest(LFUN_ALL_INSETS_TOGGLE, "toggle branch")); + kernel().dispatch(FuncRequest(LFUN_ALL_INSETS_TOGGLE, "assign branch")); } diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index b82e93b099..6e4d931deb 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,9 @@ +2004-04-07 Martin Vermeer + + * insetcollapsable.C: + * insetbranch.C: 'assign' to open/close branch inset according to + selection; also print content on closed branch button + 2004-04-06 Georg Baum * ExternalSupport.C (doSubstitution): add new variables $$AbsPath, diff --git a/src/insets/insetbranch.C b/src/insets/insetbranch.C index d1a400e08e..a8909d5a07 100644 --- a/src/insets/insetbranch.C +++ b/src/insets/insetbranch.C @@ -94,7 +94,8 @@ void InsetBranch::setButtonLabel() font.decSize(); font.decSize(); - setLabel("Branch: " + params_.branch); + string s = "Branch: " + params_.branch; + setLabel(isOpen() ? s : getNewLabel(s) ); font.setColor(LColor::foreground); if (!params_.branch.empty()) setBackgroundColor(lcolor.getFromLyXName(params_.branch)); @@ -150,9 +151,15 @@ void InsetBranch::priv_dispatch(LCursor & cur, FuncRequest & cmd) else if (cmd.argument == "close") { setStatus(Collapsed); leaveInset(cur, *this); + } else if (cmd.argument == "toggle") { + if (isOpen()) { + setStatus(Collapsed); + leaveInset(cur, *this); + } else + setStatus(Open); - // The branch inset specialises its behaviour on "toggle". - } else if (cmd.argument == "toggle" + // The branch inset uses "assign". + } else if (cmd.argument == "assign" || cmd.argument.empty()) { BranchList const & branchlist = cur.bv().buffer()->params().branchlist(); diff --git a/src/insets/insetcollapsable.C b/src/insets/insetcollapsable.C index 5871a073e7..6d908ce86e 100644 --- a/src/insets/insetcollapsable.C +++ b/src/insets/insetcollapsable.C @@ -323,7 +323,8 @@ void InsetCollapsable::priv_dispatch(LCursor & cur, FuncRequest & cmd) leaveInset(cur, *this); } else setStatus(Open); - } + } else // if assign or anything else + cur.undispatched(); cur.dispatched(); break;