Commit Graph

426 Commits

Author SHA1 Message Date
Abdelrazak Younes
414571cf68 Get rid of LyXView::hasFocus().
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31452 a592a061-630c-0410-9148-cb99ea01b6c8
2009-09-23 09:17:11 +00:00
Abdelrazak Younes
6e800efcaf Transfer special getStatus() code from LyXFunc to BufferView, GuiView and GuiApplication.
I tested this on Windows and Linux/X11 but not on Mac so...



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31451 a592a061-630c-0410-9148-cb99ea01b6c8
2009-09-23 09:07:24 +00:00
Abdelrazak Younes
1069dfa7a0 Fix crash when switching window when previous window had no BufferView.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31450 a592a061-630c-0410-9148-cb99ea01b6c8
2009-09-23 07:14:20 +00:00
Abdelrazak Younes
b379d68d21 Move LFUN_BUFFER_WRITE_ALL status to GuiView with a FIXME. I believe this LFUN should go to GuiApplication.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31447 a592a061-630c-0410-9148-cb99ea01b6c8
2009-09-22 21:46:16 +00:00
Abdelrazak Younes
a3adb3a21b Introduce Application::currentWindow() and get rid of lyx_view_ member in LyXFunc.
This commit also move the Selection saving to  QEvent::WindowActivate in GuiView.cpp.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31443 a592a061-630c-0410-9148-cb99ea01b6c8
2009-09-22 21:25:32 +00:00
Abdelrazak Younes
57a531e970 Fix gcc warning.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31426 a592a061-630c-0410-9148-cb99ea01b6c8
2009-09-21 08:20:02 +00:00
Abdelrazak Younes
c1696ccae3 * Move LFUN_BUFFER_CHILD_OPEN to GuiView.
* GuiView:openChildDocument(): New helper method, I removed the comment about bug 3970 because it doesn't apply anymore with this change.




git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31409 a592a061-630c-0410-9148-cb99ea01b6c8
2009-09-19 16:49:31 +00:00
Abdelrazak Younes
37f71fba12 * Move LFUN_BUFFER_CLOSE and LFUN_BUFFER_CLOSE_ALL to GuiView.
* Create a status for LFUN_BUFFER_CLOSE

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31400 a592a061-630c-0410-9148-cb99ea01b6c8
2009-09-19 14:34:46 +00:00
Abdelrazak Younes
93998bb239 * Move Buffer specific LFUNs to Buffer::dispatch() and Buffer::getStatus().
There is a FIXME in there that says that if some LFUN need to be dispatched even if the Buffer is internal then we should add some code. But I couldn't find any for now.
* Move LFUN_BUFFER_IMPORT status to GuiView where it belongs.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31398 a592a061-630c-0410-9148-cb99ea01b6c8
2009-09-19 14:05:52 +00:00
Abdelrazak Younes
416caba0ec Transfer completely LFUN_COMMAND_EXECUTE and LFUN_MESSAGE to GuiView.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31396 a592a061-630c-0410-9148-cb99ea01b6c8
2009-09-19 11:54:23 +00:00
Abdelrazak Younes
1d7d54a4a7 Move LFUN status check to where they belong.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31378 a592a061-630c-0410-9148-cb99ea01b6c8
2009-09-12 21:12:24 +00:00
Abdelrazak Younes
6854d67067 some more buffer -> document buffer fixes.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31377 a592a061-630c-0410-9148-cb99ea01b6c8
2009-09-12 20:55:35 +00:00
Abdelrazak Younes
91bfdfe57c Move LFUN_BUFFER_RELOAD and LFUN_VC_* to GuiView. Try to use the document buffer correctly.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31376 a592a061-630c-0410-9148-cb99ea01b6c8
2009-09-12 20:41:24 +00:00
Vincent van Ravesteijn
3be8389d61 Move LFUN_BUFFER_SWITCH from LyXFunc::getStatus to GuiView::getStatus.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31359 a592a061-630c-0410-9148-cb99ea01b6c8
2009-09-09 05:49:51 +00:00
Abdelrazak Younes
184345e4e7 * GuiView: get rid of Buffer() and documentBuffer() access.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31290 a592a061-630c-0410-9148-cb99ea01b6c8
2009-09-05 15:09:45 +00:00
Abdelrazak Younes
722d8c757b * LyXView:
- view() -> currentBufferView()
  - add const access to bufferViews.
