Commit Graph

270 Commits

Author SHA1 Message Date
Abdelrazak Younes
4d3fbc113f My six month cleanup crusade is now paying off: LyX has now multiple windows support!
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15438 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-21 09:45:11 +00:00
André Pönitz
6c300f72a2 move everything into namespace lyx
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15422 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-21 00:16:43 +00:00
Abdelrazak Younes
9b3d9eb602 - fix formatting (tab vs space)
- Move lyx_server_ and lyx_socket destruction out of prepareExit() because those are only available when lyx::use_gui is true.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15394 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-20 09:56:28 +00:00
Lars Gullik Bjønnes
18ae289343 Abdels fix for pure virtual method called
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15393 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-20 09:41:11 +00:00
Abdelrazak Younes
1f8fe29384 This commit transfers the singletons defined in the Application class to the private LyX::Singletons implementation. It also put the session_ member and top_level_keymap global variable into this Singleton structure.
This commit also modifies the LyXFunc class. A LyXView is not needed any more at construction. Neither is the top level keymap. The LyXFunc key sequences are initialized only if we are in GUI mode (lyx::use_gui = true).
The next step is to rename LyXFunc::owner to LyXFunc::lyx_view_ and to put some BOOST_ASSERT. A classification between Gui and Kernel oriented LFUNs would also be welcome.

*LyX/lyx_main.[Ch]:
 - LyX::Singletons: new private structure containing all the singletons (except the main LyX one of course).
 - buffer_list_, top_level_keymap, session_: transfered to the LyX::Singletons structure.

* LyXFunc:
  - LyXFunc: default constructor does not need any arguments.
  - setupLocalKeymap(): deleted (was not used anywhere).
  - initKeySequences(): new public method called from lyx_main.C, useful only in lyx::use_gui mode.
  - new private member accessor methods

* Application:
  - Application_pimpl: deleted (transfered to LyX)
  - global singleton accessors: transfered to lyx_main.C
  - start(): code transfered to LyX::priv_exec()


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15367 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-19 07:20:32 +00:00
Abdelrazak Younes
c174c9ea88 fix crash on emergencyCleanup() when lyx::use_gui is false.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15360 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-18 09:33:34 +00:00
Abdelrazak Younes
fb1ffecd0c This commits cuts down LyX::exec2 into two new methods (execBatchCommands() and restoreGuiSession()) and introduce a number of helper private function to sanitize the initialization and exit process; quitLyx() is replaced with LyX::quit(). The Application starting and reset is done directly in priv_exec().
* lyx_cb.[Ch]: delete quitLyX()

* lyx_main.[Ch]
  - lyx_exit(): moved to LyX::earlyExit()
  - prepareExit(), quit(), earlyExit(), execBatchCommands(), initGuiFont(): new LyX methods.
  - LyX::priv_exec(): restructured with above helper methods.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15353 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-17 08:36:04 +00:00
Abdelrazak Younes
dcfd6e5a99 enable buffer-export without loading the GUI.
* lyx_main.C:
  - parse_export(): set lyx::use_gui to false.

* MathFactory.C:
  - initMath(): initSymbols() only if lyx::use_gui is true.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15327 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-13 21:27:55 +00:00
Abdelrazak Younes
a897cda71c ensure that Application is properly destroyed after at the end of LyX::priv_exec()
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15326 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-13 19:45:10 +00:00
Abdelrazak Younes
53bbb6ed7a * 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
2006-10-12 22:02:45 +00:00
Abdelrazak Younes
83ffa28e77 This commit is purely mechanical and get rid of lyx_gui.[Ch].
Only qt4 is guaranted to compile and work. I did not remove gtk and qt3 lyx_gui.C because they might be needed for reference to complete the header declarations in "GuiApplication.C".

 - lyx_gui::use_gui transfered to lyx::use_gui in lyx_main.C
 - all remaining lyx_gui functions transfered to Application and corresponding GuiApplication implementations. 


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15306 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-12 14:10:13 +00:00
Abdelrazak Younes
3b21b04e9c * LyX class (lyx_main.[Ch]):
- new buffer_list_ member and accessors
  - implementation of theBufferList() extern function

* Application: remove everything related to BufferList

* lyx_cb.C: test for lyx::use_gui before using theApp.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15303 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-11 22:30:31 +00:00
Abdelrazak Younes
28ad960255 This commit cleans up everything related to singleton. The other important change is that lyx::dispatch() and lyx::getStatus become _the_ official way to use LyXFunc equivalent methods.
* lyxfunc.h:
  - theLyXFunc(): new function in the global namespace.
  - lyx::dispatch():  new function in the lyx namespace.
  - lyx::getStatus():  new function in the lyx namespace.

* bufferlist.h:
  - theBufferList(): new function in the global namespace.

* Clipboard.h:
  - theClipboard(): new function in the global namespace.

* Selection.h:
  - theSelection(): new function in the global namespace.

