+LyXView * LyX::newLyXView()
+{
+ if (!lyx::use_gui)
+ return 0;
+
+ // determine windows size and position, from lyxrc and/or session
+ // initial geometry
+ unsigned int width = 690;
+ unsigned int height = 510;
+ bool maximize = false;
+ // first try lyxrc
+ if (lyxrc.geometry_width != 0 && lyxrc.geometry_height != 0 ) {
+ width = lyxrc.geometry_width;
+ height = lyxrc.geometry_height;
+ }
+ // if lyxrc returns (0,0), then use session info
+ else {
+ string val = session().sessionInfo().load("WindowWidth");
+ if (!val.empty())
+ width = convert<unsigned int>(val);
+ val = session().sessionInfo().load("WindowHeight");
+ if (!val.empty())
+ height = convert<unsigned int>(val);
+ if (session().sessionInfo().load("WindowIsMaximized") == "yes")
+ maximize = true;
+ }
+
+ // if user wants to restore window position
+ int posx = -1;
+ int posy = -1;
+ if (lyxrc.geometry_xysaved) {
+ string val = session().sessionInfo().load("WindowPosX");
+ if (!val.empty())
+ posx = convert<int>(val);
+ val = session().sessionInfo().load("WindowPosY");
+ if (!val.empty())
+ posy = convert<int>(val);
+ }
+
+ if (geometryOption_) {
+ width = 0;
+ height = 0;
+ }
+ // create the main window
+ LyXView * view = &pimpl_->application_->createView(width, height, posx, posy, maximize);
+
+ return view;
+}
+
+/*
+Signals and Windows
+===================
+The SIGHUP signal does not exist on Windows and does not need to be handled.
+
+Windows handles SIGFPE and SIGSEGV signals as expected.
+
+Cntl+C interrupts (mapped to SIGINT by Windows' POSIX compatability layer)
+cause a new thread to be spawned. This may well result in unexpected
+behaviour by the single-threaded LyX.
+
+SIGTERM signals will come only from another process actually sending
+that signal using 'raise' in Windows' POSIX compatability layer. It will
+not come from the general "terminate process" methods that everyone
+actually uses (and which can't be trapped). Killing an app 'politely' on
+Windows involves first sending a WM_CLOSE message, something that is
+caught already by the Qt frontend.
+
+For more information see:
+
+http://aspn.activestate.com/ASPN/Mail/Message/ActiveTcl/2034055
+...signals are mostly useless on Windows for a variety of reasons that are
+Windows specific...
+
+'UNIX Application Migration Guide, Chapter 9'
+http://msdn.microsoft.com/library/en-us/dnucmg/html/UCMGch09.asp
+
+'How To Terminate an Application "Cleanly" in Win32'
+http://support.microsoft.com/default.aspx?scid=kb;en-us;178893
+*/