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"
32 typedef FormController<ControlBranch, FormView<FD_branch> > base_class;
34 FormBranch::FormBranch(Dialog & parent)
35 : base_class(parent, _("Branch"))
39 void FormBranch::build()
41 dialog_.reset(build_branch(this));
43 bcview().setOK(dialog_->button_ok);
44 bcview().setApply(dialog_->button_apply);
45 bcview().setCancel(dialog_->button_cancel);
49 void FormBranch::update()
51 typedef BranchList::const_iterator const_iterator;
53 BranchList const & branchlist = controller().branchlist();
54 string const cur_branch = controller().params().branch;
56 fl_clear_choice(dialog_->choice_branch);
58 const_iterator const begin = branchlist.begin();
59 const_iterator const end = branchlist.end();
62 for (const_iterator it = begin; it != end; ++it, ++count) {
63 string const & branch = it->getBranch();
64 fl_addto_choice(dialog_->choice_branch, branch.c_str());
66 if (cur_branch == branch)
69 fl_set_choice(dialog_->choice_branch, id);
73 void FormBranch::apply()
75 string const type = fl_get_choice_text(dialog_->choice_branch);
76 controller().params().branch = type;
79 } // namespace frontend