Commit graph

2591 commits

Author SHA1 Message Date
Thomas Goyne
a2c14e9c5f Check the error code when FFMS2 can't create an indexer
Creating an indexer can fail for reasons other than the file not
existing. This check is still not completely correct, since FFMS2 uses
the wrong error codes in a bunch of places.
2012-12-17 10:14:08 -08:00
Thomas Goyne
4c6be1fe55 Fix y4m loading 2012-12-17 09:32:42 -08:00
Thomas Goyne
229e5d98c5 Avoid making a full copy of the file for ThreadedFrameSource when possible
When the set of changed lines is populated, only copy those lines rather
than the entire file. On large files, this makes amend commits roughly
twice as fast when video is open.
2012-12-17 09:32:42 -08:00
Thomas Goyne
fee60be5db Announce the set of lines changed in commits
Currently this is only populated when commits are amended, for the
simple reason that it's the only time that AssFile knows what lines
changed. It is probably worth expanding this in the future.
2012-12-17 09:32:42 -08:00
Thomas Goyne
4e72fff1d9 Check the right substrings in the spellchecker dialog. Closes #1560. 2012-12-12 18:08:07 -08:00
Thomas Goyne
72ae116196 Rename SubsEditBox's private members
Mostly to cut down on conflicts with the split-editbox branch.
2012-12-12 15:17:21 -08:00
Thomas Goyne
090905056b Remove spaces in > > in nested templates 2012-12-11 10:58:28 -08:00
Thomas Goyne
6e153ed7d9 Make OpenGLTextTexture moveable so that it doesn't need to be in a shared_ptr 2012-12-11 10:41:20 -08:00
Thomas Goyne
0b133de08f Remove pointless empty destructors
An explicit empty destructor is only needed when a class has a smart
pointer to an incomplete type.
2012-12-11 09:06:21 -08:00
Thomas Goyne
9a77d564e4 Cut down on the padding under the audio toolbar 2012-12-11 08:32:58 -08:00
Thomas Goyne
7c477f3cd1 Use a real toolbar for the video box's buttons 2012-12-11 08:25:24 -08:00
Thomas Goyne
534f574a87 Delete AssDialogue::StripTag
It is not actually used anywhere.
2012-12-10 17:43:29 -08:00
Thomas Goyne
8c2062f0c7 Store AssOverrideTags directly rather than a vector of pointers 2012-12-10 17:04:18 -08:00
Thomas Goyne
a0d3b8595f Redesign AssOverrideParameter
Always store the original string form and convert it to the desired type
on demand. In most cases this is significantly faster as typically only
a few of the parameters in a line are actually read. In addition, this
makes it so that parameters which did not actually change are always
reserialized in their original form.

Delete VariableData as it's no longer used by anything.

Closes #1513.
2012-12-10 14:41:11 -08:00
Thomas Goyne
f28f6ad5b3 Join lines copied to the clipboard with newlines rather than nothing 2012-12-10 14:03:03 -08:00
Thomas Goyne
681de8cf37 Fix order of VariableData's initializers 2012-12-09 17:19:01 -08:00
Thomas Goyne
a36011a9dd Don't insert [Script Info] entries for empty values 2012-12-09 17:07:05 -08:00
Thomas Goyne
c1409b5c25 Add a space after the colon in [Script Info] entries 2012-12-09 17:05:11 -08:00
Thomas Goyne
96b3656742 Stick to the standard order of sections when inserting lines 2012-12-09 15:44:03 -08:00
Thomas Goyne
205d408f3e Move tag/param proto declarations to the cpp file
It's purely an implementation detail of the parser that should not be
exposed to the outside world.
2012-12-09 15:40:29 -08:00
Thomas Goyne
8cf47c38b6 Drop AssOverrideParameter::omitted since it's equivalent to the type being VARDATA_NONE 2012-12-09 10:36:13 -08:00
Thomas Goyne
d2a0a76ca9 Store AssOverrideParameters directly rather than a vector of pointers to them 2012-12-09 10:12:50 -08:00
Thomas Goyne
851f7f40e6 Make VariableData uncopyable but moveable 2012-12-09 10:12:50 -08:00
Thomas Goyne
482d31299b Remove unused things from VariableData 2012-12-09 08:04:29 -08:00
Thomas Goyne
7e38ad6ec7 Don't add {} to the body of \t tags 2012-12-09 08:04:20 -08:00
Thomas Goyne
bd35d9308d Use unordered_set for the actor/effect values 2012-12-07 19:24:42 -08:00
Thomas Goyne
9b44f92235 Make AssEntry purely a base class and add AssInfo
Now that all the other junk is being dropped from the file, script info
lines are the only thing left which was a concrete AssEntry, and
AssEntry wasn't actually a very good way to store them.
2012-12-07 18:55:29 -08:00
Thomas Goyne
28705000bb Use boost::join in a handful of places 2012-12-07 08:25:47 -08:00
Thomas Goyne
0ac8df140c Make the check for if an override tag needs parens less dumb 2012-12-07 08:12:45 -08:00
Thomas Goyne
422cfb153f Add a box with the character count of the longest line
Character counts are a pretty terrible measure of anything, but it's
still the main measure of length used in most subtitling standards
(because subtitling standards are written under the assumption that the
tools are terrible (which is generally an accurate assumption)).
2012-12-06 10:01:47 -08:00
Thomas Goyne
1b15a753a1 Add .m4v to the list of video file extensions
It would be nice if this didn't require adding it in five different places...
2012-12-05 20:23:32 -08:00
Thomas Goyne
222c09b58f Increase maximum undo levels to 10000 from 100 2012-12-05 19:12:34 -08:00
Thomas Goyne
d5aae26d83 Use boost::flyweight to intern the wxString members of AssDialogue
100 no-op non-amend commits on a subtitle file with 6689 dialogue lines,
with the undo limit set to 100:

Without flyweight:
	No video open:
		Initial memory usage: 30.6 MB
		Final memory usage: 498.0 MB
		Elapsed time: 6.3 seconds
	Video open, using libass:
		Initial memory usage: 54.3 MB
		Final memory usage: 653.3 MB
		Elapsed time: 23.7 seconds

With flyweight:
	No video open:
		Initial memory usage: 26.0 MB
		Final memory usage: 104.5 MB
		Elapsed time: 3.0 seconds
	Video open, using libass:
		Initial memory usage: 46.7 MB
		Final memory usage: 251.8 MB
		Elapsed time: 13.0 seconds

No video open:
	Memory usage: -79%
	Time: -52%
Video open:
	Memory usage: -61.5%
	Time: -45%

100 no-op amend commits on a line in the middle of a subtitle file with
6689 dialogue lines, with video open:

Without flyweight:
	Initial memory usage: 48.2 MB
	Final memory usage: 182.3 MB
	Elapsed time: 22.3 seconds

With flyweight:
	Initial memory usage: 39.8 MB
	Final memory usage: 165.8 MB
	Elapsed time: 13.8 seconds

Note: The large jump in memory usage here is due to that the benchmark
is blocking the main thread, so at the end there are ~100 video frames
waiting to be displayed.
2012-12-05 18:43:44 -08:00
Thomas Goyne
c7c270cf12 Use an enum for the SRT parser states 2012-12-05 15:06:02 -08:00
Thomas Goyne
c1ed667025 Add the curly braces in AssDialogueBlockOverride::GetText
All of the calling code added them, so there's no reason not to just do
it in one place.
2012-12-04 19:49:05 -08:00
Thomas Goyne
17ffacb6a0 Use iota rather than partial sum 2012-12-02 13:34:32 -08:00
Thomas Goyne
de4ef14598 Use lambdas for very short event handlers 2012-12-02 13:29:46 -08:00
Thomas Goyne
91fa11e375 Relicense all of my stuff that's still 3-BSD to ISC 2012-12-02 13:14:24 -08:00
Thomas Goyne
009518271a Document a few things and kill all remaining placeholders 2012-12-02 13:08:42 -08:00
Thomas Goyne
3949ccec24 Drop the position argument from ProcessParametersCallback since nothing needs it 2012-12-02 12:39:37 -08:00
Thomas Goyne
1c176e8568 Store parsed dialogue blocks in a ptr_vector
This eliminates the need to explicitly delete the parsed blocks.