* GuiView.h: cleanups


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31286 a592a061-630c-0410-9148-cb99ea01b6c8
2009-09-05 14:29:11 +00:00
Tommaso Cucinotta
57f1c58598 Added at the LyXView level distinction among currently selected WorkArea (and BufferView) and document WorkArea (and BufferView).
Fixes crash when opening both Toc Panel and Advanced Find and Replace Panel.
Fixes preview of document (as opposed of previewing the search/replace text) while search/replace WorkArea selected.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31203 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-22 16:16:56 +00:00
Vincent van Ravesteijn
bb09bdfc2b Some necessary cleanup, noticed by Pavel.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31182 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-21 20:29:40 +00:00
Pavel Sanda
93d27a33fe Squash warning.
Maybe this parameter should be killed after last cleanup Vicent?


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31177 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-21 16:46:53 +00:00
Vincent van Ravesteijn
5ed9b3f33e Forgot this. This is no longer necessary as we write the session file before closing workareas.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31152 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-19 21:18:34 +00:00
Vincent van Ravesteijn
b45f8b96a6 File->Close All now really closes all buffers. That is, all visible buffers in all views and all hidden buffers.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31151 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-19 21:12:53 +00:00
Vincent van Ravesteijn
66dd3db8bc Fix bug #6162: Crash after close window with master/child.
The previous fix was nonsense. It appeared to be a shameful copy-paste error. GuiView::disconnectBufferView() was exactly the same as GuiView::disconnectBuffer().

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31150 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-19 20:55:02 +00:00
Vincent van Ravesteijn
f9952369ca Make new function writeSession(). Now it's no longer entangled with closing the workareas/buffers.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31147 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-19 20:06:57 +00:00
Vincent van Ravesteijn
81403e78fc If we are in a close_event all children will be closed in some time, so no need to do it here. This will ensure that the children end up in the session file in the correct order. If we close the master buffer, we can close or release the child buffers here too.
We don't want a master buffer to release all its children immediately because that would close dirty childs without saving and would make it impossible to store the childs in a proper way in the session file. 

As, we close all children of a buffer together with the master itself, it is also no longer necessary to do it automatically. 

