3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Angus Leeming
8 * Full author contact details are available in file CREDITS.
15 #include "ControlCommand.h"
16 #include "forms/form_url.h"
20 #include "lyx_forms.h"
23 typedef FormController<ControlCommand, FormView<FD_url> > base_class;
25 FormUrl::FormUrl(Dialog & parent)
26 : base_class(parent, _("URL"))
32 dialog_.reset(build_url(this));
34 fl_set_input_return(dialog_->input_name, FL_RETURN_CHANGED);
35 fl_set_input_return(dialog_->input_url, FL_RETURN_CHANGED);
37 setPrehandler(dialog_->input_name);
38 setPrehandler(dialog_->input_url);
40 // Manage the ok, apply, restore and cancel/close buttons
41 bcview().setOK(dialog_->button_ok);
42 bcview().setApply(dialog_->button_apply);
43 bcview().setCancel(dialog_->button_close);
44 bcview().setRestore(dialog_->button_restore);
46 bcview().addReadOnly(dialog_->input_name);
47 bcview().addReadOnly(dialog_->input_url);
48 bcview().addReadOnly(dialog_->check_html);
52 void FormUrl::update()
54 fl_set_input(dialog_->input_url,
55 controller().params().getContents().c_str());
56 fl_set_input(dialog_->input_name,
57 controller().params().getOptions().c_str());
59 if (controller().params().getCmdName() == "url")
60 fl_set_button(dialog_->check_html, 0);
62 fl_set_button(dialog_->check_html, 1);
68 controller().params().setContents(fl_get_input(dialog_->input_url));
69 controller().params().setOptions(fl_get_input(dialog_->input_name));
71 if (fl_get_button(dialog_->check_html))
72 controller().params().setCmdName("htmlurl");
74 controller().params().setCmdName("url");