Commit graph

20 commits

Author SHA1 Message Date
Thomas Goyne
805481315e Split AssFile into separate lists for each section 2014-03-09 08:06:21 -07:00
Thomas Goyne
7d1cd576d1 Match the parser's section order when constructing files for undo 2014-03-05 17:31:40 -08:00
Thomas Goyne
c3fb54153f Store selection and active line in undo info and restore them on undo 2014-03-05 17:31:33 -08:00
Thomas Goyne
9ecb54333a Redesign the undo stack
Store the data in vectors rather than AssFiles since even an intrusive
linked list has comically high memory overhead. Cuts memory usage of a
full undo stack with 15k lines by 65 MB for 32-bit and 130 MB for
64-bit. Also roughly halves how long it takes to copy the file for the
undo stack, and makes undo/redo a bit faster.
2014-03-04 20:21:02 -08:00
Thomas Goyne
9a347b0b29 Use splice rather than swaps to pop the undo stack 2014-03-04 13:54:34 -08:00
Thomas Goyne
20b4515c24 Fix potential use-after-frees on redo
Don't delete the old copy of the file until after the new version is
committed to avoid a use-after-free when code tries to do things with
the active line in a COMMIT_NEW handler, as just trying to avoid doing
that hasn't really worked out.
2013-12-29 11:44:22 -08:00
Thomas Goyne
6fad60e58d Use NSDMIs where applicable 2013-12-11 18:50:12 -08:00
Thomas Goyne
747e34b981 Fix crash when a subtitles file is not found 2013-11-09 15:56:18 -08:00
Thomas Goyne
eee4da0642 Change the selection before committing deletions of lines
For whatever reason this was sometimes being done after the commit,
which resulted in a lot of code only working by coincidence when the
grid commit handler happened to be the first one to be called.
2013-10-27 07:03:51 -07:00
Thomas Goyne
6f79d8731f Pass the detected or chosen charset to SubtitleFormat::CanReadFile
The MicroDVD format needs it since it also probes the file contents.
2013-10-06 07:04:40 -07:00
Thomas Goyne
de7b09f7f7 Change some enums into enum classes 2013-06-12 20:01:21 -07:00
Thomas Goyne
3154090d2f Don't reuse commit IDs for new commits after undo. Closes #1598. 2013-05-05 21:01:02 -07:00
Thomas Goyne
17170fc5fe Remove the charset detection from TextFileReader since it's never used 2013-04-16 20:05:44 -07:00
Thomas Goyne
8118d790a4 Don't display an error message if user cancels the charset selection dialog 2013-02-06 13:38:35 -08:00
Thomas Goyne
1f831be170 Ask the user if they want to close the current file before prompting for a new file to open rather than after 2013-02-06 13:38:34 -08:00
Thomas Goyne
d55949d9c1 Only perform charset detection once when opening subtitles
Relying on TextFileReader to do the charset detection results in the
user being prompted to pick a charset twice when it can't be
auto-detected, since the result from trying to open the subtitles as
timecodes was not being reused.

Closes #1512.
2013-02-06 13:38:33 -08:00
Thomas Goyne
09aa873ed7 Hide the StatusTimeout awfulness in a util function 2013-02-06 13:22:34 -08:00
Thomas Goyne
a9467836f9 Move autosave logic to SubsController 2013-02-06 13:22:34 -08:00
Thomas Goyne
396ff897e5 Kill StandardPaths
It's now just a pointless wrapper around agi::Path.
2013-02-06 13:22:33 -08:00
Thomas Goyne
a0d3dbc550 Extract Loading/Saving/Undo stuff from AssFile
Add SubsController, which deals with things like what subtitle file is
currently open, rather than the contents of the current subtitle file.
Move the rest of the relevant logic from FrameMain there in addition to
all of the stuff from AssFile.
2013-02-06 13:22:32 -08:00