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
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
- 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
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
- group the read and emergency/autosave functions,
- add comments to the functions,
- adjust visibility of functions,
- add FIXMEs to some functions which are still unneccesarily public.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35851 a592a061-630c-0410-9148-cb99ea01b6c8
This also fixes compilation again. I forgot to cherry-pick all commits in git ;)...
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35845 a592a061-630c-0410-9148-cb99ea01b6c8
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
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
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
- 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
- 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
- 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