3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "ControlCommand.h"
17 #include "support/lstrings.h"
20 #include <libglademm.h>
28 GUrl::GUrl(Dialog & parent)
29 : GViewCB<ControlCommand, GViewGladeB>(parent, _("URL"))
36 string const gladeName = findGladeFile("url");
37 xml_ = Gnome::Glade::Xml::create(gladeName);
38 Gtk::Button * restore;
42 xml_->get_widget("Url", url_);
43 xml_->get_widget("Name", name_);
44 xml_->get_widget("Html", htmlType_);
45 xml_->get_widget("Restore", restore);
46 xml_->get_widget("Ok", ok);
47 xml_->get_widget("Apply", apply);
48 xml_->get_widget("Cancel", cancel);
53 bcview().addReadOnly(name_);
54 bcview().addReadOnly(url_);
55 bcview().addReadOnly(htmlType_);
57 url_->signal_changed().connect(
58 sigc::mem_fun(*this, &GUrl::onEntryChanged));
59 name_->signal_changed().connect(
60 sigc::mem_fun(*this, &GUrl::onEntryChanged));
64 void GUrl::onEntryChanged()
66 bc().valid(!url_->get_text().empty() || !name_->get_text().empty());
72 url_->set_text(Glib::locale_to_utf8(
73 controller().params().getContents()));
74 name_->set_text(Glib::locale_to_utf8(
75 controller().params().getOptions()));
76 if (controller().params().getCmdName() == "url")
77 htmlType_->set_active(false);
79 htmlType_->set_active();
85 controller().params().setContents(
86 Glib::locale_to_utf8(url_->get_text()));
87 controller().params().setOptions(
88 Glib::locale_to_utf8(name_->get_text()));
89 if (htmlType_->get_active())
90 controller().params().setCmdName("htmlurl");
92 controller().params().setCmdName("url");
95 } // namespace frontend