Also go ahead and remove AssDialogue::Blocks since it's really not a
very good idea in general.
2012-12-02 12:29:33 -08:00
Thomas Goyne
67d796731a Replace SubsEditBox::OnUndoTimer with a lambda 2012-12-02 07:59:32 -08:00
Thomas Goyne
b507f49cec Remove the pad argument from GetMarginString
It's no longer ever actually set to true.
2012-12-02 07:59:31 -08:00
Thomas Goyne
3045e2d012 Move the Margin controls to an array 2012-12-02 07:59:31 -08:00
Thomas Goyne
fae9a5496a Extract some duplicated code for the margin controls 2012-12-02 07:59:31 -08:00
Thomas Goyne
0b46fdff49 Refactor time ctrl handling in SubsEditBox 2012-12-02 07:59:31 -08:00
Thomas Goyne
1b6f122d12 Replace field_setter with a lambda 2012-12-02 07:59:31 -08:00
Thomas Goyne
d3fc4dcb25 Remove things used in one (or zero) files from agi_pre.h 2012-12-02 06:33:30 -08:00
Thomas Goyne
7090d2f513 Don't include wx/wx.h in subs_grid.h 2012-12-02 06:33:29 -08:00
Thomas Goyne
96cf5ea7ed Kill the #ifndef AGI_PRE guards
They don't actually improve compilation performance and make it more
annoying to modify what things are in the precompiled header.
2012-12-02 06:33:29 -08:00
Thomas Goyne
ff03fef2db Use the C++ versions of C headers 2012-12-01 17:24:59 -08:00
Thomas Goyne
f337db86d3 Make AssStyle::UpdateData and GetSSAText less weird 2012-12-01 17:24:59 -08:00
Thomas Goyne
56993f7f5e Don't use emplace_back for wxDataViewItemArray since it doesn't work in non-STL builds 2012-11-30 18:47:24 -08:00
Thomas Goyne
e0ce2962cf Fix typo in a VFW error message 2012-11-30 17:06:01 -08:00
Thomas Goyne
c2a43a2356 Clean up AssKaraoke a little bit 2012-11-30 16:40:00 -08:00
Thomas Goyne
ffef9a1485 Round syllable durations to centiseconds when splitting syllables 2012-11-30 16:25:20 -08:00
Thomas Goyne
af35e50810 Also move karaoke markers after the dragged marker if Ctrl is held down. Closes #1557. 2012-11-30 16:22:45 -08:00
Thomas Goyne
66becbab16 Fix crash on exit
Subtitle formats unregister themselves when deleted, so using
delete_clear on the list of subtitle formats does not work very well.
2012-11-30 12:01:44 -08:00
Thomas Goyne
5513d774bf Rewrite the fontconfig font lister
FcFontRenderPrepare discards excess family names and fullnames, so in
some cases it may be impossible to verify that the font returned by it
is the one we asked for. To work around this, prefilter the available
fonts to only do fontconfig's matching on the ones with the correct
names.
2012-11-30 12:01:44 -08:00
Thomas Goyne
0b19908e7b Use std::prev and std::next where applicable 2012-11-30 10:54:57 -08:00
Thomas Goyne
174a992974 Use remove_and_dispose_if where applicable 2012-11-30 10:44:09 -08:00
Thomas Goyne
6ab8345148 Use nullptr in more places 2012-11-30 10:44:09 -08:00
Thomas Goyne
7a7a036017 Switch lists of pointers to vectors of pointers 2012-11-30 10:44:09 -08:00
Thomas Goyne
e77e810bd8 Use emplace_back where applicable 2012-11-30 10:44:09 -08:00
Thomas Goyne
eca70285f1 Switch all uses of std::list for signal connections to std::deque 2012-11-28 07:28:18 -08:00
Thomas Goyne
42a8a55b51 Fix setting hotkeys
Populating a vector by resizing it to the target size then using
push_back does not work very well.
2012-11-27 16:14:06 -08:00
Thomas Goyne
d7b01edc64 Support styles after the dialogue in the fonts collector
Make two passes over the file to collect all of the styles before
processing the dialogue lines, as the styles section can legally come
after the dialogue lines which use those styles.
2012-11-26 16:37:53 -08:00
Thomas Goyne
a5ac77368c Use EVT_CHAR_HOOK rather than EVT_KEY_DOWN in TimeEdit
With wxWidgets trunk keydown events are no longer generated for
Ctrl-C/X/V on Windows, which breaks the custom copy/paste handling.
2012-11-26 07:38:50 -08:00
Thomas Goyne
5309f7fb9d Add explicit override specifiers to ASS-related virtuals 2012-11-26 07:11:30 -08:00
Thomas Goyne
2a6c6616a9 Rename AssStyle::GetType() to AssStyle::Group() so that it actually gets called 2012-11-26 07:11:30 -08:00
Thomas Goyne
1a6caa27b6 Switch to using lambdas in a few places 2012-11-26 07:11:30 -08:00
Thomas Goyne
2c1f593a13 Delete declarations of LuaParseTagData and LuaUnparseTagData 2012-11-26 07:11:30 -08:00
Thomas Goyne
6b09bdfe70 Factor out some duplicated code 2012-11-26 07:11:30 -08:00
Thomas Goyne
947dc537d1 Add a generic function for invoking functions on the GUI thread 2012-11-26 07:11:30 -08:00
Thomas Goyne
1d020b851e Add picked colors to the recently used colors 2012-11-25 16:47:39 -08:00
Thomas Goyne
59e6a1bef7 Fix crash when playing audio before time 0
There were two checks for reads past the end rather than checks for
before start and after end.

