On Tue, Oct 02, 2007 at 12:04:13AM +0200, Andre Poenitz wrote: > The attached patch replaces the signal/slot connections between Buffer > and BufferView to LyXView by ordinary delegates.
Updated patch after Abdel's ToolBar work attached. And just for fun a list of winners and losers: -31423 ../../src/frontends/controllers/ControlCo -31328 ../../src/Font.cpp -30754 ../../src/mathed/InsetMathRef.cpp -29555 ../../src/frontends/qt4/Dialogs.cpp -29038 ../../src/frontends/controllers/ControlSp -28894 ../../src/insets/InsetNote.cpp -28819 ../../src/insets/InsetCommandParams.cpp -28819 ../../src/output_docbook.cpp -28541 ../../src/mathed/InsetMathSplit.cpp -27673 ../../src/frontends/controllers/ButtonPol -27672 ../../src/graphics/GraphicsImage.cpp -27440 ../../src/Bullet.cpp -27440 ../../src/insets/InsetSpecialChar.cpp -27343 ../../src/insets/InsetInclude.cpp -26414 ../../src/frontends/controllers/ControlCi -26409 ../../src/frontends/controllers/ControlSe -26320 ../../src/mathed/InsetMathDFrac.cpp -26318 ../../src/mathed/InsetMathUnderset.cpp -26273 ../../src/frontends/controllers/ControlTa -26270 ../../src/frontends/controllers/ControlDo -26270 ../../src/frontends/controllers/ControlTo -26101 ../../src/frontends/controllers/ControlGr -26101 ../../src/insets/InsetBranch.cpp -26101 ../../src/insets/InsetERT.cpp -26083 ../../src/BufferView.cpp -26075 ../../src/insets/InsetHFill.cpp -26071 ../../src/insets/InsetGraphics.cpp -25968 ../../src/insets/RenderButton.cpp -25955 ../../src/Length.cpp -25955 ../../src/rowpainter.cpp -25932 ../../src/insets/InsetFoot.cpp -25925 ../../src/sgml.cpp -25762 ../../src/Importer.cpp -25733 ../../src/frontends/qt4/GuiToc.cpp -25176 ../../src/Variables.cpp -25165 ../../src/frontends/controllers/ControlTe -24842 ../../src/insets/InsetBibtex.cpp -24842 ../../src/insets/InsetFloatList.cpp -24842 ../../src/insets/InsetGraphicsParams.cpp -24836 ../../src/insets/Inset.cpp -24824 ../../src/Spacing.cpp -24750 ../../src/mathed/MathExtern.cpp -24748 ../../src/Intl.cpp -24745 ../../src/insets/ExternalSupport.cpp -24745 ../../src/insets/InsetIndex.cpp -24745 ../../src/insets/InsetPagebreak.cpp -24745 ../../src/insets/InsetTabular.cpp -24744 ../../src/insets/InsetNomencl.cpp -24739 ../../src/mathed/InsetMath.cpp -24739 ../../src/mathed/InsetMathSize.cpp -24738 ../../src/mathed/InsetMathColor.cpp -24728 ../../src/InsetList.cpp -24727 ../../src/insets/InsetExternal.cpp -24668 ../../src/insets/InsetCollapsable.cpp -24529 ../../src/insets/MailInset.cpp -24371 ../../src/factory.cpp -24371 ../../src/Lexer.cpp -23717 ../../src/MenuBackend.cpp -23626 ../../src/frontends/controllers/ControlBi -23597 ../../src/frontends/controllers/ControlVi -23509 ../../src/Server.cpp -23506 ../../src/InsetIterator.cpp -23506 ../../src/insets/InsetListings.cpp -23506 ../../src/insets/RenderPreview.cpp -23494 ../../src/lyxfind.cpp -23492 ../../src/Mover.cpp -23485 ../../src/callback.cpp -23303 ../../src/version.cpp -20265 ../../src/PDFOptions.cpp -19342 ../../src/CutAndPaste.cpp -19118 ../../src/insets/InsetCommand.cpp -19114 ../../src/insets/InsetLabel.cpp -19059 ../../src/insets/RenderGraphic.cpp -18911 ../../src/VSpace.cpp -18193 ../../src/frontends/qt4/GuiCommandEdit.cp -18026 ../../src/frontends/controllers/ControlMa -17822 ../../src/LyX.cpp -17808 ../../src/Layout.cpp -17799 ../../src/ServerSocket.cpp -17782 ../../src/LaTeXFeatures.cpp -17774 ../../src/BiblioInfo.cpp -17652 ../../src/frontends/qt4/GuiEmbeddedFiles. -17643 ../../src/Text2.cpp -14884 ../../src/Counters.cpp -14822 ../../src/frontends/controllers/ControlBo -13726 ../../src/frontends/qt4/Validator.cpp -11039 ../../src/TexRow.cpp -9511 ../../src/frontends/qt4/GuiSelectionManag -9490 ../../src/frontends/qt4/GuiNote.cpp -9487 ../../src/frontends/qt4/GuiCitation.cpp -9477 ../../src/Exporter.cpp -9473 ../../src/frontends/controllers/ControlRe -9463 ../../src/frontends/Application.cpp -9442 ../../src/frontends/qt4/GuiBibitem.cpp -6908 ../../src/mathed/MathData.cpp -3812 ../../src/mathed/InsetMathSubstack.cpp -3605 ../../src/mathed/InsetMathArray.cpp -1122 ../../src/mathed/InsetMathEnv.cpp -324 ../../src/mathed/InsetMathRoot.cpp -227 ../../src/mathed/InsetMathBig.cpp -6 ../../src/mathed/MathFactory.cpp -2 ../../src/Bidi.cpp -2 ../../src/frontends/qt4/ColorCache.cpp 0 ../../boost/1.cpp 0 ../../boost/libs/filesystem/src/exception 0 ../../boost/libs/filesystem/src/operation 0 ../../boost/libs/filesystem/src/path.cpp 0 ../../boost/libs/filesystem/src/portabili 0 ../../boost/libs/iostreams/src/file_descr 0 ../../boost/libs/iostreams/src/mapped_fil 0 ../../boost/libs/iostreams/src/zlib.cpp 0 ../../boost/libs/regex/src/cpp_regex_trai 0 ../../boost/libs/regex/src/cregex.cpp 0 ../../boost/libs/regex/src/c_regex_traits 0 ../../boost/libs/regex/src/fileiter.cpp 0 ../../boost/libs/regex/src/instances.cpp 0 ../../boost/libs/regex/src/posix_api.cpp 0 ../../boost/libs/regex/src/regex.cpp 0 ../../boost/libs/regex/src/regex_debug.cp 0 ../../boost/libs/regex/src/regex_raw_buff 0 ../../boost/libs/regex/src/regex_traits_d 0 ../../boost/libs/regex/src/w32_regex_trai 0 ../../boost/libs/regex/src/wide_posix_api 0 ../../boost/libs/regex/src/winstances.cpp 0 ../../boost/libs/signals/src/connection.c 0 ../../boost/libs/signals/src/named_slot_m 0 ../../boost/libs/signals/src/signal_base. 0 ../../boost/libs/signals/src/slot.cpp 0 ../../boost/libs/signals/src/trackable.cp 0 ../../boost/lyxboost.cpp 0 ../../development/cmake/src/dummy.cpp 0 ../../src/ASpell.cpp 0 ../../src/Author.cpp 0 ../../src/boost.cpp 0 ../../src/BranchList.cpp 0 ../../src/buffer_funcs.cpp 0 ../../src/BufferList.cpp 0 ../../src/BufferParams.cpp 0 ../../src/Changes.cpp 0 ../../src/Chktex.cpp 0 ../../src/client/boost.cpp 0 ../../src/client/client.cpp 0 ../../src/client/debug.cpp 0 ../../src/client/gettext.cpp 0 ../../src/client/Messages.cpp 0 ../../src/Color.cpp 0 ../../src/ConverterCache.cpp 0 ../../src/CoordCache.cpp 0 ../../src/Cursor.cpp 0 ../../src/CursorSlice.cpp 0 ../../src/debug.cpp 0 ../../src/DepTable.cpp 0 ../../src/Dimension.cpp 0 ../../src/DocIterator.cpp 0 ../../src/EmbeddedFiles.cpp 0 ../../src/Encoding.cpp 0 ../../src/ErrorList.cpp 0 ../../src/Floating.cpp 0 ../../src/FloatList.cpp 0 ../../src/FontIterator.cpp 0 ../../src/Format.cpp 0 ../../src/frontends/alert.cpp 0 ../../src/frontends/controllers/ControlCh 0 ../../src/frontends/controllers/ControlCo 0 ../../src/frontends/controllers/ControlEm 0 ../../src/frontends/controllers/ControlEr 0 ../../src/frontends/controllers/ControlER 0 ../../src/frontends/controllers/ControlEx 0 ../../src/frontends/controllers/ControlFl 0 ../../src/frontends/controllers/ControlIn 0 ../../src/frontends/controllers/ControlLi 0 ../../src/frontends/controllers/ControlLo 0 ../../src/frontends/controllers/ControlNo 0 ../../src/frontends/controllers/ControlPa 0 ../../src/frontends/controllers/ControlPr 0 ../../src/frontends/controllers/ControlPr 0 ../../src/frontends/controllers/ControlSe 0 ../../src/frontends/controllers/ControlSh 0 ../../src/frontends/controllers/ControlTa 0 ../../src/frontends/controllers/ControlTh 0 ../../src/frontends/controllers/ControlVS 0 ../../src/frontends/controllers/Dialog.cp 0 ../../src/frontends/controllers/tests/bib 0 ../../src/frontends/controllers/tests/boo 0 ../../src/frontends/Painter.cpp 0 ../../src/frontends/qt4/Action.cpp 0 ../../src/frontends/qt4/alert_pimpl.cpp 0 ../../src/frontends/qt4/ButtonController. 0 ../../src/frontends/qt4/EmptyTable.cpp 0 ../../src/frontends/qt4/FileDialog.cpp 0 ../../src/frontends/qt4/FloatPlacement.cp 0 ../../src/frontends/qt4/GuiAbout.cpp 0 ../../src/frontends/qt4/GuiApplication.cp 0 ../../src/frontends/qt4/GuiBibtex.cpp 0 ../../src/frontends/qt4/GuiBox.cpp 0 ../../src/frontends/qt4/GuiBranch.cpp 0 ../../src/frontends/qt4/GuiBranches.cpp 0 ../../src/frontends/qt4/GuiChanges.cpp 0 ../../src/frontends/qt4/GuiCharacter.cpp 0 ../../src/frontends/qt4/GuiClipboard.cpp 0 ../../src/frontends/qt4/GuiCommandBuffer. 0 ../../src/frontends/qt4/GuiDelimiter.cpp 0 ../../src/frontends/qt4/GuiDialog.cpp 0 ../../src/frontends/qt4/GuiErrorList.cpp 0 ../../src/frontends/qt4/GuiERT.cpp 0 ../../src/frontends/qt4/GuiExternal.cpp 0 ../../src/frontends/qt4/GuiFloat.cpp 0 ../../src/frontends/qt4/GuiFontExample.cp 0 ../../src/frontends/qt4/GuiFontLoader.cpp 0 ../../src/frontends/qt4/GuiFontMetrics.cp 0 ../../src/frontends/qt4/GuiGraphics.cpp 0 ../../src/frontends/qt4/GuiImage.cpp 0 ../../src/frontends/qt4/GuiImplementation 0 ../../src/frontends/qt4/GuiIndex.cpp 0 ../../src/frontends/qt4/GuiKeySymbol.cpp 0 ../../src/frontends/qt4/GuiListings.cpp 0 ../../src/frontends/qt4/GuiLog.cpp 0 ../../src/frontends/qt4/GuiMathMatrix.cpp 0 ../../src/frontends/qt4/GuiMenubar.cpp 0 ../../src/frontends/qt4/GuiNomencl.cpp 0 ../../src/frontends/qt4/GuiPopupMenu.cpp 0 ../../src/frontends/qt4/GuiPrefs.cpp 0 ../../src/frontends/qt4/GuiPrint.cpp 0 ../../src/frontends/qt4/GuiRef.cpp 0 ../../src/frontends/qt4/GuiSelection.cpp 0 ../../src/frontends/qt4/GuiSendto.cpp 0 ../../src/frontends/qt4/GuiSetBorder.cpp 0 ../../src/frontends/qt4/GuiShowFile.cpp 0 ../../src/frontends/qt4/GuiSpellchecker.c 0 ../../src/frontends/qt4/GuiTabular.cpp 0 ../../src/frontends/qt4/GuiTabularCreate. 0 ../../src/frontends/qt4/GuiThesaurus.cpp 0 ../../src/frontends/qt4/GuiToolbar.cpp 0 ../../src/frontends/qt4/GuiURL.cpp 0 ../../src/frontends/qt4/GuiView.cpp 0 ../../src/frontends/qt4/GuiViewSource.cpp 0 ../../src/frontends/qt4/GuiVSpace.cpp 0 ../../src/frontends/qt4/GuiWrap.cpp 0 ../../src/frontends/qt4/IconPalette.cpp 0 ../../src/frontends/qt4/InsertTableWidget 0 ../../src/frontends/qt4/LengthCombo.cpp 0 ../../src/frontends/qt4/LyXFileDialog.cpp 0 ../../src/frontends/qt4/TocModel.cpp 0 ../../src/frontends/qt4/TocWidget.cpp 0 ../../src/frontends/Toolbars.cpp 0 ../../src/FuncRequest.cpp 0 ../../src/FuncStatus.cpp 0 ../../src/gettext.cpp 0 ../../src/Graph.cpp 0 ../../src/graphics/GraphicsCache.cpp 0 ../../src/graphics/GraphicsCacheItem.cpp 0 ../../src/graphics/GraphicsConverter.cpp 0 ../../src/graphics/GraphicsLoader.cpp 0 ../../src/graphics/GraphicsParams.cpp 0 ../../src/graphics/GraphicsTypes.cpp 0 ../../src/graphics/PreviewImage.cpp 0 ../../src/graphics/Previews.cpp 0 ../../src/insets/ExternalTemplate.cpp 0 ../../src/insets/ExternalTransforms.cpp 0 ../../src/insets/InsetBibitem.cpp 0 ../../src/insets/InsetCaption.cpp 0 ../../src/insets/InsetCitation.cpp 0 ../../src/insets/InsetEnvironment.cpp 0 ../../src/insets/InsetFlex.cpp 0 ../../src/insets/InsetFloat.cpp 0 ../../src/insets/InsetFootlike.cpp 0 ../../src/insets/InsetListingsParams.cpp 0 ../../src/insets/InsetMarginal.cpp 0 ../../src/insets/InsetOptArg.cpp 0 ../../src/insets/InsetSpace.cpp 0 ../../src/insets/InsetText.cpp 0 ../../src/insets/InsetTheorem.cpp 0 ../../src/insets/InsetUrl.cpp 0 ../../src/insets/InsetVSpace.cpp 0 ../../src/insets/InsetWrap.cpp 0 ../../src/ISpell.cpp 0 ../../src/KeyMap.cpp 0 ../../src/KeySequence.cpp 0 ../../src/Language.cpp 0 ../../src/lengthcommon.cpp 0 ../../src/LyXAction.cpp 0 ../../src/LyXFunc.cpp 0 ../../src/LyXRC.cpp 0 ../../src/LyXVC.cpp 0 ../../src/main.cpp 0 ../../src/mathed/CommandInset.cpp 0 ../../src/mathed/InsetFormulaMacro.cpp 0 ../../src/mathed/InsetMathAMSArray.cpp 0 ../../src/mathed/InsetMathBinom.cpp 0 ../../src/mathed/InsetMathBoldSymbol.cpp 0 ../../src/mathed/InsetMathBox.cpp 0 ../../src/mathed/InsetMathBoxed.cpp 0 ../../src/mathed/InsetMathBrace.cpp 0 ../../src/mathed/InsetMathCases.cpp 0 ../../src/mathed/InsetMathChar.cpp 0 ../../src/mathed/InsetMathComment.cpp 0 ../../src/mathed/InsetMathDecoration.cpp 0 ../../src/mathed/InsetMathDiff.cpp 0 ../../src/mathed/InsetMathDots.cpp 0 ../../src/mathed/InsetMathExFunc.cpp 0 ../../src/mathed/InsetMathFBox.cpp 0 ../../src/mathed/InsetMathFont.cpp 0 ../../src/mathed/InsetMathFontOld.cpp 0 ../../src/mathed/InsetMathFracBase.cpp 0 ../../src/mathed/InsetMathFrac.cpp 0 ../../src/mathed/InsetMathFrameBox.cpp 0 ../../src/mathed/InsetMathGrid.cpp 0 ../../src/mathed/InsetMathHull.cpp 0 ../../src/mathed/InsetMathKern.cpp 0 ../../src/mathed/InsetMathLefteqn.cpp 0 ../../src/mathed/InsetMathLim.cpp 0 ../../src/mathed/InsetMathMakebox.cpp 0 ../../src/mathed/InsetMathMatrix.cpp 0 ../../src/mathed/InsetMathMBox.cpp 0 ../../src/mathed/InsetMathNest.cpp 0 ../../src/mathed/InsetMathNumber.cpp 0 ../../src/mathed/InsetMathOverset.cpp 0 ../../src/mathed/InsetMathPar.cpp 0 ../../src/mathed/InsetMathPhantom.cpp 0 ../../src/mathed/InsetMathScript.cpp 0 ../../src/mathed/InsetMathSpace.cpp 0 ../../src/mathed/InsetMathSqrt.cpp 0 ../../src/mathed/InsetMathStackrel.cpp 0 ../../src/mathed/InsetMathSymbol.cpp 0 ../../src/mathed/InsetMathTabular.cpp 0 ../../src/mathed/InsetMathTFrac.cpp 0 ../../src/mathed/InsetMathUnknown.cpp 0 ../../src/mathed/InsetMathXArrow.cpp 0 ../../src/mathed/InsetMathXYArrow.cpp 0 ../../src/mathed/InsetMathXYMatrix.cpp 0 ../../src/mathed/MacroTable.cpp 0 ../../src/mathed/MathAtom.cpp 0 ../../src/mathed/MathMacroArgument.cpp 0 ../../src/mathed/MathMacro.cpp 0 ../../src/mathed/MathMacroTemplate.cpp 0 ../../src/mathed/MathParser.cpp 0 ../../src/mathed/MathStream.cpp 0 ../../src/mathed/TextPainter.cpp 0 ../../src/Messages.cpp 0 ../../src/MetricsInfo.cpp 0 ../../src/ModuleList.cpp 0 ../../src/output.cpp 0 ../../src/output_latex.cpp 0 ../../src/OutputParams.cpp 0 ../../src/output_plaintext.cpp 0 ../../src/Paragraph.cpp 0 ../../src/paragraph_funcs.cpp 0 ../../src/ParagraphMetrics.cpp 0 ../../src/ParagraphParameters.cpp 0 ../../src/ParIterator.cpp 0 ../../src/PrinterParams.cpp 0 ../../src/PSpell.cpp 0 ../../src/Row.cpp 0 ../../src/Section.cpp 0 ../../src/Session.cpp 0 ../../src/SpellBase.cpp 0 ../../src/support/abort.cpp 0 ../../src/support/chdir.cpp 0 ../../src/support/convert.cpp 0 ../../src/support/copy.cpp 0 ../../src/support/docstream.cpp 0 ../../src/support/docstring.cpp 0 ../../src/support/environment.cpp 0 ../../src/support/FileFilterList.cpp 0 ../../src/support/FileMonitor.cpp 0 ../../src/support/FileName.cpp 0 ../../src/support/filetools.cpp 0 ../../src/support/Forkedcall.cpp 0 ../../src/support/ForkedCallQueue.cpp 0 ../../src/support/ForkedcallsController.c 0 ../../src/support/fs_extras.cpp 0 ../../src/support/getcwd.cpp 0 ../../src/support/gzstream.cpp 0 ../../src/support/kill.cpp 0 ../../src/support/lstrings.cpp 0 ../../src/support/lyxsum.cpp 0 ../../src/support/lyxtime.cpp 0 ../../src/support/minizip/zipunzip.cpp 0 ../../src/support/mkdir.cpp 0 ../../src/support/os.cpp 0 ../../src/support/os_cygwin.cpp 0 ../../src/support/os_unix.cpp 0 ../../src/support/os_win32.cpp 0 ../../src/support/Package.cpp 0 ../../src/support/Path.cpp 0 ../../src/support/qstring_helpers.cpp 0 ../../src/support/rename.cpp 0 ../../src/support/socktools.cpp 0 ../../src/support/Systemcall.cpp 0 ../../src/support/tempname.cpp 0 ../../src/support/tests/boost.cpp 0 ../../src/support/tests/check_convert.cpp 0 ../../src/support/tests/check_filetools.c 0 ../../src/support/tests/check_lstrings.cp 0 ../../src/support/textutils.cpp 0 ../../src/support/Timeout.cpp 0 ../../src/support/unicode.cpp 0 ../../src/support/unlink.cpp 0 ../../src/support/userinfo.cpp 0 ../../src/tex2lyx/boost.cpp 0 ../../src/tex2lyx/Context.cpp 0 ../../src/tex2lyx/Font.cpp 0 ../../src/tex2lyx/gettext.cpp 0 ../../src/tex2lyx/lengthcommon.cpp 0 ../../src/tex2lyx/math.cpp 0 ../../src/tex2lyx/Parser.cpp 0 ../../src/tex2lyx/preamble.cpp 0 ../../src/tex2lyx/table.cpp 0 ../../src/tex2lyx/tex2lyx.cpp 0 ../../src/tex2lyx/text.cpp 0 ../../src/Text3.cpp 0 ../../src/TextClass.cpp 0 ../../src/TextClassList.cpp 0 ../../src/Text.cpp 0 ../../src/TextMetrics.cpp 0 ../../src/Thesaurus.cpp 0 ../../src/TocBackend.cpp 0 ../../src/ToolbarBackend.cpp 0 ../../src/Trans.cpp 0 ../../src/Undo.cpp 0 ../../src/VCBackend.cpp 2 ../../src/insets/InsetRef.cpp 6 ../../src/graphics/LoaderQueue.cpp 6 ../../src/graphics/PreviewLoader.cpp 6 ../../src/insets/InsetLine.cpp 8 ../../src/insets/InsetQuotes.cpp 14 ../../src/insets/InsetNewline.cpp 16 ../../src/insets/InsetBox.cpp 18 ../../src/Buffer.cpp 18 ../../src/insets/InsetTOC.cpp 23 ../../src/mathed/InsetMathString.cpp 24 ../../src/frontends/qt4/GuiInclude.cpp 24 ../../src/frontends/qt4/GuiSearch.cpp 24 ../../src/frontends/qt4/GuiTexinfo.cpp 31 ../../src/frontends/qt4/GuiPainter.cpp 32 ../../src/frontends/Dialogs.cpp 32 ../../src/frontends/qt4/qt_helpers.cpp 51 ../../src/frontends/LyXView.cpp 58 ../../src/frontends/WorkArea.cpp 66 ../../src/frontends/qt4/PanelStack.cpp 71 ../../src/frontends/controllers/ControlCh 71 ../../src/frontends/qt4/GuiDocument.cpp 74 ../../src/frontends/controllers/frontend_ 78 ../../src/Box.cpp 78 ../../src/LaTeX.cpp 87 ../../src/frontends/controllers/ControlBr 88 ../../src/frontends/controllers/ControlWr 97 ../../src/frontends/qt4/BulletsModule.cpp 103 ../../src/frontends/qt4/GuiParagraph.cpp 109 ../../src/Converter.cpp 166 ../../src/TexStream.cpp 569 ../../src/mathed/InsetMathDelim.cpp 1493 ../../src/mathed/InsetMathExInt.cpp 7203 ../../src/mathed/MathAutoCorrect.cpp 10348 ../../src/mathed/MathSupport.cpp Results are not exact as they also contain today's other changes.
Index: Delegates.h =================================================================== --- Delegates.h (revision 0) +++ Delegates.h (revision 0) @@ -0,0 +1,79 @@ +// -*- C++ -*- +/** + * \file Delegates.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author André Pönitz + * + * Full author contact details are available in file CREDITS. + */ + +#ifndef DELEGATES_H +#define DELEGATES_H + +#include "support/docstring.h" + +namespace lyx { + +class Buffer; +class Inset; + +namespace frontend { + +class GuiBufferViewDelegate +{ +public: + virtual ~GuiBufferViewDelegate() {} + + /// This function is called when some message shows up. + virtual void message(docstring const & msg) = 0; + + /// This function is called when some dialog needs to be shown. + virtual void showDialog(std::string const & name) = 0; + + /// This function is called when some dialog needs to be shown with + /// some data. + virtual void showDialogWithData(std::string const & name, + std::string const & data) = 0; + + /// This function is called when some inset dialogs needs to be shown. + virtual void showInsetDialog(std::string const & name, + std::string const & data, Inset * inset) = 0; + + /// This function is called when some dialogs needs to be updated. + virtual void updateDialog(std::string const & name, + std::string const & data) = 0; +}; + + +class GuiBufferDelegate +{ +public: + virtual ~GuiBufferDelegate() {} + /// This function is called when the buffer is changed. + virtual void changed() = 0; + /// This function is called when the buffer structure is changed. + virtual void structureChanged() = 0; + /// This function is called when an embedded file is changed + virtual void embeddingChanged() = 0; + /// This function is called when some parsing error shows up. + virtual void errors(std::string const &) = 0; + /// This function is called when some message shows up. + virtual void message(docstring const &) = 0; + /// This function is called when the buffer busy status change. + virtual void busy(bool) = 0; + /// This function is called when the buffer readonly status change. + virtual void readonly(bool) = 0; + /// Update window titles of all users. + virtual void updateTitles() = 0; + /// Reset autosave timers for all users. + virtual void resetAutosaveTimers() = 0; + /// This signal is emitting if the buffer is being closed. + virtual void closing(Buffer *) = 0; +}; + +} // namespace frontend +} // namespace lyx + +#endif Index: LyXView.cpp =================================================================== --- LyXView.cpp (revision 20648) +++ LyXView.cpp (working copy) @@ -163,87 +163,35 @@ void LyXView::connectBuffer(Buffer & buf) { - if (errorsConnection_.connected()) - disconnectBuffer(); - - bufferStructureChangedConnection_ = - buf.getMasterBuffer()->structureChanged.connect( - boost::bind(&LyXView::updateToc, this)); - - bufferEmbeddingChangedConnection_ = - buf.embeddingChanged.connect( - boost::bind(&LyXView::updateEmbeddedFiles, this)); - - errorsConnection_ = - buf.errors.connect( - boost::bind(&LyXView::showErrorList, this, _1)); - - messageConnection_ = - buf.message.connect( - boost::bind(&LyXView::message, this, _1)); - - busyConnection_ = - buf.busy.connect( - boost::bind(&LyXView::busy, this, _1)); - - titleConnection_ = - buf.updateTitles.connect( - boost::bind(&LyXView::updateWindowTitle, this)); - - timerConnection_ = - buf.resetAutosaveTimers.connect( - boost::bind(&LyXView::resetAutosaveTimer, this)); - - readonlyConnection_ = - buf.readonly.connect( - boost::bind(&LyXView::showReadonly, this, _1)); + buf.setGuiDelegate(this); } void LyXView::disconnectBuffer() { - errorsConnection_.disconnect(); - bufferStructureChangedConnection_.disconnect(); - bufferEmbeddingChangedConnection_.disconnect(); - messageConnection_.disconnect(); - busyConnection_.disconnect(); - titleConnection_.disconnect(); - timerConnection_.disconnect(); - readonlyConnection_.disconnect(); + if (WorkArea * work_area = currentWorkArea()) + work_area->bufferView().setGuiDelegate(0); } void LyXView::connectBufferView(BufferView & bv) { - message_connection_ = bv.message.connect( - boost::bind(&LyXView::message, this, _1)); - show_dialog_connection_ = bv.showDialog.connect( - boost::bind(&LyXView::showDialog, this, _1)); - show_dialog_with_data_connection_ = bv.showDialogWithData.connect( - boost::bind(&LyXView::showDialogWithData, this, _1, _2)); - show_inset_dialog_connection_ = bv.showInsetDialog.connect( - boost::bind(&LyXView::showInsetDialog, this, _1, _2, _3)); - update_dialog_connection_ = bv.updateDialog.connect( - boost::bind(&LyXView::updateDialog, this, _1, _2)); + bv.setGuiDelegate(this); } void LyXView::disconnectBufferView() { - message_connection_.disconnect(); - show_dialog_connection_.disconnect(); - show_dialog_with_data_connection_.disconnect(); - show_inset_dialog_connection_.disconnect(); - update_dialog_connection_.disconnect(); + if (WorkArea * work_area = currentWorkArea()) + work_area->bufferView().setGuiDelegate(0); } void LyXView::showErrorList(string const & error_type) { ErrorList & el = buffer()->errorList(error_type); - if (!el.empty()) { + if (!el.empty()) getDialogs().show("errorlist", error_type); - } } @@ -367,5 +315,20 @@ } + +void LyXView::changed() +{ + if (WorkArea * wa = currentWorkArea()) + wa->redraw(); +} + + +void LyXView::closing(Buffer *) +{ + if (WorkArea * wa = currentWorkArea()) + removeWorkArea(wa); +} + + } // namespace frontend } // namespace lyx Index: WorkArea.cpp =================================================================== --- WorkArea.cpp (revision 20648) +++ WorkArea.cpp (working copy) @@ -72,38 +72,16 @@ timecon = cursor_timeout_.timeout .connect(boost::bind(&WorkArea::toggleCursor, this)); - bufferChangedConnection_ = - buffer.changed.connect( - boost::bind(&WorkArea::redraw, this)); - - bufferClosingConnection_ = - buffer.closing.connect( - boost::bind(&WorkArea::close, this)); - cursor_timeout_.start(); } WorkArea::~WorkArea() { - bufferChangedConnection_.disconnect(); - bufferClosingConnection_.disconnect(); - delete buffer_view_; } -void WorkArea::close() -{ - lyx_view_->removeWorkArea(this); -} - -//void WorkArea::setLyXView(LyXView * lyx_view) -//{ -// lyx_view_ = lyx_view; -//} - - BufferView & WorkArea::bufferView() { return *buffer_view_; Index: LyXView.h =================================================================== --- LyXView.h (revision 20648) +++ LyXView.h (working copy) @@ -14,10 +14,9 @@ #define LYXVIEW_H #include "frontends/Application.h" +#include "frontends/Delegates.h" #include "support/docstring.h" -#include <boost/signal.hpp> -#include <boost/signals/trackable.hpp> #include <boost/noncopyable.hpp> #include <vector> @@ -52,7 +51,9 @@ * Additionally we would like to support multiple views * in a single LyXView. */ -class LyXView : public boost::signals::trackable, boost::noncopyable { +class LyXView : boost::noncopyable, + public GuiBufferViewDelegate, public GuiBufferDelegate +{ public: /// LyXView(int id); @@ -177,7 +178,29 @@ /// show the error list to the user void showErrorList(std::string const &); -protected: + + // + // GuiBufferDelegate + // + /// This function is called when the buffer is changed. + void changed(); + /// This function is called if the buffer is being closed. + void closing(Buffer *); + /// This function is called when the buffer structure is changed. + void structureChanged() { updateToc(); } + /// This function is called when an embedded file is changed + void embeddingChanged() { updateEmbeddedFiles(); } + /// This function is called when some parsing error shows up. + void errors(std::string const & err) { showErrorList(err); } + /// This function is called when the buffer busy status change. + //void busy(bool); + /// This function is called when the buffer readonly status change. + void readonly(bool on) { showReadonly(on); } + /// Update window titles of all users. + void updateTitles() { updateWindowTitle(); } + /// Reset autosave timers for all users. + void resetAutosaveTimers() { resetAutosaveTimer(); } + /// connect to signals in the given BufferView void connectBufferView(BufferView & bv); /// disconnect from signals in the given BufferView @@ -203,32 +226,6 @@ /// dialogs for this view Dialogs * dialogs_; - /// buffer structure changed signal connection - boost::signals::connection bufferStructureChangedConnection_; - /// embedded file change signal connection - boost::signals::connection bufferEmbeddingChangedConnection_; - /// buffer errors signal connection - boost::signals::connection errorsConnection_; - /// buffer messages signal connection - boost::signals::connection messageConnection_; - /// buffer busy status signal connection - boost::signals::connection busyConnection_; - /// buffer title changed signal connection - boost::signals::connection titleConnection_; - /// buffer reset timers signal connection - boost::signals::connection timerConnection_; - /// buffer readonly status changed signal connection - boost::signals::connection readonlyConnection_; - - /// BufferView messages signal connection - //@{ - boost::signals::connection message_connection_; - boost::signals::connection show_dialog_connection_; - boost::signals::connection show_dialog_with_data_connection_; - boost::signals::connection show_inset_dialog_connection_; - boost::signals::connection update_dialog_connection_; - //@} - /// Bind methods for BufferView messages signal connection //@{ void showDialog(std::string const & name); Index: WorkArea.h =================================================================== --- WorkArea.h (revision 20648) +++ WorkArea.h (working copy) @@ -15,12 +15,11 @@ #define BASE_WORKAREA_H #include "frontends/key_state.h" +#include "frontends/Delegates.h" #include "support/Timeout.h" #include "support/docstring.h" -#include <boost/signals/trackable.hpp> - #undef CursorShape namespace lyx { @@ -106,10 +105,6 @@ /// void dispatch(FuncRequest const & cmd0, key_modifier::state = key_modifier::none); - - /// close this work area. - /// Slot for Buffer::closing boost signal. - void close(); /// void resizeBufferView(); /// hide the visible cursor, if it is visible @@ -136,11 +131,6 @@ /// Timeout cursor_timeout_; - - /// buffer changed signal connection - boost::signals::connection bufferChangedConnection_; - /// buffer closing signal connection - boost::signals::connection bufferClosingConnection_; }; } // namespace frontend Index: qt4/pch.h =================================================================== --- qt4/pch.h (revision 20648) +++ qt4/pch.h (working copy) @@ -7,8 +7,6 @@ #include <boost/function.hpp> #include <boost/scoped_ptr.hpp> #include <boost/shared_ptr.hpp> -#include <boost/signals/trackable.hpp> -#include <boost/signal.hpp> #include <boost/tuple/tuple.hpp> #include <boost/noncopyable.hpp>