2002-03-11 17:00:41 +00:00
|
|
|
/**
|
2003-02-27 15:57:11 +00:00
|
|
|
* \file FormUrl.C
|
2002-09-05 15:14:23 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-11 17:00:41 +00:00
|
|
|
*
|
2002-12-01 22:59:25 +00:00
|
|
|
* \author Angus Leeming
|
2002-09-05 14:10:50 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS
|
2000-07-27 08:55:59 +00:00
|
|
|
*/
|
|
|
|
|
2002-03-11 17:00:41 +00:00
|
|
|
|
2000-07-27 08:55:59 +00:00
|
|
|
#include <config.h>
|
2000-07-27 10:26:38 +00:00
|
|
|
|
|
|
|
|
2001-03-23 18:46:11 +00:00
|
|
|
#include "xformsBC.h"
|
2003-03-07 14:08:10 +00:00
|
|
|
#include "ControlCommand.h"
|
2000-07-27 08:55:59 +00:00
|
|
|
#include "FormUrl.h"
|
2002-06-13 13:43:51 +00:00
|
|
|
#include "forms/form_url.h"
|
|
|
|
#include FORMS_H_LOCATION
|
2000-07-27 08:55:59 +00:00
|
|
|
|
2003-03-07 14:08:10 +00:00
|
|
|
typedef FormController<ControlCommand, FormView<FD_url> > base_class;
|
2000-10-05 07:57:00 +00:00
|
|
|
|
2003-02-25 14:51:38 +00:00
|
|
|
FormUrl::FormUrl(Dialog & parent)
|
2003-04-30 02:06:04 +00:00
|
|
|
: base_class(parent, _("URL"))
|
2001-03-23 18:46:11 +00:00
|
|
|
{}
|
2000-10-05 07:57:00 +00:00
|
|
|
|
2000-10-20 09:50:09 +00:00
|
|
|
|
2000-07-27 08:55:59 +00:00
|
|
|
void FormUrl::build()
|
|
|
|
{
|
2002-06-13 13:43:51 +00:00
|
|
|
dialog_.reset(build_url(this));
|
2000-08-04 13:12:30 +00:00
|
|
|
|
2002-03-12 14:11:15 +00:00
|
|
|
fl_set_input_return(dialog_->input_name, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->input_url, FL_RETURN_CHANGED);
|
2000-11-28 06:46:06 +00:00
|
|
|
|
2002-03-12 14:11:15 +00:00
|
|
|
setPrehandler(dialog_->input_name);
|
|
|
|
setPrehandler(dialog_->input_url);
|
2002-03-11 18:24:31 +00:00
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
// Manage the ok, apply, restore and cancel/close buttons
|
2003-03-10 03:13:28 +00:00
|
|
|
bcview().setOK(dialog_->button_ok);
|
|
|
|
bcview().setApply(dialog_->button_apply);
|
|
|
|
bcview().setCancel(dialog_->button_close);
|
|
|
|
bcview().setRestore(dialog_->button_restore);
|
|
|
|
|
|
|
|
bcview().addReadOnly(dialog_->input_name);
|
|
|
|
bcview().addReadOnly(dialog_->input_url);
|
|
|
|
bcview().addReadOnly(dialog_->check_html);
|
2000-07-27 08:55:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-10-24 13:13:59 +00:00
|
|
|
void FormUrl::update()
|
2000-07-27 08:55:59 +00:00
|
|
|
{
|
2002-03-12 14:11:15 +00:00
|
|
|
fl_set_input(dialog_->input_url,
|
2001-03-23 18:46:11 +00:00
|
|
|
controller().params().getContents().c_str());
|
2002-03-12 14:11:15 +00:00
|
|
|
fl_set_input(dialog_->input_name,
|
2001-03-23 18:46:11 +00:00
|
|
|
controller().params().getOptions().c_str());
|
2000-07-27 08:55:59 +00:00
|
|
|
|
2001-03-23 18:46:11 +00:00
|
|
|
if (controller().params().getCmdName() == "url")
|
2002-03-12 14:11:15 +00:00
|
|
|
fl_set_button(dialog_->check_html, 0);
|
2000-07-27 08:55:59 +00:00
|
|
|
else
|
2002-03-12 14:11:15 +00:00
|
|
|
fl_set_button(dialog_->check_html, 1);
|
2000-07-27 08:55:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FormUrl::apply()
|
|
|
|
{
|
2002-03-12 14:11:15 +00:00
|
|
|
controller().params().setContents(fl_get_input(dialog_->input_url));
|
|
|
|
controller().params().setOptions(fl_get_input(dialog_->input_name));
|
2000-07-27 08:55:59 +00:00
|
|
|
|
2002-03-12 14:11:15 +00:00
|
|
|
if (fl_get_button(dialog_->check_html))
|
2001-03-23 18:46:11 +00:00
|
|
|
controller().params().setCmdName("htmlurl");
|
2000-07-27 08:55:59 +00:00
|
|
|
else
|
2001-03-23 18:46:11 +00:00
|
|
|
controller().params().setCmdName("url");
|
2000-07-27 08:55:59 +00:00
|
|
|
}
|