Move to gtk 2.4

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9011 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2004-09-26 16:48:30 +00:00
parent ec94b42f51
commit d86c6d46bb
33 changed files with 164 additions and 172 deletions

View File

@ -1,3 +1,7 @@
2004-09-26 Lars Gullik Bjonnes <larsbj@gullik.net>
* configure.ac: update for gtk 2.4
2004-09-23 Bennett Helm <bennett.helm@fandm.edu> 2004-09-23 Bennett Helm <bennett.helm@fandm.edu>
* README.MacOSX: update again * README.MacOSX: update again

View File

@ -192,13 +192,13 @@ for frontend in $FRONTENDS ; do
dnl FRONTEND_LIBS="@XPM_LIB@ @XFORMS_LIB@ ${GNOME_FRONTEND_LIBS}" dnl FRONTEND_LIBS="@XPM_LIB@ @XFORMS_LIB@ ${GNOME_FRONTEND_LIBS}"
dnl ;; dnl ;;
gtk) 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_PROGS="$FRONTENDS_PROGS lyx-gtk\$(EXEEXT)"
FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS gtk" FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS gtk"
RPM_FRONTEND="gtk" RPM_FRONTEND="gtk"
RPM_FRONTEND_DEPS='gtkmm >= 2.2.0' RPM_FRONTEND_DEPS='gtkmm >= 2.4.0'
GTKMM_VERSION=`pkg-config --modversion gtkmm-2.0` GTKMM_VERSION=`pkg-config --modversion gtkmm-2.4`
LIBGLADEMM_VERSION=`pkg-config --modversion libglademm-2.0` LIBGLADEMM_VERSION=`pkg-config --modversion libglademm-2.4`
FRONTEND_INFO="${FRONTEND_INFO}\ FRONTEND_INFO="${FRONTEND_INFO}\
GTK Frontend:\n\ GTK Frontend:\n\
libgtkmm version:\t\t${GTKMM_VERSION}\n\ libgtkmm version:\t\t${GTKMM_VERSION}\n\

View File

