Commit Graph

140 Commits

Author SHA1 Message Date
Thomas Goyne 6fad60e58d Use NSDMIs where applicable 2013-12-11 18:50:12 -08:00
Thomas Goyne d6a5d9c458 Use initializer lists in some places 2013-12-11 18:50:11 -08:00
Thomas Goyne 85148002bc Get the UI font from CoreText on OS X 2013-12-10 09:08:30 -08:00
Thomas Goyne a7f4fb5b87 Run clang-modernize on things 2013-11-23 09:57:22 -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 82412e6428 Fix compilation with UTF-8 wxString 2013-10-12 08:41:37 -07:00
Thomas Goyne 1cdd461023 Separate UI state info from functional ASS info headers a bit
Prefix script info entries that are just storing Aegisub UI state with
"Aegisub ", and use a separate AssFile method to get/set them.
2013-10-07 17:57:16 -07:00
Thomas Goyne 921d5ed01a Only paint the margin values in the grid if they're non-zero
Showing zero is mildly misleading since it's actually default margin
rather than no margin, and this makes it much easier to spot the rows
where there's actually an interesting value.
2013-09-27 18:02:54 -07:00
Thomas Goyne c62ebf7e8b Use std::to_wstring rather than wxString::Format("%d", ...)
std::to_wstring is significantly faster and is a bit shorter.
2013-09-18 08:32:30 -07:00
Thomas Goyne 0d50820178 Clean up BaseGrid a little 2013-09-17 07:51:06 -07:00
Thomas Goyne 5787ca4ae0 Cache widths of strings in SetColumnWidths 2013-09-16 10:43:56 -07:00
Thomas Goyne 079ccc728d Significantly speed up resizing the window with large files open
SetColumnWidths can take a long time to run and the only column that can
change width on resize is the last one, so only update that.
2013-09-16 10:26:41 -07:00
Thomas Goyne ce23d72399 Kill AssDialogue::GetMarginString
It didn't actually make the calling code any shorter or simpler.
2013-07-09 08:35:50 -07:00
Thomas Goyne 72d4577d7d Kill scoped_ptr in favor of unique_ptr 2013-06-11 16:06:58 -07: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
Thomas Goyne 1e0f08c0ed Mostly purge wxWidgets from non-UI stuff
Use boost::filesystem::path for all paths, and std::string for all other
strings, converting to/from wxString as close to the actual uses of wx
as possible.

Where possible, replace the uses of non-UI wxWidgets functionality with
the additions to the standard library in C++11, or the equivalents in
boost.

Move the path token management logic to libaegisub (and rewrite it in
the process).

Add a basic thread pool based on asio and std::thread to libaegisub.

This touches nearly every file in the project and a nontrivial amount of
code had to be rewritten entirely, so there's probably a lot of broken
stuff.
2013-02-06 13:22:15 -08:00
Thomas Goyne a99428c49d Extract options and MRU stuff from main.h
Nearly all of the files including main.h are doing so only for OPT_GET
and friends, which are rather unrelated to the main things that main.h
declares.
2013-01-09 16:48:31 -08:00
Thomas Goyne d0f4d9df99 Replace all uses of lagi_wxString with to_wx 2012-12-22 15:18:38 -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 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 06aaaff16b NULL -> nullptr 2012-11-13 08:51:01 -08:00
Thomas Goyne e4d6b8661b Add range adaptor for filtering to a specific subclass from a heterogeneous range
This makes looping over the subtitle file and parsed dialogue lines less
awkward in many cases.
2012-11-12 18:35:25 -08:00
Thomas Goyne 67df64e879 Use range-based for loops in a bunch of places 2012-11-12 18:35:25 -08:00
Thomas Goyne 1848aad5c1 Fix compilation with C++ 11/libc++ 2012-11-12 18:35:21 -08:00
Thomas Goyne 0893ed3f0a Remove references to tr1 2012-11-10 18:05:57 -08:00
Thomas Goyne ea5428b65f Replace AssColor with agi::Color
Add agi::Color, and replace AssColor and all uses of wxColor that are
not immediately passed to/from wx with it.
2012-11-10 18:05:56 -08:00
Thomas Goyne 83761d881a Convert AssFile::Line to an intrusive list
Gives O(1) pointer -> iterator conversions, better memory usage, better
performance, and overall slightly simplifies the code using it.
2012-11-10 18:05:56 -08:00
Thomas Goyne e44c47c863 Remove $Id$ markers since git doesn't support them 2012-10-25 17:39:49 -07:00
Thomas Goyne 40bb3b857e Allow scrolling the subtitles grid a page past the last row. Closes #888. 2012-10-20 08:26:38 -07:00
Thomas Goyne c7fd04a739 Rename ASS -> Ass in symbol names
Most types and functions used Ass, but a decent number used ASS, so make
them consistent.
2012-10-16 09:52:19 -07:00
Thomas Goyne 8aeb611745 Make the correct row visible when selecting rows with shift + arrow keys in the grid. Closes #1533. 2012-10-14 08:31:16 -07:00
Thomas Goyne b7e0af6bbb Delete BaseGrid::GetFirstSelRow() since it's no longer used by anything 2012-10-14 08:22:13 -07:00
Thomas Goyne e4a6092b36 Use signals for selection change notifications 2012-10-12 14:54:07 -07:00
Thomas Goyne f756aa73c1 Add SelectionController::SetSelectionAndActive, which automatically batches the changes to the selection and active line
Originally committed to SVN as r6752.
2012-05-05 02:11:03 +00:00
Thomas Goyne 1bd24d837c Allow block selections on the grid with modifier keys held down
Originally committed to SVN as r6747.
2012-05-04 02:52:58 +00:00
Thomas Goyne 213ccccf86 Redesign the logic for scrolling the grid on drags
Update the grid scroll position on mouse up rather than mouse down,
eliminating the need for the logic that made it impossible to do a drag
selection from the top or bottom rows of the grid, and fix some cases
where the grid would scroll in an undesirable direction.

