Commit Graph

628 Commits

Author SHA1 Message Date
Vincent van Ravesteijn
573500dd04 Remove unneccessary uses of dynamic_cast from the code.
A dynamic_cast is necessary when:

- the object to be casted is from an external library because we can't add Qxxx::asXxxx() to Qt e.g.:
    * QAbstractListModel to GuiIdListModel,
    * QValidator to PathValidator,
    * QWidget to TabWorkArea,
    * QWidget to GuiWorkArea;

- the object is to be casted from an interface to the implementing class, because the Interface does not know by whom it is implemented:
    * ProgressInterface to GuiProgress,
    * Application to GuiApplication.

A dynamic_cast can be replaced by:
  - already existing as***Inset() functions, e.g.:
    * asHullInset(),
    * asInsetMath()->asMacro(),
    * asInsetText();

  - a static_cast when we are sure this can't go wrong, e.g.:
    * we are sure that CellData::inset->clone() is an InsetTableCell,
    * in cases where we explicitly check it->lyxCode().


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35855 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-26 15:03:51 +00:00
Vincent van Ravesteijn
8d10d82392 Buffer: Rename function names:
- rename readFromVC to extractFromVC because this function actually doesn't read anything as compared to readEmergency, readAutosave and so on.

- rename readEmergency and readAutosave to loadEmergency and loadAutosave just like loadLyXFile and loadThisLyXFile. Only in loadThisLyXFile we switch to the actually reading of a file.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35854 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-26 13:27:06 +00:00
Vincent van Ravesteijn
f311377671 Buffer: Make Buffer::readFile() private.
It's strange to have a public interface which has a function loadLyXFile and a function readFile. A user of this class will be confused about the difference.

Therefore, loadThisLyXFile will be next to loadLyXFile to stress that loadThisLyXFile will not load another file ;). I don't know whether all of you like that this function just calls readFile, but it feels good this way. All public paths for loading a file will now go through loadThisLyXFile (i.e. the paths that come from loadLyXFile), while readFile is a pure private function. If this doesn't make sense, just shout.

I think this improves the readability of the class.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35852 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-26 13:17:10 +00:00
Richard Heck
3e53707570 Little bit of cleanup, motivated by need to squash a warning.
The only substantive change here is moving the markDirty() call into the
first case. If we don't load the file successfully, then there is no
need to mark dirty.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35834 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-25 15:33:51 +00:00
Vincent van Ravesteijn
80a09f4ea6 Merge readFile and readFile; and readFile and readString.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35832 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-25 14:14:44 +00:00
Vincent van Ravesteijn
5a30a98346 Buffer.cpp:
Extract convertLyXFormat function that runs LyX2LyX.

(and some compile fixes)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35831 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-25 13:55:39 +00:00
Vincent van Ravesteijn
5f9b12ec39 Buffer.cpp:
We need to save the checksum of the requested file. Not of the autosave file.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35830 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-25 13:32:38 +00:00
Vincent van Ravesteijn
aab708c594 Buffer.cpp:
- Move the saveCheckSum to both autosave file as emergency file read function.
- Extract the function parseLyxFormat.
- Improve comment about the older LyX format numbers.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35829 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-25 13:29:50 +00:00
Vincent van Ravesteijn
80a5dd8144 Buffer.cpp:
- Move some lines of code to more proper places.
- Let Buffer::readFile(FileName const &) return ReadStatus as well.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35827 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-25 13:04:13 +00:00
Vincent van Ravesteijn
375db69d99 Centralize the generation of the emergency and autosave filenames.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35825 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-25 12:31:22 +00:00
Richard Heck
5cd48620f1 Return early again if there's nothing to do. Also, mark the buffer dirty
only if we manage to read the autosave file successfully.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35824 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-25 12:24:15 +00:00
Vincent van Ravesteijn
1d55e97b2d Oops.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35823 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-25 12:19:39 +00:00
Vincent van Ravesteijn
1102636923 FFix warnings in Buffer::readString.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35822 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-25 12:18:09 +00:00
Richard Heck
1edd77ca30 Lessen indentation by returning early if there's nothing to do.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35821 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-25 12:14:10 +00:00
Vincent van Ravesteijn
df1c5ef611 Refactor Buffer.cpp: loadLyXFile():
- make a new function readFromVC(),
if the file does not exist, try to extract it from the version control (RCS),

