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
15 #include "ControlBranch.h"
16 #include "FormBranch.h"
17 #include "forms/form_branch.h"
18 #include "xforms_helpers.h" // formatted
19 #include "lyx_forms.h"
20 #include "insets/insetbranch.h"
23 typedef FormController<ControlBranch, FormView<FD_branch> > base_class;
25 FormBranch::FormBranch(Dialog & parent)
26 : base_class(parent, _("Branch"))
30 void FormBranch::build()
32 string all_branches(controller().params().branchlist.allBranches());
34 dialog_.reset(build_branch(this));
36 fl_addto_choice(dialog_->choice_branch, all_branches.c_str());
38 bcview().setOK(dialog_->button_ok);
39 bcview().setApply(dialog_->button_apply);
40 bcview().setCancel(dialog_->button_cancel);
44 void FormBranch::update()
46 // Make changes in all_branches propagate within session:
47 string all_branches(controller().params().branchlist.allBranches());
48 fl_clear_choice(dialog_->choice_branch);
49 fl_addto_choice(dialog_->choice_branch, all_branches.c_str());
51 string branch(controller().params().branch);
52 if (all_branches.find(branch) != string::npos && branch != "none")
53 fl_set_choice_text(dialog_->choice_branch, branch.c_str());
57 void FormBranch::apply()
59 string const type = fl_get_choice_text(dialog_->choice_branch);
61 controller().params().branch = type;