From: John Spray Date: Tue, 7 Feb 2006 00:48:47 +0000 (+0000) Subject: Sexy new GTK about dialog X-Git-Tag: 1.6.10~13627 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=670fc3e2c58aaa950f52a2e79ece8eb7b8689733;p=features.git Sexy new GTK about dialog git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10820 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/gtk/ChangeLog b/src/frontends/gtk/ChangeLog index f8c444ac8f..451a9e7a11 100644 --- a/src/frontends/gtk/ChangeLog +++ b/src/frontends/gtk/ChangeLog @@ -5,6 +5,7 @@ * GBibtex.[Ch], glade/bibtex.glade: Implement bibtex dialog * ghelpers.[Ch], GtkLengthEntry.[Ch]: Move some old stuff out of ghelpers into GtkLengthEntry + * GAboutlyx.[Ch], glade/aboutlyx.glade: Sexy new about dialog 2006-02-05 John Spray diff --git a/src/frontends/gtk/GAboutlyx.C b/src/frontends/gtk/GAboutlyx.C index 5b06755e09..abf04e9d27 100644 --- a/src/frontends/gtk/GAboutlyx.C +++ b/src/frontends/gtk/GAboutlyx.C @@ -23,10 +23,14 @@ #include "ghelpers.h" #include "version.h" +#include "support/filetools.h" // LibFileSearch + #include #include +using lyx::support::LibFileSearch; + using std::ostringstream; using std::string; @@ -157,32 +161,66 @@ void GAboutlyx::doBuild() { string const gladeName = findGladeFile("aboutlyx"); xml_ = Gnome::Glade::Xml::create(gladeName); - Gtk::Label * version; - Gtk::Label * credits; - Gtk::Label * license; - xml_->get_widget("version", version); - xml_->get_widget("credits", credits); - xml_->get_widget("license", license); - std::ostringstream vs; - vs << controller().getVersion() - << std::endl << lyx_version_info; - version->set_text(Glib::locale_to_utf8(vs.str())); - std::ostringstream crs; - controller().getCredits(crs); - credits->set_markup( - translateMarkup(Glib::convert(crs.str(), - "UTF-8", - "ISO8859-1"))); + + Gtk::AboutDialog *dialog; + xml_->get_widget("dialog", dialog); + + dialog->set_version(Glib::ustring(PACKAGE_VERSION)); + std::ostringstream ls; ls << controller().getCopyright() << "\n\n" << controller().getLicense() << "\n\n" << controller().getDisclaimer(); - license->set_text(Glib::locale_to_utf8(ls.str())); - Gtk::Button * btn; - xml_->get_widget("close_button", btn); - setCancel(btn); - //btn->signal_clicked().connect(sigc::mem_fun(*this, &GViewBase::onCancel)); + dialog->set_license (ls.str()); + + string const filename = LibFileSearch("images", "banner", "ppm"); + Glib::RefPtr logo = Gdk::Pixbuf::create_from_file(filename); + Glib::RefPtr logo_scaled = logo->scale_simple( + logo->get_width() / 2, + logo->get_height() / 2, + Gdk::INTERP_BILINEAR); + dialog->set_logo(logo_scaled); + + // Total crack - find and hide the built in Credits button + // that glade helpfully puts there for us. + Glib::List_Iterator it = + dialog->get_action_area()->children().begin(); + Glib::List_Iterator const end = + dialog->get_action_area()->children().end(); + for (; it != end; ++it) { + Gtk::Button * button = (Gtk::Button*)(it->get_widget()); + // The close button is a stock ID which we can reliably test for + // The license button has no icon + // What's left is the credits button + if (button->get_label() != "gtk-close" && button->get_image()) + button->hide(); + } + + Gtk::Button &authorbutton = *Gtk::manage( + new Gtk::Button(_("C_redits"), true)); + authorbutton.set_image(*Gtk::manage( + new Gtk::Image(Gtk::Stock::ABOUT, Gtk::ICON_SIZE_BUTTON))); + dialog->get_action_area()->pack_end(authorbutton); + dialog->get_action_area()->reorder_child(authorbutton, 0); + authorbutton.signal_clicked().connect( + sigc::mem_fun(*this, &GAboutlyx::showAuthors)); + authorbutton.show(); + xml_->get_widget("AuthorsDialog", authordialog_); + Gtk::Label *authorlabel; + xml_->get_widget("Authors", authorlabel); + std::ostringstream crs; + controller().getCredits(crs); + authorlabel->set_markup(translateMarkup( + Glib::convert(crs.str(), "UTF-8", "ISO-8859-1"))); +} + + +void GAboutlyx::showAuthors() +{ + authordialog_->run(); + authordialog_->hide(); } + } // namespace frontend } // namespace lyx diff --git a/src/frontends/gtk/GAboutlyx.h b/src/frontends/gtk/GAboutlyx.h index 22166f8cbb..0527858330 100644 --- a/src/frontends/gtk/GAboutlyx.h +++ b/src/frontends/gtk/GAboutlyx.h @@ -26,6 +26,9 @@ private: virtual void apply() {} virtual void update() {} virtual void doBuild(); + + void showAuthors(); + Gtk::Dialog *authordialog_; }; } // namespace frontend diff --git a/src/frontends/gtk/glade/aboutlyx.glade b/src/frontends/gtk/glade/aboutlyx.glade index d38a7916cf..35d5982849 100644 --- a/src/frontends/gtk/glade/aboutlyx.glade +++ b/src/frontends/gtk/glade/aboutlyx.glade @@ -3,13 +3,26 @@ - - About LyX + + True + False + LyX + Copyright © 1995 Matthias Ettrich +Copyright © 1995-2006 LyX Team + The Document Processor + True + http://www.lyx.org + http://www.lyx.org + translator-credits + + + + Credits GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False 300 - 200 + 300 True False True @@ -17,7 +30,9 @@ False GDK_WINDOW_TYPE_HINT_DIALOG GDK_GRAVITY_NORTH_WEST - True + True + False + False @@ -31,7 +46,7 @@ GTK_BUTTONBOX_END - + True True True @@ -40,7 +55,6 @@ GTK_RELIEF_NORMAL True -7 - @@ -53,190 +67,41 @@ - + + 12 True True - True - True - GTK_POS_TOP - False - False - - - - 400 - 250 - True - True - GTK_POLICY_NEVER - GTK_POLICY_AUTOMATIC - GTK_SHADOW_NONE - GTK_CORNER_TOP_LEFT - - - - True - GTK_SHADOW_IN - - - - True - version - False - False - GTK_JUSTIFY_LEFT - True - False - 0.5 - 0.5 - 0 - 0 - - - - - - - False - True - - - - - - True - Version - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - tab - - - - - - 400 - 250 - True - True - GTK_POLICY_NEVER - GTK_POLICY_AUTOMATIC - GTK_SHADOW_NONE - GTK_CORNER_TOP_LEFT - - - - True - GTK_SHADOW_IN - - - - True - credits - False - False - GTK_JUSTIFY_LEFT - True - False - 0.5 - 0.5 - 0 - 0 - - - - - - - False - True - - - - - - True - Credits - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - tab - - + GTK_POLICY_NEVER + GTK_POLICY_AUTOMATIC + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT - - 400 - 250 + True - True - GTK_POLICY_NEVER - GTK_POLICY_AUTOMATIC - GTK_SHADOW_NONE - GTK_CORNER_TOP_LEFT + GTK_SHADOW_IN - + True - GTK_SHADOW_IN - - - - True - license - False - False - GTK_JUSTIFY_LEFT - True - False - 0.5 - 0.5 - 0 - 0 - - + True + label8 + False + False + GTK_JUSTIFY_LEFT + True + True + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 - - False - True - - - - - - True - License - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - tab -