- make a new function readEmergency(),
try to read the emergency file that is associated to the file we are trying to read,

- make a new function readAutosave(),
try to read the autosave file that is associated to the file we are trying to read,

- merge loadLyXFile() and readFileHelper(),
this new function now determines which file to read.

- add more ReadStatus elements to describe failures.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35819 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-25 11:57:56 +00:00
Vincent van Ravesteijn
75773f3c22 Use Buffer::ReadStatus as a return value for Buffer::loadLyXFile.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35818 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-25 10:18:42 +00:00
Vincent van Ravesteijn
058035bf2c One should use dynamic_casts for inheritance-based casting.
(This is a little necessary clean-up of my tree.)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35817 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-25 09:49:24 +00:00
Vincent van Ravesteijn
943288066d Fix bug #6968: isExternallyModified remains "true" after "Revert to Saved".
I forgot to save the checksum after reloading.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35805 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-24 21:38:19 +00:00
Richard Heck
1c059dba29 Simplify comment.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35756 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-21 17:53:21 +00:00
Richard Heck
00e6dfb14b Make updateMacros() descend into tables. Fixes #6897.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35718 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-19 15:36:11 +00:00
Richard Heck
97910b056e Revert r35715. Didn't mean to commit both.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35716 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-19 15:33:39 +00:00
Richard Heck
a773428fce Cut and paste solution to get export working. The issue is that the old
exportAndDestroy was calling:
  buffer->doExport(format, true, update_unincluded);
