Looks like I forgot withdialog.[Ch]. here they are; they go in the insets dir. A
On Tuesday 19 March 2002 3:53 pm, Angus Leeming wrote: > Good! Then the interface is to be: > > LFUN_INSET_PROPERTIES, inset-properties > Inset::toggleDialog(BufferView *) {} > > I'll code it up now. JMarc, here's the patch. It seems to work perfectly. I believe you first mentioned this to me (more than?) a year ago! Perhaps, the ideas just took time to mature? I'll leave this in your tender care. Feel free to do whatever you want to it. Angus
toggle.diff.bz2
Description: BZip2 compressed data
/** * \file withdialog.C * Copyright 2000-2002 the LyX Team * Read the file COPYING * * \author Angus Leeming, [EMAIL PROTECTED] */ #include <config.h> #ifdef __GNUG__ #pragma implementation #endif #include "withdialog.h" #include "frontends/DialogBase.h" withDialog::~withDialog() { hideDialog(); } bool withDialog::connected() const { // Why isn't SigC::Connection::connected() a const method? // How bloody stupid of SigC! SigC::Connection & tmp = const_cast<SigC::Connection &>(connection_); return tmp.connected(); } void withDialog::disconnect() { connection_.disconnect(); } void withDialog::connect(DialogBase & dialog) { connection_ = hideDialog_.connect(SigC::slot(&dialog, &DialogBase::hide)); } void withDialog::hideDialog() { if (connected()) { hideDialog_.emit(); } }
// -*- C++ -*- /** * \file withdialog.h * Copyright 2000-2002 the LyX Team * Read the file COPYING * * \author Angus Leeming, [EMAIL PROTECTED] */ /* All insets with a dialog should derive from this class. * Enables the dialog to be hidden when the inset is deleted. * Also enables the dialog to toggled open and closed in response to an * LFUN request. */ #ifndef WITHDIALOG_H #define WITHDIALOG_H #ifdef __GNUG__ #pragma interface #endif #include <sigc++/signal_system.h> class DialogBase; class BufferView; class withDialog { public: /// If the dialog is connected to the inset, then hide it. virtual ~withDialog(); /// Are the dialog and inset connected? bool connected() const; /** Disconnect the dialog from the inset. * Invoked by the dialog. */ void disconnect(); /** Connect the dialog to the inset. * Invoked by the dialog. */ void connect(DialogBase &); /// Emit the signal to hide the dialog. void hideDialog(); private: /// SigC::Signal0<void> hideDialog_; /// SigC::Connection connection_; }; #endif // WITHDIALOG