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 // Too hard to make concept checks work with this file
14 #ifdef _GLIBCXX_CONCEPT_CHECKS
15 #undef _GLIBCXX_CONCEPT_CHECKS
17 #ifdef _GLIBCPP_CONCEPT_CHECKS
18 #undef _GLIBCPP_CONCEPT_CHECKS
21 #include "ControlCommand.h"
25 #include "support/lstrings.h"
28 #include <libglademm.h>
36 GUrl::GUrl(Dialog & parent)
37 : GViewCB<ControlCommand, GViewGladeB>(parent, lyx::to_utf8(_("URL")))
44 string const gladeName = findGladeFile("url");
45 xml_ = Gnome::Glade::Xml::create(gladeName);
46 Gtk::Button * restore;
50 xml_->get_widget("Url", url_);
51 xml_->get_widget("Name", name_);
52 xml_->get_widget("Html", htmlType_);
53 xml_->get_widget("Restore", restore);
54 xml_->get_widget("Ok", ok);
55 xml_->get_widget("Apply", apply);
56 xml_->get_widget("Cancel", cancel);
61 bcview().addReadOnly(name_);
62 bcview().addReadOnly(url_);
63 bcview().addReadOnly(htmlType_);
65 url_->signal_changed().connect(
66 sigc::mem_fun(*this, &GUrl::onEntryChanged));
67 name_->signal_changed().connect(
68 sigc::mem_fun(*this, &GUrl::onEntryChanged));
72 void GUrl::onEntryChanged()
74 bc().valid(!url_->get_text().empty() || !name_->get_text().empty());
80 url_->set_text(Glib::locale_to_utf8(
81 controller().params().getContents()));
82 name_->set_text(Glib::locale_to_utf8(
83 controller().params().getOptions()));
84 if (controller().params().getCmdName() == "url")
85 htmlType_->set_active(false);
87 htmlType_->set_active();
93 controller().params().setContents(
94 Glib::locale_to_utf8(url_->get_text()));
95 controller().params().setOptions(
96 Glib::locale_to_utf8(name_->get_text()));
97 if (htmlType_->get_active())
98 controller().params().setCmdName("htmlurl");
100 controller().params().setCmdName("url");
103 } // namespace frontend