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 "forms/form_branch.h"
18 #include "BranchList.h"
20 #include "controllers/ControlBranch.h"
22 #include "insets/insetbranch.h"
24 #include "lyx_forms.h"
29 typedef FormController<ControlBranch, FormView<FD_branch> > base_class;
31 FormBranch::FormBranch(Dialog & parent)
32 : base_class(parent, _("Branch"))
36 void FormBranch::build()
38 dialog_.reset(build_branch(this));
40 bcview().setOK(dialog_->button_ok);
41 bcview().setApply(dialog_->button_apply);
42 bcview().setCancel(dialog_->button_cancel);
46 void FormBranch::update()
48 typedef BranchList::const_iterator const_iterator;
50 BranchList const & branchlist = controller().branchlist();
51 string const cur_branch = controller().params().branch;
53 fl_clear_choice(dialog_->choice_branch);
55 const_iterator const begin = branchlist.begin();
56 const_iterator const end = branchlist.end();
59 for (const_iterator it = begin; it != end; ++it, ++count) {
60 string const & branch = it->getBranch();
61 fl_addto_choice(dialog_->choice_branch, branch.c_str());
63 if (cur_branch == branch)
66 fl_set_choice(dialog_->choice_branch, id);
70 void FormBranch::apply()
72 string const type = fl_get_choice_text(dialog_->choice_branch);
73 controller().params().branch = type;