2001-03-26 13:16:57 +00:00
|
|
|
/* This file is part of
|
2000-07-27 08:55:59 +00:00
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
2001-03-23 18:46:11 +00:00
|
|
|
* Copyright 2000-2001 The LyX Team.
|
2000-07-27 08:55:59 +00:00
|
|
|
*
|
|
|
|
* ======================================================
|
2001-03-23 18:46:11 +00:00
|
|
|
*
|
2001-03-26 13:16:57 +00:00
|
|
|
* \file FormUrl.C
|
2001-03-23 18:46:11 +00:00
|
|
|
* \author Angus Leeming, a.leeming@ic.ac.uk
|
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"
|
|
|
|
#include "form_url.h"
|
|
|
|
|
2001-03-23 18:46:11 +00:00
|
|
|
typedef FormCB<ControlUrl, FormDB<FD_form_url> > base_class;
|
2000-10-05 07:57:00 +00:00
|
|
|
|
2001-03-23 18:46:11 +00:00
|
|
|
FormUrl::FormUrl(ControlUrl & c)
|
|
|
|
: base_class(c, _("Url"))
|
|
|
|
{}
|
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()
|
|
|
|
{
|
2001-03-15 13:37:04 +00:00
|
|
|
dialog_.reset(build_url());
|
2000-08-04 13:12:30 +00:00
|
|
|
|
2000-11-28 06:46:06 +00:00
|
|
|
fl_set_input_return(dialog_->name, FL_RETURN_CHANGED);
|
|
|
|
fl_set_input_return(dialog_->url, FL_RETURN_CHANGED);
|
|
|
|
|
|
|
|
// 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);
|
|
|
|
bc().setCancel(dialog_->button_cancel);
|
2001-04-03 14:30:58 +00:00
|
|
|
bc().setRestore(dialog_->button_restore);
|
2001-03-15 13:37:04 +00:00
|
|
|
|
|
|
|
bc().addReadOnly(dialog_->name);
|
|
|
|
bc().addReadOnly(dialog_->url);
|
|
|
|
bc().addReadOnly(dialog_->radio_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
|
|
|
{
|
2001-03-23 18:46:11 +00:00
|
|
|
fl_set_input(dialog_->url,
|
|
|
|
controller().params().getContents().c_str());
|
|
|
|
fl_set_input(dialog_->name,
|
|
|
|
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")
|
2000-07-27 08:55:59 +00:00
|
|
|
fl_set_button(dialog_->radio_html, 0);
|
|
|
|
else
|
|
|
|
fl_set_button(dialog_->radio_html, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FormUrl::apply()
|
|
|
|
{
|
2001-03-23 18:46:11 +00:00
|
|
|
controller().params().setContents(fl_get_input(dialog_->url));
|
|
|
|
controller().params().setOptions(fl_get_input(dialog_->name));
|
2000-07-27 08:55:59 +00:00
|
|
|
|
|
|
|
if (fl_get_button(dialog_->radio_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
|
|
|
}
|