@ -37,8 +37,8 @@ string translateShortcut(string const & str)
void warning_pimpl(string const &, string const & message) void warning_pimpl(string const &, string const & message)
{ {
Gtk::MessageDialog dlg(Glib::locale_to_utf8(message), Gtk::MessageDialog dlg(Glib::locale_to_utf8(message),
Gtk::MESSAGE_WARNING, true, Gtk::MESSAGE_WARNING,
Gtk::BUTTONS_CLOSE, true, true); Gtk::BUTTONS_CLOSE, true);
dlg.run(); dlg.run();
} }
@ -46,8 +46,8 @@ void warning_pimpl(string const &, string const & message)
void error_pimpl(string const &, string const & message) void error_pimpl(string const &, string const & message)
{ {
Gtk::MessageDialog dlg(Glib::locale_to_utf8(message), Gtk::MessageDialog dlg(Glib::locale_to_utf8(message),
Gtk::MESSAGE_ERROR, true, Gtk::MESSAGE_ERROR,
Gtk::BUTTONS_CLOSE, true, true); Gtk::BUTTONS_CLOSE, true);
dlg.run(); dlg.run();
} }
@ -55,8 +55,8 @@ void error_pimpl(string const &, string const & message)
void information_pimpl(string const &, string const & message) void information_pimpl(string const &, string const & message)
{ {
Gtk::MessageDialog dlg(Glib::locale_to_utf8(message), Gtk::MessageDialog dlg(Glib::locale_to_utf8(message),
Gtk::MESSAGE_INFO, true, Gtk::MESSAGE_INFO,
Gtk::BUTTONS_CLOSE, true, true); Gtk::BUTTONS_CLOSE, true);
dlg.run(); dlg.run();
} }
@ -71,8 +71,8 @@ int prompt_pimpl(string const &, string const & question,
if (!b3.empty()) if (!b3.empty())
gb3 = Glib::locale_to_utf8(translateShortcut(b3)); gb3 = Glib::locale_to_utf8(translateShortcut(b3));
Gtk::MessageDialog dlg(Glib::locale_to_utf8(question), Gtk::MessageDialog dlg(Glib::locale_to_utf8(question),
Gtk::MESSAGE_QUESTION, true, Gtk::MESSAGE_QUESTION,
Gtk::BUTTONS_NONE, true, true); Gtk::BUTTONS_NONE, true);
dlg.add_button(gb1, 0); dlg.add_button(gb1, 0);
dlg.add_button(gb2, 1); dlg.add_button(gb2, 1);
if (!b3.empty()) if (!b3.empty())
@ -86,9 +86,9 @@ std::pair<bool, string> const askForText_pimpl(string const & msg,
string const & dflt) string const & dflt)
{ {
Gtk::MessageDialog dlg(Glib::locale_to_utf8(msg), Gtk::MessageDialog dlg(Glib::locale_to_utf8(msg),
Gtk::MESSAGE_QUESTION, true, Gtk::MESSAGE_QUESTION,
Gtk::BUTTONS_OK_CANCEL, Gtk::BUTTONS_OK_CANCEL,
true, true); true);
Gtk::Entry entry; Gtk::Entry entry;
entry.set_text(Glib::locale_to_utf8(dflt)); entry.set_text(Glib::locale_to_utf8(dflt));
entry.set_position(-1); entry.set_position(-1);

View File

@ -1,3 +1,8 @@
2004-09-26 Lars Gullik Bjonnes <larsbj@gullik.net>
John Spray <spray_john@users.sourceforge.net>
* Initial move to gtk 2.4.
2004-09-26 Lars Gullik Bjonnes <larsbj@gullik.net> 2004-09-26 Lars Gullik Bjonnes <larsbj@gullik.net>
* WS changes. * WS changes.

View File

@ -28,9 +28,9 @@ FileDialog::Private::Private(string const & title,
fileSelection_.get_button_area()->children().push_back( fileSelection_.get_button_area()->children().push_back(
Gtk::Box_Helpers::Element(button2_)); Gtk::Box_Helpers::Element(button2_));
button1_.signal_clicked().connect( button1_.signal_clicked().connect(
SigC::slot(*this, &FileDialog::Private::onButton1Clicked)); sigc::mem_fun(*this, &FileDialog::Private::onButton1Clicked));
button2_.signal_clicked().connect( button2_.signal_clicked().connect(
SigC::slot(*this, &FileDialog::Private::onButton2Clicked)); sigc::mem_fun(*this, &FileDialog::Private::onButton2Clicked));
if (!b1.first.empty() && !b1.second.empty()) { if (!b1.first.empty() && !b1.second.empty()) {
string::size_type pos = b1.first.find('|'); string::size_type pos = b1.first.find('|');
button1_.set_label( button1_.set_label(

View File

@ -12,10 +12,11 @@
#ifndef FILE_DIALOG_PRIVATE_H #ifndef FILE_DIALOG_PRIVATE_H
#define FILE_DIALOG_PRIVATE_H #define FILE_DIALOG_PRIVATE_H
#include <gtkmm.h>
#include "frontends/FileDialog.h" #include "frontends/FileDialog.h"
class FileDialog::Private : public SigC::Object { #include <gtkmm.h>
class FileDialog::Private : public sigc::trackable {
public: public:
Private(std::string const & title, Private(std::string const & title,
kb_action action, kb_action action,

View File

@ -173,7 +173,7 @@ void GAboutlyx::doBuild()
Gtk::Button * btn; Gtk::Button * btn;
xml_->get_widget("close_button", btn); xml_->get_widget("close_button", btn);
setCancel(btn); setCancel(btn);
//btn->signal_clicked().connect(SigC::slot(*this, &GViewBase::onCancel)); //btn->signal_clicked().connect(sigc::mem_fun(*this, &GViewBase::onCancel));
} }
} // namespace frontend } // namespace frontend

View File

@ -123,7 +123,7 @@ void GMathDelim::doBuild()
rightSel_ = 1; rightSel_ = 1;
xml_->get_widget("Box", box); xml_->get_widget("Box", box);
delimTbl_.signalClicked().connect( delimTbl_.signalClicked().connect(
SigC::slot(*this, &GMathDelim::onDelimTblClicked)); sigc::mem_fun(*this, &GMathDelim::onDelimTblClicked));
delimTbl_.show(); delimTbl_.show();
box->children().push_back( box->children().push_back(
Gtk::Box_Helpers::Element(delimTbl_)); Gtk::Box_Helpers::Element(delimTbl_));
@ -133,11 +133,11 @@ void GMathDelim::doBuild()
bcview().addReadOnly(both_); bcview().addReadOnly(both_);
bcview().addReadOnly(demo_); bcview().addReadOnly(demo_);
left_->signal_clicked().connect( left_->signal_clicked().connect(
SigC::slot(*this, &GMathDelim::onRadioClicked)); sigc::mem_fun(*this, &GMathDelim::onRadioClicked));
right_->signal_clicked().connect( right_->signal_clicked().connect(
SigC::slot(*this, &GMathDelim::onRadioClicked)); sigc::mem_fun(*this, &GMathDelim::onRadioClicked));
both_->signal_clicked().connect( 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(), pixmap_ = Gdk::Pixmap::create_from_xpm(demo_->get_colormap(),
mask_, mask_,
delim0); delim0);
image = SigC::manage(new Gtk::Image(pixmap_, mask_)); image = Gtk::manage(new Gtk::Image(pixmap_, mask_));
image->show(); image->show();
demo_->add(*image); demo_->add(*image);
gcMask_ = Gdk::GC::create(mask_); gcMask_ = Gdk::GC::create(mask_);

View File

@ -114,10 +114,10 @@ void GMathPanel::doBuild()
setCancel(close); setCancel(close);
tableUp_.signalClicked().connect( tableUp_.signalClicked().connect(
SigC::slot(*this, &GMathPanel::onTableUpClicked)); sigc::mem_fun(*this, &GMathPanel::onTableUpClicked));
tableUp_.show(); tableUp_.show();
tableDown_.signalClicked().connect( tableDown_.signalClicked().connect(
SigC::slot(*this, &GMathPanel::onTableDownClicked)); sigc::mem_fun(*this, &GMathPanel::onTableDownClicked));
tableDown_.show(); tableDown_.show();
xml_->get_widget("Vbox", vbox); xml_->get_widget("Vbox", vbox);
@ -132,7 +132,7 @@ void GMathPanel::doBuild()
functions_->append_column("Functions", listCol_); functions_->append_column("Functions", listCol_);
listSel_ = functions_->get_selection(); listSel_ = functions_->get_selection();
listSel_->signal_changed().connect( listSel_->signal_changed().connect(
SigC::slot(*this, &GMathPanel::onFunctionSelected)); sigc::mem_fun(*this, &GMathPanel::onFunctionSelected));
for (int i = 0; i < nr_function_names; ++i) for (int i = 0; i < nr_function_names; ++i)
(*listStore_->append())[listCol_] = (*listStore_->append())[listCol_] =
Glib::locale_to_utf8(function_names[i]); Glib::locale_to_utf8(function_names[i]);

View File

@ -85,7 +85,7 @@ GMenubar::GMenubar(LyXView * lyxView, MenuBackend const & /*menuBackend*/) :
labelTrans(i->label(), i->shortcut()), labelTrans(i->label(), i->shortcut()),
*gmenu)); *gmenu));
menubar_.items().back().signal_activate().connect( 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())); &menubar_.items().back()));
mainMenuNames_.push_back(i->submenuname()); mainMenuNames_.push_back(i->submenuname());
} }
@ -173,7 +173,7 @@ void GMenubar::onSubMenuActivate(MenuItem const * item,
labelTrans(i->label(), i->shortcut()), labelTrans(i->label(), i->shortcut()),
*gmenu_new)); *gmenu_new));
gmenu->items().back().signal_activate().connect( gmenu->items().back().signal_activate().connect(
SigC::bind(SigC::slot(*this, &GMenubar::onSubMenuActivate), sigc::bind(sigc::mem_fun(*this, &GMenubar::onSubMenuActivate),
&(*i), &(*i),
&gmenu->items().back())); &gmenu->items().back()));
if (submenuDisabled(&(*i))) if (submenuDisabled(&(*i)))
@ -206,7 +206,7 @@ void GMenubar::onSubMenuActivate(MenuItem const * item,
} }
Gtk::MenuItem & item = gmenu->items().back(); Gtk::MenuItem & item = gmenu->items().back();
item.signal_activate().connect( item.signal_activate().connect(
SigC::bind(SigC::slot(*this, &GMenubar::onCommandActivate), sigc::bind(sigc::mem_fun(*this, &GMenubar::onCommandActivate),
&(*i), &item)); &(*i), &item));
if (!flag.enabled()) if (!flag.enabled())
item.set_sensitive(false); item.set_sensitive(false);

