Buffer::errors("Parse") is called 7 times in the whole project. 4 times from GuiView and three times from functions in other classes, but which are (almost) only called from the GuiView.
Buffer::errors is used to signal the GUI that there might be an error occuring, but what sense does it make if it is only called from the Gui ?
Isn't it better to let the function return wether it succeeded or not and let the GuiView take action in doing something with the possible errors.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35911 a592a061-630c-0410-9148-cb99ea01b6c8
An example of a fatal function call is "gotoInset(this, NOTE_CODE, true)". Luckily we don't check for the contents in LFUN_NOTE_NEXT.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35860 a592a061-630c-0410-9148-cb99ea01b6c8
avoids multiple screen redraws in some cases.
If someone knows how to fix the FIXMEs in GuiErrorList and
GuiSpellcheker, I'd really appreciate it.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35651 a592a061-630c-0410-9148-cb99ea01b6c8
be telling us. I'm not sure why this wasn't being used any more.
If we find any missing updates, it may be because the inset dispatch
stuff wasn't doing its job.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35634 a592a061-630c-0410-9148-cb99ea01b6c8
* src/LyXAction.cpp: add ReadOnly flag to LFUN_UNDO and LFUN_REDO, since
we do not want the dispatch mechanism to mark buffer dirty after them.
* src/BufferView.cpp: handle "by hand" the activation of undo/redo
* src/Undo.cpp: add lyx_clean member to UndoElement and make sure to
maintain it with undo operations; add a new markDirty() member for UndoStack
* src/Buffer.cpp: when saving a document, mark the undo and redo stacks
elements as dirty.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35068 a592a061-630c-0410-9148-cb99ea01b6c8
reported by the caller. Otherwise, you could get the error message the
first time, and then it would succeed the second!!
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35019 a592a061-630c-0410-9148-cb99ea01b6c8
DispatchResult to store a flag that tells us whether we need a buffer
update or not.
So: If you find a missing one, go to an appropriate place in the
dispatch and call cur.forceBufferUpdate() or, if you don't have a cursor
but do have a DispatchResult, call dr.forceBufferUpdate().
There is one remaining call I could not move, in
TextMetrics::redoParagraph. But this looks like an emergency call when
the macro context has not been set. There are also a couple calls that
are connected with buffer creation that I commented out, since the same
call is done again almost immediately. But I'm not positive about those.
Now the nice thing would be to do the same for updateMacros().
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34826 a592a061-630c-0410-9148-cb99ea01b6c8
Clear the mouse_hover state when closing the BufferView. Otherwise, there will be an invalid pointer stored in the Inset and crashing LyX when the Inset's destructor is called.
See also r33908, r34117, r34348, r34353, r34354, r34363 and bug #3900.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34365 a592a061-630c-0410-9148-cb99ea01b6c8
Now, we only want to let the last_inset_ pointer point at insets that accept the mouse_hover setting. Otherwise, the pointer is not cleared on deletion of the inset.
See also r33908, r34117, r34348, r34353 and bug #3900.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34354 a592a061-630c-0410-9148-cb99ea01b6c8
This is also in preparation of a decent fix for bug #3900.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34347 a592a061-630c-0410-9148-cb99ea01b6c8
Fix the regression introduced in r28397 while fixing bug #5573.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34296 a592a061-630c-0410-9148-cb99ea01b6c8
We need a way to test for the pointer to be valid before using it in updateHoveredInset(). For now, just set it to zero, so that this critical won't find its way into alpha-2.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34117 a592a061-630c-0410-9148-cb99ea01b6c8
Change inset-forall so that screen is not repainted at each iteration, since this lead to very slow opeartion on large files. This is not a problem for current uses, but can potentially lead to crashes.
See ticket #6641 for more thoughts and possible solutions.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34092 a592a061-630c-0410-9148-cb99ea01b6c8
When updating the screen, moving the mouse, or scrolling the buffer, we check whether the hovering status of the insets.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33908 a592a061-630c-0410-9148-cb99ea01b6c8
a lot of simplification is possible. Except some instability period...
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33389 a592a061-630c-0410-9148-cb99ea01b6c8
Split LyXFunc::dispatch into a wrapper that does the actual screen updates and
a worker method that updates a DispatchResult object.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33226 a592a061-630c-0410-9148-cb99ea01b6c8
- Fix crash when performing word-replace while the cursor has a selection
in mathed (bug 6437)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33204 a592a061-630c-0410-9148-cb99ea01b6c8
current buffer and applies a given function at cursor position before the
inset. It is actually possible to filter on the type of inset.
Remove all index insets:
inset-forall Index delete-char-forward
Remove all (!!) insets:
inset-forall * delete-char-forward
Close all Notes (also works for a particular branch, for example)
inset-forall Note inset-toggle close
Close only yellow sticky notes
inset-forall Note:Note inset-toggle close
Of course, things may become weird:
Put LyX in an infinite loop if there is at least a Note
inset-forall Note char-backward
In this case, the code will stop after 1000 iterations.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32834 a592a061-630c-0410-9148-cb99ea01b6c8
- scopes now handled in FindAndReplaceWidget, while lyxfind.cpp only searches within single buffer
- cursor().result().dispatched() now encodes whether a match was found or not, after LFUN_WORD_FINDADV dispatch
- removed a few unneeded functions
- followed a few cosmetic advices
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32760 a592a061-630c-0410-9148-cb99ea01b6c8
Move the AtPoint handling into the Cursor dispatch machinery
Note that the call to Cursor::getStatus is in BufferView::getStatus, while
the call to Cursor::dispatch is still in LyXFunc::dispatch. This needs to be
fixed, but the code there is a bit fragile.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31969 a592a061-630c-0410-9148-cb99ea01b6c8
The solution is just to remove special code :)
I think there is a ticket for this, but I cannot find it.
Abdel, could you please validate my thinking?
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31869 a592a061-630c-0410-9148-cb99ea01b6c8
I still don't know why it is that bad that this call is made below, but this seems to fix the problem.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31758 a592a061-630c-0410-9148-cb99ea01b6c8
The list of dialog edited inset is now stored in BufferView.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31472 a592a061-630c-0410-9148-cb99ea01b6c8
* Add a recenter() call to BufferView::setCursorFromRow() in order to get the screen centered around the found position.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31455 a592a061-630c-0410-9148-cb99ea01b6c8
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
* I transferred local function loadLayoutFile() in LyXFunc.cpp to a LayoutFileList::load().
Richard, as I am not into this layout thing, please check that these LFUNs still operate correctly (except from an embedded work area of course).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31412 a592a061-630c-0410-9148-cb99ea01b6c8
LFUN_BUFFER_PARAMS_APPLY has now a status (disabled if read-only).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31411 a592a061-630c-0410-9148-cb99ea01b6c8
LyX crashes when backward selecting during formula writing
The problem is basically that the anchor is not set (because there is no
selection going on) and BufferView::mouseSetCursor does not handle this.
* Cursor.cpp (anchor): return immediately when there is no selection.
* BufferView.cpp (mouseSetCursor): reset anchor before setting cursor
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30245 a592a061-630c-0410-9148-cb99ea01b6c8
The row in editXY is corrected when we're scrolling with PgUp and PgDwn to make sure that the row where the cursor is places, is completely in the view.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29752 a592a061-630c-0410-9148-cb99ea01b6c8
* Remove the EDITABLE enum,
* add functions hasSettings() for all insets.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29375 a592a061-630c-0410-9148-cb99ea01b6c8
* Inset
Handle LFUN_INSET_SETTINGS.
* LyXAction
Use the AtPoint command flag.
* BufferView
* Text3
Remove code that handled LFUN_INSET_SETTINGS. The inset/next-inset part is handled by the AtPoint lfun flag. showInsetDialog is called by Inset::doDispatch and getStatus will be handled by all insets themselves.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29171 a592a061-630c-0410-9148-cb99ea01b6c8
This patch enhances the Buffer::dispatch() method to make it a full-fledged
member of the dispatch sequence. The most immediate payoff is that LFUNs that
are handled in Buffer::dispatch() can be used from the command line.
We make better use of the DispatchResult object and return error information
through it, rather than using return values. (This was JMarc's suggestion.) We
also introduce a corresponding Buffer::getStatus() method, and modify
BufferView::getStatus() to return a flag indicating whether a decision has been
made, as is already done in some other cases.
Finally, some LFUNs are moved to Buffer::dispatch(), including LFUN_BUFFER_PRINT.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29125 a592a061-630c-0410-9148-cb99ea01b6c8
Also show the Merge dialog when we are behind the last change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29111 a592a061-630c-0410-9148-cb99ea01b6c8
Resizing can occur by toggling toolbars (bug 4733), or by creating or closing buffers which causes the tabbar to toggle (e.g. bug 4174, comment 5).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29066 a592a061-630c-0410-9148-cb99ea01b6c8
this case, when the cursor is on a branch inset (using the AtPoint mechanism)
the branch to which the branch inset belongs will be (de)activated.
This functionality can now be used through the branch inset context menu
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28987 a592a061-630c-0410-9148-cb99ea01b6c8
* src/LyXAction.h: introduce new function attribute AtPoint: this is
for lfuns that should first look at cursor postion whether there
is an inset, before dispatching to container inset.
* src/LyXAction.cpp: remove LFUN_NEXT_INSET_TOGGLE;
mark LFUN_INSET_TOGGLE as AtPoint.
* src/BufferView.cpp (dispatch, getStatus): remove handling of
LFUN_NEXT_INSET_TOGGLE.
* src/LyXFunc.cpp (dispatch, getStatus): handle functions marked
AtPoint.
* lib/*/*: replace next-inset-toggle with inset-toggle.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28980 a592a061-630c-0410-9148-cb99ea01b6c8
http://bugzilla.lyx.org/show_bug.cgi?id=4935
* GuiPrefs: Add an option to the Editing dialog.
* BufferView: Scroll below document if the option is set.
* LyXRC: Write/read the option from preferences file.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28947 a592a061-630c-0410-9148-cb99ea01b6c8
http://bugzilla.lyx.org/show_bug.cgi?id=4733
* GuiWorkArea: This adds "buffer_view_->scrollToCursor();" to GuiWorkArea::resizeBufferView() to make sure that the cursor remains visible.
* BufferView: Make sure that we can call the scrollToCursor function without causing a new repaint.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28946 a592a061-630c-0410-9148-cb99ea01b6c8
Crash with completion in mathed.
When deleting an inset, the stored DocIterator might contain a reference to a non-existent Inset and Text. Therefore, if we detect that the depth has changed, we are (for sure) not in the same paragraph, but we should make sure not to ask for the innerParagraph.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28596 a592a061-630c-0410-9148-cb99ea01b6c8
* BufferView.cpp (dispatch): make sure to repaint the document after
jumping to a new change.
* lyxfind.cpp (findNextChange): do not ignore the last character when
a change extends to the end of an inset.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27083 a592a061-630c-0410-9148-cb99ea01b6c8
* BufferView.cpp (setCursorFromInset): do not ignore the first inset
of the document; revert first tentative patch for this bug.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26645 a592a061-630c-0410-9148-cb99ea01b6c8
* BufferView.cpp (setCursorFromInset): new method, useful to find
an inset that is known to be in the document.
* frontends/qt4/GuiView.cpp (dispatch): do a proper recordUndo
befire appplying changes to an inset. The insets are responsible
for recording additional undo steps that could be needed.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26428 a592a061-630c-0410-9148-cb99ea01b6c8
http://bugzilla.lyx.org/show_bug.cgi?id=5065
* BufferView.cpp (setCursorFromScrollbar): makes sure that the mouse is set using mouseSetCursor (so that dEPM can trigger).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26158 a592a061-630c-0410-9148-cb99ea01b6c8
If Trolltech ever fixes this, then we can put an upper bound onto the #if.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25773 a592a061-630c-0410-9148-cb99ea01b6c8
- move Previews singleton to LyX
- LyX.cpp: set singleton to zero at destruction.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25594 a592a061-630c-0410-9148-cb99ea01b6c8
These have been added to BufferView::dispatch() and BufferView::getStatus() for now. Shortly, we'll be making wider use of Buffer::dispatch() and introducing Buffer::getStatus() and moving these and some other LFUNs there.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24979 a592a061-630c-0410-9148-cb99ea01b6c8
Allow LFUN_INSET_SETTINGS with enclosing inset if this particular dialog has been explicitely requested.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24618 a592a061-630c-0410-9148-cb99ea01b6c8
For the record, this developer is sorry that the problems with this code were not noticed much earlier. It's not fun to do so much work and then have it all reverted.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24373 a592a061-630c-0410-9148-cb99ea01b6c8
However, I am not really sure we should care about these. It's not much
difference, except that application shutdown in slower after 'fixing'
them.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24305 a592a061-630c-0410-9148-cb99ea01b6c8
* src/Text3.cpp:
- fix LFUN_INSET_SETTINGS so that it also works at cursor position.
* LyXAction.cpp:
- doxy.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23923 a592a061-630c-0410-9148-cb99ea01b6c8
* src/BufferView.cpp:
* src/FuncCode.h:
* src/LyXAction.cpp:
- new LFUN_NEXT_INSET_MODIFY
* src/insets/InsetBox.{cpp, h}:
* src/insets/InsetCommand.{cpp,h}:
* src/insets/InsetNote.{cpp,h}:
* src/insets/InsetSpace.{cpp,h}:
* src/insets/InsetVSpace.{cpp,h}:
- implement context menu and access to some changes
* lib/ui/stdmenus.ui:
- new context menus for Box, Space, VSpace, Note.
- extend the context menu for InsetRef.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23920 a592a061-630c-0410-9148-cb99ea01b6c8
EmbeddedFile::enable() and EmbeddedFiles::enable() to differentiate different usages.
A member variable bibfiles_ is added to InsetBibtex because it is not efficient to obtain
EmbeddedFileList each time from params()['bibfiles'] and params()['embed'].
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23576 a592a061-630c-0410-9148-cb99ea01b6c8
* Inset and derived class: get rid of getLabelList()
* BufferView::gotoLabel(): Speed up and simplify by using the tocBackend.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23541 a592a061-630c-0410-9148-cb99ea01b6c8