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"
28 typedef FormController<ControlBranch, FormView<FD_branch> > base_class;
30 FormBranch::FormBranch(Dialog & parent)
31 : base_class(parent, _("Branch"))
35 void FormBranch::build()
37 string all_branches(controller().params().branchlist.allBranches());
39 dialog_.reset(build_branch(this));
41 fl_addto_choice(dialog_->choice_branch, all_branches.c_str());
43 bcview().setOK(dialog_->button_ok);
44 bcview().setApply(dialog_->button_apply);
45 bcview().setCancel(dialog_->button_cancel);
49 void FormBranch::update()
51 // Make changes in all_branches propagate within session:
52 string all_branches(controller().params().branchlist.allBranches());
53 fl_clear_choice(dialog_->choice_branch);
54 fl_addto_choice(dialog_->choice_branch, all_branches.c_str());
56 string branch(controller().params().branch);
57 if (all_branches.find(branch) != string::npos && branch != "none")
58 fl_set_choice_text(dialog_->choice_branch, branch.c_str());
62 void FormBranch::apply()
64 string const type = fl_get_choice_text(dialog_->choice_branch);
66 controller().params().branch = type;