lasgout...@lyx.org wrote:
> Author: lasgouttes
> Date: Tue Mar 31 11:38:07 2009
> New Revision: 28987
> URL: http://www.lyx.org/trac/changeset/28987
> 
> Log:
> Extend the branch-(de)activate functions to work without a parameter. In
> this case, when the cursor is on a branch inset (using the AtPoint mechanism)
> the branch to which the branch inset belongs will be (de)activated.
> 
> This functionality can now be used through the branch inset context menu
> 

> Modified: lyx-devel/trunk/src/insets/InsetBranch.cpp
> ==============================================================================
> --- lyx-devel/trunk/src/insets/InsetBranch.cpp        Tue Mar 31 11:02:13 
> 2009        (r28986)
> +++ lyx-devel/trunk/src/insets/InsetBranch.cpp        Tue Mar 31 11:38:07 
> 2009        (r28987)
> @@ -143,6 +143,18 @@
>               cur.bv().updateDialog("branch", params2string(params()));
>               break;
>  
> +     case LFUN_BRANCH_ACTIVATE:
> +     case LFUN_BRANCH_DEACTIVATE: {
> +             // FIXME: I do not like this cast, but have no other idea...
> +             Buffer * realbuffer = const_cast<Buffer 
> *>(buffer().masterBuffer());
> +             BranchList & branchlist = realbuffer->params().branchlist();
> +             Branch * ourBranch = branchlist.find(params_.branch);
> +             if (!ourBranch)
> +                     break;
> +             ourBranch->setSelected(cmd.action == LFUN_BRANCH_ACTIVATE);
> +             break;
> +     }

be careful about this part, one fix i needed in my branch was the attached (i 
plan to commit soon).

pavel
commit d06477c14f5a8d985dab54c0ce460e3793e24161
Author: Pavel Sanda <p...@twin.jikos.cz>
Date:   Tue Mar 24 11:43:30 2009 +0100

    Fix status check of branch (de)activation from the child, when master
    has no info about that branch.

diff --git a/src/insets/InsetBranch.cpp b/src/insets/InsetBranch.cpp
index 76e813d..93c5ecb 100644
--- a/src/insets/InsetBranch.cpp
+++ b/src/insets/InsetBranch.cpp
@@ -209,8 +209,14 @@ bool InsetBranch::isBranchSelected() const
 	Buffer const & realbuffer = *buffer().masterBuffer();
 	BranchList const & branchlist = realbuffer.params().branchlist();
 	Branch const * ourBranch = branchlist.find(params_.branch);
-	if (!ourBranch)
-		return false;
+	// this branch is defined in child only
+	if (!ourBranch) {
+		ourBranch = buffer().params().branchlist().find(params_.branch);
+		if (ourBranch)
+			return ourBranch->isSelected();
+		else
+			return false;
+	}
 	return ourBranch->isSelected();
 }
 

Reply via email to