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.
14 #include "ControlCommand.h"
15 #include "forms/form_url.h"
19 #include "lyx_forms.h"
24 typedef FormController<ControlCommand, FormView<FD_url> > base_class;
26 FormUrl::FormUrl(Dialog & parent)
27 : base_class(parent, _("URL"))
33 dialog_.reset(build_url(this));
35 fl_set_input_return(dialog_->input_name, FL_RETURN_CHANGED);
36 fl_set_input_return(dialog_->input_url, FL_RETURN_CHANGED);
38 setPrehandler(dialog_->input_name);
39 setPrehandler(dialog_->input_url);
41 // Manage the ok, apply, restore and cancel/close buttons
42 bcview().setOK(dialog_->button_ok);
43 bcview().setApply(dialog_->button_apply);
44 bcview().setCancel(dialog_->button_close);
45 bcview().setRestore(dialog_->button_restore);
47 bcview().addReadOnly(dialog_->input_name);
48 bcview().addReadOnly(dialog_->input_url);
49 bcview().addReadOnly(dialog_->check_html);
53 void FormUrl::update()
55 fl_set_input(dialog_->input_url,
56 controller().params().getContents().c_str());
57 fl_set_input(dialog_->input_name,
58 controller().params().getOptions().c_str());
60 if (controller().params().getCmdName() == "url")
61 fl_set_button(dialog_->check_html, 0);
63 fl_set_button(dialog_->check_html, 1);
69 controller().params().setContents(fl_get_input(dialog_->input_url));
70 controller().params().setOptions(fl_get_input(dialog_->input_name));
72 if (fl_get_button(dialog_->check_html))
73 controller().params().setCmdName("htmlurl");
75 controller().params().setCmdName("url");
78 } // namespace frontend