Remove some methods from GuiView.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21672 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-11-18 23:49:52 +00:00
parent 6feb6a8947
commit dba4159cc2
2 changed files with 43 additions and 60 deletions

View File

@ -79,6 +79,7 @@ using std::string;
#include <QSplitter>
#include <QStackedWidget>
#include <QStatusBar>
#include <QTimer>
#include <QToolBar>
#include <QUrl>
@ -1079,6 +1080,47 @@ void GuiView::restartCursor()
d.current_work_area_->startBlinkingCursor();
}
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.
char const * const dialognames[] = {
"aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character",
"citation", "document", "embedding", "errorlist", "ert", "external", "file",
"findreplace", "float", "graphics", "include", "index", "nomenclature", "label", "log",
"mathdelimiter", "mathmatrix", "note", "paragraph",
"prefs", "print", "ref", "sendto", "spellchecker","tabular", "tabularcreate",
#ifdef HAVE_LIBAIKSAURUS
"thesaurus",
#endif
"texinfo", "toc", "href", "view-source", "vspace", "wrap", "listings" };
char const * const * const end_dialognames =
dialognames + (sizeof(dialognames) / sizeof(char *));
class cmpCStr {
public:
cmpCStr(char const * name) : name_(name) {}
bool operator()(char const * other) {
return strcmp(other, name_) == 0;
}
private:
char const * name_;
};
bool isValidName(string const & name)
{
return std::find_if(dialognames, end_dialognames,
cmpCStr(name.c_str())) != end_dialognames;
}
} // namespace anon
Dialog * GuiView::find_or_build(string const & name)
{
@ -1209,16 +1251,6 @@ void GuiView::updateBufferDependent(bool switched) const
}
void GuiView::redrawDialog() const
{
std::map<string, DialogPtr>::const_iterator it = d.dialogs_.begin();
std::map<string, DialogPtr>::const_iterator end = d.dialogs_.end();
for(; it != end; ++it)
it->second->redraw();
}
void GuiView::checkStatus()
{
std::map<string, DialogPtr>::const_iterator it = d.dialogs_.begin();
@ -1232,40 +1264,6 @@ void GuiView::checkStatus()
}
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.
char const * const dialognames[] = {
"aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character",
"citation", "document", "embedding", "errorlist", "ert", "external", "file",
"findreplace", "float", "graphics", "include", "index", "nomenclature", "label", "log",
"mathdelimiter", "mathmatrix", "note", "paragraph",
"prefs", "print", "ref", "sendto", "spellchecker","tabular", "tabularcreate",
#ifdef HAVE_LIBAIKSAURUS
"thesaurus",
#endif
"texinfo", "toc", "href", "view-source", "vspace", "wrap", "listings" };
char const * const * const end_dialognames =
dialognames + (sizeof(dialognames) / sizeof(char *));
class cmpCStr {
public:
cmpCStr(char const * name) : name_(name) {}
bool operator()(char const * other) {
return strcmp(other, name_) == 0;
}
private:
char const * name_;
};
} // namespace anon
// will be replaced by a proper factory...
Dialog * createGuiAbout(LyXView & lv);
@ -1310,13 +1308,6 @@ Dialog * createGuiViewSource(LyXView & lv);
Dialog * createGuiWrap(LyXView & lv);
bool GuiView::isValidName(string const & name) const
{
return std::find_if(dialognames, end_dialognames,
cmpCStr(name.c_str())) != end_dialognames;
}
Dialog * GuiView::build(string const & name)
{
BOOST_ASSERT(isValidName(name));

View File

@ -21,7 +21,6 @@
#include <QMainWindow>
#include <QTimer>
class QCloseEvent;
class QDragEnterEvent;
@ -32,16 +31,13 @@ class QShowEvent;
namespace lyx {
class Timeout;
class ToolbarInfo;
namespace frontend {
class Dialog;
class GuiToolbar;
class GuiWorkArea;
class Dialog;
QWidget * mainWindow();
/**
* GuiView - Qt4 implementation of LyXView
@ -239,10 +235,6 @@ public:
Inset * getOpenInset(std::string const & name) const;
private:
///
void redrawDialog() const;
///
bool isValidName(std::string const & name) const;
///
Dialog * find_or_build(std::string const & name);
///