add connection objects and assign to them to

work around a bug with some gcc compilers,
RHs 2.96 in particular.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4752 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2002-07-22 20:57:58 +00:00
parent c43fc67eff
commit 92c15c86a5
7 changed files with 218 additions and 170 deletions

View File

@ -118,8 +118,24 @@ extern int bibitemMaxWidth(BufferView *, LyXFont const &);
namespace {
const unsigned int saved_positions_num = 20;
unsigned int const saved_positions_num = 20;
// All the below connection objects are needed because of a bug in some
// versions of GCC (<=2.96 are on the suspects list.) By having and assigning
// to these connections we avoid a segfault upon startup, and also at exit.
// (Lgb)
boost::signals::connection timecon;
boost::signals::connection doccon;
boost::signals::connection resizecon;
boost::signals::connection bpresscon;
boost::signals::connection breleasecon;
boost::signals::connection motioncon;
boost::signals::connection doublecon;
boost::signals::connection triplecon;
boost::signals::connection kpresscon;
boost::signals::connection selectioncon;
boost::signals::connection lostcon;
} // anon namespace
@ -133,27 +149,27 @@ BufferView::Pimpl::Pimpl(BufferView * b, LyXView * o,
screen_.reset(LyXScreenFactory::create(workarea()));
// Setup the signals
workarea().scrollDocView.connect(boost::bind(&BufferView::Pimpl::scrollDocView, this, _1));
workarea().workAreaResize
doccon = workarea().scrollDocView.connect(boost::bind(&BufferView::Pimpl::scrollDocView, this, _1));
resizecon = workarea().workAreaResize
.connect(boost::bind(&BufferView::Pimpl::workAreaResize, this));
workarea().workAreaButtonPress
bpresscon = workarea().workAreaButtonPress
.connect(boost::bind(&BufferView::Pimpl::workAreaButtonPress, this, _1, _2, _3));
workarea().workAreaButtonRelease
breleasecon = workarea().workAreaButtonRelease
.connect(boost::bind(&BufferView::Pimpl::workAreaButtonRelease, this, _1, _2, _3));
workarea().workAreaMotionNotify
motioncon = workarea().workAreaMotionNotify
.connect(boost::bind(&BufferView::Pimpl::workAreaMotionNotify, this, _1, _2, _3));
workarea().workAreaDoubleClick
doublecon = workarea().workAreaDoubleClick
.connect(boost::bind(&BufferView::Pimpl::doubleClick, this, _1, _2, _3));
workarea().workAreaTripleClick
triplecon = workarea().workAreaTripleClick
.connect(boost::bind(&BufferView::Pimpl::tripleClick, this, _1, _2, _3));
workarea().workAreaKeyPress
kpresscon = workarea().workAreaKeyPress
.connect(boost::bind(&BufferView::Pimpl::workAreaKeyPress, this, _1, _2));
workarea().selectionRequested
selectioncon = workarea().selectionRequested
.connect(boost::bind(&BufferView::Pimpl::selectionRequested, this));
workarea().selectionLost
lostcon = workarea().selectionLost
.connect(boost::bind(&BufferView::Pimpl::selectionLost, this));
cursor_timeout.timeout.connect(boost::bind(&BufferView::Pimpl::cursorToggle, this));
timecon = cursor_timeout.timeout.connect(boost::bind(&BufferView::Pimpl::cursorToggle, this));
cursor_timeout.start();
saved_positions.resize(saved_positions_num);
}

View File

@ -1,3 +1,8 @@
2002-07-22 Lars Gullik Bjønnes <larsbj@birdstep.com>
* BufferView_pimpl.C: add connection objects and use them...
(Pimpl): here.
2002-07-22 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* MenuBackend.C (expandLastfiles):

View File

@ -1,3 +1,12 @@
2002-07-22 Lars Gullik Bjønnes <larsbj@birdstep.com>
* XMiniBuffer.h: add connection objects, and use them
* XMiniBuffer.C (XMiniBuffer): here and
(dd_init): here
* XFormsView.h: add connection objects, use them
* XFormsView.C (XFormsView): here
2002-07-22 John Levon <moz@compsoc.man.ac.uk>
* XFormsView.C: don't call toolbar_->set()

