From d86c6d46bb9dbd694c8228d3568ca25b44c17645 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Sun, 26 Sep 2004 16:48:30 +0000 Subject: [PATCH] Move to gtk 2.4 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9011 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 4 + configure.ac | 8 +- src/frontends/gtk/Alert_pimpl.C | 20 ++--- src/frontends/gtk/ChangeLog | 5 ++ src/frontends/gtk/FileDialogPrivate.C | 4 +- src/frontends/gtk/FileDialogPrivate.h | 5 +- src/frontends/gtk/GAboutlyx.C | 2 +- src/frontends/gtk/GMathDelim.C | 10 +-- src/frontends/gtk/GMathPanel.C | 6 +- src/frontends/gtk/GMenubar.C | 6 +- src/frontends/gtk/GMenubar.h | 2 +- src/frontends/gtk/GMiniBuffer.C | 16 ++-- src/frontends/gtk/GMiniBuffer.h | 2 +- src/frontends/gtk/GPainter.h | 1 + src/frontends/gtk/GPrint.C | 21 ++--- src/frontends/gtk/GSearch.C | 8 +- src/frontends/gtk/GText.C | 2 +- src/frontends/gtk/GTimeout.C | 2 +- src/frontends/gtk/GTimeout.h | 6 +- src/frontends/gtk/GToolbar.C | 119 +++++++++++--------------- src/frontends/gtk/GToolbar.h | 5 +- src/frontends/gtk/GUrl.C | 4 +- src/frontends/gtk/GView.C | 2 +- src/frontends/gtk/GViewBase.C | 10 +-- src/frontends/gtk/GViewBase.h | 5 +- src/frontends/gtk/GWorkArea.C | 20 ++--- src/frontends/gtk/GWorkArea.h | 2 +- src/frontends/gtk/GXpmBtnTbl.C | 16 ++-- src/frontends/gtk/GXpmBtnTbl.h | 11 ++- src/frontends/gtk/LyXScreenFactory.C | 4 +- src/frontends/gtk/io_callback.C | 2 +- src/frontends/gtk/io_callback.h | 4 +- src/frontends/gtk/xftFontLoader.C | 2 +- 33 files changed, 164 insertions(+), 172 deletions(-) diff --git a/ChangeLog b/ChangeLog index 722e083bca..760715b1c8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2004-09-26 Lars Gullik Bjonnes + + * configure.ac: update for gtk 2.4 + 2004-09-23 Bennett Helm * README.MacOSX: update again diff --git a/configure.ac b/configure.ac index 4d578cadd4..f5458d0288 100644 --- a/configure.ac +++ b/configure.ac @@ -192,13 +192,13 @@ for frontend in $FRONTENDS ; do dnl FRONTEND_LIBS="@XPM_LIB@ @XFORMS_LIB@ ${GNOME_FRONTEND_LIBS}" dnl ;; gtk) - PKG_CHECK_MODULES(GTK_FRONTEND, gtkmm-2.0 libglademm-2.0) + PKG_CHECK_MODULES(GTK_FRONTEND, gtkmm-2.4 libglademm-2.4) FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-gtk\$(EXEEXT)" FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS gtk" RPM_FRONTEND="gtk" - RPM_FRONTEND_DEPS='gtkmm >= 2.2.0' - GTKMM_VERSION=`pkg-config --modversion gtkmm-2.0` - LIBGLADEMM_VERSION=`pkg-config --modversion libglademm-2.0` + RPM_FRONTEND_DEPS='gtkmm >= 2.4.0' + GTKMM_VERSION=`pkg-config --modversion gtkmm-2.4` + LIBGLADEMM_VERSION=`pkg-config --modversion libglademm-2.4` FRONTEND_INFO="${FRONTEND_INFO}\ GTK Frontend:\n\ libgtkmm version:\t\t${GTKMM_VERSION}\n\ diff --git a/src/frontends/gtk/Alert_pimpl.C b/src/frontends/gtk/Alert_pimpl.C index fd69a46ac6..8372e41ca7 100644 --- a/src/frontends/gtk/Alert_pimpl.C +++ b/src/frontends/gtk/Alert_pimpl.C @@ -37,8 +37,8 @@ string translateShortcut(string const & str) void warning_pimpl(string const &, string const & message) { Gtk::MessageDialog dlg(Glib::locale_to_utf8(message), - Gtk::MESSAGE_WARNING, - Gtk::BUTTONS_CLOSE, true, true); + true, Gtk::MESSAGE_WARNING, + Gtk::BUTTONS_CLOSE, true); dlg.run(); } @@ -46,8 +46,8 @@ void warning_pimpl(string const &, string const & message) void error_pimpl(string const &, string const & message) { Gtk::MessageDialog dlg(Glib::locale_to_utf8(message), - Gtk::MESSAGE_ERROR, - Gtk::BUTTONS_CLOSE, true, true); + true, Gtk::MESSAGE_ERROR, + Gtk::BUTTONS_CLOSE, true); dlg.run(); } @@ -55,8 +55,8 @@ void error_pimpl(string const &, string const & message) void information_pimpl(string const &, string const & message) { Gtk::MessageDialog dlg(Glib::locale_to_utf8(message), - Gtk::MESSAGE_INFO, - Gtk::BUTTONS_CLOSE, true, true); + true, Gtk::MESSAGE_INFO, + Gtk::BUTTONS_CLOSE, true); dlg.run(); } @@ -71,8 +71,8 @@ int prompt_pimpl(string const &, string const & question, if (!b3.empty()) gb3 = Glib::locale_to_utf8(translateShortcut(b3)); Gtk::MessageDialog dlg(Glib::locale_to_utf8(question), - Gtk::MESSAGE_QUESTION, - Gtk::BUTTONS_NONE, true, true); + true, Gtk::MESSAGE_QUESTION, + Gtk::BUTTONS_NONE, true); dlg.add_button(gb1, 0); dlg.add_button(gb2, 1); if (!b3.empty()) @@ -86,9 +86,9 @@ std::pair const askForText_pimpl(string const & msg, string const & dflt) { Gtk::MessageDialog dlg(Glib::locale_to_utf8(msg), - Gtk::MESSAGE_QUESTION, + true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_OK_CANCEL, - true, true); + true); Gtk::Entry entry; entry.set_text(Glib::locale_to_utf8(dflt)); entry.set_position(-1); diff --git a/src/frontends/gtk/ChangeLog b/src/frontends/gtk/ChangeLog index 61bd362cf7..1e950297a5 100644 --- a/src/frontends/gtk/ChangeLog +++ b/src/frontends/gtk/ChangeLog @@ -1,3 +1,8 @@ +2004-09-26 Lars Gullik Bjonnes + John Spray + + * Initial move to gtk 2.4. + 2004-09-26 Lars Gullik Bjonnes * WS changes. diff --git a/src/frontends/gtk/FileDialogPrivate.C b/src/frontends/gtk/FileDialogPrivate.C index a1b3cc2d7e..fe8bcf36d6 100644 --- a/src/frontends/gtk/FileDialogPrivate.C +++ b/src/frontends/gtk/FileDialogPrivate.C @@ -28,9 +28,9 @@ FileDialog::Private::Private(string const & title, fileSelection_.get_button_area()->children().push_back( Gtk::Box_Helpers::Element(button2_)); button1_.signal_clicked().connect( - SigC::slot(*this, &FileDialog::Private::onButton1Clicked)); + sigc::mem_fun(*this, &FileDialog::Private::onButton1Clicked)); button2_.signal_clicked().connect( - SigC::slot(*this, &FileDialog::Private::onButton2Clicked)); + sigc::mem_fun(*this, &FileDialog::Private::onButton2Clicked)); if (!b1.first.empty() && !b1.second.empty()) { string::size_type pos = b1.first.find('|'); button1_.set_label( diff --git a/src/frontends/gtk/FileDialogPrivate.h b/src/frontends/gtk/FileDialogPrivate.h index eeac92f92d..9d414bc1b6 100644 --- a/src/frontends/gtk/FileDialogPrivate.h +++ b/src/frontends/gtk/FileDialogPrivate.h @@ -12,10 +12,11 @@ #ifndef FILE_DIALOG_PRIVATE_H #define FILE_DIALOG_PRIVATE_H -#include #include "frontends/FileDialog.h" -class FileDialog::Private : public SigC::Object { +#include + +class FileDialog::Private : public sigc::trackable { public: Private(std::string const & title, kb_action action, diff --git a/src/frontends/gtk/GAboutlyx.C b/src/frontends/gtk/GAboutlyx.C index a878ffcbd2..3e97e2b24e 100644 --- a/src/frontends/gtk/GAboutlyx.C +++ b/src/frontends/gtk/GAboutlyx.C @@ -173,7 +173,7 @@ void GAboutlyx::doBuild() Gtk::Button * btn; xml_->get_widget("close_button", btn); setCancel(btn); - //btn->signal_clicked().connect(SigC::slot(*this, &GViewBase::onCancel)); + //btn->signal_clicked().connect(sigc::mem_fun(*this, &GViewBase::onCancel)); } } // namespace frontend diff --git a/src/frontends/gtk/GMathDelim.C b/src/frontends/gtk/GMathDelim.C index 85a7cf22a6..b58add6eeb 100644 --- a/src/frontends/gtk/GMathDelim.C +++ b/src/frontends/gtk/GMathDelim.C @@ -123,7 +123,7 @@ void GMathDelim::doBuild() rightSel_ = 1; xml_->get_widget("Box", box); delimTbl_.signalClicked().connect( - SigC::slot(*this, &GMathDelim::onDelimTblClicked)); + sigc::mem_fun(*this, &GMathDelim::onDelimTblClicked)); delimTbl_.show(); box->children().push_back( Gtk::Box_Helpers::Element(delimTbl_)); @@ -133,11 +133,11 @@ void GMathDelim::doBuild() bcview().addReadOnly(both_); bcview().addReadOnly(demo_); left_->signal_clicked().connect( - SigC::slot(*this, &GMathDelim::onRadioClicked)); + sigc::mem_fun(*this, &GMathDelim::onRadioClicked)); right_->signal_clicked().connect( - SigC::slot(*this, &GMathDelim::onRadioClicked)); + sigc::mem_fun(*this, &GMathDelim::onRadioClicked)); both_->signal_clicked().connect( - SigC::slot(*this, &GMathDelim::onRadioClicked)); + sigc::mem_fun(*this, &GMathDelim::onRadioClicked)); } @@ -147,7 +147,7 @@ void GMathDelim::setDemoPixmap() pixmap_ = Gdk::Pixmap::create_from_xpm(demo_->get_colormap(), mask_, delim0); - image = SigC::manage(new Gtk::Image(pixmap_, mask_)); + image = Gtk::manage(new Gtk::Image(pixmap_, mask_)); image->show(); demo_->add(*image); gcMask_ = Gdk::GC::create(mask_); diff --git a/src/frontends/gtk/GMathPanel.C b/src/frontends/gtk/GMathPanel.C index 1193f90ce3..92e543331a 100644 --- a/src/frontends/gtk/GMathPanel.C +++ b/src/frontends/gtk/GMathPanel.C @@ -114,10 +114,10 @@ void GMathPanel::doBuild() setCancel(close); tableUp_.signalClicked().connect( - SigC::slot(*this, &GMathPanel::onTableUpClicked)); + sigc::mem_fun(*this, &GMathPanel::onTableUpClicked)); tableUp_.show(); tableDown_.signalClicked().connect( - SigC::slot(*this, &GMathPanel::onTableDownClicked)); + sigc::mem_fun(*this, &GMathPanel::onTableDownClicked)); tableDown_.show(); xml_->get_widget("Vbox", vbox); @@ -132,7 +132,7 @@ void GMathPanel::doBuild() functions_->append_column("Functions", listCol_); listSel_ = functions_->get_selection(); listSel_->signal_changed().connect( - SigC::slot(*this, &GMathPanel::onFunctionSelected)); + sigc::mem_fun(*this, &GMathPanel::onFunctionSelected)); for (int i = 0; i < nr_function_names; ++i) (*listStore_->append())[listCol_] = Glib::locale_to_utf8(function_names[i]); diff --git a/src/frontends/gtk/GMenubar.C b/src/frontends/gtk/GMenubar.C index 2450c68f04..e83b1e2197 100644 --- a/src/frontends/gtk/GMenubar.C +++ b/src/frontends/gtk/GMenubar.C @@ -85,7 +85,7 @@ GMenubar::GMenubar(LyXView * lyxView, MenuBackend const & /*menuBackend*/) : labelTrans(i->label(), i->shortcut()), *gmenu)); menubar_.items().back().signal_activate().connect( - SigC::bind(SigC::slot(*this, &GMenubar::onSubMenuActivate), &(*i), + sigc::bind(sigc::mem_fun(*this, &GMenubar::onSubMenuActivate), &(*i), &menubar_.items().back())); mainMenuNames_.push_back(i->submenuname()); } @@ -173,7 +173,7 @@ void GMenubar::onSubMenuActivate(MenuItem const * item, labelTrans(i->label(), i->shortcut()), *gmenu_new)); gmenu->items().back().signal_activate().connect( - SigC::bind(SigC::slot(*this, &GMenubar::onSubMenuActivate), + sigc::bind(sigc::mem_fun(*this, &GMenubar::onSubMenuActivate), &(*i), &gmenu->items().back())); if (submenuDisabled(&(*i))) @@ -206,7 +206,7 @@ void GMenubar::onSubMenuActivate(MenuItem const * item, } Gtk::MenuItem & item = gmenu->items().back(); item.signal_activate().connect( - SigC::bind(SigC::slot(*this, &GMenubar::onCommandActivate), + sigc::bind(sigc::mem_fun(*this, &GMenubar::onCommandActivate), &(*i), &item)); if (!flag.enabled()) item.set_sensitive(false); diff --git a/src/frontends/gtk/GMenubar.h b/src/frontends/gtk/GMenubar.h index b23d89fa66..afcd9e5b29 100644 --- a/src/frontends/gtk/GMenubar.h +++ b/src/frontends/gtk/GMenubar.h @@ -21,7 +21,7 @@ class LyXView; namespace lyx { namespace frontend { -class GMenubar : public Menubar, public SigC::Object { +class GMenubar : public Menubar, public sigc::trackable { public: GMenubar(LyXView *, MenuBackend const &); ~GMenubar(); diff --git a/src/frontends/gtk/GMiniBuffer.C b/src/frontends/gtk/GMiniBuffer.C index 182a20ae1b..3e8c129321 100644 --- a/src/frontends/gtk/GMiniBuffer.C +++ b/src/frontends/gtk/GMiniBuffer.C @@ -34,14 +34,14 @@ GMiniBuffer::GMiniBuffer(GView * view, ControlCommandBuffer & control) : listView_.set_model(listStore_); listView_.append_column("Completions", listCol_); listView_.signal_key_press_event().connect( - SigC::slot(*this, &GMiniBuffer::onListKeyPress)); + sigc::mem_fun(*this, &GMiniBuffer::onListKeyPress)); listView_.signal_focus_in_event().connect( - SigC::slot(*this, &GMiniBuffer::onListFocusIn)); + sigc::mem_fun(*this, &GMiniBuffer::onListFocusIn)); listView_.signal_focus_out_event().connect( - SigC::slot(*this, &GMiniBuffer::onFocusOut)); + sigc::mem_fun(*this, &GMiniBuffer::onFocusOut)); listSel_ = listView_.get_selection(); listSel_->signal_changed().connect( - SigC::slot(*this, &GMiniBuffer::onSelected)); + sigc::mem_fun(*this, &GMiniBuffer::onSelected)); listView_.show(); scrolledWindow_.set_policy(Gtk::POLICY_AUTOMATIC, @@ -53,13 +53,13 @@ GMiniBuffer::GMiniBuffer(GView * view, ControlCommandBuffer & control) : Gtk::Box_Helpers::Element(scrolledWindow_,Gtk::PACK_SHRINK)); entry_.signal_key_press_event().connect( - SigC::slot(*this, &GMiniBuffer::onKeyPress)); + sigc::mem_fun(*this, &GMiniBuffer::onKeyPress)); entry_.signal_focus_in_event().connect( - SigC::slot(*this, &GMiniBuffer::onFocusIn)); + sigc::mem_fun(*this, &GMiniBuffer::onFocusIn)); entry_.signal_focus_out_event().connect( - SigC::slot(*this, &GMiniBuffer::onFocusOut)); + sigc::mem_fun(*this, &GMiniBuffer::onFocusOut)); entry_.signal_activate().connect( - SigC::slot(*this, &GMiniBuffer::onCommit)); + sigc::mem_fun(*this, &GMiniBuffer::onCommit)); entry_.show(); view_->getBox(GView::Bottom).children().push_back( diff --git a/src/frontends/gtk/GMiniBuffer.h b/src/frontends/gtk/GMiniBuffer.h index 982cfd5ccf..f7de185b5b 100644 --- a/src/frontends/gtk/GMiniBuffer.h +++ b/src/frontends/gtk/GMiniBuffer.h @@ -20,7 +20,7 @@ namespace frontend { class ControlCommandBuffer; -class GMiniBuffer : public SigC::Object { +class GMiniBuffer : public sigc::trackable { public: GMiniBuffer(GView * view, ControlCommandBuffer & control); ~GMiniBuffer(); diff --git a/src/frontends/gtk/GPainter.h b/src/frontends/gtk/GPainter.h index 775d9e73a8..e64cbbc61e 100644 --- a/src/frontends/gtk/GPainter.h +++ b/src/frontends/gtk/GPainter.h @@ -15,6 +15,7 @@ #include "frontends/Painter.h" #include +#include #include diff --git a/src/frontends/gtk/GPrint.C b/src/frontends/gtk/GPrint.C index c31f79a3b6..0347d197b6 100644 --- a/src/frontends/gtk/GPrint.C +++ b/src/frontends/gtk/GPrint.C @@ -150,22 +150,23 @@ void GPrint::doBuild() Gtk::Button * apply; xml_->get_widget("PrintButton", ok); xml_->get_widget("CancelButton", cancel); + setOK(ok); setCancel(cancel); Gtk::Button * browse; xml_->get_widget("Browse", browse); - browse->signal_clicked().connect(SigC::slot(*this, &GPrint::onBrowse)); + browse->signal_clicked().connect(sigc::mem_fun(*this, &GPrint::onBrowse)); - fileEntry_->signal_changed().connect(SigC::bind(SigC::slot(*this, &GPrint::onTargetEdit), fileEntry_)); - printerEntry_->signal_changed().connect(SigC::bind(SigC::slot(*this, &GPrint::onTargetEdit), printerEntry_)); - fromEntry_->signal_changed().connect(SigC::slot(*this, &GPrint::onFromToEdit)); - toEntry_->signal_changed().connect(SigC::slot(*this, &GPrint::onFromToEdit)); - printer_->signal_toggled().connect(SigC::slot(*this, &GPrint::updateUI)); - file_->signal_toggled().connect(SigC::slot(*this, &GPrint::updateUI)); - all_->signal_toggled().connect(SigC::slot(*this, &GPrint::updateUI)); - fromTo_->signal_toggled().connect(SigC::slot(*this, &GPrint::updateUI)); - number_->signal_changed().connect(SigC::slot(*this, &GPrint::updateUI)); + fileEntry_->signal_changed().connect(sigc::bind(sigc::mem_fun(*this, &GPrint::onTargetEdit), fileEntry_)); + printerEntry_->signal_changed().connect(sigc::bind(sigc::mem_fun(*this, &GPrint::onTargetEdit), printerEntry_)); + fromEntry_->signal_changed().connect(sigc::mem_fun(*this, &GPrint::onFromToEdit)); + toEntry_->signal_changed().connect(sigc::mem_fun(*this, &GPrint::onFromToEdit)); + printer_->signal_toggled().connect(sigc::mem_fun(*this, &GPrint::updateUI)); + file_->signal_toggled().connect(sigc::mem_fun(*this, &GPrint::updateUI)); + all_->signal_toggled().connect(sigc::mem_fun(*this, &GPrint::updateUI)); + fromTo_->signal_toggled().connect(sigc::mem_fun(*this, &GPrint::updateUI)); + number_->signal_changed().connect(sigc::mem_fun(*this, &GPrint::updateUI)); controller().initialiseParams(""); update(); diff --git a/src/frontends/gtk/GSearch.C b/src/frontends/gtk/GSearch.C index 63372ae1fa..e6d748fbfa 100644 --- a/src/frontends/gtk/GSearch.C +++ b/src/frontends/gtk/GSearch.C @@ -48,13 +48,13 @@ void GSearch::doBuild() xml_->get_widget("SearchBackwards", backwardscheck); findnextbutton->signal_clicked().connect( - SigC::slot(*this, &GSearch::onFindNext)); + sigc::mem_fun(*this, &GSearch::onFindNext)); replacebutton->signal_clicked().connect( - SigC::slot(*this, &GSearch::onReplace)); + sigc::mem_fun(*this, &GSearch::onReplace)); replaceallbutton->signal_clicked().connect( - SigC::slot(*this, &GSearch::onReplaceAll)); + sigc::mem_fun(*this, &GSearch::onReplaceAll)); findentry->signal_changed().connect( - SigC::slot(*this,&GSearch::onFindEntryChanged)); + sigc::mem_fun(*this,&GSearch::onFindEntryChanged)); bcview().addReadOnly(replaceentry); bcview().addReadOnly(replacebutton); diff --git a/src/frontends/gtk/GText.C b/src/frontends/gtk/GText.C index 0f4eff37e3..14c2595ef9 100644 --- a/src/frontends/gtk/GText.C +++ b/src/frontends/gtk/GText.C @@ -67,7 +67,7 @@ void GText::doBuild() setRestore(restore); bcview().addReadOnly(entry_); entry_->signal_changed().connect( - SigC::slot(*this, >ext::onEntryChanged)); + sigc::mem_fun(*this, >ext::onEntryChanged)); } diff --git a/src/frontends/gtk/GTimeout.C b/src/frontends/gtk/GTimeout.C index 943cf6ba87..0ed30abc0e 100644 --- a/src/frontends/gtk/GTimeout.C +++ b/src/frontends/gtk/GTimeout.C @@ -51,7 +51,7 @@ void GTimeout::start() } conn_ = Glib::signal_timeout().connect( - SigC::slot(*this, >imeout::timeoutEvent), + sigc::mem_fun(*this, >imeout::timeoutEvent), timeout_ms() ); running_ = true; diff --git a/src/frontends/gtk/GTimeout.h b/src/frontends/gtk/GTimeout.h index a0e068d64a..faefae79ab 100644 --- a/src/frontends/gtk/GTimeout.h +++ b/src/frontends/gtk/GTimeout.h @@ -24,7 +24,7 @@ namespace frontend { * This class executes the callback when the timeout expires * using Gtk mechanisms */ -class GTimeout : public Timeout::Impl, public SigC::Object { +class GTimeout : public Timeout::Impl, public sigc::trackable { public: /// GTimeout(Timeout & owner_); @@ -40,8 +40,8 @@ public: bool timeoutEvent(); private: /// Timer connection - SigC::Connection conn_; - /// Used for running as SigC::Connection::connected() isn't const + sigc::connection conn_; + /// Used for running as sigc::connection::connected() isn't const bool running_; }; diff --git a/src/frontends/gtk/GToolbar.C b/src/frontends/gtk/GToolbar.C index eedfefb3af..6ab4586fa6 100644 --- a/src/frontends/gtk/GToolbar.C +++ b/src/frontends/gtk/GToolbar.C @@ -79,18 +79,20 @@ GLayoutBox::GLayoutBox(LyXView & owner, combo_.get_entry()->unset_flags(Gtk::CAN_FOCUS | Gtk::CAN_DEFAULT); comboClear(combo_); - combo_.get_entry()->signal_changed().connect( - SigC::slot(*this, - &GLayoutBox::selected)); + combo_.get_entry()->signal_changed().connect( + sigc::mem_fun(*this,&GLayoutBox::selected)); combo_.show(); - toolbar.tools().push_back(Gtk::Toolbar_Helpers::Element(combo_)); - toolbar.tools().back().get_widget()->set_data( + + combo_.set_data( gToolData, reinterpret_cast(&const_cast(func))); + + Gtk::ToolItem * toolitem = Gtk::manage(new Gtk::ToolItem); + toolitem->add(combo_); + toolbar.insert(*toolitem,-1); } - void GLayoutBox::set(string const & layout) { LyXTextClass const & tc = getTextClass(owner_); @@ -188,6 +190,7 @@ GToolbar::GToolbar(ToolbarBackend::Toolbar const & tbb, LyXView & owner) add(it->first, it->second); toolbar_.set_toolbar_style(Gtk::TOOLBAR_ICONS); + toolbar_.show_all(); GView::Position const position = getPosition(tbb.flags); @@ -196,51 +199,54 @@ GToolbar::GToolbar(ToolbarBackend::Toolbar const & tbb, LyXView & owner) owner_.getBox(position).children().push_back( Gtk::Box_Helpers::Element(toolbar_, Gtk::PACK_SHRINK)); + + tooltips_.enable(); } - void GToolbar::add(FuncRequest const & func, string const & tooltip) { - switch (func.action) { - case ToolbarBackend::SEPARATOR: - toolbar_.tools().push_back(Gtk::Toolbar_Helpers::Space()); - break; - case ToolbarBackend::MINIBUFFER: - // Not supported yet. - break; - case ToolbarBackend::LAYOUTS: - { - layout_.reset(new GLayoutBox(owner_, toolbar_, func)); - break; + switch (func.action) { + case ToolbarBackend::SEPARATOR: { + Gtk::SeparatorToolItem * space = + Gtk::manage(new Gtk::SeparatorToolItem); + toolbar_.insert(*space,-1); + break; } - default: + + case ToolbarBackend::MINIBUFFER: + // Not supported yet. + break; + + case ToolbarBackend::LAYOUTS: { + layout_.reset(new GLayoutBox(owner_, toolbar_, func)); + break; + } + + default: { Glib::ustring xpmName = Glib::locale_to_utf8(toolbarbackend.getIcon(func)); Glib::ustring tip = Glib::locale_to_utf8(tooltip); + Gtk::ToolButton * toolbutton; if (xpmName.size() == 0) { - toolbar_.tools().push_back( - Gtk::Toolbar_Helpers::ButtonElem( - "", - SigC::bind(SigC::slot(*this, >oolbar::clicked), - FuncRequest(func)), - tip)); + toolbutton = Gtk::manage(new Gtk::ToolButton); } else { - Gtk::Image * image = - Gtk::manage(new Gtk::Image(xpmName)); + Gtk::Image * image = Gtk::manage(new Gtk::Image(xpmName)); image->show(); - toolbar_.tools().push_back( - Gtk::Toolbar_Helpers::ButtonElem( - "", - *image, - SigC::bind(SigC::slot(*this, >oolbar::clicked), - FuncRequest(func)), - tip)); + toolbutton = Gtk::manage(new Gtk::ToolButton(*image)); } - toolbar_.tools().back().get_content()->set_data( - gToolData, + // This code is putting a function reference into the GObject data field + // named gToolData. That's how we know how to update the status of the + // toolitem later. + toolbutton->set_data(gToolData, reinterpret_cast(&const_cast(func))); + tooltips_.set_tip(*toolbutton, tip, tip); + toolbutton->signal_clicked().connect(sigc::bind(sigc::mem_fun(*this, + >oolbar::clicked), FuncRequest(func))); + toolbar_.insert(*toolbutton,-1); break; } + + } } @@ -264,40 +270,17 @@ void GToolbar::show(bool) void GToolbar::update() { - Gtk::Toolbar_Helpers::ToolList::iterator it = - toolbar_.tools().begin(); - Gtk::Toolbar_Helpers::ToolList::iterator const end = - toolbar_.tools().end(); + int items = toolbar_.get_n_items(); - for (; it != end; ++it) { - Gtk::Widget * widget; - switch (it->get_type()) { - case Gtk::TOOLBAR_CHILD_WIDGET: - widget = it->get_widget(); - break; - case Gtk::TOOLBAR_CHILD_SPACE: - continue; - default: - widget = it->get_content(); + for (int i = 0; i < items; ++i) { + Gtk::ToolItem * item = toolbar_.get_nth_item(i); + + FuncRequest const * func = reinterpret_cast( + item->get_data(gToolData)); + if (func) { + FuncStatus const status = owner_.getLyXFunc().getStatus(*func); + item->set_sensitive(status.enabled()); } - - FuncRequest const & func = *reinterpret_cast( - widget->get_data(gToolData)); - - if (func.action == int(ToolbarBackend::LAYOUTS)) - continue; - - FuncStatus const status = owner_.getLyXFunc().getStatus(func); - bool sensitive = status.enabled(); - widget->set_sensitive(sensitive); - if (it->get_type() != Gtk::TOOLBAR_CHILD_BUTTON) - return; - if (status.onoff(true)) - static_cast(widget)-> - set_relief(Gtk::RELIEF_NORMAL); - if (status.onoff(false)) - static_cast(widget)-> - set_relief(Gtk::RELIEF_NONE); } } diff --git a/src/frontends/gtk/GToolbar.h b/src/frontends/gtk/GToolbar.h index cfbc4e5640..fd291d9a24 100644 --- a/src/frontends/gtk/GToolbar.h +++ b/src/frontends/gtk/GToolbar.h @@ -24,7 +24,7 @@ namespace frontend { class GView; -class GLayoutBox: public LayoutBox, public SigC::Object { +class GLayoutBox: public LayoutBox, public sigc::trackable { public: GLayoutBox(LyXView &, Gtk::Toolbar &, FuncRequest const &); @@ -48,7 +48,7 @@ private: }; -class GToolbar : public Toolbar, public SigC::Object { +class GToolbar : public Toolbar, public sigc::trackable { public: GToolbar(ToolbarBackend::Toolbar const &, LyXView &); void add(FuncRequest const & func, std::string const & tooltip); @@ -61,6 +61,7 @@ private: GView & owner_; Gtk::Toolbar toolbar_; + Gtk::Tooltips tooltips_; boost::scoped_ptr layout_; }; diff --git a/src/frontends/gtk/GUrl.C b/src/frontends/gtk/GUrl.C index dfb7bd3bcc..3a564e83d2 100644 --- a/src/frontends/gtk/GUrl.C +++ b/src/frontends/gtk/GUrl.C @@ -54,9 +54,9 @@ void GUrl::doBuild() bcview().addReadOnly(htmlType_); url_->signal_changed().connect( - SigC::slot(*this, &GUrl::onEntryChanged)); + sigc::mem_fun(*this, &GUrl::onEntryChanged)); name_->signal_changed().connect( - SigC::slot(*this, &GUrl::onEntryChanged)); + sigc::mem_fun(*this, &GUrl::onEntryChanged)); } diff --git a/src/frontends/gtk/GView.C b/src/frontends/gtk/GView.C index 7b46f51b90..c6e7622077 100644 --- a/src/frontends/gtk/GView.C +++ b/src/frontends/gtk/GView.C @@ -91,7 +91,7 @@ GView::GView() focus_command_buffer.connect( boost::bind(&GMiniBuffer::editMode, minibuffer_.get())); view_state_changed.connect(boost::bind(&GView::showViewState, this)); - signal_focus_in_event().connect(SigC::slot(*this, &GView::onFocusIn)); + signal_focus_in_event().connect(sigc::mem_fun(*this, &GView::onFocusIn)); set_default_size(500, 550); // Make sure the buttons are disabled if needed. updateToolbars(); diff --git a/src/frontends/gtk/GViewBase.C b/src/frontends/gtk/GViewBase.C index 2c1c61398f..af627b88e9 100644 --- a/src/frontends/gtk/GViewBase.C +++ b/src/frontends/gtk/GViewBase.C @@ -44,7 +44,7 @@ void GViewBase::build() if (!iconName.empty()) window()->set_icon_from_file(iconName); window()->signal_delete_event().connect( - SigC::slot(*this, &GViewBase::onDeleteEvent)); + sigc::mem_fun(*this, &GViewBase::onDeleteEvent)); window()->set_title(Glib::locale_to_utf8(getTitle())); } @@ -74,7 +74,7 @@ void GViewBase::setCancel(Gtk::Button * cancel) { bcview().setCancel(cancel); cancel->signal_clicked().connect( - SigC::slot(*this, &GViewBase::onCancel)); + sigc::mem_fun(*this, &GViewBase::onCancel)); } @@ -82,7 +82,7 @@ void GViewBase::setApply(Gtk::Button * apply) { bcview().setApply(apply); apply->signal_clicked().connect( - SigC::slot(*this, &GViewBase::onApply)); + sigc::mem_fun(*this, &GViewBase::onApply)); } @@ -90,7 +90,7 @@ void GViewBase::setOK(Gtk::Button * ok) { bcview().setOK(ok); ok->signal_clicked().connect( - SigC::slot(*this, &GViewBase::onOK)); + sigc::mem_fun(*this, &GViewBase::onOK)); } @@ -98,7 +98,7 @@ void GViewBase::setRestore(Gtk::Button * restore) { bcview().setRestore(restore); restore->signal_clicked().connect( - SigC::slot(*this, &GViewBase::onRestore)); + sigc::mem_fun(*this, &GViewBase::onRestore)); } diff --git a/src/frontends/gtk/GViewBase.h b/src/frontends/gtk/GViewBase.h index 1958523b41..ed0cde0f13 100644 --- a/src/frontends/gtk/GViewBase.h +++ b/src/frontends/gtk/GViewBase.h @@ -22,7 +22,7 @@ namespace lyx { namespace frontend { -class GViewBase : public Dialog::View, public SigC::Object { +class GViewBase : public Dialog::View, public sigc::trackable { public: GViewBase(Dialog &, std::string const &, bool allowResize); virtual ~GViewBase(); @@ -84,8 +84,7 @@ const Gtk::Window * GViewDB::window() const } -class GViewGladeB : public GViewBase -{ +class GViewGladeB : public GViewBase { protected: GViewGladeB(Dialog & parent, std::string const & t, bool allowResize); virtual Gtk::Window const * window() const; diff --git a/src/frontends/gtk/GWorkArea.C b/src/frontends/gtk/GWorkArea.C index 2044cd4258..d052e6c3ae 100644 --- a/src/frontends/gtk/GWorkArea.C +++ b/src/frontends/gtk/GWorkArea.C @@ -160,22 +160,22 @@ GWorkArea::GWorkArea(LyXView & owner, int width, int height) Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::KEY_PRESS_MASK | Gdk::BUTTON1_MOTION_MASK); workArea_.signal_expose_event().connect( - SigC::slot(*this, &GWorkArea::onExpose)); + sigc::mem_fun(*this, &GWorkArea::onExpose)); workArea_.signal_configure_event().connect( - SigC::slot(*this, &GWorkArea::onConfigure)); + sigc::mem_fun(*this, &GWorkArea::onConfigure)); workArea_.signal_button_press_event().connect( - SigC::slot(*this, &GWorkArea::onButtonPress)); + sigc::mem_fun(*this, &GWorkArea::onButtonPress)); workArea_.signal_button_release_event().connect( - SigC::slot(*this, &GWorkArea::onButtonRelease)); + sigc::mem_fun(*this, &GWorkArea::onButtonRelease)); workArea_.signal_key_press_event().connect( - SigC::slot(*this, &GWorkArea::onKeyPress)); + sigc::mem_fun(*this, &GWorkArea::onKeyPress)); workArea_.signal_motion_notify_event().connect( - SigC::slot(*this, &GWorkArea::onMotionNotify)); + sigc::mem_fun(*this, &GWorkArea::onMotionNotify)); workArea_.show(); vscrollbar_.get_adjustment()->signal_value_changed().connect( - SigC::slot(*this, &GWorkArea::onScroll)); + sigc::mem_fun(*this, &GWorkArea::onScroll)); workArea_.signal_scroll_event().connect( - SigC::slot(*this, &GWorkArea::onScrollWheel)); + sigc::mem_fun(*this, &GWorkArea::onScrollWheel)); vscrollbar_.show(); hbox_.children().push_back(Gtk::Box_Helpers::Element(workArea_)); hbox_.children().push_back( @@ -469,9 +469,9 @@ void GWorkArea::haveSelection(bool toHave) const std::vector listTargets; listTargets.push_back(Gtk::TargetEntry("UTF8_STRING")); clipboard->set(listTargets, - SigC::slot(const_cast(*this), + sigc::mem_fun(const_cast(*this), &GWorkArea::onClipboardGet), - SigC::slot(const_cast(*this), + sigc::mem_fun(const_cast(*this), &GWorkArea::onClipboardClear)); } } diff --git a/src/frontends/gtk/GWorkArea.h b/src/frontends/gtk/GWorkArea.h index 9c9d14d474..23e330746b 100644 --- a/src/frontends/gtk/GWorkArea.h +++ b/src/frontends/gtk/GWorkArea.h @@ -55,7 +55,7 @@ private: }; -class GWorkArea : public WorkArea, public SigC::Object { +class GWorkArea : public WorkArea, public sigc::trackable { public: GWorkArea(LyXView & owner, int width, int height); ~GWorkArea(); diff --git a/src/frontends/gtk/GXpmBtnTbl.C b/src/frontends/gtk/GXpmBtnTbl.C index a32e41eab3..53a6f5ef09 100644 --- a/src/frontends/gtk/GXpmBtnTbl.C +++ b/src/frontends/gtk/GXpmBtnTbl.C @@ -23,7 +23,7 @@ void GXpmBtnTbl::GXpmBtn::setXpm(XpmData xpm) pixmap_ = Gdk::Pixmap::create_from_xpm(clrmap, mask_, xpm); - Gtk::Image * image = SigC::manage(new Gtk::Image(pixmap_, mask_)); + Gtk::Image * image = Gtk::manage(new Gtk::Image(pixmap_, mask_)); image->show(); add(*image); } @@ -34,7 +34,8 @@ void GXpmBtnTbl::GXpmBtn::setXpm(Glib::RefPtr pixmap, { pixmap_ = pixmap; mask_ = mask; - Gtk::Image * image = SigC::manage(new Gtk::Image(pixmap_, mask_)); + Gtk::Image * image = + Gtk::manage(new Gtk::Image(pixmap_, mask_)); image->show(); add(*image); } @@ -74,7 +75,7 @@ void GXpmBtnTbl::construct() GXpmBtn * btn = &btns_[index(row, col)]; btn->setRow(row); btn->setCol(col); - btn->signalClicked().connect(signalClicked_.slot()); + btn->signalClicked().connect(signalClicked_); btn->show(); attach(*btn, col, col + 1, row, row + 1); } @@ -162,15 +163,12 @@ void GXpmBtnTbl::on_realize() void buttonSetXpm(Gtk::Button * btn, char const ** xpm) { - Glib::RefPtr mask; - Glib::RefPtr clrmap = btn->get_colormap(); + Glib::RefPtr mask; Glib::RefPtr pixmap = - Gdk::Pixmap::create_from_xpm(clrmap, - mask, - xpm); - Gtk::Image * image = SigC::manage(new Gtk::Image(pixmap, mask)); + Gdk::Pixmap::create_from_xpm(clrmap, mask, xpm); + Gtk::Image * image = Gtk::manage(new Gtk::Image(pixmap, mask)); image->show(); btn->add(*image); } diff --git a/src/frontends/gtk/GXpmBtnTbl.h b/src/frontends/gtk/GXpmBtnTbl.h index dd7295c3ba..df790404d6 100644 --- a/src/frontends/gtk/GXpmBtnTbl.h +++ b/src/frontends/gtk/GXpmBtnTbl.h @@ -12,14 +12,14 @@ #ifndef XPM_BTN_TBL_H #define XPM_BTN_TBL_H -#include +#include +#include class GXpmBtnTbl : public Gtk::Table { public: typedef char const ** XpmData; - typedef SigC::Signal2 SigType; - + typedef sigc::signal SigType; struct XbmData { unsigned char const* data_; int width_; @@ -31,8 +31,7 @@ public: public: GXpmBtn() : row_(-1), col_(-1) { - signal_clicked().connect( - SigC::slot(*this, + signal_clicked().connect(sigc::mem_fun(*this, &GXpmBtn::onButtonClicked)); } void setRow(int row) { row_ = row; } @@ -79,7 +78,7 @@ private: int rows_; int cols_; boost::scoped_array btns_; - const XbmData * xbm_; + XbmData const * xbm_; SigType signalClicked_; }; diff --git a/src/frontends/gtk/LyXScreenFactory.C b/src/frontends/gtk/LyXScreenFactory.C index a041779eb3..3b72c9905a 100644 --- a/src/frontends/gtk/LyXScreenFactory.C +++ b/src/frontends/gtk/LyXScreenFactory.C @@ -10,12 +10,12 @@ #include +#include +#include "frontends/LyXScreenFactory.h" #include "GWorkArea.h" #include "GScreen.h" -#include "frontends/LyXScreenFactory.h" -#include namespace LyXScreenFactory { diff --git a/src/frontends/gtk/io_callback.C b/src/frontends/gtk/io_callback.C index 064171ee0d..e2d7f8273d 100644 --- a/src/frontends/gtk/io_callback.C +++ b/src/frontends/gtk/io_callback.C @@ -18,7 +18,7 @@ io_callback::io_callback(int fd, boost::function func) : func_(func) { conn_ = Glib::signal_io().connect( - SigC::slot(*this, &io_callback::data_received), + sigc::mem_fun(*this, &io_callback::data_received), fd, Glib::IO_IN); } diff --git a/src/frontends/gtk/io_callback.h b/src/frontends/gtk/io_callback.h index 24da391263..db4362ba6f 100644 --- a/src/frontends/gtk/io_callback.h +++ b/src/frontends/gtk/io_callback.h @@ -26,14 +26,14 @@ * connected/read. * */ -class io_callback : public SigC::Object { +class io_callback : public sigc::trackable { public: /// connect a connection notification from the LyXServerSocket io_callback(int fd, boost::function func); private: bool data_received(Glib::IOCondition); /// our notifier - SigC::Connection conn_; + sigc::connection conn_; /// The callback function boost::function func_; }; diff --git a/src/frontends/gtk/xftFontLoader.C b/src/frontends/gtk/xftFontLoader.C index 6484af7424..e2e495b1fa 100644 --- a/src/frontends/gtk/xftFontLoader.C +++ b/src/frontends/gtk/xftFontLoader.C @@ -10,6 +10,7 @@ #include +#include #include "xftFontLoader.h" #include "FontInfo.h" #include "gettext.h" @@ -24,7 +25,6 @@ #include "support/systemcall.h" #include "support/filetools.h" -#include #include