View File

@ -21,7 +21,7 @@ class LyXView;
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
class GMenubar : public Menubar, public SigC::Object { class GMenubar : public Menubar, public sigc::trackable {
public: public:
GMenubar(LyXView *, MenuBackend const &); GMenubar(LyXView *, MenuBackend const &);
~GMenubar(); ~GMenubar();

View File

@ -34,14 +34,14 @@ GMiniBuffer::GMiniBuffer(GView * view, ControlCommandBuffer & control) :
listView_.set_model(listStore_); listView_.set_model(listStore_);
listView_.append_column("Completions", listCol_); listView_.append_column("Completions", listCol_);
listView_.signal_key_press_event().connect( listView_.signal_key_press_event().connect(
SigC::slot(*this, &GMiniBuffer::onListKeyPress)); sigc::mem_fun(*this, &GMiniBuffer::onListKeyPress));
listView_.signal_focus_in_event().connect( listView_.signal_focus_in_event().connect(
SigC::slot(*this, &GMiniBuffer::onListFocusIn)); sigc::mem_fun(*this, &GMiniBuffer::onListFocusIn));
listView_.signal_focus_out_event().connect( listView_.signal_focus_out_event().connect(
SigC::slot(*this, &GMiniBuffer::onFocusOut)); sigc::mem_fun(*this, &GMiniBuffer::onFocusOut));
listSel_ = listView_.get_selection(); listSel_ = listView_.get_selection();
listSel_->signal_changed().connect( listSel_->signal_changed().connect(
SigC::slot(*this, &GMiniBuffer::onSelected)); sigc::mem_fun(*this, &GMiniBuffer::onSelected));
listView_.show(); listView_.show();
scrolledWindow_.set_policy(Gtk::POLICY_AUTOMATIC, scrolledWindow_.set_policy(Gtk::POLICY_AUTOMATIC,
@ -53,13 +53,13 @@ GMiniBuffer::GMiniBuffer(GView * view, ControlCommandBuffer & control) :
Gtk::Box_Helpers::Element(scrolledWindow_,Gtk::PACK_SHRINK)); Gtk::Box_Helpers::Element(scrolledWindow_,Gtk::PACK_SHRINK));
entry_.signal_key_press_event().connect( entry_.signal_key_press_event().connect(
SigC::slot(*this, &GMiniBuffer::onKeyPress)); sigc::mem_fun(*this, &GMiniBuffer::onKeyPress));
entry_.signal_focus_in_event().connect( entry_.signal_focus_in_event().connect(
SigC::slot(*this, &GMiniBuffer::onFocusIn)); sigc::mem_fun(*this, &GMiniBuffer::onFocusIn));
entry_.signal_focus_out_event().connect( entry_.signal_focus_out_event().connect(
SigC::slot(*this, &GMiniBuffer::onFocusOut)); sigc::mem_fun(*this, &GMiniBuffer::onFocusOut));
entry_.signal_activate().connect( entry_.signal_activate().connect(
SigC::slot(*this, &GMiniBuffer::onCommit)); sigc::mem_fun(*this, &GMiniBuffer::onCommit));
entry_.show(); entry_.show();
view_->getBox(GView::Bottom).children().push_back( view_->getBox(GView::Bottom).children().push_back(

View File

@ -20,7 +20,7 @@ namespace frontend {
class ControlCommandBuffer; class ControlCommandBuffer;
class GMiniBuffer : public SigC::Object { class GMiniBuffer : public sigc::trackable {
public: public:
GMiniBuffer(GView * view, ControlCommandBuffer & control); GMiniBuffer(GView * view, ControlCommandBuffer & control);
~GMiniBuffer(); ~GMiniBuffer();

View File

@ -15,6 +15,7 @@
#include "frontends/Painter.h" #include "frontends/Painter.h"
#include <X11/Xft/Xft.h> #include <X11/Xft/Xft.h>
#include <gtkmm.h>
#include <map> #include <map>

View File

@ -150,22 +150,23 @@ void GPrint::doBuild()
Gtk::Button * apply; Gtk::Button * apply;
xml_->get_widget("PrintButton", ok); xml_->get_widget("PrintButton", ok);
xml_->get_widget("CancelButton", cancel); xml_->get_widget("CancelButton", cancel);
setOK(ok); setOK(ok);
setCancel(cancel); setCancel(cancel);
Gtk::Button * browse; Gtk::Button * browse;
xml_->get_widget("Browse", 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_)); fileEntry_->signal_changed().connect(sigc::bind(sigc::mem_fun(*this, &GPrint::onTargetEdit), fileEntry_));
printerEntry_->signal_changed().connect(SigC::bind(SigC::slot(*this, &GPrint::onTargetEdit), printerEntry_)); printerEntry_->signal_changed().connect(sigc::bind(sigc::mem_fun(*this, &GPrint::onTargetEdit), printerEntry_));
fromEntry_->signal_changed().connect(SigC::slot(*this, &GPrint::onFromToEdit)); fromEntry_->signal_changed().connect(sigc::mem_fun(*this, &GPrint::onFromToEdit));
toEntry_->signal_changed().connect(SigC::slot(*this, &GPrint::onFromToEdit)); toEntry_->signal_changed().connect(sigc::mem_fun(*this, &GPrint::onFromToEdit));
printer_->signal_toggled().connect(SigC::slot(*this, &GPrint::updateUI)); printer_->signal_toggled().connect(sigc::mem_fun(*this, &GPrint::updateUI));
file_->signal_toggled().connect(SigC::slot(*this, &GPrint::updateUI)); file_->signal_toggled().connect(sigc::mem_fun(*this, &GPrint::updateUI));
all_->signal_toggled().connect(SigC::slot(*this, &GPrint::updateUI)); all_->signal_toggled().connect(sigc::mem_fun(*this, &GPrint::updateUI));
fromTo_->signal_toggled().connect(SigC::slot(*this, &GPrint::updateUI)); fromTo_->signal_toggled().connect(sigc::mem_fun(*this, &GPrint::updateUI));
number_->signal_changed().connect(SigC::slot(*this, &GPrint::updateUI)); number_->signal_changed().connect(sigc::mem_fun(*this, &GPrint::updateUI));
controller().initialiseParams(""); controller().initialiseParams("");
update(); update();

View File

@ -48,13 +48,13 @@ void GSearch::doBuild()
xml_->get_widget("SearchBackwards", backwardscheck); xml_->get_widget("SearchBackwards", backwardscheck);
findnextbutton->signal_clicked().connect( findnextbutton->signal_clicked().connect(
SigC::slot(*this, &GSearch::onFindNext)); sigc::mem_fun(*this, &GSearch::onFindNext));
replacebutton->signal_clicked().connect( replacebutton->signal_clicked().connect(
SigC::slot(*this, &GSearch::onReplace)); sigc::mem_fun(*this, &GSearch::onReplace));
replaceallbutton->signal_clicked().connect( replaceallbutton->signal_clicked().connect(
SigC::slot(*this, &GSearch::onReplaceAll)); sigc::mem_fun(*this, &GSearch::onReplaceAll));
findentry->signal_changed().connect( findentry->signal_changed().connect(
SigC::slot(*this,&GSearch::onFindEntryChanged)); sigc::mem_fun(*this,&GSearch::onFindEntryChanged));
bcview().addReadOnly(replaceentry); bcview().addReadOnly(replaceentry);
bcview().addReadOnly(replacebutton); bcview().addReadOnly(replacebutton);

View File

@ -67,7 +67,7 @@ void GText::doBuild()
setRestore(restore); setRestore(restore);
bcview().addReadOnly(entry_); bcview().addReadOnly(entry_);
entry_->signal_changed().connect( entry_->signal_changed().connect(
SigC::slot(*this, &GText::onEntryChanged)); sigc::mem_fun(*this, &GText::onEntryChanged));
} }

View File

@ -51,7 +51,7 @@ void GTimeout::start()
} }
conn_ = Glib::signal_timeout().connect( conn_ = Glib::signal_timeout().connect(
SigC::slot(*this, &GTimeout::timeoutEvent), sigc::mem_fun(*this, &GTimeout::timeoutEvent),
timeout_ms() timeout_ms()
); );
running_ = true; running_ = true;

View File

@ -24,7 +24,7 @@ namespace frontend {
* This class executes the callback when the timeout expires * This class executes the callback when the timeout expires
* using Gtk mechanisms * using Gtk mechanisms
*/ */
class GTimeout : public Timeout::Impl, public SigC::Object { class GTimeout : public Timeout::Impl, public sigc::trackable {
public: public:
/// ///
GTimeout(Timeout & owner_); GTimeout(Timeout & owner_);
@ -40,8 +40,8 @@ public:
bool timeoutEvent(); bool timeoutEvent();
private: private:
/// Timer connection /// Timer connection
SigC::Connection conn_; sigc::connection conn_;
/// Used for running as SigC::Connection::connected() isn't const /// Used for running as sigc::connection::connected() isn't const
bool running_; bool running_;
}; };

View File

@ -79,18 +79,20 @@ GLayoutBox::GLayoutBox(LyXView & owner,
combo_.get_entry()->unset_flags(Gtk::CAN_FOCUS | Gtk::CAN_DEFAULT); combo_.get_entry()->unset_flags(Gtk::CAN_FOCUS | Gtk::CAN_DEFAULT);
comboClear(combo_); comboClear(combo_);
combo_.get_entry()->signal_changed().connect( combo_.get_entry()->signal_changed().connect(
SigC::slot(*this, sigc::mem_fun(*this,&GLayoutBox::selected));
&GLayoutBox::selected));
combo_.show(); combo_.show();
toolbar.tools().push_back(Gtk::Toolbar_Helpers::Element(combo_));
toolbar.tools().back().get_widget()->set_data( combo_.set_data(
gToolData, gToolData,
reinterpret_cast<void*>(&const_cast<FuncRequest &>(func))); reinterpret_cast<void*>(&const_cast<FuncRequest &>(func)));
Gtk::ToolItem * toolitem = Gtk::manage(new Gtk::ToolItem);
toolitem->add(combo_);
toolbar.insert(*toolitem,-1);
} }
void GLayoutBox::set(string const & layout) void GLayoutBox::set(string const & layout)
{ {
LyXTextClass const & tc = getTextClass(owner_); LyXTextClass const & tc = getTextClass(owner_);
@ -188,6 +190,7 @@ GToolbar::GToolbar(ToolbarBackend::Toolbar const & tbb, LyXView & owner)
add(it->first, it->second); add(it->first, it->second);
toolbar_.set_toolbar_style(Gtk::TOOLBAR_ICONS); toolbar_.set_toolbar_style(Gtk::TOOLBAR_ICONS);
toolbar_.show_all();
GView::Position const position = getPosition(tbb.flags); 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( owner_.getBox(position).children().push_back(
Gtk::Box_Helpers::Element(toolbar_, Gtk::PACK_SHRINK)); Gtk::Box_Helpers::Element(toolbar_, Gtk::PACK_SHRINK));
tooltips_.enable();
} }
void GToolbar::add(FuncRequest const & func, string const & tooltip) void GToolbar::add(FuncRequest const & func, string const & tooltip)
{ {
switch (func.action) { switch (func.action) {
case ToolbarBackend::SEPARATOR: case ToolbarBackend::SEPARATOR: {
toolbar_.tools().push_back(Gtk::Toolbar_Helpers::Space()); Gtk::SeparatorToolItem * space =
break; Gtk::manage(new Gtk::SeparatorToolItem);
case ToolbarBackend::MINIBUFFER: toolbar_.insert(*space,-1);
// Not supported yet. break;
break;
case ToolbarBackend::LAYOUTS:
{
layout_.reset(new GLayoutBox(owner_, toolbar_, func));
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::ustring xpmName =
Glib::locale_to_utf8(toolbarbackend.getIcon(func)); Glib::locale_to_utf8(toolbarbackend.getIcon(func));
Glib::ustring tip = Glib::locale_to_utf8(tooltip); Glib::ustring tip = Glib::locale_to_utf8(tooltip);
Gtk::ToolButton * toolbutton;
if (xpmName.size() == 0) { if (xpmName.size() == 0) {
toolbar_.tools().push_back( toolbutton = Gtk::manage(new Gtk::ToolButton);
Gtk::Toolbar_Helpers::ButtonElem(
"",
SigC::bind(SigC::slot(*this, &GToolbar::clicked),
FuncRequest(func)),
tip));
} else { } else {
Gtk::Image * image = Gtk::Image * image = Gtk::manage(new Gtk::Image(xpmName));
Gtk::manage(new Gtk::Image(xpmName));
image->show(); image->show();
toolbar_.tools().push_back( toolbutton = Gtk::manage(new Gtk::ToolButton(*image));
Gtk::Toolbar_Helpers::ButtonElem(
"",
*image,
SigC::bind(SigC::slot(*this, &GToolbar::clicked),
FuncRequest(func)),
tip));
} }
toolbar_.tools().back().get_content()->set_data( // This code is putting a function reference into the GObject data field
gToolData, // named gToolData. That's how we know how to update the status of the
// toolitem later.
toolbutton->set_data(gToolData,
reinterpret_cast<void*>(&const_cast<FuncRequest &>(func))); reinterpret_cast<void*>(&const_cast<FuncRequest &>(func)));
tooltips_.set_tip(*toolbutton, tip, tip);
toolbutton->signal_clicked().connect(sigc::bind(sigc::mem_fun(*this,
&GToolbar::clicked), FuncRequest(func)));
toolbar_.insert(*toolbutton,-1);
break; break;
} }
}
} }
@ -264,40 +270,17 @@ void GToolbar::show(bool)
void GToolbar::update() void GToolbar::update()
{ {
Gtk::Toolbar_Helpers::ToolList::iterator it = int items = toolbar_.get_n_items();
toolbar_.tools().begin();
Gtk::Toolbar_Helpers::ToolList::iterator const end =
toolbar_.tools().end();
for (; it != end; ++it) { for (int i = 0; i < items; ++i) {
Gtk::Widget * widget; Gtk::ToolItem * item = toolbar_.get_nth_item(i);
switch (it->get_type()) {
case Gtk::TOOLBAR_CHILD_WIDGET: FuncRequest const * func = reinterpret_cast<FuncRequest *>(
widget = it->get_widget(); item->get_data(gToolData));
break; if (func) {
case Gtk::TOOLBAR_CHILD_SPACE: FuncStatus const status = owner_.getLyXFunc().getStatus(*func);
continue; item->set_sensitive(status.enabled());
default:
widget = it->get_content();
} }
FuncRequest const & func = *reinterpret_cast<FuncRequest *>(
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<Gtk::Button*>(widget)->
set_relief(Gtk::RELIEF_NORMAL);
if (status.onoff(false))
static_cast<Gtk::Button*>(widget)->
set_relief(Gtk::RELIEF_NONE);
} }
} }

View File

@ -24,7 +24,7 @@ namespace frontend {
class GView; class GView;
class GLayoutBox: public LayoutBox, public SigC::Object { class GLayoutBox: public LayoutBox, public sigc::trackable {
public: public:
GLayoutBox(LyXView &, Gtk::Toolbar &, FuncRequest const &); 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: public:
GToolbar(ToolbarBackend::Toolbar const &, LyXView &); GToolbar(ToolbarBackend::Toolbar const &, LyXView &);
void add(FuncRequest const & func, std::string const & tooltip); void add(FuncRequest const & func, std::string const & tooltip);
@ -61,6 +61,7 @@ private:
GView & owner_; GView & owner_;
Gtk::Toolbar toolbar_; Gtk::Toolbar toolbar_;
Gtk::Tooltips tooltips_;
boost::scoped_ptr<GLayoutBox> layout_; boost::scoped_ptr<GLayoutBox> layout_;
}; };

View File

@ -54,9 +54,9 @@ void GUrl::doBuild()
bcview().addReadOnly(htmlType_); bcview().addReadOnly(htmlType_);
url_->signal_changed().connect( url_->signal_changed().connect(
SigC::slot(*this, &GUrl::onEntryChanged)); sigc::mem_fun(*this, &GUrl::onEntryChanged));
name_->signal_changed().connect( name_->signal_changed().connect(
SigC::slot(*this, &GUrl::onEntryChanged)); sigc::mem_fun(*this, &GUrl::onEntryChanged));
} }

View File

@ -91,7 +91,7 @@ GView::GView()
focus_command_buffer.connect( focus_command_buffer.connect(
boost::bind(&GMiniBuffer::editMode, minibuffer_.get())); boost::bind(&GMiniBuffer::editMode, minibuffer_.get()));
view_state_changed.connect(boost::bind(&GView::showViewState, this)); 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); set_default_size(500, 550);
// Make sure the buttons are disabled if needed. // Make sure the buttons are disabled if needed.
updateToolbars(); updateToolbars();

View File

@ -44,7 +44,7 @@ void GViewBase::build()
if (!iconName.empty()) if (!iconName.empty())
window()->set_icon_from_file(iconName); window()->set_icon_from_file(iconName);
window()->signal_delete_event().connect( window()->signal_delete_event().connect(
SigC::slot(*this, &GViewBase::onDeleteEvent)); sigc::mem_fun(*this, &GViewBase::onDeleteEvent));
window()->set_title(Glib::locale_to_utf8(getTitle())); window()->set_title(Glib::locale_to_utf8(getTitle()));
} }
@ -74,7 +74,7 @@ void GViewBase::setCancel(Gtk::Button * cancel)
{ {
bcview().setCancel(cancel); bcview().setCancel(cancel);
cancel->signal_clicked().connect( 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); bcview().setApply(apply);
apply->signal_clicked().connect( 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); bcview().setOK(ok);
ok->signal_clicked().connect( 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); bcview().setRestore(restore);
restore->signal_clicked().connect( restore->signal_clicked().connect(
SigC::slot(*this, &GViewBase::onRestore)); sigc::mem_fun(*this, &GViewBase::onRestore));
} }

