2002-03-11 17:00:41 +00:00
|
|
|
/**
|
2002-03-11 22:47:41 +00:00
|
|
|
* \file xforms/FormUrl.C
|
2002-03-11 17:00:41 +00:00
|
|
|
* Copyright 2000-2001 The LyX Team.
|
|
|
|
* See the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Angus Leeming, a.leeming@ic.ac.uk
|
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
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
2001-03-23 18:46:11 +00:00
|
|
|
#include "xformsBC.h"
|
|
|
|
#include "ControlUrl.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
|
|
|
|
2002-06-13 13:43:51 +00:00
|
|
|
typedef FormCB<ControlUrl, FormDB<FD_url> > base_class;
|
2000-10-05 07:57:00 +00:00
|
|
|
|
2002-07-02 19:23:10 +00:00
|
|
|
FormUrl::FormUrl(ControlUrl & c, Dialogs & d)
|
|
|
|
: base_class(c, d, _("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
|
2001-03-15 13:37:04 +00:00
|
|
|
bc().setOK(dialog_->button_ok);
|
|
|
|
bc().setApply(dialog_->button_apply);
|
2002-03-12 14:11:15 +00:00
|
|
|
bc().setCancel(dialog_->button_close);
|
2001-04-03 14:30:58 +00:00
|
|
|
bc().setRestore(dialog_->button_restore);
|
2001-03-15 13:37:04 +00:00
|
|
|
|
2002-03-12 14:11:15 +00:00
|
|
|
bc().addReadOnly(dialog_->input_name);
|
|
|
|
bc().addReadOnly(dialog_->input_url);
|
|
|
|
bc().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
|
|
|
}
|