]> git.lyx.org Git - features.git/commitdiff
Move the call to LFUN_SET_COLOR from the handling of LFUN_BRANCH_ADD_INSERT to LFUN_B...
authorVincent van Ravesteijn <vfr@lyx.org>
Thu, 29 Oct 2009 22:06:27 +0000 (22:06 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Thu, 29 Oct 2009 22:06:27 +0000 (22:06 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31792 a592a061-630c-0410-9148-cb99ea01b6c8

src/Buffer.cpp
src/BufferView.cpp

index 11c9231bb651b4be4cc1a87c67feae6cbd6f7920..b42f14d028ff642e155f6bdc1feb7148a16b599b 100644 (file)
@@ -1857,21 +1857,25 @@ void Buffer::dispatch(FuncRequest const & func, DispatchResult & dr)
                break;
 
        case LFUN_BRANCH_ADD: {
-               BranchList & branchList = params().branchlist();
-               docstring const branchName = func.argument();
-               if (branchName.empty()) {
+               docstring const branch_name = func.argument();
+               if (branch_name.empty()) {
                        dispatched = false;
                        break;
                }
-               Branch * branch = branchList.find(branchName);
+               BranchList & branch_list = params().branchlist();
+               Branch * branch = branch_list.find(branch_name);
                if (branch) {
-                       LYXERR0("Branch " << branchName << " does already exist.");
+                       LYXERR0("Branch " << branch_name << " already exists.");
                        dr.setError(true);
                        docstring const msg = 
-                               bformat(_("Branch \"%1$s\" does already exist."), branchName);
+                               bformat(_("Branch \"%1$s\" already exists."), branch_name);
                        dr.setMessage(msg);
                } else {
-                       branchList.add(branchName);
+                       branch_list.add(branch_name);
+                       branch = branch_list.find(branch_name);
+                       string const x11hexname = X11hexname(branch->color());
+                       docstring const str = branch_name + ' ' + from_ascii(x11hexname);
+                       lyx::dispatch(FuncRequest(LFUN_SET_COLOR, str));        
                        dr.setError(false);
                        dr.update(Update::Force);
                }
index d07a7d9cac9b9a992aea82ea3ccb934280768e65..4b055a923595a6288617c03688c563e3468e5c21 100644 (file)
@@ -1800,11 +1800,6 @@ bool BufferView::dispatch(FuncRequest const & cmd)
                        Alert::warning(_("Branch already exists"), drtmp.message());
                        break;
                }
-               BranchList & branch_list = buffer_.params().branchlist();
-               Branch const * branch = branch_list.find(branch_name);
-               string const x11hexname = X11hexname(branch->color());
-               docstring const str = branch_name + ' ' + from_ascii(x11hexname);
-               lyx::dispatch(FuncRequest(LFUN_SET_COLOR, str));
                lyx::dispatch(FuncRequest(LFUN_BRANCH_INSERT, branch_name));
                break;
        }