View File

@ -22,7 +22,7 @@
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
class GViewBase : public Dialog::View, public SigC::Object { class GViewBase : public Dialog::View, public sigc::trackable {
public: public:
GViewBase(Dialog &, std::string const &, bool allowResize); GViewBase(Dialog &, std::string const &, bool allowResize);
virtual ~GViewBase(); virtual ~GViewBase();
@ -84,8 +84,7 @@ const Gtk::Window * GViewDB<Dialog>::window() const
} }
class GViewGladeB : public GViewBase class GViewGladeB : public GViewBase {
{
protected: protected:
GViewGladeB(Dialog & parent, std::string const & t, bool allowResize); GViewGladeB(Dialog & parent, std::string const & t, bool allowResize);
virtual Gtk::Window const * window() const; virtual Gtk::Window const * window() const;

View File

@ -160,22 +160,22 @@ GWorkArea::GWorkArea(LyXView & owner, int width, int height)
Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK |
Gdk::KEY_PRESS_MASK | Gdk::BUTTON1_MOTION_MASK); Gdk::KEY_PRESS_MASK | Gdk::BUTTON1_MOTION_MASK);
workArea_.signal_expose_event().connect( workArea_.signal_expose_event().connect(
SigC::slot(*this, &GWorkArea::onExpose)); sigc::mem_fun(*this, &GWorkArea::onExpose));
workArea_.signal_configure_event().connect( workArea_.signal_configure_event().connect(
SigC::slot(*this, &GWorkArea::onConfigure)); sigc::mem_fun(*this, &GWorkArea::onConfigure));
workArea_.signal_button_press_event().connect( workArea_.signal_button_press_event().connect(
SigC::slot(*this, &GWorkArea::onButtonPress)); sigc::mem_fun(*this, &GWorkArea::onButtonPress));
workArea_.signal_button_release_event().connect( workArea_.signal_button_release_event().connect(
SigC::slot(*this, &GWorkArea::onButtonRelease)); sigc::mem_fun(*this, &GWorkArea::onButtonRelease));
workArea_.signal_key_press_event().connect( workArea_.signal_key_press_event().connect(
SigC::slot(*this, &GWorkArea::onKeyPress)); sigc::mem_fun(*this, &GWorkArea::onKeyPress));
workArea_.signal_motion_notify_event().connect( workArea_.signal_motion_notify_event().connect(
SigC::slot(*this, &GWorkArea::onMotionNotify)); sigc::mem_fun(*this, &GWorkArea::onMotionNotify));
workArea_.show(); workArea_.show();
vscrollbar_.get_adjustment()->signal_value_changed().connect( vscrollbar_.get_adjustment()->signal_value_changed().connect(
SigC::slot(*this, &GWorkArea::onScroll)); sigc::mem_fun(*this, &GWorkArea::onScroll));
workArea_.signal_scroll_event().connect( workArea_.signal_scroll_event().connect(
SigC::slot(*this, &GWorkArea::onScrollWheel)); sigc::mem_fun(*this, &GWorkArea::onScrollWheel));
vscrollbar_.show(); vscrollbar_.show();
hbox_.children().push_back(Gtk::Box_Helpers::Element(workArea_)); hbox_.children().push_back(Gtk::Box_Helpers::Element(workArea_));
hbox_.children().push_back( hbox_.children().push_back(
@ -469,9 +469,9 @@ void GWorkArea::haveSelection(bool toHave) const
std::vector<Gtk::TargetEntry> listTargets; std::vector<Gtk::TargetEntry> listTargets;
listTargets.push_back(Gtk::TargetEntry("UTF8_STRING")); listTargets.push_back(Gtk::TargetEntry("UTF8_STRING"));
clipboard->set(listTargets, clipboard->set(listTargets,
SigC::slot(const_cast<GWorkArea&>(*this), sigc::mem_fun(const_cast<GWorkArea&>(*this),
&GWorkArea::onClipboardGet), &GWorkArea::onClipboardGet),
SigC::slot(const_cast<GWorkArea&>(*this), sigc::mem_fun(const_cast<GWorkArea&>(*this),
&GWorkArea::onClipboardClear)); &GWorkArea::onClipboardClear));
} }
} }

