2003-08-17 11:28:23 +00:00
|
|
|
/**
|
|
|
|
* \file FormBranch.C
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Martin Vermeer
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2003-08-17 11:28:23 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include "FormBranch.h"
|
2003-09-05 13:15:43 +00:00
|
|
|
#include "ControlBranch.h"
|
2003-08-17 11:28:23 +00:00
|
|
|
#include "forms/form_branch.h"
|
2003-09-05 13:15:43 +00:00
|
|
|
|
|
|
|
#include "xformsBC.h"
|
|
|
|
|
2003-08-17 11:28:23 +00:00
|
|
|
#include "insets/insetbranch.h"
|
2003-09-05 13:15:43 +00:00
|
|
|
|
|
|
|
#include "lyx_forms.h"
|
|
|
|
|
2003-08-17 11:28:23 +00:00
|
|
|
|
|
|
|
typedef FormController<ControlBranch, FormView<FD_branch> > base_class;
|
|
|
|
|
|
|
|
FormBranch::FormBranch(Dialog & parent)
|
|
|
|
: base_class(parent, _("Branch"))
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
void FormBranch::build()
|
|
|
|
{
|
|
|
|
string all_branches(controller().params().branchlist.allBranches());
|
|
|
|
|
|
|
|
dialog_.reset(build_branch(this));
|
|
|
|
|
|
|
|
fl_addto_choice(dialog_->choice_branch, all_branches.c_str());
|
2003-09-09 18:27:24 +00:00
|
|
|
|
2003-08-17 11:28:23 +00:00
|
|
|
bcview().setOK(dialog_->button_ok);
|
|
|
|
bcview().setApply(dialog_->button_apply);
|
|
|
|
bcview().setCancel(dialog_->button_cancel);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FormBranch::update()
|
|
|
|
{
|
|
|
|
// Make changes in all_branches propagate within session:
|
|
|
|
string all_branches(controller().params().branchlist.allBranches());
|
|
|
|
fl_clear_choice(dialog_->choice_branch);
|
|
|
|
fl_addto_choice(dialog_->choice_branch, all_branches.c_str());
|
|
|
|
|
|
|
|
string branch(controller().params().branch);
|
|
|
|
if (all_branches.find(branch) != string::npos && branch != "none")
|
|
|
|
fl_set_choice_text(dialog_->choice_branch, branch.c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FormBranch::apply()
|
|
|
|
{
|
|
|
|
string const type = fl_get_choice_text(dialog_->choice_branch);
|
|
|
|
|
|
|
|
controller().params().branch = type;
|
|
|
|
}
|
|
|
|
|