3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Martin Vermeer
8 * Full author contact details are available in file CREDITS.
14 #include "FormBranch.h"
15 #include "ControlBranch.h"
16 #include "forms/form_branch.h"
20 #include "insets/insetbranch.h"
22 #include "lyx_forms.h"
25 typedef FormController<ControlBranch, FormView<FD_branch> > base_class;
27 FormBranch::FormBranch(Dialog & parent)
28 : base_class(parent, _("Branch"))
32 void FormBranch::build()
34 string all_branches(controller().params().branchlist.allBranches());
36 dialog_.reset(build_branch(this));
38 fl_addto_choice(dialog_->choice_branch, all_branches.c_str());
40 bcview().setOK(dialog_->button_ok);
41 bcview().setApply(dialog_->button_apply);
42 bcview().setCancel(dialog_->button_cancel);
46 void FormBranch::update()
48 // Make changes in all_branches propagate within session:
49 string all_branches(controller().params().branchlist.allBranches());
50 fl_clear_choice(dialog_->choice_branch);
51 fl_addto_choice(dialog_->choice_branch, all_branches.c_str());
53 string branch(controller().params().branch);
54 if (all_branches.find(branch) != string::npos && branch != "none")
55 fl_set_choice_text(dialog_->choice_branch, branch.c_str());
59 void FormBranch::apply()
61 string const type = fl_get_choice_text(dialog_->choice_branch);
63 controller().params().branch = type;