where "true" means: Leave it in the tempdir. We need false, which means
we need another parameter, if we're not doing it as cut and paste.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35715 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-19 15:10:13 +00:00
Richard Heck
6a80ce62ca DispatchResult::update() ==> DispatchResult::screenUpdate()
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35631 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-13 17:28:55 +00:00
Richard Heck
01013c0785 Refstyle support. The user can now choose between prettyref and restyle
for formatted references. Fixes #2295, in so far as it makes it possible
to translate formatted references.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35623 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-13 12:36:53 +00:00
Richard Heck
d4634167cc Get rid of "CharStyle:", "Custom:", and "Element:" prefixes, per a
suggestion of JMarc's. Docs to follow.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35608 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-12 14:46:17 +00:00
Uwe Stöhr
e8a1fed47c InsetBibtex.cpp:
- fix #1881, fileformat change
- fix #6470

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35590 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-11 01:05:20 +00:00
Richard Heck
3b87f59e42 Fix bug #6929.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35564 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-05 15:21:14 +00:00
Richard Heck
4e799ee358 Simplify Buffer::allRelatives() now.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35539 a592a061-630c-0410-9148-cb99ea01b6c8
2010-09-29 13:07:12 +00:00
Richard Heck
5a46224f73 Remove the magic boolean in getChildren() from the public interface.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35538 a592a061-630c-0410-9148-cb99ea01b6c8
2010-09-29 13:05:57 +00:00
Richard Heck
a6d22abf03 Keep the "find the master" recursion in masterDocument().
We should probably be checking for recursive includes here, and we want
to do that in one place.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35537 a592a061-630c-0410-9148-cb99ea01b6c8
2010-09-29 12:55:39 +00:00
Richard Heck
6a85b8a96e I am pretty sure we do not want duplicates here. What's worse, recursive
includes could crash this if we allow them.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35534 a592a061-630c-0410-9148-cb99ea01b6c8
2010-09-29 12:30:31 +00:00
Richard Heck
7ff1a60d12 Introduce Buffer::hasChildren() and use it.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35531 a592a061-630c-0410-9148-cb99ea01b6c8
2010-09-29 12:17:24 +00:00
Richard Heck
f5696b8872 Use getChildren() to collect all the relatives. Note that this makes
allRelatives() "stable", in the sense that what it returns does not
depend upon which Buffer we start with.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35530 a592a061-630c-0410-9148-cb99ea01b6c8
2010-09-29 11:59:31 +00:00
Richard Heck
2291614a6c Introduce a typedef for vector<Buffer *>. No change in behavior
anticipated.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35529 a592a061-630c-0410-9148-cb99ea01b6c8
2010-09-29 11:55:10 +00:00
Pavel Sanda
65962da47b Add support for feyn package and Diagram inset.
Patch from Ronen Abravanel.
http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg161952.html

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35455 a592a061-630c-0410-9148-cb99ea01b6c8
2010-09-19 22:12:06 +00:00
Stephan Witt
dec437fbac add cache of spell checker results to speed up native speller engine on macosx
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35362 a592a061-630c-0410-9148-cb99ea01b6c8
2010-09-14 05:24:04 +00:00
Uwe Stöhr
0e7ab29f49 InsetLine: support for the LaTeX command \rule; kick out the hardcoded \lyxline; fileformat change
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35299 a592a061-630c-0410-9148-cb99ea01b6c8
2010-09-07 00:41:00 +00:00
Uwe Stöhr
1712e4f35e support to load the mathdots package via the document settings; fixes #5373; fileformat change
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35241 a592a061-630c-0410-9148-cb99ea01b6c8
2010-08-31 02:04:46 +00:00
Richard Heck
89e50feaf2 Invalidate caches when the parent is reset.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35115 a592a061-630c-0410-9148-cb99ea01b6c8
2010-08-10 14:37:06 +00:00
Richard Heck
2203d7aa0a Fix some bugs in the bibinfo caching mechanism. Comments to follow.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35112 a592a061-630c-0410-9148-cb99ea01b6c8
2010-08-10 14:12:48 +00:00
Richard Heck
0ac2636d28 Missing invalidations of bibfile cache.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35111 a592a061-630c-0410-9148-cb99ea01b6c8
2010-08-09 21:35:44 +00:00
Richard Heck
350b82fd62 Revert r35106.
Help needed here. Why isn't this equivalent?


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35108 a592a061-630c-0410-9148-cb99ea01b6c8
2010-08-09 19:17:44 +00:00
Richard Heck
35f3f7cbc4 Don't need this argument, since it was only ever called thus:
it->fillWithBibKeys(d->bibinfo_, it);
This could be useful later, if we decide to try to do the work that
fillWithBibKeys did from updateLabels().


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35106 a592a061-630c-0410-9148-cb99ea01b6c8
2010-08-09 18:00:46 +00:00
Richard Heck
2a6109e972 Minor cleanup. We don't need the deleted call, as that is done at the
beginning of updateBuffer() anyway.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35104 a592a061-630c-0410-9148-cb99ea01b6c8
2010-08-09 17:14:45 +00:00
Richard Heck
e992140685 More work toward speeding up the bibfile caching stuff.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35103 a592a061-630c-0410-9148-cb99ea01b6c8
2010-08-09 17:01:51 +00:00
Richard Heck
4509607bf6 Do not invalidate cache unless we find some BibTeX insets. Part of
#6846.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35102 a592a061-630c-0410-9148-cb99ea01b6c8
2010-08-09 16:18:57 +00:00
Jean-Marc Lasgouttes
f8eda52820 Fix bug #3733: 'undo' does not revert 'changed' status for file
* 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
2010-08-06 23:54:04 +00:00
Jean-Marc Lasgouttes
e4f2484cb5 Implement LFUN_SPELLING_REMOVE (patch from switt)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35055 a592a061-630c-0410-9148-cb99ea01b6c8
2010-08-05 20:10:40 +00:00
Richard Heck
06445c964e Next step in fixing problems noted by Vincent: Remove magic boolean from
updateMacros().


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35000 a592a061-630c-0410-9148-cb99ea01b6c8
2010-07-21 21:58:54 +00:00
Richard Heck
2f78698fbd First step towards fixing some issues noted by Vincent. We record in the
Buffer whether we are exporting or not, rather than rely upon isClone(),
which could be adapted to other purposes. And, of course, someone might
choose locally to disable cloning....


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34999 a592a061-630c-0410-9148-cb99ea01b6c8
2010-07-21 21:51:33 +00:00