View File

@ -55,7 +55,7 @@ private:
}; };
class GWorkArea : public WorkArea, public SigC::Object { class GWorkArea : public WorkArea, public sigc::trackable {
public: public:
GWorkArea(LyXView & owner, int width, int height); GWorkArea(LyXView & owner, int width, int height);
~GWorkArea(); ~GWorkArea();

View File

@ -23,7 +23,7 @@ void GXpmBtnTbl::GXpmBtn::setXpm(XpmData xpm)
pixmap_ = Gdk::Pixmap::create_from_xpm(clrmap, pixmap_ = Gdk::Pixmap::create_from_xpm(clrmap,
mask_, mask_,
xpm); xpm);
Gtk::Image * image = SigC::manage(new Gtk::Image(pixmap_, mask_)); Gtk::Image * image = Gtk::manage(new Gtk::Image(pixmap_, mask_));
image->show(); image->show();
add(*image); add(*image);
} }
@ -34,7 +34,8 @@ void GXpmBtnTbl::GXpmBtn::setXpm(Glib::RefPtr<Gdk::Pixmap> pixmap,
{ {
pixmap_ = pixmap; pixmap_ = pixmap;
mask_ = mask; mask_ = mask;
Gtk::Image * image = SigC::manage(new Gtk::Image(pixmap_, mask_)); Gtk::Image * image =
Gtk::manage(new Gtk::Image(pixmap_, mask_));
image->show(); image->show();
add(*image); add(*image);
} }
@ -74,7 +75,7 @@ void GXpmBtnTbl::construct()
GXpmBtn * btn = &btns_[index(row, col)]; GXpmBtn * btn = &btns_[index(row, col)];
btn->setRow(row); btn->setRow(row);
btn->setCol(col); btn->setCol(col);
btn->signalClicked().connect(signalClicked_.slot()); btn->signalClicked().connect(signalClicked_);
btn->show(); btn->show();
attach(*btn, col, col + 1, row, row + 1); attach(*btn, col, col + 1, row, row + 1);
} }
@ -162,15 +163,12 @@ void GXpmBtnTbl::on_realize()
void buttonSetXpm(Gtk::Button * btn, char const ** xpm) void buttonSetXpm(Gtk::Button * btn, char const ** xpm)
{ {
Glib::RefPtr<Gdk::Bitmap> mask;
Glib::RefPtr<Gdk::Colormap> clrmap = btn->get_colormap(); Glib::RefPtr<Gdk::Colormap> clrmap = btn->get_colormap();
Glib::RefPtr<Gdk::Bitmap> mask;
Glib::RefPtr<Gdk::Pixmap> pixmap = Glib::RefPtr<Gdk::Pixmap> pixmap =
Gdk::Pixmap::create_from_xpm(clrmap, Gdk::Pixmap::create_from_xpm(clrmap, mask, xpm);
mask, Gtk::Image * image = Gtk::manage(new Gtk::Image(pixmap, mask));
xpm);
Gtk::Image * image = SigC::manage(new Gtk::Image(pixmap, mask));
image->show(); image->show();
btn->add(*image); btn->add(*image);
} }