I'll leave it commented out for a while in case someone objects to it.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31130 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-18 21:18:21 +00:00
Vincent van Ravesteijn
b2588a80f3 - Ditch the in_close_event parameter, as we can use closing_ for this purpose.
- Add some comments for the functions.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31127 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-18 20:48:15 +00:00
Vincent van Ravesteijn
49d03a2576 If we are in a closeEvent, we don't want to close all buffers, because these may live in another View. So, only close the WorkAreas in this view.
For now, I stick to the convention that closing a buffer, will close it in all tabworkareas and all views. Therefore, when choosing File->Close All, we still close all buffers.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31126 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-18 20:41:29 +00:00
Vincent van Ravesteijn
64d7a33a89 Rename closeBufferAll to closeWorkAreaAll (because that's what we do). Add a new closeBufferAll function that closes all WorkArea's and then all hidden buffers. This is easy now, because we've done everything to prevent hidden buffers to be dirty.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31125 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-18 20:12:34 +00:00
Vincent van Ravesteijn
6e4ca1d18f Fix bug #5893: LyX closes hidden dirty buffers without asking.
Closing a tab group will now hide the buffers, but if buffers are dirty it will first ask you to save it.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31124 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-18 19:27:19 +00:00
Vincent van Ravesteijn
0e5f082a57 Dissect closeBufferAll and closeTabWorkArea. Unfortunately, I have two pass ugly parameters.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31122 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-18 19:04:39 +00:00
Vincent van Ravesteijn
0cf46fe101 Don't close the buffer when it is a child.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31109 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-18 00:04:19 +00:00
Vincent van Ravesteijn
f781cdc021 Close the correct tab when clicking one while the active tab is in another tabworkarea. This is also in 1.6.3.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31108 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-17 22:33:49 +00:00
Vincent van Ravesteijn
0e3f25489e Simplify the code, and rename tolastopened to in_close_event. Rationale: when we are in a close event we want to store the last opened files, and we don't want to close any child buffers. Closing the child buffers now will crimple the last opened files in the session file (the order of tabs that is). Child buffers are closed anyway when we are in a close event.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31106 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-17 21:31:24 +00:00
Vincent van Ravesteijn
c76fca43bc Closing the children of a master can be done in closeWorkArea.
This fixes yet another bug. Previously, when a master was closed, its child buffers were also released without asking to save dirty buffers. (What a mess!).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31104 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-17 21:25:27 +00:00
Vincent van Ravesteijn
372e539c6a Mark a buffer as clean when the user chose to discard the changes. This is a patch from Richard to make his emergency cleanup procedure in Buffer::~Buffer work.
Besides that, this can also been seen in 1.6.3. If you have a master and a dirty child, and the dirty child is the second tab, you'll see that when closing LyX, LyX will ask twice whether you want to save the file. Once if the file itself is closed, a second time if the master is closing all his children.

See also the previous commit that treats the case in which the tabs were switched around.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31074 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-16 00:26:14 +00:00
Vincent van Ravesteijn
263c012d4b Fix a crash when closing LyX while a master and a dirty child were open, and if the dirty child is the first tab.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31073 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-16 00:21:02 +00:00
Vincent van Ravesteijn
1520629d7c If we are hiding a buffer _and_ the buffer is visible in another view/tabgroup, then we don't need to ensure that the buffer is clean.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31065 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-15 21:46:39 +00:00
Vincent van Ravesteijn
845baf5016 Let's get rid of this strange Buffer * construction. After that I introduced the inMultiViews() function, it wasn't necessary anymore.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31064 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-15 21:33:37 +00:00
Vincent van Ravesteijn
5679ae92f2 Rename closeBuffer to closeWorkArea, because we'll have to await whether we'll actually close the buffer or not.
Now we can also pass the WorkArea we would like to close. This fixes also the problem that hideWorkArea still wasn't correct. That's a consequence of the fact that we relied on currentMainWorkArea(). I wanted to get rid of that anyway.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31063 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-15 21:29:14 +00:00
Vincent van Ravesteijn
7372c173a6 Make a new function to check whether a workArea is also shown in another view.
Use this function in closeBufferAll, and use closeBuffer to hide the buffer. Now, closeBuffer will decide whether we need to save the buffer or not. Previously, the buffer got hidden even if it was dirty.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31059 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-15 18:13:21 +00:00
Richard Heck
45600e36eb Typo.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31055 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-15 16:03:11 +00:00
Vincent van Ravesteijn
7044b156f0 Fix crash when closing a TabGroup. Probably introduced in r27525 and revealed in r30933.
In setCurrentWorkArea d.current_work_area_ is used which is invalidated by deleting the TabWorkArea.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31054 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-15 15:47:12 +00:00
Vincent van Ravesteijn
ffea0ce1e9 Fix a crash when applying the preferences.
The problem is that all toolbars are deleted and thus also the LayoutBox, which I made a member of GuiView. 

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31051 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-15 14:34:00 +00:00
Vincent van Ravesteijn
3c91fecb61 Among other problems still left. At least close the right tab if you use the context menu.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31050 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-15 14:07:05 +00:00
Vincent van Ravesteijn
bbafbc884c Extend saveBufferIsNeeded with a parameter indicating whether the buffer is going into a hidden state. If so, and the user discards his changes, the buffer will be reloaded to discard the changes.
Now, the option "Hide Tab" uses closeBuffer and asks for saving intead of instantly removing the workArea.

This is part of bug #5893: we try to make sure that there are no dirty hidden buffers.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31043 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-14 23:12:21 +00:00
Vincent van Ravesteijn
81554c90f1 Move layout from GuiToolbar to GuiView. Now, it is possible to use the popup also when the Toolbar has not been visible before.
see: 
http://www.mail-archive.com/lyx-users@lists.lyx.org/msg75503.html

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31042 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-14 22:58:57 +00:00
Abdelrazak Younes
5f2429b4e2 This move out the GuiLayoutBox class out of GuiToolbar where it was a mess. The new LayoutBox is less of a mess now but still a mess.
We need a proper LayoutModel class.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30995 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-12 21:51:10 +00:00
Vincent van Ravesteijn
797f13806d Whitespace and correct naming.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30994 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-12 20:06:29 +00:00
Vincent van Ravesteijn
5ba1f471c7 Explicitly pass to closeBuffer whether the tab should only be hidden or that the buffer should be released.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30993 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-12 20:03:34 +00:00
Vincent van Ravesteijn
3ac3ab1a78 Dissect closeBuffer() and saveBufferIfNeeded().
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30992 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-12 18:50:09 +00:00
Jürgen Spitzmüller
9b8549f5da * GuiView.cpp: disable character and symbols dialog in read-only mode.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30986 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-12 11:02:02 +00:00