* FontLoader.h:
  - theFontLoader(): new function in the global namespace.

* FontMetrics.h:
  - theFontMetrics(LyXFont const &): new function in the global namespace.

* Application.C: implements the functions defined above.

* LyXView.h:
  - getLyXFunc(): deleted.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15298 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-11 17:24:46 +00:00
Georg Baum
6ada61e182 Rename namespace Alert to lyx::frontend::Alert.
This prevents a name clash with Qt 4.2.0 on OS X.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15267 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-07 16:47:54 +00:00
Abdelrazak Younes
f54f0e2d4c * lyx_gui: parse_lyxrc() and getStatus() methods deleted.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15256 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-05 16:52:04 +00:00
Abdelrazak Younes
1b8c2a95df use theApp directly for default fonts.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15214 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-03 14:21:15 +00:00
Abdelrazak Younes
85d2e4b917 * lyx_gui: create_view(), start() and exit() functions deleted.
* lyx_main.C and lyx_cb.C: use Application methods directly instead of the above functions.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15211 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-03 13:38:28 +00:00
Abdelrazak Younes
6a947f349b This commit moves system font initialization and restoration to new support/fontutils.[Ch].
These font related functions were identical for qt3 and qt4. They are not Qt dependent at all and could also apply to an eventual Win32 or MacOSX gtk port.

Jen-Marc says: It would be nice to convince fontconfig to do the same for linux.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15196 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-02 10:48:03 +00:00
Abdelrazak Younes
3a1f656e4e * Application: new createView() method
* gtk/qt3/qt4/GuiApplication: createView() method deleted

* LyXView:
 - init(): is now a pure virtual method. autoSave code transferred to constructor and updates to the frontends.
 - setGeometry(): new pure virtual method

* gtk/GView, qt3/QtView, qt4/GuiView: adapted to above change
 - setGeometry(): code transfered from GuiApplication

* lyx_main.C: call LyX::ref().addLyXView() in there instead of in Application::createView()


* 

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15183 a592a061-630c-0410-9148-cb99ea01b6c8
2006-09-29 23:10:17 +00:00
Abdelrazak Younes
ca5411f913 This commit introduces Application_pimpl and cleanup the header includes of the affected .C files.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15182 a592a061-630c-0410-9148-cb99ea01b6c8
2006-09-29 22:06:28 +00:00
Enrico Forestieri
12a6d46370 Small fixes for STLPort compliance
* src/cursor.C: add using std::for_each;

	* src/graphics/GraphicsTypes.h: add #include <string>

	* src/graph.C: add using std::fill;

	* src/frontends/controllers/helper_funcs.h: add #include <algorithm>

	* src/bufferview_funcs.C: add using std::find;

	* src/lyx_main.C: add using std::for_each;

	* configure.ac: don't use boost format on cygwin


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15176 a592a061-630c-0410-9148-cb99ea01b6c8
2006-09-28 00:42:47 +00:00
Abdelrazak Younes
1396c73262 replace global variable bufferlist with Application class member access.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15161 a592a061-630c-0410-9148-cb99ea01b6c8
2006-09-27 10:24:13 +00:00
Abdelrazak Younes
6104eebe0d replace lyxserver and lyxsocket with theApp->server() and theApp->socket() equivalent methods.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15119 a592a061-630c-0410-9148-cb99ea01b6c8
2006-09-22 12:34:13 +00:00
André Pönitz
e89625ef28 rename mathed/math_xinset into mathed/InsetMathX
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15026 a592a061-630c-0410-9148-cb99ea01b6c8
2006-09-17 09:14:18 +00:00
Enrico Forestieri
179ff08011 Avoid a name clash with boost 1.34
* src/lyx_cb.C (reconfigure):
	* src/buffer.C (runChktex):
	* src/lyxfunc.C (dispatch):
	* src/vc-backend.C (doVCCommand):
	* src/lyx_main.C (reconfigureUserLyXDir):
	Explicitly specify lyx::support::Path.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14982 a592a061-630c-0410-9148-cb99ea01b6c8
2006-09-12 17:41:50 +00:00
Abdelrazak Younes
a6444784dc A bunch of conversion to docstring.
- bformat(): contributed by Georg Beaum
- Alert::XXX
- error(): in SpellBase, ispell, psell, aspell, buffer, etc.
- message(), message signal
- displayMessage(), setMessage,
- ErrorItems
- prettyName()
- makeDisplayPath()

and maybe some more...


