mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 21:49:51 +00:00
92d522b7f1
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7224 a592a061-630c-0410-9148-cb99ea01b6c8
81 lines
1.9 KiB
C
81 lines
1.9 KiB
C
/**
|
|
* \file FormBibitem.C
|
|
* This file is part of LyX, the document processor.
|
|
* Licence details can be found in the file COPYING.
|
|
*
|
|
* \author Angus Leeming
|
|
* \author John Levon
|
|
*
|
|
* Full author contact details are available in file CREDITS
|
|
*/
|
|
|
|
|
|
#include <config.h>
|
|
#include "xformsBC.h"
|
|
#include "ControlCommand.h"
|
|
#include "FormBibitem.h"
|
|
#include "Tooltips.h"
|
|
#include "forms/form_bibitem.h"
|
|
#include "lyx_forms.h"
|
|
#include "gettext.h"
|
|
#include "support/lstrings.h" // compare
|
|
|
|
using namespace lyx::support;
|
|
|
|
typedef FormController<ControlCommand, FormView<FD_bibitem> > base_class;
|
|
|
|
FormBibitem::FormBibitem(Dialog & parent)
|
|
: base_class(parent, _("Bibliography Entry"))
|
|
{}
|
|
|
|
|
|
void FormBibitem::build()
|
|
{
|
|
dialog_.reset(build_bibitem(this));
|
|
|
|
fl_set_input_return(dialog_->input_key, FL_RETURN_CHANGED);
|
|
fl_set_input_return(dialog_->input_label, FL_RETURN_CHANGED);
|
|
|
|
setPrehandler(dialog_->input_key);
|
|
setPrehandler(dialog_->input_label);
|
|
|
|
// Manage the ok, apply, restore and cancel/close buttons
|
|
bcview().setOK(dialog_->button_ok);
|
|
bcview().setCancel(dialog_->button_close);
|
|
|
|
bcview().addReadOnly(dialog_->input_key);
|
|
bcview().addReadOnly(dialog_->input_label);
|
|
|
|
// set up the tooltips
|
|
string str = _("Key used within LyX document.");
|
|
tooltips().init(dialog_->input_key, str);
|
|
str = _("Label used for final output.");
|
|
tooltips().init(dialog_->input_label, str);
|
|
}
|
|
|
|
|
|
ButtonPolicy::SMInput FormBibitem::input(FL_OBJECT *, long)
|
|
{
|
|
// minimal validation
|
|
if (!compare(fl_get_input(dialog_->input_key), ""))
|
|
return ButtonPolicy::SMI_NOOP;
|
|
|
|
return ButtonPolicy::SMI_VALID;
|
|
}
|
|
|
|
|
|
void FormBibitem::update()
|
|
{
|
|
fl_set_input(dialog_->input_key,
|
|
controller().params().getContents().c_str());
|
|
fl_set_input(dialog_->input_label,
|
|
controller().params().getOptions().c_str());
|
|
}
|
|
|
|
|
|
void FormBibitem::apply()
|
|
{
|
|
controller().params().setContents(fl_get_input(dialog_->input_key));
|
|
controller().params().setOptions(fl_get_input(dialog_->input_label));
|
|
}
|