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
16 #include "ControlCommand.h"
18 #include "forms/form_url.h"
19 #include "lyx_forms.h"
21 typedef FormController<ControlCommand, FormView<FD_url> > base_class;
23 FormUrl::FormUrl(Dialog & parent)
24 : base_class(parent, _("URL"))
30 dialog_.reset(build_url(this));
32 fl_set_input_return(dialog_->input_name, FL_RETURN_CHANGED);
33 fl_set_input_return(dialog_->input_url, FL_RETURN_CHANGED);
35 setPrehandler(dialog_->input_name);
36 setPrehandler(dialog_->input_url);
38 // Manage the ok, apply, restore and cancel/close buttons
39 bcview().setOK(dialog_->button_ok);
40 bcview().setApply(dialog_->button_apply);
41 bcview().setCancel(dialog_->button_close);
42 bcview().setRestore(dialog_->button_restore);
44 bcview().addReadOnly(dialog_->input_name);
45 bcview().addReadOnly(dialog_->input_url);
46 bcview().addReadOnly(dialog_->check_html);
50 void FormUrl::update()
52 fl_set_input(dialog_->input_url,
53 controller().params().getContents().c_str());
54 fl_set_input(dialog_->input_name,
55 controller().params().getOptions().c_str());
57 if (controller().params().getCmdName() == "url")
58 fl_set_button(dialog_->check_html, 0);
60 fl_set_button(dialog_->check_html, 1);
66 controller().params().setContents(fl_get_input(dialog_->input_url));
67 controller().params().setOptions(fl_get_input(dialog_->input_name));
69 if (fl_get_button(dialog_->check_html))
70 controller().params().setCmdName("htmlurl");
72 controller().params().setCmdName("url");