From 8279ab9cf0890a58cb82cf43f4d5296ff3a3e60e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Tue, 2 Oct 2007 21:01:25 +0000 Subject: [PATCH] mere two functions git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20670 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/Dialogs.cpp | 17 ++--------------- src/frontends/Dialogs.h | 19 +++++++------------ src/frontends/qt4/Dialogs.cpp | 7 ++++--- 3 files changed, 13 insertions(+), 30 deletions(-) diff --git a/src/frontends/Dialogs.cpp b/src/frontends/Dialogs.cpp index 514fb4f9ea..452b7ccbbf 100644 --- a/src/frontends/Dialogs.cpp +++ b/src/frontends/Dialogs.cpp @@ -48,20 +48,6 @@ Dialog * Dialogs::find_or_build(string const & name) } -void Dialogs::show(string const & name, string const & data) -{ - if (in_show_) - return; - - in_show_ = true; - Dialog * dialog = find_or_build(name); - if (dialog) - dialog->showData(data); - - in_show_ = false; -} - - void Dialogs::show(string const & name, string const & data, Inset * inset) { if (in_show_) @@ -71,7 +57,8 @@ void Dialogs::show(string const & name, string const & data, Inset * inset) Dialog * dialog = find_or_build(name); if (dialog) { dialog->showData(data); - open_insets_[name] = inset; + if (inset) + open_insets_[name] = inset; } in_show_ = false; } diff --git a/src/frontends/Dialogs.h b/src/frontends/Dialogs.h index e13039f372..9a57462982 100644 --- a/src/frontends/Dialogs.h +++ b/src/frontends/Dialogs.h @@ -52,30 +52,25 @@ public: void hideBufferDependent() const; /** Update visible, buffer-dependent dialogs If the bool is true then a buffer change has occurred - else its still the same buffer. + else it is still the same buffer. */ - void updateBufferDependent(bool) const ; - - /** \param name == "about" etc; an identifier used to - launch a particular dialog. - \param data is a string encoding of the data used to populate - the dialog. Several of these dialogs do not need any data, - so it defaults to string(). - */ - void show(std::string const & name, std::string const & data = std::string()); + void updateBufferDependent(bool) const; /** \param name == "bibtex", "citation" etc; an identifier used to launch a particular dialog. \param data is a string representation of the Inset contents. It is often little more than the output from Inset::write. It is passed to, and parsed by, the frontend dialog. - \param inset is _not_ passed to the frontend dialog. + Several of these dialogs do not need any data, + so it defaults to string(). + \param inset ownership is _not_ passed to the frontend dialog. It is stored internally and used by the kernel to ascertain what to do with the FuncRequest dispatched from the frontend dialog on 'Apply'; should it be used to create a new inset at the current cursor position or modify an existing, 'open' inset? */ - void show(std::string const & name, std::string const & data, Inset * inset); + void show(std::string const & name, + std::string const & data = std::string(), Inset * inset = 0); /** \param name == "citation", "bibtex" etc; an identifier used to update the contents of a particular dialog with \param data. diff --git a/src/frontends/qt4/Dialogs.cpp b/src/frontends/qt4/Dialogs.cpp index dcdb194ee3..18bef47df8 100644 --- a/src/frontends/qt4/Dialogs.cpp +++ b/src/frontends/qt4/Dialogs.cpp @@ -77,9 +77,10 @@ namespace frontend { namespace { -//This list should be kept in sync with the list of insets in src/insets/Inset.cpp. -//I.e., if a dialog goes with an inset, the dialog should have the same name as the -//inset. +// This list should be kept in sync with the list of insets in +// src/insets/Inset.cpp. I.e., if a dialog goes with an inset, the +// dialog should have the same name as the inset. + char const * const dialognames[] = { "aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character", "citation", "document", "embedding", "errorlist", "ert", "external", "file", -- 2.39.2