View File

@ -35,7 +35,7 @@
#include "BufferView.h"
#include <boost/bind.hpp>
#include <boost/signals/connection.hpp>
using std::abs;
using std::endl;
@ -62,12 +62,12 @@ XFormsView::XFormsView(int width, int height)
create_form_form_main(*getDialogs(), width, height);
fl_set_form_atclose(getForm(), C_XFormsView_atCloseMainFormCB, 0);
view_state_changed.connect(boost::bind(&XFormsView::show_view_state, this));
focus_command_buffer.connect(boost::bind(&XMiniBuffer::focus, minibuffer_.get()));
view_state_con = view_state_changed.connect(boost::bind(&XFormsView::show_view_state, this));
focus_con = focus_command_buffer.connect(boost::bind(&XMiniBuffer::focus, minibuffer_.get()));
// Make sure the buttons are disabled if needed.
updateToolbar();
getDialogs()->redrawGUI.connect(boost::bind(&XFormsView::redraw, this));
redraw_con = getDialogs()->redrawGUI.connect(boost::bind(&XFormsView::redraw, this));
}

View File

@ -73,6 +73,13 @@ private:
void create_form_form_main(Dialogs & d, int width, int height);
/// the minibuffer
boost::scoped_ptr<XMiniBuffer> minibuffer_;
///
boost::signals::connection view_state_con;
///
boost::signals::connection focus_con;
///
boost::signals::connection redraw_con;
/// the main form.
FL_FORM * form_;
};

View File

@ -44,24 +44,24 @@ XMiniBuffer::XMiniBuffer(XFormsView * v, ControlCommandBuffer & control,
input_obj_ = create_input_box(FL_NORMAL_INPUT, x, y, h, w);
info_timer_.reset(new Timeout(1500));
idle_timer_.reset(new Timeout(6000));
info_timer_->timeout.connect(boost::bind(&XMiniBuffer::info_timeout, this));
idle_timer_->timeout.connect(boost::bind(&XMiniBuffer::idle_timeout, this));
info_con = info_timer_->timeout.connect(boost::bind(&XMiniBuffer::info_timeout, this));
idle_con = idle_timer_->timeout.connect(boost::bind(&XMiniBuffer::idle_timeout, this));
idle_timer_->start();
messageMode();
}
// This is here so that scoped ptr will not require a complete type.
XMiniBuffer::~XMiniBuffer()
{}
// thanks for nothing, xforms (recursive creation not allowed)
void XMiniBuffer::dd_init()
{
dropdown_.reset(new DropDown(the_buffer_));
dropdown_->result.connect(boost::bind(&XMiniBuffer::set_complete_input, this, _1));
dropdown_->keypress.connect(boost::bind(&XMiniBuffer::append_char, this, _1));
}
XMiniBuffer::~XMiniBuffer()
{
result_con = dropdown_->result.connect(boost::bind(&XMiniBuffer::set_complete_input, this, _1));
keypress_con = dropdown_->keypress.connect(boost::bind(&XMiniBuffer::append_char, this, _1));
}

View File

@ -15,6 +15,7 @@
#include FORMS_H_LOCATION
#include <boost/scoped_ptr.hpp>
#include <boost/signals/connection.hpp>
#ifdef __GNUG__
#pragma interface
@ -27,9 +28,11 @@ class Timeout;
/// in xforms, the minibuffer is both a status bar and a command buffer
class XMiniBuffer {
public:
///
XMiniBuffer(XFormsView * o, ControlCommandBuffer & control,
FL_Coord x, FL_Coord y, FL_Coord h, FL_Coord w);
///
~XMiniBuffer();
/// create drop down
@ -50,7 +53,7 @@ public:
/// disable event management
void freeze();
protected:
private:
/// Are we in editing mode?
bool isEditingMode() const;
@ -90,6 +93,14 @@ protected:
/// idle timer
boost::scoped_ptr<Timeout> idle_timer_;
///
boost::signals::connection info_con;
///
boost::signals::connection idle_con;
///
boost::signals::connection result_con;
///
boost::signals::connection keypress_con;
/// This is the input widget object
FL_OBJECT * the_buffer_;