Commit Graph

122 Commits

Author SHA1 Message Date
Richard Heck
75bfed5507 Fix trailing whitespace in cpp files. 2017-07-03 13:53:14 -04:00
Richard Heck
0d77a7e325 Allow LyX to open empty files (created, e.g., via "touch").
Patch from new contributor Jan Niklas Hasse.
2017-01-19 15:34:45 -05:00
Georg Baum
5c431b9335 Make newUnnamedFile() threadsafe 2014-07-05 12:58:22 +02:00
Richard Heck
fdbe775b9f This is the result of an audit of all static variables, looking
for possible thread conflicts, of the sort Georg resolved at
6a30211f. I have made static variables const where possible,
and marked cases that looked potentially problematic with the
comment:
	// FIXME THREAD
Many of these definitely are vulnerable to concurrent access, such
as the static variables declared at the start of output_latex.cpp.
Suppose, e.g., we were outputting latex and also displaying the
source of a different document.

I'd appreciate it if others could grep for "FIXME THREAD" and see
if some of these are harmless, or what.
2014-04-21 11:51:57 -04:00
Juergen Spitzmueller
afab1140e9 Add a real Cancel button to 'Already Loaded' dialog box (part of #8787).
Also correlate the other buttons more explicitly to the question asked.
2013-11-28 17:06:49 +01:00
Juergen Spitzmueller
0445c8e08e Revert "Properly name Cancel button (part of #8787)"
This reverts commit aa5ef5bbbe.
2013-11-27 08:38:42 +01:00
Juergen Spitzmueller
aa5ef5bbbe Properly name Cancel button (part of #8787) 2013-11-26 16:16:24 +01:00
Juergen Spitzmueller
dd739820d2 Set default to button which does _NOT_ discard data (part of #8787) 2013-11-18 15:06:32 +01:00
Georg Baum
9d99d3dbea Implement extractFromVC() for CVS and SVN.
Both cvs and svn are able to retrieve non-existing files from repository,
but this was only implemented for rcs. This is a prerequisite for the
planned move and copy VCV operations. I also improved error schecking and
used extractFromVC() also for files specified on the command line if they
do not exist (in GUI mode, it was already the case in non-GUI mode).
2012-11-15 22:01:19 +01:00
Stephan Witt
42dfd71197 #7789 unify and fix buffer statistics
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40602 a592a061-630c-0410-9148-cb99ea01b6c8
2012-01-12 07:03:24 +00:00
Stephan Witt
291c5c91ec #7357 correct the numbers by introducing two modes of word count
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37947 a592a061-630c-0410-9148-cb99ea01b6c8
2011-03-18 12:50:09 +00:00
Stephan Witt
0afeabb969 #7357 avoid an endless loop in countWords() when the "to" position is inside skipped text (e. g. note inset)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37940 a592a061-630c-0410-9148-cb99ea01b6c8
2011-03-16 17:58:27 +00:00
Stephan Witt
7f9d85e285 detect end of paragraph and use it as word separator to correct the word count in tables - thanks, JMarc
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36659 a592a061-630c-0410-9148-cb99ea01b6c8
2010-12-02 16:50:12 +00:00
Vincent van Ravesteijn
4e394eb9c5 Remove unnecessary call to Buffer::setFileName. The buffer already knows its name.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36374 a592a061-630c-0410-9148-cb99ea01b6c8
2010-11-18 17:35:49 +00:00
Vincent van Ravesteijn
afa873dc5f Remove the FileName parameter of Buffer::loadLyXFile and friends. Now, getAutosaveFileNameFor and getEmergencyFileNamefor can be removed too. Last, the call to lyxvc.file_found_hook can now be centralized and can be given the correct parameter (d->filename instead of the name of the emergency/autosave file).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36145 a592a061-630c-0410-9148-cb99ea01b6c8
2010-11-05 21:21:01 +00:00
Vincent van Ravesteijn
c9a91c5474 Relay the ReadStatus all the way up to the GUI also for Buffer::reload().
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35908 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-29 16:26:32 +00:00
Vincent van Ravesteijn
6ba6d4120d Compile fix.
I forgot this in the previous commit.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35853 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-26 13:19:26 +00:00
Vincent van Ravesteijn
314232d2ff Properly convert from ReadStatus to boolean.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35833 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-25 15:21:08 +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
Pavel Sanda
62ca7f3ae5 Proper camel case for FileName.absFilename
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34234 a592a061-630c-0410-9148-cb99ea01b6c8
2010-04-21 01:19:09 +00:00
Richard Heck
fbad45864c Add a comment.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34121 a592a061-630c-0410-9148-cb99ea01b6c8
2010-04-12 15:16:43 +00:00
Richard Heck
51fce57c78 A compromise suggested by JMarc: We mark the buffer dirty if, but only
if, the filename was not automatically generated. So, if the user chose
the filename, we assume she wants to keep the file.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34119 a592a061-630c-0410-9148-cb99ea01b6c8
2010-04-12 15:15:35 +00:00
Enrico Forestieri
5aa69caae5 Accept dirty buffer if the document has not been saved to disk (part of bug 6645).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34114 a592a061-630c-0410-9148-cb99ea01b6c8
2010-04-10 14:30:59 +00:00
Richard Heck
19947bfc83 Revert what no one likes.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34113 a592a061-630c-0410-9148-cb99ea01b6c8
2010-04-10 12:11:45 +00:00
Richard Heck
84be7c89b3 Mark new files dirty. Otherwise, you can't save them, and maybe you want
to do that right away.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34107 a592a061-630c-0410-9148-cb99ea01b6c8
2010-04-09 19:03:46 +00:00
Vincent van Ravesteijn
f0c386fa6b Fix bug #6491: Empty .emergency file causes crash.
If the load fails, we should not try to save an emergency file as the file was not yet fully loaded and weird things may happen.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33294 a592a061-630c-0410-9148-cb99ea01b6c8
2010-01-31 16:17:17 +00:00
Vincent van Ravesteijn
8c5626cf13 Use the Buffer::reload() function also in buffer_func.cpp::checkAndLoadLyXFile().
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33265 a592a061-630c-0410-9148-cb99ea01b6c8
2010-01-29 21:09:59 +00:00
Vincent van Ravesteijn
e89a267c71 Do not save an emergency file after choosing to revert the document to the version saved on disk.
Now also when the user tries to load the document when it's already loaded.

see r32170.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32485 a592a061-630c-0410-9148-cb99ea01b6c8
2009-12-12 01:18:18 +00:00
Vincent van Ravesteijn
0d016420ce Fix the new from template functionality. The templatename parameter was magically disappeared in r31704.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31899 a592a061-630c-0410-9148-cb99ea01b6c8
2009-11-08 13:20:08 +00:00
Vincent van Ravesteijn
9722c8f1ea Add a global accessible function loadIfNeeded().
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31705 a592a061-630c-0410-9148-cb99ea01b6c8
2009-10-24 14:57:28 +00:00
Vincent van Ravesteijn
316a17f414 Changes in buffer_funcs.cpp::newUnnamedFile():
- the prefix can now be supplied,
- there can be more types of unnamed files,
- the code is made more concise,
- templatefile parameter is made optional,
- "newfile" is made translatable.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31704 a592a061-630c-0410-9148-cb99ea01b6c8
2009-10-24 14:20:00 +00:00
Abdelrazak Younes
2b9e44cb01 Move contents of paragraph_funcs.* to Text.h and Text.cpp.
The goal is to simplify the code afterwards.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30955 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-09 17:30:41 +00:00
Jean-Marc Lasgouttes
01b290e2dd Fix part of bug http://www.lyx.org/trac/ticket/2566
We use Inset::producesOutput to skip things like notes and inactive
branches.

	* buffer_funcs.cpp (countWords): align code style with countChars;
	skip insets for which producesOutput() is false.
	(countChars): honor Inset::producesOutput.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30242 a592a061-630c-0410-9148-cb99ea01b6c8
2009-06-23 09:46:48 +00:00
Abdelrazak Younes
5387379c24 Introduce Paragraph::isWordSeparator() and use it instead of Paragraph::isLetter(). Note here a change in behavior WRT to word selection: a deleted character is not considered a word separator. This new behavior will impact word finding and spellchecking.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30211 a592a061-630c-0410-9148-cb99ea01b6c8
2009-06-21 14:30:57 +00:00
Jürgen Spitzmüller
f4b8f4528f * src/buffer_funcs.{cpp,h}:
- add optional bool "acceptDirty" to checkAndLoadLyXFiles. 
	   If true, the method doesn't care for buffer dirtiness
* src/Buffer.cpp:
	- when checking for master buffer, do not care if it's dirty
	  (fix bug 5514)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27774 a592a061-630c-0410-9148-cb99ea01b6c8
2008-12-05 15:49:07 +00:00
André Pönitz
32a53f8d6a move more stuff from buffer_func to Buffer
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27565 a592a061-630c-0410-9148-cb99ea01b6c8
2008-11-16 17:49:00 +00:00
André Pönitz
f8f5a7b28d move updateLables to buffer
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27562 a592a061-630c-0410-9148-cb99ea01b6c8
2008-11-16 16:43:49 +00:00
André Pönitz
f1cba8ff64 more latin1..utf8 schanges. all of src/* should be utf8 now
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27425 a592a061-630c-0410-9148-cb99ea01b6c8
2008-11-14 15:58:50 +00:00
Stefan Schimanski
520b760891 * make sure that the reference cache, buffer_ pointers and macros are updated
in child documents.

  Fixes:
    http://bugzilla.lyx.org/show_bug.cgi?id=5153
    http://bugzilla.lyx.org/show_bug.cgi?id=5032
    http://bugzilla.lyx.org/show_bug.cgi?id=5159

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26137 a592a061-630c-0410-9148-cb99ea01b6c8
2008-08-13 10:36:43 +00:00
Abdelrazak Younes
4065e2b2c4 this call to setBuffer() is now not necessary.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25979 a592a061-630c-0410-9148-cb99ea01b6c8
2008-07-29 13:33:50 +00:00
Abdelrazak Younes
ff80da000e Fix http://bugzilla.lyx.org/show_bug.cgi?id=5097 with a hammer. The correct fix would be to call setBuffer() inside pasteSelectionHelper() only for those inserted paragraphs.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25977 a592a061-630c-0410-9148-cb99ea01b6c8
2008-07-29 13:15:28 +00:00
Abdelrazak Younes
d7a30a2ea1 This code is not valid anymore.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25975 a592a061-630c-0410-9148-cb99ea01b6c8
2008-07-29 12:19:42 +00:00
Abdelrazak Younes
d56faa70c4 BufferList::getBuffer(): migrate to FileName.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25958 a592a061-630c-0410-9148-cb99ea01b6c8
2008-07-29 08:16:09 +00:00
Abdelrazak Younes
5ac9db6dfc First step toward fixing http://bugzilla.lyx.org/show_bug.cgi?id=3243
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25955 a592a061-630c-0410-9148-cb99ea01b6c8
2008-07-29 07:53:08 +00:00
Abdelrazak Younes
4bc7feaa96 * Inset: ensure that the Buffer pointer is not copied. This was the cause of very weird bugs with copy and paste within table.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25837 a592a061-630c-0410-9148-cb99ea01b6c8
2008-07-23 12:13:41 +00:00
Abdelrazak Younes
641ae02e37 Delay the Toc update of child documents until we update the master one.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24868 a592a061-630c-0410-9148-cb99ea01b6c8
2008-05-20 12:58:54 +00:00
Abdelrazak Younes
be310e33ca Fix label numbering of child documents.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24865 a592a061-630c-0410-9148-cb99ea01b6c8
2008-05-20 11:25:29 +00:00
Jean-Marc Lasgouttes
9b4a26a252 rename assert.h to lassert.h
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24559 a592a061-630c-0410-9148-cb99ea01b6c8
2008-04-30 08:26:40 +00:00
André Pönitz
7f461f4392 infrastructure for 'graceful asserts'
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24216 a592a061-630c-0410-9148-cb99ea01b6c8
2008-04-10 21:49:34 +00:00
Richard Heck
a01cb111a0 Change the interface to a paragraph's layout. We still store a LayoutPtr, but now privately, and make a Layout const & available to clients.
The need for a LayoutPtr arises from the fact that (a) we do not want to give our clients a Layout &, since we do not want them to be able to change our Layout; but (b) we also need to be able to change which layout is ours. So we cannot store a Layout const &. Or so it seems to the compiler.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23522 a592a061-630c-0410-9148-cb99ea01b6c8
2008-03-06 21:31:27 +00:00