simplify window creation.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21735 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-11-23 09:56:33 +00:00
parent 42015a8ebd
commit d4b02ad711
5 changed files with 6 additions and 27 deletions

View File

@ -48,7 +48,6 @@
#include "frontends/alert.h"
#include "frontends/Application.h"
#include "frontends/LyXView.h"
#include "support/environment.h"
#include "support/filetools.h"
@ -99,7 +98,6 @@ using support::package;
using support::prependEnvPath;
using support::rtrim;
using support::Systemcall;
using frontend::LyXView;
namespace Alert = frontend::Alert;
namespace os = support::os;
@ -627,7 +625,8 @@ void LyX::execBatchCommands()
void LyX::restoreGuiSession()
{
LyXView * view = newLyXView();
// create the main window
pimpl_->application_->createView(geometryArg);
// if there is no valid class list, do not load any file.
if (textclasslist.empty())
@ -663,24 +662,6 @@ void LyX::restoreGuiSession()
continue;
updateLabels(*buf);
}
// FIXME: Switch to the last loaded Buffer. This must not be the first one
// because the Buffer won't be connected in this case. The correct solution
// would be to avoid the manual connection of the current Buffer in LyXView.
if (!pimpl_->buffer_list_.empty())
view->setBuffer(pimpl_->buffer_list_.last());
}
LyXView * LyX::newLyXView()
{
if (!lyx::use_gui)
return 0;
// create the main window
LyXView * view = &pimpl_->application_->createView(geometryArg);
return view;
}
/*

View File

@ -1854,7 +1854,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
}
case LFUN_WINDOW_NEW:
LyX::ref().newLyXView();
theApp()->createView();
break;
case LFUN_WINDOW_CLOSE:

View File

@ -207,7 +207,7 @@ public:
/// Create the main window with given geometry settings.
/// \param geometry_arg: only for Windows platform.
virtual LyXView & createView(std::string const & geometry_arg) = 0;
virtual void createView(std::string const & geometry_arg = std::string()) = 0;
};
} // namespace frontend

View File

@ -230,7 +230,7 @@ static void updateIds(map<int, GuiView *> const & stdmap, vector<int> & ids)
}
LyXView & GuiApplication::createView(string const & geometry_arg)
void GuiApplication::createView(string const & geometry_arg)
{
updateIds(views_, view_ids_);
int id = 0;
@ -259,8 +259,6 @@ LyXView & GuiApplication::createView(string const & geometry_arg)
view->setFocus();
setCurrentView(*view);
return *view;
}

View File

@ -68,7 +68,7 @@ public:
virtual void updateColor(ColorCode col);
virtual void registerSocketCallback(int fd, SocketCallback func);
void unregisterSocketCallback(int fd);
LyXView & createView(std::string const & geometry_arg);
void createView(std::string const & geometry_arg = std::string());
//@}
/// Methods inherited from \c QApplication class