Originally committed to SVN as r6746.
2012-05-04 02:52:52 +00:00
Thomas Goyne 123f02f0fb Process hotkeys in wxEVT_CHAR_HOOK rather than wxEVT_KEY_DOWN
Char hook events propagate by default, removing the need for the event
filter to make key down events propagate, which was causing some funny
issues.

On Windows, the char hook handler runs before menu accelerators, fixing
a bug where Default context hotkeys would override more specific ones
when they appeared on a menu. Unfortunately, this is not the case on
GTK, so the dumb accelerator-disabling hack is still required.

Originally committed to SVN as r6724.
2012-04-27 19:07:49 +00:00
Thomas Goyne 3403734c00 Update the cached grid colors when the relevant options are changed rather than just repainting the grid. Closes #1466.
Originally committed to SVN as r6668.
2012-04-06 15:50:46 +00:00
Thomas Goyne 9f3fd691e2 Unskip key events handled by the non-command keypress handling in BaseGrid
hotkey::check marks non-matching events as skipped, so the default key
event handler was running even if BaseGrid did something with the
keypress.

Closes #1464.

Originally committed to SVN as r6667.
2012-04-06 03:53:38 +00:00
Thomas Goyne de9cc755d2 Stop key event propagation when checking for hotkeys to avoid checking keypresses that aren't hotkeys several times
Originally committed to SVN as r6577.
2012-03-12 23:34:34 +00:00
Thomas Goyne de7df882e9 Seek audio to the line on double-click in the grid in addition to video
Originally committed to SVN as r6456.
2012-02-07 23:17:26 +00:00
Thomas Goyne aa49a4eb0f Factor out the options lookups from BaseGrid::GetRowStrings so that they aren't pointlessly checked every row
Originally committed to SVN as r6393.
2012-01-31 00:43:32 +00:00
Thomas Goyne 0c972886fb Cache most of the brushes used in grid painting
Originally committed to SVN as r6391.
2012-01-31 00:43:15 +00:00
Thomas Goyne cf1425f9d1 Don't get the strings for hidden columns when painting the grid. Speeds up grid painting by up to 25%.
Originally committed to SVN as r6390.
2012-01-31 00:43:06 +00:00
Thomas Goyne b34d2c547f Use wxAutoBufferedPaintDC rather than manual double-buffering in BaseGrid, as it's simpler and slightly faster
Originally committed to SVN as r6389.
2012-01-31 00:42:58 +00:00
Thomas Goyne 8c246e1cb8 Make shift-scrollwheel scroll the grid a page at a time. Closes #1407.
Originally committed to SVN as r6372.
2012-01-26 22:46:09 +00:00
Thomas Goyne 6d550b4a5d Repaint the entire grid on timing changes
Timing changes can potentially make all of the columns need to be
repainted (due to the collision line color), and the grid currently
isn't smart enough to know when this is actually the case, so just
always repaint the entire thing.

Originally committed to SVN as r6371.
2012-01-26 22:27:57 +00:00
Thomas Goyne 2094814077 Save the current row and scroll position in the file and restore it when the file is reopened. Closes #1417.
Originally committed to SVN as r6362.
2012-01-25 19:07:36 +00:00
Thomas Goyne 26c3e13340 Fix poor synchronization between mouse and keyboard modifications to the selection
Combining Shift+Up/Down (or Home/End or Page Up/Page Down) with
shift-clicking had very odd results due to that they used separate
variables to decide where to extend from (and even when only one was
used they were handled incorrectly in some cases).

Closes #1311.

Originally committed to SVN as r6355.
2012-01-25 04:59:17 +00:00
Thomas Goyne 9ac2f93bf0 Fix some mostly unimportant uses of uninitialized memory
Originally committed to SVN as r6304.
2012-01-18 20:08:06 +00:00