- etc... 

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14970 a592a061-630c-0410-9148-cb99ea01b6c8
2006-09-11 08:54:10 +00:00
Lars Gullik Bjønnes
43b77ba2d7 Change _() to return a docstring. Fixup callers with the help of lyx::to_utf8.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14952 a592a061-630c-0410-9148-cb99ea01b6c8
2006-09-09 15:27:44 +00:00
Georg Baum
c20cf44f4e remove unused 'using lyx::support::quoteName;'
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14946 a592a061-630c-0410-9148-cb99ea01b6c8
2006-09-08 15:32:20 +00:00
Jean-Marc Lasgouttes
f8a5da9048 * configure.ac: add LYX_DATE variable for release date.
* config/lyxinclude.m4: reset release date for development versions.

	* src/version.C.in: make lyx_release_date a placeholder.

	* src/lyx_main.C (parse_version): 
	* src/frontends/controllers/ControlAboutlyx.C (getVersion): change a 
	bit the display of LyX release date.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14712 a592a061-630c-0410-9148-cb99ea01b6c8
2006-08-16 21:54:55 +00:00
Georg Baum
28ef49f2d9 * src/buffer.C
(Buffer::errorList): simplify

	* src/buffer.h
	emptyErrorList_ move to buffer.C and make it static const

	* src/lyx_main.C
	(LyX::exec2): Use for_each instead of for loop


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14667 a592a061-630c-0410-9148-cb99ea01b6c8
2006-08-14 09:33:49 +00:00
Abdelrazak Younes
c5a4f61f33 This commit creates a error_lists map member inside the Buffer class.
I had no choice but to use string for the map key. This is
because the only information that could be passed to the controller is a
string.

With this new architecture, persistent error lists are now possible.

* Buffer
  - errorList_, addError(),  : deleted
  - std::map<std::string, ErrorList> errorLists_ : new member
  - errorList(std::string const & type): associated accessors

* buffer_funcs.C
  - bufferErrors(Buffer const & buf, TeXErrors const & terr): now needs a third errorList argument
  - bufferErrors(Buffer const & buf, ErrorList const & el): deleted.

* Converter
  - convert(): now needs an ErrorList argument instead of filling the Buffer errorList member directly.
  - runLaTeX(): ditto
  - scanLog(): ditto

* CutAndPaste.C
  - pasteParagraphList(): ditto
  - pasteSelection(): ditto

* lyxtext.h/text.C
  - readParagraph(): ditto
  - LyXText::read(): ditto

* importer:
  - Importer::Import(): ditto

* BufferView_pimpl.C
  - loadLyXFile(): send the Buffer::errors() signal instead of calling LyXView::showErrorList() directly.

* exporter.C
  - Export(): send the Buffer::errors() signal instead of calling LyXView::showErrorList() directly in lyxfunc.C

* ControlErrorList.C
  - initialiseParams(): translation operation transfered here from LyXView::showErrorList().

* LyXView.C
  - LoadLyXFile(): add a showErrorList("Parse") call.
  - showErrorList(): simplified due to code transferred to the ControlErrorList.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14652 a592a061-630c-0410-9148-cb99ea01b6c8
2006-08-13 16:16:43 +00:00
Jean-Marc Lasgouttes
5c4151bb9b * lyx_main.C (init): Do automatic reconfiguration even when
running in batch mode (bug 2741).



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14619 a592a061-630c-0410-9148-cb99ea01b6c8
2006-08-11 22:11:33 +00:00
Bo Peng
c8e5ee867f load files from lyx_main.C instead of lyx_gui.C, do not add session-restored files to lastfile list.
* src/frontends/lyx_gui.h: add prototype for create_view
	* src/frontends/(gtk,qt3,qt4)/lyx_gui.C: separate start()
	* src/lyx_main.C: call create_view, load file, and call start


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14500 a592a061-630c-0410-9148-cb99ea01b6c8
2006-07-27 14:13:45 +00:00
Georg Baum
04986c096a Fix bug 2404
* src/lyx_cb.C
	(newFile): Only set the new buffer if it is valid

	* src/BufferView_pimpl.C
	(BufferView::Pimpl::loadLyXFile): Test whether newFile succeeded

	* src/lyxfunc.C
	(LyXFunc::menuNew): Only set the new buffer if it is valid
	(LyXFunc::open): ditto

	* src/importer.C
	(Importer::Import): ditto

	* src/lyx_main.C
	(LyX::exec2): Only use the new buffer if newFile succeeded

	* src/buffer_funcs.C
	(newFile): discard the buffer and return 0 if the template is invalid


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14474 a592a061-630c-0410-9148-cb99ea01b6c8
2006-07-17 15:13:49 +00:00
Abdelrazak Younes
00c37e4781 This commit transfer the ErrorList handling from LyXView to Buffer. It also removes the need for the error signal and simplify the kerbel <-> frontend communication. I think it should speed-up _significantly_ the latex compilation for example in case of problematic files.
TODO 1: All occurrences of "LyXView::showErrorList()" in the "kernel" should be replaced by a boost signal emission (Buffer::errors()). This signal is already connected to this showErrorList() slot.

TODO 2: The ErrorList mechanism is used wrongly in a number of place, most notably in "Converter.C". Instead of replacing the ErrorList in the "Buffer" class, the "Converter" class should maintain its own list instead and connect directly to the LyXView::showErrorList() slot.

