From 53bbb6ed7a05a07863e71bc00c1bdf8420d30367 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Thu, 12 Oct 2006 22:02:45 +0000 Subject: [PATCH] * GuiApplication.C: align Windows with other platform. No more static trick! * lyx_main: - LyX::application_ : new scoped_ptr member containing the Application instance. - LyX::priv_exec(): initialize application_. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15316 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiApplication.C | 8 -------- src/lyx_main.C | 17 +++++++++-------- src/lyx_main.h | 8 +++++++- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/frontends/qt4/GuiApplication.C b/src/frontends/qt4/GuiApplication.C index f3c8421f62..fb50274b57 100644 --- a/src/frontends/qt4/GuiApplication.C +++ b/src/frontends/qt4/GuiApplication.C @@ -75,15 +75,7 @@ namespace lyx { lyx::frontend::Application * createApplication(int & argc, char * argv[]) { - // FIXME: it would be great if we could just do: - //return new lyx::frontend::GuiApplication(argc, argv); - -#if defined(Q_WS_WIN) && !defined(Q_CYGWIN_WIN) - static lyx::frontend::GuiApplication app(argc, argv); - return &app; -#else return new lyx::frontend::GuiApplication(argc, argv); -#endif } diff --git a/src/lyx_main.C b/src/lyx_main.C index 2d1a08489e..9da0098cbf 100644 --- a/src/lyx_main.C +++ b/src/lyx_main.C @@ -256,13 +256,14 @@ int LyX::priv_exec(int & argc, char * argv[]) if (lyx::use_gui) { // Force adding of font path _before_ Application is initialized lyx::support::addFontResources(); - theApp = lyx::createApplication(argc, argv); + application_.reset(lyx::createApplication(argc, argv)); + theApp = application_.get(); } else { // FIXME: create a ConsoleApplication theApp = 0; } - + return exec2(argc, argv); } @@ -378,7 +379,7 @@ int LyX::exec2(int & argc, char * argv[]) height = 0; } // create the main window - LyXView * view = &theApp->createView(width, height, posx, posy, maximize); + LyXView * view = &application_->createView(width, height, posx, posy, maximize); ref().addLyXView(view); // load files @@ -397,7 +398,7 @@ int LyX::exec2(int & argc, char * argv[]) // clear this list to save a few bytes of RAM session_->clearLastOpenedFiles(); - return theApp->start(batch_command); + return application_->start(batch_command); } else { // Something went wrong above quitLyX(false); @@ -534,15 +535,15 @@ bool LyX::init() if (lyxrc.roman_font_name.empty()) lyxrc.roman_font_name = - lyx::use_gui? theApp->romanFontName(): "serif"; + lyx::use_gui? application_->romanFontName(): "serif"; if (lyxrc.sans_font_name.empty()) lyxrc.sans_font_name = - lyx::use_gui? theApp->sansFontName(): "sans"; + lyx::use_gui? application_->sansFontName(): "sans"; if (lyxrc.typewriter_font_name.empty()) lyxrc.typewriter_font_name = - lyx::use_gui? theApp->typewriterFontName(): "monospace"; + lyx::use_gui? application_->typewriterFontName(): "monospace"; // // Read configuration files @@ -705,7 +706,7 @@ void LyX::emergencyCleanup() const // a crash theBufferList().emergencyWriteAll(); - theApp->server().emergencyCleanup(); + application_->server().emergencyCleanup(); } diff --git a/src/lyx_main.h b/src/lyx_main.h index c40232f454..8f51d818b2 100644 --- a/src/lyx_main.h +++ b/src/lyx_main.h @@ -27,8 +27,12 @@ class ErrorItem; class InsetBase; class LyXView; class kb_keymap; + namespace lyx { - class Session; +class Session; +namespace frontend { +class Application; +} } @@ -118,6 +122,8 @@ private: /// bool geometryOption_; + /// + boost::scoped_ptr application_; }; #endif // LYX_MAIN_H -- 2.39.2