Closes #1556.
2012-11-25 14:01:50 -08:00
Thomas Goyne
4e8e5b597c Change AssEntry::group to an enum 2012-11-25 14:01:50 -08:00
Thomas Goyne
49ed0551ad Consolidate all entries of each group when there are duplicate sections
Dealing with multiple instances of each section makes the code
significantly more complicated, and in most cases Aegisub doesn't
actually bother to handle it correctly.
2012-11-24 16:24:01 -08:00
Thomas Goyne
b94547aa71 Drop format and header lines from the in-memory file representation
They're just pointless cruft, so drop them from the file when parsing
and re-add them when saving as ASS or SSA.
2012-11-24 16:24:00 -08:00
Thomas Goyne
30ceced39f Skip the current line when searching for the next matching line in the kanji timer 2012-11-24 16:24:00 -08:00
Thomas Goyne
bdf7a0ca83 Parse unclosed override blocks as plain text as VSFilter does 2012-11-24 10:04:53 -08:00
Thomas Goyne
a4311b50f7 Update the correct inputs when typing in the HTML box in the color picker 2012-11-24 10:04:53 -08:00
Thomas Goyne
ded55272a0 Use the correct format for ASS colors in the color picker 2012-11-24 10:04:53 -08:00
Martin Herkt
b1e40455ed ASS: Fix script header
Previously, Aegisub wrote its "Script generated by" lines without a
semicolon to mark them as comments. As a result, it prepended these
lines every time a script was loaded and then saved again. Fix.

Also fix a bug that caused the ASS parser to treat comments before
the [Script Info] section as non-blank lines, therefore inserting a
duplicate section header whenever such comments were present.
2012-11-22 07:50:14 -08:00
Thomas Goyne
3f840ceec8 Fix crash when rearranging styles in the style manager
Inserting lines already in an intrusive list at a different position
does not work, unlike with unintrusive lists. Instead, swap each item in
to the correct place.
2012-11-21 07:32:06 -08:00
Thomas Goyne
8e10d67d2f Read strings from Matroska as UTF-8
Strings in Matroska files are all either UTF-8 or a UTF-8 subset, not
whatever the current locale happens to be.
2012-11-21 06:27:27 -08:00
Thomas Goyne
bd259b7197 Fix awesome variable shadowing derp 2012-11-20 14:28:57 -08:00
Thomas Goyne
b8b9bfdfb6 Fix non-pch compilation 2012-11-18 21:10:36 -08:00
Thomas Goyne
291e411f4c Use a patched zconf.h that doesn't try to include unistd.h when it isn't available 2012-11-17 11:13:08 -08:00
Thomas Goyne
b6c2cf887f Add an empty unistd.h for zconf.h 2012-11-16 15:58:56 -08:00
Thomas Goyne
b055abae44 Fix compliation with gcc 4.7 2012-11-15 18:15:40 -08:00
Thomas Goyne
89fef06d6b Replace all uses of auto_ptr with unique_ptr 2012-11-15 18:15:39 -08:00
Thomas Goyne
06aaaff16b NULL -> nullptr 2012-11-13 08:51:01 -08:00
Thomas Goyne
47c678bd63 Make UCDetect a little less insane 2012-11-13 08:46:31 -08:00
Thomas Goyne
653aa32eb2 Use std::any_of rather than std::find_if() != end() 2012-11-13 05:52:24 -08:00
Thomas Goyne
b6b68b789d Use lambdas in a few places 2012-11-12 19:40:42 -08:00
Thomas Goyne
6212afb314 Add karaoke templater support to the syntax highlighter 2012-11-12 18:35:27 -08:00
Thomas Goyne
c1dc875a05 Always add the spellchecker language list to the edit box context menu
There's really no reason not to include it even if the right-click
wasn't on a word, and leaving it out can lead to confusing situations
when the dictionary file for the user's currently selected language
doesn't exist.
2012-11-12 18:35:26 -08:00
Thomas Goyne
01c833d9b3 Make the autosave dialog resizeable 2012-11-12 18:35:26 -08:00
Thomas Goyne
c41f2ff343 Add an icon to the autosave dialog 2012-11-12 18:35:26 -08:00