Buffer:
* errorList_: new private member and associated access methods.
* setErrorList(): new accessor method.
* addError(): apend an error to the errorList_.
* error(): deleted.
* errors(): new boost signal, unused for now. Shall be used instead of LyXView::showErrorList().

LyXView:
* getErrorList(), addError(), errorlist_, errorConnection_: deleted.
* errorsConnection_: new boost connection for the Buffer::errors() signal.

lyx_main.C:
* LyX::exec2(): manually print all errors.

BufferView.h: remove unneeded ErrorList forward declaration.

BufferView::pimpl::menuInsertLyXFile(): delete Buffer::error() connection and add a FIXME comment

text.C: Use Buffer::addError() instead of Buffer::error() signal emission.

ControlErrorList.C: get the ErrorList from the Buffer instead of LyXView


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14467 a592a061-630c-0410-9148-cb99ea01b6c8
2006-07-15 22:43:37 +00:00
Georg Baum
da9cdaf218 Reduce calls of ::exit()
* src/main.C
	(main): return LyX::exec()

	* src/frontends/{gtk,qt3,qt4}/lyx_gui.C
	(lyx_gui::exec): Change return value to int
	(lyx_gui::start): ditto

	* src/frontends/qt[3,4]/lyx_gui.C
	(lyx_gui::exit): Call QApplication::exit instead of ::exit, this
	hack is not needed anymore

	* src/frontends/lyx_gui.h
	(lyx_gui::exec): Change return value to int
	(lyx_gui::start): ditto

	* src/lyxtextclasslist.[Ch]
	(LyXSetStyle): SChange return value to bool and don't call ::exit

	* src/lyx_main.C
	(showFileError): Don't exit anymore

	* src/lyx_main.[Ch]
	(LyX::exec): Change return value to int
	(LyX::priv_exec): ditto
	(LyX::exec2): ditto
	(LyX::init): Change return value to bool
	(LyX::readRcFile): ditto
	(LyX::readUIFile): ditto



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14339 a592a061-630c-0410-9148-cb99ea01b6c8
2006-07-05 17:01:26 +00:00
Jean-Marc Lasgouttes
44a5cfc89c Renaming:
cygwin_path_fix		->	windows_style_tex_paths
	cygwin_path_fix_needed	->	tex_expects_windows_paths
	check_cygwin_path	->	check_windows_style_tex_paths
	use_cygwin_paths	->	use_windows_paths
	RC_CYGWIN_PATH_FIX	->	RC_TEX_EXPECTS_WINDOWS_PATHS

	* src/frontends/qt4/ui/QPrefCygwinPathUi.ui
	* src/frontends/qt3/ui/QPrefCygwinPathModule.ui
	  Updated checkbutton label and description

	* src/frontends/qt4/QPrefsDialog.C
	  (PrefCygwinPath): cygwin_path_fix -> windows_style_tex_paths
	  (QPrefsDialog): Enable checkbutton for native WIN32 builds

	* src/frontends/xforms/forms/form_preferences.fd
	  Updated label and name of checkbutton

	* src/frontends/xforms/FormPreferences.C
	  (apply): cygwin_path_fix -> windows_style_tex_paths
	           check_cygwin_path -> check_windows_style_tex_paths
	  (build): Enable checkbutton for native WIN32 builds
	  (update): Ditto
	  (feedback): Updated description

	* src/frontends/qt3/QPrefs.C
	* src/frontends/qt3/QPrefsDialog.C
	* src/frontends/qt3/QPrefsDialog.h
	  Renaming as above, enabled checkbutton for native WIN32 builds

	* src/support/os_unix.C
	* src/support/os.h
	* src/support/os_win32.C
	  Renaming cygwin_path_fix -> windows_style_tex_paths
	* src/support/os_cygwin.C
	  Ditto
	  (external_path, external_path_list): always return windows
	  style paths, not depending on the checkbutton status

	* src/lyxrc.C
	* src/lyxrc.h
	* src/lyxfunc.C
	* src/lyx_main.C
	  Renaming

	* lib/configure.py
	  Renaming, more meaningful diagnostics




