From 0cfafddc7d9fd51fafd4b8c6d721732caf4e6744 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Thu, 15 Aug 2002 17:48:53 +0000 Subject: [PATCH] The dialogs/guiapi re-working. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5003 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/ChangeLog | 9 + src/frontends/Dialogs.C | 301 +--------- src/frontends/Dialogs.h | 28 +- src/frontends/LyXView.C | 4 +- src/frontends/Makefile.am | 1 + src/frontends/controllers/ChangeLog | 6 + .../controllers/ControlConnections.C | 4 +- src/frontends/controllers/ControlParagraph.C | 8 +- src/frontends/controllers/GUI.h | 1 - src/frontends/guiapi.C | 278 +++++++++ src/frontends/guiapi.h | 103 ++-- src/frontends/xforms/ChangeLog | 16 + src/frontends/xforms/Dialogs.C | 180 +++++- src/frontends/xforms/Dialogs2.C | 203 +++++++ src/frontends/xforms/Dialogs3.C | 253 +++++++++ src/frontends/xforms/Dialogs_impl.h | 258 +++++++++ src/frontends/xforms/FormBaseDeprecated.C | 2 +- src/frontends/xforms/FormFiledialog.C | 2 +- src/frontends/xforms/Makefile.am | 3 + src/frontends/xforms/XFormsView.C | 2 +- src/frontends/xforms/guiapi.C | 533 ------------------ 21 files changed, 1303 insertions(+), 892 deletions(-) create mode 100644 src/frontends/xforms/Dialogs2.C create mode 100644 src/frontends/xforms/Dialogs3.C create mode 100644 src/frontends/xforms/Dialogs_impl.h delete mode 100644 src/frontends/xforms/guiapi.C diff --git a/src/frontends/ChangeLog b/src/frontends/ChangeLog index 2579aef45a..64306cfb2d 100644 --- a/src/frontends/ChangeLog +++ b/src/frontends/ChangeLog @@ -1,3 +1,12 @@ +2002-08-15 Angus Leeming + + * Dialogs.[Ch]: + * guiapi.[Ch]: the brave new world of Dialog creation. + + * LyXView.C: associated change. + + * Makefile.am: add new file guiapi.C. + 2002-08-13 Angus Leeming * DialogBase.h: removed. diff --git a/src/frontends/Dialogs.C b/src/frontends/Dialogs.C index 77e6b2e948..43b1d155a7 100644 --- a/src/frontends/Dialogs.C +++ b/src/frontends/Dialogs.C @@ -1,17 +1,10 @@ -/* This file is part of - * ====================================================== - * - * LyX, The Document Processor - * - * Copyright 1995 Matthias Ettrich - * Copyright 1995-2001 The LyX Team. - * - * ====================================================== - * +/** * \file Dialogs.C - * \author Angus Leeming + * Copyright 1995-2002 The LyX Team. + * See the file COPYING. + * \author Angus Leeming * - * Methods common to all frontends' Dialogs that should not be inline + * Common to all frontends' Dialogs */ #include @@ -22,274 +15,28 @@ #include "Dialogs.h" -#include "support/LAssert.h" - -#include "guiapi.h" - -// Signal enabling all visible dialogs to be redrawn if so desired. -// E.g., when the GUI colours have been remapped. -//boost::signal0 Dialogs::redrawGUI; - -extern LyXView * dialogs_lyxview; - - -// toggle tooltips on/off in all dialogs. -//boost::signal0 Dialogs::toggleTooltips; - -void Dialogs::showAboutlyx() -{ - gui_ShowAboutlyx(*dialogs_lyxview, *this); -} - - -void Dialogs::showBibitem(InsetCommand * ic) -{ - gui_ShowBibitem(ic, *dialogs_lyxview, *this); -} - - -void Dialogs::showBibtex(InsetCommand * ic) -{ - gui_ShowBibtex(ic, *dialogs_lyxview, *this); -} - - -void Dialogs::showCharacter() -{ - gui_ShowCharacter(*dialogs_lyxview, *this); -} - - -void Dialogs::setUserFreeFont() -{ - gui_SetUserFreeFont(*dialogs_lyxview, *this); -} - - -void Dialogs::showCitation(InsetCommand * ic) -{ - gui_ShowCitation(ic, *dialogs_lyxview, *this); -} - - -void Dialogs::createCitation(string const & s) -{ - gui_CreateCitation(s, *dialogs_lyxview, *this); -} - - -void Dialogs::showDocument() -{ - gui_ShowDocument(*dialogs_lyxview, *this); -} - - -void Dialogs::showError(InsetError * ie) -{ - gui_ShowError(ie, *dialogs_lyxview, *this); -} - - -void Dialogs::showERT(InsetERT * ie) -{ - gui_ShowERT(ie, *dialogs_lyxview, *this); -} - - -void Dialogs::updateERT(InsetERT * ie) -{ - gui_UpdateERT(ie, *dialogs_lyxview, *this); -} - - -void Dialogs::showExternal(InsetExternal * ie) -{ - gui_ShowExternal(ie, *dialogs_lyxview, *this); -} - - -void Dialogs::showFile(string const & f) -{ - gui_ShowFile(f, *dialogs_lyxview, *this); -} - - -void Dialogs::showFloat(InsetFloat * ifl) -{ - gui_ShowFloat(ifl, *dialogs_lyxview, *this); -} - - -void Dialogs::showForks() -{ - gui_ShowForks(*dialogs_lyxview, *this); -} - - -void Dialogs::showGraphics(InsetGraphics * ig) -{ - gui_ShowGraphics(ig, *dialogs_lyxview, *this); -} - - -void Dialogs::showInclude(InsetInclude * ii) -{ - gui_ShowInclude(ii, *dialogs_lyxview, *this); -} - - -void Dialogs::showIndex(InsetCommand * ic) -{ - gui_ShowIndex(ic, *dialogs_lyxview, *this); -} - - -void Dialogs::createIndex() -{ - gui_CreateIndex(*dialogs_lyxview, *this); -} - - -void Dialogs::showLogFile() -{ - gui_ShowLogFile(*dialogs_lyxview, *this); -} - - -void Dialogs::showMathPanel() -{ - gui_ShowMathPanel(*dialogs_lyxview, *this); -} - - -void Dialogs::showMinipage(InsetMinipage * im) -{ - gui_ShowMinipage(im, *dialogs_lyxview, *this); -} - - -void Dialogs::updateMinipage(InsetMinipage * im) -{ - gui_UpdateMinipage(im, *dialogs_lyxview, *this); -} - - -void Dialogs::showParagraph() -{ - gui_ShowParagraph(*dialogs_lyxview, *this); -} - - -void Dialogs::showPreamble() -{ - gui_ShowPreamble(*dialogs_lyxview, *this); -} - - -void Dialogs::showPreferences() -{ - gui_ShowPreferences(*dialogs_lyxview, *this); -} - - -void Dialogs::showPrint() -{ - gui_ShowPrint(*dialogs_lyxview, *this); -} - - -void Dialogs::showRef(InsetCommand * ic) -{ - gui_ShowRef(ic, *dialogs_lyxview, *this); -} - - -void Dialogs::createRef(string const & s) -{ - gui_CreateRef(s, *dialogs_lyxview, *this); -} - - -void Dialogs::showSearch() -{ - gui_ShowSearch(*dialogs_lyxview, *this); -} - - -void Dialogs::showSendto() -{ - gui_ShowSendto(*dialogs_lyxview, *this); -} - - -void Dialogs::showSpellchecker() -{ - gui_ShowSpellchecker(*dialogs_lyxview, *this); -} - - -void Dialogs::showTabular(InsetTabular * it) -{ - gui_ShowTabular(it, *dialogs_lyxview, *this); -} +// Note that static boost signals break some compilers, so this wrapper +// initialises the signal dynamically when it is first invoked. +template +class BugfixSignal { +public: + Signal & operator()() { return thesignal(); } + Signal const & operator()() const { return thesignal(); } +private: + Signal & thesignal() const + { + if (!signal_.get()) + signal_.reset(new Signal); + return *signal_; + } -void Dialogs::updateTabular(InsetTabular * it) -{ - gui_UpdateTabular(it, *dialogs_lyxview, *this); -} - - -void Dialogs::showTabularCreate() -{ - gui_ShowTabularCreate(*dialogs_lyxview, *this); -} + mutable boost::scoped_ptr signal_; +}; -void Dialogs::showThesaurus(string const & s) +boost::signal0 & Dialogs::redrawGUI() { - gui_ShowThesaurus(s, *dialogs_lyxview, *this); + static BugfixSignal > thesignal; + return thesignal(); } - - -void Dialogs::showTexinfo() -{ - gui_ShowTexinfo(*dialogs_lyxview, *this); -} - - -void Dialogs::showTOC(InsetCommand * ic) -{ - gui_ShowTOC(ic, *dialogs_lyxview, *this); -} - - -void Dialogs::createTOC(string const & s) -{ - gui_CreateTOC(s, *dialogs_lyxview, *this); -} - - -void Dialogs::showUrl(InsetCommand * ic) -{ - gui_ShowUrl(ic, *dialogs_lyxview, *this); -} - - -void Dialogs::createUrl(string const & s) -{ - gui_CreateUrl(s, *dialogs_lyxview, *this); -} - - -void Dialogs::showVCLogFile() -{ - gui_ShowVCLogFile(*dialogs_lyxview, *this); -} - - -//void Dialogs::add(DialogBase * ptr) -//{ -// lyx::Assert(ptr); -// dialogs_.push_back(db_ptr(ptr)); -//} diff --git a/src/frontends/Dialogs.h b/src/frontends/Dialogs.h index 97e3bb873d..33d78ab8e0 100644 --- a/src/frontends/Dialogs.h +++ b/src/frontends/Dialogs.h @@ -16,13 +16,11 @@ #include "LString.h" #include -#include +#include #include #include -// Maybe this should be a UIFunc modelled on LyXFunc class LyXView; - class InsetBibKey; class InsetBibtex; class InsetCommand; @@ -45,16 +43,20 @@ class Dialogs : boost::noncopyable { public: /// - typedef boost::shared_ptr db_ptr; - /// - Dialogs(LyXView *); + Dialogs(LyXView &); + /// Define an empty d-tor out-of-line to keep boost::scoped_ptr happy. + ~Dialogs(); /** Redraw all visible dialogs because, for example, the GUI colours - have been re-mapped. */ - boost::signal0 redrawGUI; + * have been re-mapped. + * + * Note that static boost signals break some compilers, so we return a + * reference to some hidden magic ;-) + */ + static boost::signal0 & redrawGUI(); /// Toggle tooltips on/off in all dialogs. - boost::signal0 toggleTooltips; + static void toggleTooltips(); /// Are the tooltips on or off? static bool tooltipsEnabled(); @@ -126,7 +128,7 @@ public: /// void showParagraph(); /// - boost::signal0 updateParagraph; + void updateParagraph(); /// void showPreamble(); /// @@ -164,6 +166,12 @@ public: /// show the version control log void showVCLogFile(); //@} + +private: + /// Use the Pimpl idiom to hide the internals. + class Impl; + /// The pointer never changes although *pimpl_'s contents may. + boost::scoped_ptr const pimpl_; }; #endif diff --git a/src/frontends/LyXView.C b/src/frontends/LyXView.C index 674c3ec6c4..bfc54c6f35 100644 --- a/src/frontends/LyXView.C +++ b/src/frontends/LyXView.C @@ -49,8 +49,8 @@ LyXView::LyXView() : intl_(new Intl), autosave_timeout_(new Timeout(5000)), lyxfunc_(new LyXFunc(this)), - dialogs_(new Dialogs(this)), - controlcommand_(new ControlCommandBuffer(getLyXFunc())) + dialogs_(new Dialogs(*this)), + controlcommand_(new ControlCommandBuffer(getLyXFunc())) { lyxerr[Debug::INIT] << "Initializing LyXFunc" << endl; } diff --git a/src/frontends/Makefile.am b/src/frontends/Makefile.am index 8e194e4775..7fb67b402b 100644 --- a/src/frontends/Makefile.am +++ b/src/frontends/Makefile.am @@ -40,6 +40,7 @@ libfrontends_la_SOURCES = \ WorkAreaFactory.h \ font_metrics.h \ guiapi.h \ + guiapi.C \ key_state.h \ lyx_gui.h \ mouse_state.h \ diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index 8a0a8a5176..0c1f6aa44c 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,9 @@ +2002-08-15 Angus Leeming + + * ControlConnections.C: Dialogs::redrawGUI is now a method not a signal. + + * ControlParagraph.C: no longer bind to Dailogs::updateParagraph. + 2002-08-15 Angus Leeming * lots: changed my email address to leeming@lyx.org. diff --git a/src/frontends/controllers/ControlConnections.C b/src/frontends/controllers/ControlConnections.C index a154f07a24..1824a9ebde 100644 --- a/src/frontends/controllers/ControlConnections.C +++ b/src/frontends/controllers/ControlConnections.C @@ -8,7 +8,7 @@ * ====================================================== * * \file ControlConnections.C - * \author Angus Leeming + * \author Angus Leeming */ #include @@ -36,7 +36,7 @@ ControlConnectBase::ControlConnectBase(LyXView & lv, Dialogs & d) void ControlConnectBase::connect() { - r_ = d_.redrawGUI. + r_ = d_.redrawGUI(). connect(boost::bind(&ControlConnectBase::redraw, this)); } diff --git a/src/frontends/controllers/ControlParagraph.C b/src/frontends/controllers/ControlParagraph.C index 08750e7c13..459b16629a 100644 --- a/src/frontends/controllers/ControlParagraph.C +++ b/src/frontends/controllers/ControlParagraph.C @@ -24,22 +24,16 @@ #include "lyxtext.h" #include "ParagraphParameters.h" -#include "frontends/Dialogs.h" #include "frontends/Liason.h" #include "support/LAssert.h" -#include - using Liason::setMinibuffer; ControlParagraph::ControlParagraph(LyXView & lv, Dialogs & d) : ControlDialogBD(lv, d), pp_(0), ininset_(false) -{ - d_.updateParagraph.connect( - boost::bind(&ControlParagraph::changedParagraph, this)); -} +{} ControlParagraph::~ControlParagraph() diff --git a/src/frontends/controllers/GUI.h b/src/frontends/controllers/GUI.h index 5e44edbc75..5035c297d3 100644 --- a/src/frontends/controllers/GUI.h +++ b/src/frontends/controllers/GUI.h @@ -48,5 +48,4 @@ GUI::GUI(LyXView & lv, Dialogs & d) view_.setController(controller_); } - #endif // GUI_H diff --git a/src/frontends/guiapi.C b/src/frontends/guiapi.C index e69de29bb2..59088a2f9c 100644 --- a/src/frontends/guiapi.C +++ b/src/frontends/guiapi.C @@ -0,0 +1,278 @@ +/** + * \file guiapi.C + * Copyright 2002 The LyX Team. + * See the file COPYING. + * + * \author Lars Gullik Bjønnes + * \author Angus Leeming + */ + +#include + +#ifdef __GNUG__ +#pragma implementation +#endif + +#include "guiapi.h" +#include "Dialogs.h" + +extern "C" { + + void gui_ShowAboutlyx(Dialogs & d) + { + d.showAboutlyx(); + } + + + void gui_ShowBibitem(InsetCommand * ic, Dialogs & d) + { + d.showBibitem(ic); + } + + + void gui_ShowBibtex(InsetCommand * ic, Dialogs & d) + { + d.showBibtex(ic); + } + + + void gui_ShowCharacter(Dialogs & d) + { + d.showCharacter(); + } + + + void gui_SetUserFreeFont(Dialogs & d) + { + d.setUserFreeFont(); + } + + + void gui_ShowCitation(InsetCommand * ic, Dialogs & d) + { + d.showCitation(ic); + } + + + void gui_CreateCitation(string const & s, Dialogs & d) + { + d.createCitation(s); + } + + + void gui_ShowDocument(Dialogs & d) + { + d.showDocument(); + } + + + void gui_ShowError(InsetError * ie, Dialogs & d) + { + d.showError(ie); + } + + + void gui_ShowERT(InsetERT * ie, Dialogs & d) + { + d.showERT(ie); + } + + + void gui_UpdateERT(InsetERT * ie, Dialogs & d) + { + d.updateERT(ie); + } + + + void gui_ShowExternal(InsetExternal * ie, Dialogs & d) + { + d.showExternal(ie); + } + + + void gui_ShowFile(string const & f, Dialogs & d) + { + d.showFile(f); + } + + + void gui_ShowFloat(InsetFloat * ifl, Dialogs & d) + { + d.showFloat(ifl); + } + + + void gui_ShowForks(Dialogs & d) + { + d.showForks(); + } + + + void gui_ShowGraphics(InsetGraphics * ig, Dialogs & d) + { + d.showGraphics(ig); + } + + + void gui_ShowInclude(InsetInclude * ii, Dialogs & d) + { + d.showInclude(ii); + } + + + void gui_ShowIndex(InsetCommand * ic, Dialogs & d) + { + d.showIndex(ic); + } + + + void gui_CreateIndex(Dialogs & d) + { + d.createIndex(); + } + + + void gui_ShowLogFile(Dialogs & d) + { + d.showLogFile(); + } + + + void gui_ShowMathPanel(Dialogs & d) + { + d.showMathPanel(); + } + + + void gui_ShowMinipage(InsetMinipage * im, Dialogs & d) + { + d.showMinipage(im); + } + + + void gui_UpdateMinipage(InsetMinipage * im, Dialogs & d) + { + d.updateMinipage(im); + } + + + void gui_ShowParagraph(Dialogs & d) + { + d.showParagraph(); + } + + + void gui_UpdateParagraph(Dialogs & d) + { + d.updateParagraph(); + } + + + void gui_ShowPreamble(Dialogs & d) + { + d.showPreamble(); + } + + + void gui_ShowPreferences(Dialogs & d) + { + d.showPreferences(); + } + + + void gui_ShowPrint(Dialogs & d) + { + d.showPrint(); + } + + + void gui_ShowRef(InsetCommand * ic, Dialogs & d) + { + d.showRef(ic); + } + + + void gui_CreateRef(string const & s, Dialogs & d) + { + d.createRef(s); + } + + + void gui_ShowSearch(Dialogs & d) + { + d.showSearch(); + } + + + void gui_ShowSendto(Dialogs & d) + { + d.showSendto(); + } + + + void gui_ShowSpellchecker(Dialogs & d) + { + d.showSpellchecker(); + } + + + void gui_ShowTabular(InsetTabular * it, Dialogs & d) + { + d.showTabular(it); + } + + + void gui_UpdateTabular(InsetTabular * it, Dialogs & d) + { + d.updateTabular(it); + } + + + void gui_ShowTabularCreate(Dialogs & d) + { + d.showTabularCreate(); + } + + + void gui_ShowTexinfo(Dialogs & d) + { + d.showTexinfo(); + } + + + void gui_ShowThesaurus(string const & s, Dialogs & d) + { + d.showThesaurus(s); + } + + + void gui_ShowTOC(InsetCommand * ic, Dialogs & d) + { + d.showTOC(ic); + } + + + void gui_CreateTOC(string const & s, Dialogs & d) + { + d.createTOC(s); + } + + + void gui_ShowUrl(InsetCommand * ic, Dialogs & d) + { + d.showUrl(ic); + } + + + void gui_CreateUrl(string const & s, Dialogs & d) + { + d.createUrl(s); + } + + + void gui_ShowVCLogFile(Dialogs & d) + { + d.showVCLogFile(); + } + +} // extern "C" diff --git a/src/frontends/guiapi.h b/src/frontends/guiapi.h index fda0fe1841..43832854db 100644 --- a/src/frontends/guiapi.h +++ b/src/frontends/guiapi.h @@ -1,8 +1,21 @@ // -*- C++ -*- +/** + * \file guiapi.h + * Copyright 2002 The LyX Team. + * See the file COPYING. + * + * \author Lars Gullik Bjønnes + */ + +#ifndef GUIAPI_H +#define GUIAPI_H + +#ifdef __GNUG__ +#pragma interface +#endif #include "LString.h" -class LyXView; class Dialogs; class InsetCommand; class InsetError; @@ -16,48 +29,50 @@ class InsetTabular; extern "C" { - void gui_ShowAboutlyx(LyXView &, Dialogs &); - void gui_ShowBibitem(InsetCommand * ic, LyXView & lv, Dialogs & d); - void gui_ShowBibtex(InsetCommand * ic, LyXView & lv, Dialogs & d); - void gui_ShowCharacter(LyXView & lv, Dialogs & d); - void gui_SetUserFreeFont(LyXView & lv, Dialogs & d); - void gui_ShowCitation(InsetCommand * ic, LyXView & lv, Dialogs & d); - void gui_CreateCitation(string const &, LyXView & lv, Dialogs & d); - void gui_ShowDocument(LyXView & lv, Dialogs & d); - void gui_ShowError(InsetError * ie, LyXView & lv, Dialogs & d); - void gui_ShowERT(InsetERT * ie, LyXView & lv, Dialogs & d); - void gui_UpdateERT(InsetERT * ie, LyXView & lv, Dialogs & d); - void gui_ShowExternal(InsetExternal * ie, LyXView & lv, Dialogs & d); - void gui_ShowFile(string const & f, LyXView & lv, Dialogs & d); - void gui_ShowFloat(InsetFloat *, LyXView & lv, Dialogs &); - void gui_ShowForks(LyXView & lv, Dialogs & d); - void gui_ShowGraphics(InsetGraphics *, LyXView & lv, Dialogs & d); - void gui_ShowInclude(InsetInclude *, LyXView & lv, Dialogs & d); - void gui_ShowIndex(InsetCommand *, LyXView & lv, Dialogs & d); - void gui_CreateIndex(LyXView & lv, Dialogs & d); - void gui_ShowLogFile(LyXView & lv, Dialogs & d); - void gui_ShowMathPanel(LyXView & lv, Dialogs & d); - void gui_ShowMinipage(InsetMinipage *, LyXView & lv, Dialogs & d); - void gui_UpdateMinipage(InsetMinipage *, LyXView & lv, Dialogs & d); - void gui_ShowParagraph(LyXView & lv, Dialogs & d); - void gui_UpdateParagraph(LyXView & lv, Dialogs & d); - void gui_ShowPreamble(LyXView & lv, Dialogs & d); - void gui_ShowPreferences(LyXView & lv, Dialogs & d); - void gui_ShowPrint(LyXView & lv, Dialogs & d); - void gui_ShowRef(InsetCommand *, LyXView &, Dialogs &); - void gui_CreateRef(string const &, LyXView &, Dialogs &); - void gui_ShowSearch(LyXView & lv, Dialogs & d); - void gui_ShowSendto(LyXView & lv, Dialogs & d); - void gui_ShowSpellchecker(LyXView & lv, Dialogs & d); - void gui_ShowTabular(InsetTabular *, LyXView &, Dialogs &); - void gui_UpdateTabular(InsetTabular *, LyXView &, Dialogs &); - void gui_ShowTabularCreate(LyXView & lv, Dialogs & d); - void gui_ShowTexinfo(LyXView & lv, Dialogs & d); - void gui_ShowThesaurus(string const &, LyXView &, Dialogs &); - void gui_ShowTOC(InsetCommand *, LyXView &, Dialogs &); - void gui_CreateTOC(string const &, LyXView &, Dialogs &); - void gui_ShowUrl(InsetCommand *, LyXView &, Dialogs &); - void gui_CreateUrl(string const &, LyXView &, Dialogs &); - void gui_ShowVCLogFile(LyXView & lv, Dialogs & d); + void gui_ShowAboutlyx(Dialogs &); + void gui_ShowBibitem(InsetCommand *, Dialogs &); + void gui_ShowBibtex(InsetCommand *, Dialogs &); + void gui_ShowCharacter(Dialogs &); + void gui_SetUserFreeFont(Dialogs &); + void gui_ShowCitation(InsetCommand *, Dialogs &); + void gui_CreateCitation(string const &, Dialogs &); + void gui_ShowDocument(Dialogs &); + void gui_ShowError(InsetError *, Dialogs &); + void gui_ShowERT(InsetERT *, Dialogs &); + void gui_UpdateERT(InsetERT *, Dialogs &); + void gui_ShowExternal(InsetExternal *, Dialogs &); + void gui_ShowFile(string const &, Dialogs &); + void gui_ShowFloat(InsetFloat *, Dialogs &); + void gui_ShowForks(Dialogs &); + void gui_ShowGraphics(InsetGraphics *, Dialogs &); + void gui_ShowInclude(InsetInclude *, Dialogs &); + void gui_ShowIndex(InsetCommand *, Dialogs &); + void gui_CreateIndex(Dialogs &); + void gui_ShowLogFile(Dialogs &); + void gui_ShowMathPanel(Dialogs &); + void gui_ShowMinipage(InsetMinipage *, Dialogs &); + void gui_UpdateMinipage(InsetMinipage *, Dialogs &); + void gui_ShowParagraph(Dialogs &); + void gui_UpdateParagraph(Dialogs &); + void gui_ShowPreamble(Dialogs &); + void gui_ShowPreferences(Dialogs &); + void gui_ShowPrint(Dialogs &); + void gui_ShowRef(InsetCommand *, Dialogs &); + void gui_CreateRef(string const &, Dialogs &); + void gui_ShowSearch(Dialogs &); + void gui_ShowSendto(Dialogs &); + void gui_ShowSpellchecker(Dialogs &); + void gui_ShowTabular(InsetTabular *, Dialogs &); + void gui_UpdateTabular(InsetTabular *, Dialogs &); + void gui_ShowTabularCreate(Dialogs &); + void gui_ShowTexinfo(Dialogs &); + void gui_ShowThesaurus(string const &, Dialogs &); + void gui_ShowTOC(InsetCommand *, Dialogs &); + void gui_CreateTOC(string const &, Dialogs &); + void gui_ShowUrl(InsetCommand *, Dialogs &); + void gui_CreateUrl(string const &, Dialogs &); + void gui_ShowVCLogFile(Dialogs &); } // extern "C" + +#endif // GUIAPI_H diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 102ef54f03..26bb9102ad 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,19 @@ +2002-08-15 Angus Leeming + + * Dialogs.C: + * Dialogs2.C + * Dialogs3.C + * Dialogs_impl.h: the brave new world of Dialog creation. + + * FormBaseDeprecated.C: + * FormFiledialog.C: + * XFormsView.C: Dialogs::redrawGUI is now a method not a signal. + + * guiapi.C: discard. + + * Makefile.am: add new files Dialogs[23].C Dialogs_impl.h and + remove guiapi.C. + 2002-08-15 Angus Leeming * lots: changed my email address to leeming@lyx.org. diff --git a/src/frontends/xforms/Dialogs.C b/src/frontends/xforms/Dialogs.C index 7fc8af49f5..34124a60d9 100644 --- a/src/frontends/xforms/Dialogs.C +++ b/src/frontends/xforms/Dialogs.C @@ -5,6 +5,7 @@ * See the file COPYING. * * \author Allan Rae, rae@lyx.org + * \author Angus Leeming */ #include @@ -13,28 +14,181 @@ #pragma implementation #endif -#include "Dialogs.h" +#include "Dialogs_impl.h" + #include "Tooltips.h" +#include "xformsBC.h" +#include "combox.h" -#include +#include "ControlAboutlyx.h" +#include "FormAboutlyx.h" +#include "forms/form_aboutlyx.h" -LyXView * dialogs_lyxview; +#include "ControlBibitem.h" +#include "FormBibitem.h" +#include "forms/form_bibitem.h" +#include "ControlBibtex.h" +#include "FormBibtex.h" +#include "forms/form_bibtex.h" -/// Are the tooltips on or off? -bool Dialogs::tooltipsEnabled() -{ - return Tooltips::enabled(); -} +#include "FormBrowser.h" +#include "forms/form_browser.h" +#include "ControlCharacter.h" +#include "FormCharacter.h" +#include "forms/form_character.h" -Dialogs::Dialogs(LyXView * lv) -{ -#if 1 - dialogs_lyxview = lv; +#include "ControlCitation.h" +#include "FormCitation.h" +#include "forms/form_citation.h" + +#include "FormDocument.h" +#include "forms/form_document.h" + +#include "ControlError.h" +#include "FormError.h" +#include "forms/form_error.h" + +#include "ControlERT.h" +#include "FormERT.h" +#include "forms/form_ert.h" + +#include "ControlExternal.h" +#include "FormExternal.h" +#include "forms/form_external.h" + +#include "ControlFloat.h" +#include "FormFloat.h" +#include "forms/form_float.h" + +#include "ControlForks.h" +#include "FormForks.h" +#include "forms/form_forks.h" + +#include "ControlGraphics.h" +#include "FormGraphics.h" +#include "forms/form_graphics.h" + +#include "ControlInclude.h" +#include "FormInclude.h" +#include "forms/form_include.h" + +#include "ControlIndex.h" +#include "FormIndex.h" +#include "forms/form_index.h" + +#include "ControlLog.h" +#include "FormLog.h" + +#include "ControlShowFile.h" +#include "FormShowFile.h" + +#include "FormMathsBitmap.h" + +#include "FormMathsPanel.h" +#include "forms/form_maths_panel.h" + +#include "FormMathsDeco.h" +#include "forms/form_maths_deco.h" + +#include "FormMathsDelim.h" +#include "forms/form_maths_delim.h" + +#include "FormMathsMatrix.h" +#include "forms/form_maths_matrix.h" + +#include "FormMathsSpace.h" +#include "forms/form_maths_space.h" + +#include "FormMathsStyle.h" +#include "forms/form_maths_style.h" + +#include "ControlMinipage.h" +#include "FormMinipage.h" +#include "forms/form_minipage.h" + +#include "ControlParagraph.h" +#include "FormParagraph.h" +#include "forms/form_paragraph.h" + +#include "ControlPreamble.h" +#include "FormPreamble.h" +#include "forms/form_preamble.h" + +#include "FormPreferences.h" +#include "forms/form_preferences.h" + +#include "ControlPrint.h" +#include "FormPrint.h" +#include "forms/form_print.h" + +#include "ControlRef.h" +#include "FormRef.h" +#include "forms/form_ref.h" + +#include "ControlSearch.h" +#include "FormSearch.h" +#include "forms/form_search.h" + +#include "ControlSendto.h" +#include "FormSendto.h" +#include "forms/form_sendto.h" + +#include "ControlSpellchecker.h" +#include "FormSpellchecker.h" +#include "forms/form_spellchecker.h" + +#include "FormTabular.h" +#include "forms/form_tabular.h" + +#include "ControlTabularCreate.h" +#include "FormTabularCreate.h" +#include "forms/form_tabular_create.h" + +#include "ControlTexinfo.h" +#include "FormTexinfo.h" +#include "forms/form_texinfo.h" + +#ifdef HAVE_LIBAIKSAURUS +#include "ControlThesaurus.h" +#include "FormThesaurus.h" +#include "forms/form_thesaurus.h" #endif - toggleTooltips.connect(boost::bind(&Tooltips::toggleEnabled)); + +#include "ControlToc.h" +#include "FormToc.h" +#include "forms/form_toc.h" + +#include "ControlUrl.h" +#include "FormUrl.h" +#include "forms/form_url.h" + +#include "ControlVCLog.h" +#include "FormVCLog.h" + + +Dialogs::Dialogs(LyXView & lv) + : pimpl_(new Impl(lv, *this)) +{ // reduce the number of connections needed in // dialogs by a simple connection here. hideAll.connect(hideBufferDependent); } + + +Dialogs::~Dialogs() +{} + + +void Dialogs::toggleTooltips() +{ + Tooltips::toggleEnabled(); +} + + +/// Are the tooltips on or off? +bool Dialogs::tooltipsEnabled() +{ + return Tooltips::enabled(); +} diff --git a/src/frontends/xforms/Dialogs2.C b/src/frontends/xforms/Dialogs2.C new file mode 100644 index 0000000000..d0b7bef247 --- /dev/null +++ b/src/frontends/xforms/Dialogs2.C @@ -0,0 +1,203 @@ +/** + * \file xforms/Dialogs.C + * Copyright 1995 Matthias Ettrich + * Copyright 1995-2001 The LyX Team. + * See the file COPYING. + * + * \author Allan Rae, rae@lyx.org + * \author Angus Leeming + */ + +#include + +#ifdef __GNUG__ +#pragma implementation +#endif + +#include "Dialogs_impl.h" + +#include "combox.h" + +#include "ControlAboutlyx.h" +#include "FormAboutlyx.h" +#include "forms/form_aboutlyx.h" + +#include "ControlBibitem.h" +#include "FormBibitem.h" +#include "forms/form_bibitem.h" + +#include "ControlBibtex.h" +#include "FormBibtex.h" +#include "forms/form_bibtex.h" + +#include "FormBrowser.h" +#include "forms/form_browser.h" + +#include "ControlCharacter.h" +#include "FormCharacter.h" +#include "forms/form_character.h" + +#include "ControlCitation.h" +#include "FormCitation.h" +#include "forms/form_citation.h" + +#include "FormDocument.h" +#include "forms/form_document.h" + +#include "ControlError.h" +#include "FormError.h" +#include "forms/form_error.h" + +#include "ControlERT.h" +#include "FormERT.h" +#include "forms/form_ert.h" + +#include "ControlExternal.h" +#include "FormExternal.h" +#include "forms/form_external.h" + +#include "ControlFloat.h" +#include "FormFloat.h" +#include "forms/form_float.h" + +#include "ControlForks.h" +#include "FormForks.h" +#include "forms/form_forks.h" + +#include "ControlGraphics.h" +#include "FormGraphics.h" +#include "forms/form_graphics.h" + +#include "ControlInclude.h" +#include "FormInclude.h" +#include "forms/form_include.h" + +#include "ControlIndex.h" +#include "FormIndex.h" +#include "forms/form_index.h" + +#include "ControlLog.h" +#include "FormLog.h" + +#include "ControlShowFile.h" +#include "FormShowFile.h" + + +void Dialogs::showAboutlyx() +{ + pimpl_->dialog(pimpl_->aboutlyx).controller().show(); +} + + +void Dialogs::showBibitem(InsetCommand * ic) +{ + pimpl_->dialog(pimpl_->bibitem).controller().showInset(ic); +} + + +void Dialogs::showBibtex(InsetCommand * ic) +{ + pimpl_->dialog(pimpl_->bibtex).controller().showInset(ic); +} + + +void Dialogs::showCharacter() +{ + pimpl_->dialog(pimpl_->character).controller().show(); +} + + +void Dialogs::setUserFreeFont() +{ + pimpl_->dialog(pimpl_->character).controller().apply(); +} + + +void Dialogs::showCitation(InsetCommand * ic) +{ + pimpl_->dialog(pimpl_->citation).controller().showInset(ic); +} + + +void Dialogs::createCitation(string const & s) +{ + pimpl_->dialog(pimpl_->citation).controller().createInset(s); +} + + +void Dialogs::showDocument() +{ + pimpl_->dialog(pimpl_->document).show(); +} + + +void Dialogs::showError(InsetError * ie) +{ + pimpl_->dialog(pimpl_->error).controller().showInset(ie); +} + + +void Dialogs::showERT(InsetERT * ie) +{ + pimpl_->dialog(pimpl_->ert).controller().showInset(ie); +} + + +void Dialogs::updateERT(InsetERT * ie) +{ + pimpl_->dialog(pimpl_->ert).controller().showInset(ie); +} + + +void Dialogs::showExternal(InsetExternal * ie) +{ + pimpl_->dialog(pimpl_->external).controller().showInset(ie); +} + + +void Dialogs::showFile(string const & f) +{ + pimpl_->dialog(pimpl_->file).controller().showFile(f); +} + + +void Dialogs::showFloat(InsetFloat * ifl) +{ + pimpl_->dialog(pimpl_->floats).controller().showInset(ifl); +} + + +void Dialogs::showForks() +{ + pimpl_->dialog(pimpl_->forks).controller().show(); +} + + +void Dialogs::showGraphics(InsetGraphics * ig) +{ + pimpl_->dialog(pimpl_->graphics).controller().showInset(ig); +} + + +void Dialogs::showInclude(InsetInclude * ii) +{ + pimpl_->dialog(pimpl_->include).controller().showInset(ii); +} + + +void Dialogs::showIndex(InsetCommand * ic) +{ + pimpl_->dialog(pimpl_->index).controller().showInset(ic); +} + + +void Dialogs::createIndex() +{ + pimpl_->dialog(pimpl_->index).controller().createInset(string()); +} + + +void Dialogs::showLogFile() +{ + pimpl_->dialog(pimpl_->logfile).controller().show(); +} diff --git a/src/frontends/xforms/Dialogs3.C b/src/frontends/xforms/Dialogs3.C new file mode 100644 index 0000000000..3f760f6b3e --- /dev/null +++ b/src/frontends/xforms/Dialogs3.C @@ -0,0 +1,253 @@ +/** + * \file xforms/Dialogs2.C + * Copyright 1995 Matthias Ettrich + * Copyright 1995-2001 The LyX Team. + * See the file COPYING. + * + * \author Allan Rae, rae@lyx.org + * \author Angus Leeming + */ + +#include + +#ifdef __GNUG__ +#pragma implementation +#endif + +#include "Dialogs_impl.h" + +#include "Tooltips.h" +#include "xformsBC.h" +#include "combox.h" + +#include "FormBrowser.h" +#include "forms/form_browser.h" + +#include "FormMathsBitmap.h" + +#include "FormMathsPanel.h" +#include "forms/form_maths_panel.h" + +#include "FormMathsDeco.h" +#include "forms/form_maths_deco.h" + +#include "FormMathsDelim.h" +#include "forms/form_maths_delim.h" + +#include "FormMathsMatrix.h" +#include "forms/form_maths_matrix.h" + +#include "FormMathsSpace.h" +#include "forms/form_maths_space.h" + +#include "FormMathsStyle.h" +#include "forms/form_maths_style.h" + +#include "ControlMinipage.h" +#include "FormMinipage.h" +#include "forms/form_minipage.h" + +#include "ControlParagraph.h" +#include "FormParagraph.h" +#include "forms/form_paragraph.h" + +#include "ControlPreamble.h" +#include "FormPreamble.h" +#include "forms/form_preamble.h" + +#include "FormPreferences.h" +#include "forms/form_preferences.h" + +#include "ControlPrint.h" +#include "FormPrint.h" +#include "forms/form_print.h" + +#include "ControlRef.h" +#include "FormRef.h" +#include "forms/form_ref.h" + +#include "ControlSearch.h" +#include "FormSearch.h" +#include "forms/form_search.h" + +#include "ControlSendto.h" +#include "FormSendto.h" +#include "forms/form_sendto.h" + +#include "ControlSpellchecker.h" +#include "FormSpellchecker.h" +#include "forms/form_spellchecker.h" + +#include "FormTabular.h" +#include "forms/form_tabular.h" + +#include "ControlTabularCreate.h" +#include "FormTabularCreate.h" +#include "forms/form_tabular_create.h" + +#include "ControlTexinfo.h" +#include "FormTexinfo.h" +#include "forms/form_texinfo.h" + +#ifdef HAVE_LIBAIKSAURUS +#include "ControlThesaurus.h" +#include "FormThesaurus.h" +#include "forms/form_thesaurus.h" +#endif + +#include "ControlToc.h" +#include "FormToc.h" +#include "forms/form_toc.h" + +#include "ControlUrl.h" +#include "FormUrl.h" +#include "forms/form_url.h" + +#include "ControlVCLog.h" +#include "FormVCLog.h" + +void Dialogs::showMathPanel() +{ + pimpl_->dialog(pimpl_->mathpanel).show(); +} + + +void Dialogs::showMinipage(InsetMinipage * im) +{ + pimpl_->dialog(pimpl_->minipage).controller().showInset(im); +} + + +void Dialogs::updateMinipage(InsetMinipage * im) +{ + pimpl_->dialog(pimpl_->minipage).controller().showInset(im); +} + + +void Dialogs::showParagraph() +{ + pimpl_->dialog(pimpl_->paragraph).controller().show(); +} + + +void Dialogs::updateParagraph() +{ + pimpl_->dialog(pimpl_->paragraph).controller().changedParagraph(); +} + + +void Dialogs::showPreamble() +{ + pimpl_->dialog(pimpl_->preamble).controller().show(); +} + + +void Dialogs::showPreferences() +{ + pimpl_->dialog(pimpl_->preferences).show(); +} + + +void Dialogs::showPrint() +{ + pimpl_->dialog(pimpl_->print).controller().show(); +} + + +void Dialogs::showRef(InsetCommand * ic) +{ + pimpl_->dialog(pimpl_->ref).controller().showInset(ic); +} + + +void Dialogs::createRef(string const & s) +{ + pimpl_->dialog(pimpl_->ref).controller().createInset(s); +} + + +void Dialogs::showSearch() +{ + pimpl_->dialog(pimpl_->search).controller().show(); +} + + +void Dialogs::showSendto() +{ + pimpl_->dialog(pimpl_->sendto).controller().show(); +} + + +void Dialogs::showSpellchecker() +{ + pimpl_->dialog(pimpl_->spellchecker).controller().show(); +} + + +void Dialogs::showTabular(InsetTabular * it) +{ + pimpl_->dialog(pimpl_->tabular).showInset(it); +} + + +void Dialogs::updateTabular(InsetTabular * it) +{ + pimpl_->dialog(pimpl_->tabular).updateInset(it); +} + + +void Dialogs::showTabularCreate() +{ + pimpl_->dialog(pimpl_->tabularcreate).controller().show(); +} + + +void Dialogs::showTexinfo() +{ + pimpl_->dialog(pimpl_->texinfo).controller().show(); +} + + +#ifdef HAVE_LIBAIKSAURUS + +void Dialogs::showThesaurus(string const & s) +{ + pimpl_->dialog(pimpl_->thesaurus).controller().showEntry(s); +} + +#else + +void Dialogs::showThesaurus(string const &) +{} + +#endif + + +void Dialogs::showTOC(InsetCommand * ic) +{ + pimpl_->dialog(pimpl_->toc).controller().showInset(ic); +} + + +void Dialogs::createTOC(string const & s) +{ + pimpl_->dialog(pimpl_->toc).controller().createInset(s); +} + + +void Dialogs::showUrl(InsetCommand * ic) +{ + pimpl_->dialog(pimpl_->url).controller().showInset(ic); +} + + +void Dialogs::createUrl(string const & s) +{ + pimpl_->dialog(pimpl_->url).controller().createInset(s); +} + + +void Dialogs::showVCLogFile() +{ + pimpl_->dialog(pimpl_->vclogfile).controller().show(); +} diff --git a/src/frontends/xforms/Dialogs_impl.h b/src/frontends/xforms/Dialogs_impl.h new file mode 100644 index 0000000000..2529dfa3d5 --- /dev/null +++ b/src/frontends/xforms/Dialogs_impl.h @@ -0,0 +1,258 @@ +// -*- C++ -*- +/** + * \file Dialogs_impl.h + * Copyright 1995-2002 The LyX Team. + * See the file COPYING. + * \author Angus Leeming + */ + +#ifndef DIALOGS_IMPL_H +#define DIALOGS_IMP_H + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "Dialogs.h" +#include "GUI.h" + +#include + + +class ControlAboutlyx; +class ControlBibitem; +class ControlBibtex; +class ControlCharacter; +class ControlCitation; +class ControlError; +class ControlERT; +class ControlExternal; +class ControlShowFile; +class ControlFloat; +class ControlForks; +class ControlGraphics; +class ControlInclude; +class ControlIndex; +class ControlLog; +class ControlMinipage; +class ControlParagraph; +class ControlPreamble; +class ControlPrint; +class ControlRef; +class ControlSearch; +class ControlSendto; +class ControlSpellchecker; +class ControlTabularCreate; +class ControlTexinfo; +class ControlToc; +class ControlUrl; +class ControlVCLog; + +class FormAboutlyx; +class FormBibitem; +class FormBibtex; +class FormCharacter; +class FormCitation; +class FormDocument; +class FormError; +class FormERT; +class FormExternal; +class FormShowFile; +class FormFloat; +class FormForks; +class FormGraphics; +class FormInclude; +class FormIndex; +class FormLog; +class FormMathsPanel; +class FormMinipage; +class FormParagraph; +class FormPreamble; +class FormPreferences; +class FormPrint; +class FormRef; +class FormSearch; +class FormSendto; +class FormSpellchecker; +class FormTabular; +class FormTabularCreate; +class FormTexinfo; +class FormToc; +class FormUrl; +class FormVCLog; + +#ifdef HAVE_LIBAIKSAURUS +class ControlThesaurus; +class FormThesaurus; +#endif + +class OkCancelPolicy; +class OkApplyCancelPolicy; +class OkCancelReadOnlyPolicy; +class OkApplyCancelReadOnlyPolicy; +class NoRepeatedApplyReadOnlyPolicy; +class xformsBC; + + +typedef GUI +AboutlyxDialog; + +typedef GUI +BibitemDialog; + +typedef GUI +BibtexDialog; + +typedef GUI +CharacterDialog; + +typedef GUI +CitationDialog; + +typedef FormDocument DocumentDialog; + +typedef GUI +ErrorDialog; + +typedef GUI +ERTDialog; + +typedef GUI +ExternalDialog; + +typedef GUI +FileDialog; + +typedef GUI +FloatDialog; + +typedef GUI +ForksDialog; + +typedef GUI +GraphicsDialog; + +typedef GUI +IncludeDialog; + +typedef GUI +IndexDialog; + +typedef GUI +LogFileDialog; + +typedef FormMathsPanel MathPanelDialog; + +typedef GUI +MinipageDialog; + +typedef GUI +ParagraphDialog; + +typedef GUI +PreambleDialog; + +typedef FormPreferences PreferencesDialog; + +typedef GUI +PrintDialog; + +typedef GUI +RefDialog; + +typedef GUI +SearchDialog; + +typedef GUI +SendtoDialog; + +typedef GUI +SpellcheckerDialog; + +typedef FormTabular TabularDialog; + +typedef GUI +TabularCreateDialog; + +typedef GUI +TexinfoDialog; + +#ifdef HAVE_LIBAIKSAURUS +typedef GUI +ThesaurusDialog; +#endif + +typedef GUI +TocDialog; + +typedef GUI +UrlDialog; + +typedef GUI +VCLogFileDialog; + +struct Dialogs::Impl { + Impl(LyXView & lv, Dialogs & d) : lv_(lv), d_(d) {} + + template + T & dialog(boost::scoped_ptr & var) + { + if (!var.get()) + var.reset(new T(lv_, d_)); + return *var; + } + + boost::scoped_ptr aboutlyx; + boost::scoped_ptr bibitem; + boost::scoped_ptr bibtex; + boost::scoped_ptr character; + boost::scoped_ptr citation; + boost::scoped_ptr document; + boost::scoped_ptr error; + boost::scoped_ptr ert; + boost::scoped_ptr external; + boost::scoped_ptr file; + boost::scoped_ptr floats; + boost::scoped_ptr forks; + boost::scoped_ptr graphics; + boost::scoped_ptr include; + boost::scoped_ptr index; + boost::scoped_ptr logfile; + boost::scoped_ptr mathpanel; + boost::scoped_ptr minipage; + boost::scoped_ptr paragraph; + boost::scoped_ptr preamble; + boost::scoped_ptr preferences; + boost::scoped_ptr print; + boost::scoped_ptr ref; + boost::scoped_ptr search; + boost::scoped_ptr sendto; + boost::scoped_ptr spellchecker; + boost::scoped_ptr tabular; + boost::scoped_ptr tabularcreate; + boost::scoped_ptr texinfo; + +#ifdef HAVE_LIBAIKSAURUS + boost::scoped_ptr thesaurus; +#endif + + boost::scoped_ptr toc; + boost::scoped_ptr url; + boost::scoped_ptr vclogfile; + +private: + LyXView & lv_; + Dialogs & d_; +}; + +#endif // DIALOGS_IMPL_H diff --git a/src/frontends/xforms/FormBaseDeprecated.C b/src/frontends/xforms/FormBaseDeprecated.C index 9230bf7d48..b1b20d9f1f 100644 --- a/src/frontends/xforms/FormBaseDeprecated.C +++ b/src/frontends/xforms/FormBaseDeprecated.C @@ -69,7 +69,7 @@ void FormBaseDeprecated::redraw() void FormBaseDeprecated::connect() { fl_set_form_minsize(form(), minw_, minh_); - r_ = d_.redrawGUI.connect(boost::bind(&FormBaseDeprecated::redraw, this)); + r_ = d_.redrawGUI().connect(boost::bind(&FormBaseDeprecated::redraw, this)); } diff --git a/src/frontends/xforms/FormFiledialog.C b/src/frontends/xforms/FormFiledialog.C index aeb7528a21..54af581406 100644 --- a/src/frontends/xforms/FormFiledialog.C +++ b/src/frontends/xforms/FormFiledialog.C @@ -416,7 +416,7 @@ FileDialog::Private::Private(Dialogs & dia) fl_hide_object(file_dlg_form_->User1); fl_hide_object(file_dlg_form_->User2); - r_ = dia.redrawGUI.connect(boost::bind(&FileDialog::Private::redraw, this)); + r_ = dia.redrawGUI().connect(boost::bind(&FileDialog::Private::redraw, this)); } diff --git a/src/frontends/xforms/Makefile.am b/src/frontends/xforms/Makefile.am index 61a5c34be4..207a40ad20 100644 --- a/src/frontends/xforms/Makefile.am +++ b/src/frontends/xforms/Makefile.am @@ -48,6 +48,9 @@ libxforms_la_SOURCES = \ ColorHandler.C \ ColorHandler.h \ Dialogs.C \ + Dialogs2.C \ + Dialogs3.C \ + Dialogs_impl.h \ DropDown.h \ DropDown.C \ FeedbackController.C \ diff --git a/src/frontends/xforms/XFormsView.C b/src/frontends/xforms/XFormsView.C index 00519c2978..78f192d70f 100644 --- a/src/frontends/xforms/XFormsView.C +++ b/src/frontends/xforms/XFormsView.C @@ -67,7 +67,7 @@ XFormsView::XFormsView(int width, int height) // Make sure the buttons are disabled if needed. updateToolbar(); - redraw_con = getDialogs().redrawGUI.connect(boost::bind(&XFormsView::redraw, this)); + redraw_con = getDialogs().redrawGUI().connect(boost::bind(&XFormsView::redraw, this)); } diff --git a/src/frontends/xforms/guiapi.C b/src/frontends/xforms/guiapi.C deleted file mode 100644 index 28f41d2723..0000000000 --- a/src/frontends/xforms/guiapi.C +++ /dev/null @@ -1,533 +0,0 @@ -#include - -#include "guiapi.h" - -#include "FormAboutlyx.h" -#include "forms/form_aboutlyx.h" - -#include "FormBibitem.h" -#include "forms/form_bibitem.h" - -#include "FormBibtex.h" -#include "forms/form_bibtex.h" - -#include "FormBrowser.h" -#include "forms/form_browser.h" - -#include "FormCharacter.h" -#include "forms/form_character.h" - -#include "FormCitation.h" -#include "forms/form_citation.h" - -#include "FormDocument.h" -#include "forms/form_document.h" - -#include "FormError.h" -#include "forms/form_error.h" - -#include "FormERT.h" -#include "forms/form_ert.h" - -#include "FormExternal.h" -#include "forms/form_external.h" - -#include "FormFloat.h" -#include "forms/form_float.h" - -#include "FormForks.h" -#include "forms/form_forks.h" - -#include "FormGraphics.h" -#include "forms/form_graphics.h" - -#include "FormInclude.h" -#include "forms/form_include.h" - -#include "FormIndex.h" -#include "forms/form_index.h" - -#include "FormLog.h" - -#include "FormMathsPanel.h" -#include "FormMathsBitmap.h" -#include "FormMathsDeco.h" -#include "FormMathsDelim.h" -#include "FormMathsMatrix.h" -#include "FormMathsSpace.h" -#include "FormMathsStyle.h" - -#include "forms/form_maths_deco.h" -#include "forms/form_maths_delim.h" -#include "forms/form_maths_matrix.h" -#include "forms/form_maths_panel.h" -#include "forms/form_maths_space.h" -#include "forms/form_maths_style.h" - -#include "FormMinipage.h" -#include "forms/form_minipage.h" - -#include "FormParagraph.h" -#include "forms/form_paragraph.h" - -#include "FormPreamble.h" -#include "forms/form_preamble.h" - -#include "FormPreferences.h" -#include "forms/form_preferences.h" - -#include "FormPrint.h" -#include "forms/form_print.h" - -#include "FormRef.h" -#include "forms/form_ref.h" - -#include "FormSearch.h" -#include "forms/form_search.h" - -#include "FormSendto.h" -#include "forms/form_sendto.h" - -#include "FormShowFile.h" - -#include "FormSpellchecker.h" -#include "forms/form_spellchecker.h" - -#include "FormTabular.h" -#include "forms/form_tabular.h" - -#include "FormTabularCreate.h" -#include "forms/form_tabular_create.h" - -#include "FormTexinfo.h" -#include "forms/form_texinfo.h" - -#ifdef HAVE_LIBAIKSAURUS -#include "FormThesaurus.h" -#include "forms/form_thesaurus.h" -#endif - -#include "FormToc.h" -#include "forms/form_toc.h" - -#include "FormUrl.h" -#include "forms/form_url.h" - -#include "FormVCLog.h" - -#include "xformsBC.h" -#include "combox.h" - -#include "controllers/GUI.h" -#include "insets/inseterror.h" - -#include "LyXView.h" - -#include "ControlAboutlyx.h" -#include "ControlBibitem.h" -#include "ControlBibtex.h" -#include "ControlCharacter.h" -#include "ControlCitation.h" -#include "ControlError.h" -#include "ControlERT.h" -#include "ControlExternal.h" -#include "ControlFloat.h" -#include "ControlForks.h" -#include "ControlGraphics.h" -#include "insets/insetgraphicsParams.h" -#include "ControlInclude.h" -#include "ControlIndex.h" -#include "ControlLog.h" -#include "ControlMinipage.h" -#include "ControlParagraph.h" -#include "ControlPreamble.h" -#include "ControlPrint.h" -#include "ControlRef.h" -#include "ControlSearch.h" -#include "ControlSendto.h" -#include "ControlShowFile.h" -#include "ControlSpellchecker.h" -#include "ControlTabularCreate.h" -#include "ControlTexinfo.h" -#include "ControlThesaurus.h" -#include "ControlToc.h" -#include "ControlUrl.h" -#include "ControlVCLog.h" - - -namespace { // anon - -// I belive that this one is buggy (Lgb) -// But not if used correctly. (Lgb) -template -class GUISingleton { -public: - static - T & get(LyXView & lv, Dialogs & d) { - static T t(lv, d); - return t; - } -}; - - -GUISingleton > -controlCharacterSingleton; - -GUISingleton > -controlCitationSingleton; - - -GUISingleton > -controlERTSingleton; - -GUISingleton > -controlIndexSingleton; - -GUISingleton > -controlMinipageSingleton; - -GUISingleton formPreferencesSingleton; - -GUISingleton > -controlRefSingleton; - -GUISingleton formTabularSingleton; - -GUISingleton > -controlTocSingleton; - -GUISingleton > -controlUrlSingleton; - -} // anon - - -extern "C" { - - void gui_ShowAboutlyx(LyXView & lv, Dialogs & d) - { - static GUI cal(lv, d); - cal.controller().show(); - } - - - void gui_ShowBibitem(InsetCommand * ic, LyXView & lv, Dialogs & d) - { - static GUI cbi(lv, d); - cbi.controller().showInset(ic); - } - - - void gui_ShowBibtex(InsetCommand * ic, LyXView & lv, Dialogs & d) - { - static GUI cbt(lv, d); - cbt.controller().showInset(ic); - } - - - void gui_ShowCharacter(LyXView & lv, Dialogs & d) - { - controlCharacterSingleton.get(lv, d).controller().show(); - } - - - void gui_SetUserFreeFont(LyXView & lv, Dialogs & d) - { - controlCharacterSingleton.get(lv, d).controller().apply(); - } - - - void gui_ShowCitation(InsetCommand * ic, LyXView & lv, Dialogs & d) - { - controlCitationSingleton.get(lv, d).controller().showInset(ic); - } - - - void gui_CreateCitation(string const & s, LyXView & lv, Dialogs & d) - { - controlCitationSingleton.get(lv, d).controller().createInset(s); - } - - - void gui_ShowDocument(LyXView & lv, Dialogs & d) - { - static FormDocument fd(lv, d); - fd.show(); - } - - - void gui_ShowError(InsetError * ie, LyXView & lv, Dialogs & d) - { - static GUI ce(lv, d); - ce.controller().showInset(ie); - } - - - void gui_ShowERT(InsetERT * ie, LyXView & lv, Dialogs & d) - { - controlERTSingleton.get(lv, d).controller().showInset(ie); - } - - - void gui_UpdateERT(InsetERT * ie, LyXView & lv, Dialogs & d) - { - controlERTSingleton.get(lv, d).controller().showInset(ie); - } - - - void gui_ShowExternal(InsetExternal * ie, LyXView & lv, Dialogs & d) - { - static GUI ce(lv, d); - ce.controller().showInset(ie); - } - - - void gui_ShowFile(string const & f, LyXView & lv, Dialogs & d) - { - static GUI csf(lv, d); - csf.controller().showFile(f); - } - - - void gui_ShowFloat(InsetFloat * ifl, LyXView & lv, Dialogs & d) - { - static GUI cf(lv, d); - cf.controller().showInset(ifl); - } - - - void gui_ShowForks(LyXView & lv, Dialogs & d) - { - static GUI cf(lv, d); - cf.controller().show(); - } - - - void gui_ShowGraphics(InsetGraphics * ig, LyXView & lv, Dialogs & d) - { - static GUI cg(lv, d); - cg.controller().showInset(ig); - } - - - void gui_ShowInclude(InsetInclude * ii, LyXView & lv, Dialogs & d) - { - static GUI ci(lv, d); - ci.controller().showInset(ii); - } - - - void gui_ShowIndex(InsetCommand * ic, LyXView & lv, Dialogs & d) - { - controlIndexSingleton.get(lv, d).controller().showInset(ic); - } - - - void gui_CreateIndex(LyXView & lv, Dialogs & d) - { - controlIndexSingleton.get(lv, d).controller().createInset(""); - } - - - void gui_ShowLogFile(LyXView & lv, Dialogs & d) - { - static GUI cl(lv, d); - cl.controller().show(); - } - - - void gui_ShowMathPanel(LyXView & lv, Dialogs & d) - { - static FormMathsPanel fmp(lv, d); - fmp.show(); - } - - - void gui_ShowMinipage(InsetMinipage * im, LyXView & lv, Dialogs & d) - { - controlMinipageSingleton.get(lv, d).controller().showInset(im); - } - - - void gui_UpdateMinipage(InsetMinipage * im, LyXView & lv, Dialogs & d) - { - controlMinipageSingleton.get(lv, d).controller().showInset(im); - } - - - void gui_ShowParagraph(LyXView & lv, Dialogs & d) - { - static GUI cp(lv, d); - cp.controller().show(); - } - - -#if 0 - void gui_UpdateParagraph(LyXView & lv, Dialogs & d) - { -#warning FIXME! - // This should be the same object as in gui_ShowParagraph - static GUI cp(lv, d); -#if 0 - cp. -#endif - } -#endif - - - void gui_ShowPreamble(LyXView & lv, Dialogs & d) - { - static GUI cp(lv, d); - cp.controller().show(); - } - - - void gui_ShowPreferences(LyXView & lv, Dialogs & d) - { - formPreferencesSingleton.get(lv, d).show(); - } - - - void gui_ShowPrint(LyXView & lv, Dialogs & d) - { - static GUI cp(lv, d); - cp.controller().show(); - } - - - void gui_ShowRef(InsetCommand * ic, LyXView & lv, Dialogs & d) - { - controlRefSingleton.get(lv, d).controller().showInset(ic); - } - - - void gui_CreateRef(string const & s, LyXView & lv, Dialogs & d) - { - controlRefSingleton.get(lv, d).controller().createInset(s); - } - - - void gui_ShowSearch(LyXView & lv, Dialogs & d) - { - static GUI cs(lv, d); - cs.controller().show(); - } - - - void gui_ShowSendto(LyXView & lv, Dialogs & d) - { - static GUI cs(lv, d); - cs.controller().show(); - } - - - void gui_ShowSpellchecker(LyXView & lv, Dialogs & d) - { - static GUI cp(lv, d); - cp.controller().show(); - } - - - void gui_ShowTabular(InsetTabular * it, LyXView & lv, Dialogs & d) - { - formTabularSingleton.get(lv, d).showInset(it); - } - - - void gui_UpdateTabular(InsetTabular * it, LyXView & lv, Dialogs & d) - { - formTabularSingleton.get(lv, d).updateInset(it); - } - - - void gui_ShowTabularCreate(LyXView & lv, Dialogs & d) - { - static GUI ctc(lv, d); - ctc.controller().show(); - } - - - void gui_ShowTexinfo(LyXView & lv, Dialogs & d) - { - static GUI ct(lv, d); - ct.controller().show(); - } - - -#ifdef HAVE_LIBAIKSAURUS - - void gui_ShowThesaurus(string const & s, LyXView & lv, Dialogs & d) - { - static GUI ct(lv, d); - ct.controller().showEntry(s); - } - -#else - - void gui_ShowThesaurus(string const &, LyXView &, Dialogs &) - {} - -#endif - - - void gui_ShowTOC(InsetCommand * ic, LyXView & lv, Dialogs & d) - { - controlTocSingleton.get(lv, d).controller().showInset(ic); - } - - - void gui_CreateTOC(string const & s, LyXView & lv, Dialogs & d) - { - controlTocSingleton.get(lv, d).controller().createInset(s); - } - - - void gui_ShowUrl(InsetCommand * ic, LyXView & lv, Dialogs & d) - { - controlUrlSingleton.get(lv, d).controller().showInset(ic); - } - - - void gui_CreateUrl(string const & s, LyXView & lv, Dialogs & d) - { - controlUrlSingleton.get(lv, d).controller().createInset(s); - } - - - void gui_ShowVCLogFile(LyXView & lv, Dialogs & d) - { - static GUI cv(lv, d); - cv.controller().show(); - } - -} // extern "C" -- 2.39.5