View File

@ -12,14 +12,14 @@
#ifndef XPM_BTN_TBL_H #ifndef XPM_BTN_TBL_H
#define XPM_BTN_TBL_H #define XPM_BTN_TBL_H
#include <boost/scoped_array.hpp> #include <gtkmm.h>
#include <boost/scoped_array.hpp>
class GXpmBtnTbl : public Gtk::Table { class GXpmBtnTbl : public Gtk::Table {
public: public:
typedef char const ** XpmData; typedef char const ** XpmData;
typedef SigC::Signal2<void, int, int> SigType; typedef sigc::signal<void, int, int> SigType;
struct XbmData { struct XbmData {
unsigned char const* data_; unsigned char const* data_;
int width_; int width_;
@ -31,8 +31,7 @@ public:
public: public:
GXpmBtn() : row_(-1), col_(-1) GXpmBtn() : row_(-1), col_(-1)
{ {
signal_clicked().connect( signal_clicked().connect(sigc::mem_fun(*this,
SigC::slot(*this,
&GXpmBtn::onButtonClicked)); &GXpmBtn::onButtonClicked));
} }
void setRow(int row) { row_ = row; } void setRow(int row) { row_ = row; }
@ -79,7 +78,7 @@ private:
int rows_; int rows_;
int cols_; int cols_;
boost::scoped_array<GXpmBtn> btns_; boost::scoped_array<GXpmBtn> btns_;
const XbmData * xbm_; XbmData const * xbm_;
SigType signalClicked_; SigType signalClicked_;
}; };

View File

@ -10,12 +10,12 @@
#include <config.h> #include <config.h>
#include <gtkmm.h>
#include "frontends/LyXScreenFactory.h"
#include "GWorkArea.h" #include "GWorkArea.h"
#include "GScreen.h" #include "GScreen.h"
#include "frontends/LyXScreenFactory.h"
#include <gtkmm.h>
namespace LyXScreenFactory { namespace LyXScreenFactory {

View File

@ -18,7 +18,7 @@ io_callback::io_callback(int fd, boost::function<void()> func)
: func_(func) : func_(func)
{ {
conn_ = Glib::signal_io().connect( conn_ = Glib::signal_io().connect(
SigC::slot(*this, &io_callback::data_received), sigc::mem_fun(*this, &io_callback::data_received),
fd, Glib::IO_IN); fd, Glib::IO_IN);
} }

View File

@ -26,14 +26,14 @@
* connected/read. * connected/read.
* *
*/ */
class io_callback : public SigC::Object { class io_callback : public sigc::trackable {
public: public:
/// connect a connection notification from the LyXServerSocket /// connect a connection notification from the LyXServerSocket
io_callback(int fd, boost::function<void()> func); io_callback(int fd, boost::function<void()> func);
private: private:
bool data_received(Glib::IOCondition); bool data_received(Glib::IOCondition);
/// our notifier /// our notifier
SigC::Connection conn_; sigc::connection conn_;
/// The callback function /// The callback function
boost::function<void()> func_; boost::function<void()> func_;
}; };

View File

@ -10,6 +10,7 @@
#include <config.h> #include <config.h>
#include <gtkmm.h>
#include "xftFontLoader.h" #include "xftFontLoader.h"
#include "FontInfo.h" #include "FontInfo.h"
#include "gettext.h" #include "gettext.h"
@ -24,7 +25,6 @@
#include "support/systemcall.h" #include "support/systemcall.h"
#include "support/filetools.h" #include "support/filetools.h"
#include <gtkmm.h>
#include <X11/Xft/Xft.h> #include <X11/Xft/Xft.h>