git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14242 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-27 10:51:24 +00:00
Peter Kümmel
2deec8a96a Pass width = 0 and height = 0 as unsigned int to indicate the usage of the geometry option
* lyx_main.C set             width and height to 0
	* frontends/qt3/lyx_gui.C    test on 0
	* frontends/qt4/lyx_gui.C    test on 0  
	


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14235 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-26 18:07:10 +00:00
Abdelrazak Younes
3287c44f33 GUI API Cleanup step 2: merge of the "younes" branch.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14231 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-26 16:55:35 +00:00
Peter Kümmel
04cfa65a96 fix: qt3/qt4 save/restore of the window geometry and maximize status
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14166 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-21 10:30:32 +00:00
Peter Kümmel
bbc587ee9a coding style and readability corrections
Index: frontends/qt3/lyx_gui.C
===================================================================
--- frontends/qt3/lyx_gui.C     (revision 14088)
+++ frontends/qt3/lyx_gui.C     (working copy)
@@ -222,12 +222,12 @@


 void start(string const & batch, vector<string> const & files,
-          unsigned int width, unsigned int height, int posx, int posy, bool isMax)
+          unsigned int width, unsigned int height, int posx, int posy, bool maximize)
 {
        // this can't be done before because it needs the Languages object
        initEncodings();

-       boost::shared_ptr<QtView> view_ptr(new QtView(width, height, isMax));
+       boost::shared_ptr<QtView> view_ptr(new QtView(width, height, maximize));
        LyX::ref().addLyXView(view_ptr);

        QtView & view = *view_ptr.get();
Index: frontends/qt3/QtView.C
===================================================================
--- frontends/qt3/QtView.C      (revision 14088)
+++ frontends/qt3/QtView.C      (working copy)
@@ -55,12 +55,12 @@



-QtView::QtView(unsigned int width, unsigned int height, bool isMax)
+QtView::QtView(unsigned int width, unsigned int height, bool maximize)
        : QMainWindow(), LyXView(), commandbuffer_(0)
 {
        resize(width, height);

-       if(isMax)
+       if (maximize)
                this->setWindowState(WindowMaximized);

        qApp->setMainWidget(this);
@@ -164,7 +164,7 @@
 void QtView::closeEvent(QCloseEvent *)
 {
        LyX::ref().session().saveSessionInfo("WindowIsMaximized", (this->isMaximized() ? "yes" : "no"));
-       //don't save maximized values
+       // don't save maximized values
        this->showNormal();
        // save windows size and position
        LyX::ref().session().saveSessionInfo("WindowWidth", convert<string>(width()));
Index: frontends/qt3/QtView.h
===================================================================
--- frontends/qt3/QtView.h      (revision 14088)
+++ frontends/qt3/QtView.h      (working copy)
@@ -37,7 +37,7 @@
        Q_OBJECT
 public:
        /// create a main window of the given dimensions
-       QtView(unsigned int w, unsigned int h, bool isMax);
+       QtView(unsigned int w, unsigned int h, bool maximize);

        ~QtView();

Index: frontends/qt4/lyx_gui.C
===================================================================
--- frontends/qt4/lyx_gui.C     (revision 14088)
+++ frontends/qt4/lyx_gui.C     (working copy)
@@ -228,12 +228,12 @@


 void start(string const & batch, vector<string> const & files,
-          unsigned int width, unsigned int height, int posx, int posy, bool isMax)
+          unsigned int width, unsigned int height, int posx, int posy, bool maximize)
 {
        // this can't be done before because it needs the Languages object
        initEncodings();

-       boost::shared_ptr<QtView> view_ptr(new QtView(width, height, isMax));
+       boost::shared_ptr<QtView> view_ptr(new QtView(width, height, maximize));
        LyX::ref().addLyXView(view_ptr);

        QtView & view = *view_ptr.get();
Index: frontends/qt4/QtView.C
===================================================================
--- frontends/qt4/QtView.C      (revision 14088)
+++ frontends/qt4/QtView.C      (working copy)
@@ -70,12 +70,12 @@
 } // namespace anon


-QtView::QtView(unsigned int width, unsigned int height, bool isMax)
+QtView::QtView(unsigned int width, unsigned int height, bool maximize)
        : QMainWindow(), LyXView(), commandbuffer_(0)
 {
        resize(width, height);

-       if(isMax)
+       if (maximize)
                this->setWindowState(Qt::WindowMaximized);

        mainWidget_ = this;
Index: frontends/qt4/QtView.h
===================================================================
--- frontends/qt4/QtView.h      (revision 14088)
+++ frontends/qt4/QtView.h      (working copy)
@@ -47,7 +47,7 @@
        Q_OBJECT
 public:
        /// create a main window of the given dimensions
-       QtView(unsigned int w, unsigned int h, bool isMax);
+       QtView(unsigned int w, unsigned int h, bool maximize);

        ~QtView();

Index: frontends/lyx_gui.h
===================================================================
--- frontends/lyx_gui.h (revision 14088)
+++ frontends/lyx_gui.h (working copy)
@@ -57,7 +57,7 @@
  * batch commands, and loading the given documents
  */
 void start(std::string const & batch, std::vector<std::string> const & files,
-           unsigned int width, unsigned int height, int posx, int posy, bool isMax);
+           unsigned int width, unsigned int height, int posx, int posy, bool maximize);

 /**
  * Enter the main event loop (\sa LyX::exec2)
Index: lyx_main.C
===================================================================
--- lyx_main.C  (revision 14088)
+++ lyx_main.C  (working copy)
@@ -307,7 +307,7 @@
                // initial geometry
                unsigned int width = 690;
                unsigned int height = 510;
-               bool isMax = false;
+               bool maximize = false;
                // first try lyxrc
                if (lyxrc.geometry_width != 0 && lyxrc.geometry_height != 0 ) {
                        width = lyxrc.geometry_width;
@@ -322,7 +322,7 @@
                        if (!val.empty())
                                height = convert<unsigned int>(val);
                        if (session().loadSessionInfo("WindowIsMaximized") == "yes")
-                               isMax = true;
+                               maximize = true;
                }
                // if user wants to restore window position
                int posx = -1;
@@ -335,7 +335,7 @@
                        if (!val.empty())
                                posy = convert<int>(val);
                }
-               lyx_gui::start(batch_command, files, width, height, posx, posy, isMax);
+               lyx_gui::start(batch_command, files, width, height, posx, posy, maximize);
        } else {
                // Something went wrong above
                quitLyX(false);



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14089 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-13 08:24:43 +00:00
Peter Kümmel
226acfcbab Qt3/Qt4:
- don't save geometry values of the maximized lyx window
   - save/restore the maximized property of the lyx window

- fix changed lyx_gui::start interface for xform and gtk


Index: frontends/gtk/lyx_gui.C
===================================================================
--- frontends/gtk/lyx_gui.C	(revision 14083)
+++ frontends/gtk/lyx_gui.C	(working copy)
@@ -123,7 +123,7 @@
 
 
 void lyx_gui::start(string const & batch, std::vector<string> const & files,
-		    unsigned int width, unsigned int height, int posx, int posy)
+		    unsigned int width, unsigned int height, int posx, int posy, bool)
 {
 	boost::shared_ptr<GView> view_ptr(new GView);
 	LyX::ref().addLyXView(view_ptr);
Index: frontends/qt3/lyx_gui.C
===================================================================
--- frontends/qt3/lyx_gui.C	(revision 14083)
+++ frontends/qt3/lyx_gui.C	(working copy)
@@ -222,12 +222,12 @@
 
 
 void start(string const & batch, vector<string> const & files,
-	   unsigned int width, unsigned int height, int posx, int posy)
+	   unsigned int width, unsigned int height, int posx, int posy, bool isMax)
 {
 	// this can't be done before because it needs the Languages object
 	initEncodings();
 
-	boost::shared_ptr<QtView> view_ptr(new QtView(width, height));
+	boost::shared_ptr<QtView> view_ptr(new QtView(width, height, isMax));
 	LyX::ref().addLyXView(view_ptr);
 
 	QtView & view = *view_ptr.get();
Index: frontends/qt3/QtView.C
===================================================================
--- frontends/qt3/QtView.C	(revision 14083)
+++ frontends/qt3/QtView.C	(working copy)
@@ -55,10 +55,13 @@
 
 
 
-QtView::QtView(unsigned int width, unsigned int height)
+QtView::QtView(unsigned int width, unsigned int height, bool isMax)
 	: QMainWindow(), LyXView(), commandbuffer_(0)
 {
 	resize(width, height);
+	
+	if(isMax)
+		this->setWindowState(WindowMaximized);
 
 	qApp->setMainWidget(this);
 
@@ -160,6 +163,9 @@
 
 void QtView::closeEvent(QCloseEvent *)
 {
+	LyX::ref().session().saveSessionInfo("WindowIsMaximized", (this->isMaximized() ? "yes" : "no"));
+	//don't save maximized values
+	this->showNormal();
 	// save windows size and position
 	LyX::ref().session().saveSessionInfo("WindowWidth", convert<string>(width()));
 	LyX::ref().session().saveSessionInfo("WindowHeight", convert<string>(height()));
Index: frontends/qt3/QtView.h
===================================================================
--- frontends/qt3/QtView.h	(revision 14083)
+++ frontends/qt3/QtView.h	(working copy)
@@ -37,7 +37,7 @@
 	Q_OBJECT
 public:
 	/// create a main window of the given dimensions
-	QtView(unsigned int w, unsigned int h);
+	QtView(unsigned int w, unsigned int h, bool isMax);
 
 	~QtView();
 
Index: frontends/qt4/lyx_gui.C
===================================================================
--- frontends/qt4/lyx_gui.C	(revision 14083)
+++ frontends/qt4/lyx_gui.C	(working copy)
@@ -228,12 +228,12 @@
 
 
 void start(string const & batch, vector<string> const & files,
-	   unsigned int width, unsigned int height, int posx, int posy)
+	   unsigned int width, unsigned int height, int posx, int posy, bool isMax)
 {
 	// this can't be done before because it needs the Languages object
 	initEncodings();
 
-	boost::shared_ptr<QtView> view_ptr(new QtView(width, height));
+	boost::shared_ptr<QtView> view_ptr(new QtView(width, height, isMax));
 	LyX::ref().addLyXView(view_ptr);
 
 	QtView & view = *view_ptr.get();
Index: frontends/qt4/QtView.C
===================================================================
--- frontends/qt4/QtView.C	(revision 14083)
+++ frontends/qt4/QtView.C	(working copy)
@@ -70,11 +70,14 @@
 } // namespace anon
 
 
-QtView::QtView(unsigned int width, unsigned int height)
+QtView::QtView(unsigned int width, unsigned int height, bool isMax)
 	: QMainWindow(), LyXView(), commandbuffer_(0)
 {
 	resize(width, height);
 
+	if(isMax)
+		this->setWindowState(Qt::WindowMaximized);
+
 	mainWidget_ = this;
 
 //	setToolButtonStyle(Qt::ToolButtonIconOnly);
@@ -182,11 +185,12 @@
 void QtView::closeEvent(QCloseEvent *)
 {
 	// save windows size and position
-	LyX::ref().session().saveSessionInfo("WindowWidth", convert<string>(width()));
-	LyX::ref().session().saveSessionInfo("WindowHeight", convert<string>(height()));
+	LyX::ref().session().saveSessionInfo("WindowWidth", convert<string>(this->normalGeometry().width()));
+	LyX::ref().session().saveSessionInfo("WindowHeight", convert<string>(this->normalGeometry().height()));
+	LyX::ref().session().saveSessionInfo("WindowIsMaximized", (this->isMaximized() ? "yes" : "no"));
 	if (lyxrc.geometry_xysaved) {
-		LyX::ref().session().saveSessionInfo("WindowPosX", convert<string>(x()));
-		LyX::ref().session().saveSessionInfo("WindowPosY", convert<string>(y()));
+		LyX::ref().session().saveSessionInfo("WindowPosX", convert<string>(this->normalGeometry().x()));
+		LyX::ref().session().saveSessionInfo("WindowPosY", convert<string>(this->normalGeometry().y()));
 	}
 	// trigger LFUN_LYX_QUIT instead of quit directly
 	// since LFUN_LYX_QUIT may have more cleanup stuff
Index: frontends/qt4/QtView.h
===================================================================
--- frontends/qt4/QtView.h	(revision 14083)
+++ frontends/qt4/QtView.h	(working copy)
@@ -47,7 +47,7 @@
 	Q_OBJECT
 public:
 	/// create a main window of the given dimensions
-	QtView(unsigned int w, unsigned int h);
+	QtView(unsigned int w, unsigned int h, bool isMax);
 
 	~QtView();
 
Index: frontends/xforms/lyx_gui.C
===================================================================
--- frontends/xforms/lyx_gui.C	(revision 14083)
+++ frontends/xforms/lyx_gui.C	(working copy)
@@ -256,7 +256,7 @@
 
 
 void start(string const & batch, vector<string> const & files,
-	   unsigned int width, unsigned int height, int posx, int posy)
+	   unsigned int width, unsigned int height, int posx, int posy, bool)
 {
 	int const geometryBitmask =
 		XParseGeometry(geometry, &posx, &posy, &width, &height);
Index: frontends/lyx_gui.h
===================================================================
--- frontends/lyx_gui.h	(revision 14083)
+++ frontends/lyx_gui.h	(working copy)
@@ -57,7 +57,7 @@
  * batch commands, and loading the given documents
  */
 void start(std::string const & batch, std::vector<std::string> const & files,
-           unsigned int width, unsigned int height, int posx, int posy);
+           unsigned int width, unsigned int height, int posx, int posy, bool isMax);
 
 /**
  * Enter the main event loop (\sa LyX::exec2)
Index: lyx_main.C
===================================================================
--- lyx_main.C	(revision 14083)
+++ lyx_main.C	(working copy)
@@ -307,6 +307,7 @@
 		// initial geometry
 		unsigned int width = 690;
 		unsigned int height = 510;
+		bool isMax = false;
 		// first try lyxrc
 		if (lyxrc.geometry_width != 0 && lyxrc.geometry_height != 0 ) {
 			width = lyxrc.geometry_width;
@@ -320,6 +321,8 @@
 			val = session().loadSessionInfo("WindowHeight");
 			if (!val.empty())
 				height = convert<unsigned int>(val);
+			if (session().loadSessionInfo("WindowIsMaximized") == "yes")
+				isMax = true;
 		}
 		// if user wants to restore window position
 		int posx = -1;
@@ -332,7 +335,7 @@
 			if (!val.empty())
 				posy = convert<int>(val);
 		}
-		lyx_gui::start(batch_command, files, width, height, posx, posy);
+		lyx_gui::start(batch_command, files, width, height, posx, posy, isMax);
 	} else {
 		// Something went wrong above
 		quitLyX(false);



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14088 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-13 08:05:00 +00:00
Georg Baum
042d5a0242 Fix crash on exit (bug 2549) by correct usage of QApplication
* src/lyx_cb.C
	(quitLyX): lyx_gui::exit takes now an argument

	* src/frontends/{gtk,xforms}/lyx_gui.C
	(lyx_gui::parse_init): rename to lyx_gui::exec and call LyX::exec2
	(void lyx_gui::exit): add exit status argument

	* src/frontends/qt{3,4}/lyx_gui.C
	(cleanup): new function for pointer cleanup
	(lyx_gui::parse_init): rename to lyx_gui::exec and call LyX::exec2,
	turn static variables into automatic variables
	(void lyx_gui::exit): add exit status argument
	(start): Use cleanup()
	(exit): ditto

	* src/frontends/lyx_gui.h
	(parse_init): remove
	(exec): new
	(exit): Take exist status argument

	* src/lyx_main.[Ch]
	(LyX::priv_exec): split into LyX::priv_exec and LyX::exec2

	* src/lyx_main.C
	(lyx_exit): New, choose the right exit function
	(showFileError): call lyx_exit
	(LyX::queryUserLyXDir): ditto
	(LyX::init): ditto
	(LyX::priv_exec): ditto
	(LyX::priv_exec): Replace want_gui by lyx_gui::use_gui
	(LyX::priv_exec): replace lyx_gui::parse_init by lyx_gui::exec and
	exec2
	(LyX::init): Replace gui argument by lyx_gui::use_gui


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14036 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-07 20:08:37 +00:00
Bo Peng
f9c7473ed3 Move window width/height/posx/posy from frontends to lyx_main.C, from Bo Peng (ben.bob@gmail.com)
* src/frontends/ALLFRONTENDS/lyx_gui.C: use passed width/height/posx/posy in lyx_gui::start
	* src/frontends/lyx_gui.h: prototype change for lyx_gui::start
	* src/lyx_main.C: determine windows size and position from lyxrc or session.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13953 a592a061-630c-0410-9148-cb99ea01b6c8
2006-05-29 15:11:19 +00:00
Jean-Marc Lasgouttes
b6e30400f5 New auto-open feature from Bo Peng (with help from Jean-Marc and Enrico)
* src/lyx_main.C (init): call Formats::setAutoOpen.
	
	* src/lyxrc.C (read): do not reset editor/viewer values of "none".

	* src/format.C (fixCommand): helper function: tweak command depending
	of the availability of OS viewer/editor.
	(setAutoOpen): run fixCommand over all the formats.

	* src/support/Makefile.am: under win32, link against shlwapi.dll.
	
	* src/support/os_*.C (canAutoOpenFile, autoOpenFile): new
	functions, used	to let the OS handle viewers and editors it knows about.

	* configure.ac: improve check for shlwapi.

	* lib/configure.py: remove check for native windows viewers.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13855 a592a061-630c-0410-9148-cb99ea01b6c8
2006-05-17 22:13:33 +00:00
Jean-Marc Lasgouttes
b01dc72b0e * src/lyx_main.C (init): call queryUserLyXDir just after reading
lyxrc.dist, but before reading lyxrc.defaults; add extra_prefix to
	the PATH before reconfiguring.
	(needsUpdate): new helper function; returns true if file does not
	exist or is older than configure.py.
	(queryUserLyXDir): check textclass.lst and packages.lst in
	addition to lyxrc.defaults.
	(reconfigureUserLyXDir): use SystemCall, since system() does not
	wait on windows.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13816 a592a061-630c-0410-9148-cb99ea01b6c8
2006-05-09 15:41:42 +00:00
Michael Schmitt
1396ade8b1 fix LFUN enum values (some of them were broken by r13801)
adjust some commands according to the LyX naming conventions
(toggle-tooltip => tooltip-toggle, *-change(s) => change(s)-*) 


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13811 a592a061-630c-0410-9148-cb99ea01b6c8
2006-05-08 18:09:19 +00:00
André Pönitz
da65e2b7fb rename LFUN enum values according to their command (as used in th minibuffer/bind files
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13801 a592a061-630c-0410-9148-cb99ea01b6c8
2006-05-05 20:23:12 +00:00
Jean-Marc Lasgouttes
c1cd75a877 * src/lyx_main.C (readRcFile): do not report an error if file is not
found. 
	(init): read lyxrc.dist before lyxrc.defaults; remove code to read
	lyxrc (LyX 1.1.5 compatibility code).

	* src/encoding.C (read): 
	* src/language.C (read): set debug to the INFO channel.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13788 a592a061-630c-0410-9148-cb99ea01b6c8
2006-05-02 12:53:48 +00:00
Bo Peng
34770cd68b Fix a few issues with session/lastopenedfiles, Bo Peng (ben.bob@gmail.com)
* src/bufferlist.C: save opened file list here, do not save slave document
	* src/lyxfunc.C: not here
	* src/session.[nC]: change to single file addition
	* src/lyx_main.C: needed change because of single file addition


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13777 a592a061-630c-0410-9148-cb99ea01b6c8
2006-04-28 14:29:38 +00:00