Commit Graph

51 Commits

Author SHA1 Message Date
Thomas Goyne a7f4fb5b87 Run clang-modernize on things 2013-11-23 09:57:22 -08:00
Thomas Goyne 0d50820178 Clean up BaseGrid a little 2013-09-17 07:51:06 -07:00
Thomas Goyne 72d4577d7d Kill scoped_ptr in favor of unique_ptr 2013-06-11 16:06:58 -07:00
Thomas Goyne 009518271a Document a few things and kill all remaining placeholders 2012-12-02 13:08:42 -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 e44c47c863 Remove $Id$ markers since git doesn't support them 2012-10-25 17:39:49 -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 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 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 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 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 dc380c5848 Refactor BaseGrid painting a bit
Originally committed to SVN as r5829.
2011-11-08 00:24:53 +00:00
Thomas Goyne 8e81fd07ed Move everything but the subtitle modification utility functions from SubtitlesGrid to BaseGrid. There never has been a clean division of responsibilities between them and the split mostly just made things awkward.
Originally committed to SVN as r5828.
2011-11-08 00:24:41 +00:00
Thomas Goyne be77dc8307 Mostly rewrite the visual tools and related classes
Convert all coordinates within the visual tools to Vector2D, which has
been significantly extended. Eliminates a lot of issues with accumulated
rounding errors and simplifies a lot of code.

Modernize the visual tools' interactions with the rest of Aegisub by
connecting to signals directly rather than routing everything through
the video display and converting the main visual tool mode toolbar to
the command system.

Extract all references to OpenGL from the visual tools and move them to
OpenGLWrapper as a first step towards making it possible to implement an
alternative video renderer. In the process, eliminate all uses of OpenGL
immediate mode.

Fix a bunch of minor issues and general instability.

Originally committed to SVN as r5823.
2011-11-06 17:18:20 +00:00
Thomas Goyne 683dd6c0a9 Kill BaseGrid::SelectVisible
Originally committed to SVN as r5600.
2011-09-15 05:17:43 +00:00
Thomas Goyne 11c40188c2 Eliminate some old selection code in BaseGrid
Originally committed to SVN as r5599.
2011-09-15 05:17:36 +00:00
Thomas Goyne 934a5b24eb Refine the commit types
Switch to a bitmask with much more finely-grained information about what
changed in the commit, fixing a few potential correctness problems and
significantly improving the performance of several scenarios where commits
are spammed very frequently.

Originally committed to SVN as r5590.
2011-09-15 05:16:32 +00:00
Thomas Goyne d82e2bb496 Use wxEVT_CONTEXT_MENU for context menus rather than right button down so that the context menu key works correctly. Updates #1238.
Originally committed to SVN as r5578.
2011-08-31 04:17:37 +00:00
Thomas Goyne 03d7849d12 Significantly speed up grid painting, especially when only some columns need to be repainted
Originally committed to SVN as r5571.
2011-08-27 06:52:42 +00:00
Thomas Goyne bc70429ffb Remove #pragma once from subs_grid.h
Originally committed to SVN as r5560.
2011-08-27 06:30:16 +00:00
Thomas Goyne 95cadb5226 Clean up base_grid a bit
Reduce the visibilty of many members and document some of them

Cut down on recreation of wxPen and wxBrush objects in DrawImage,
probably speeding up painting somewhat

Simplify handling of extendRow

Move event IDs to base_grid.cpp

Remove worthless comments and dead code

Assorted cosmetic changes

Originally committed to SVN as r5462.
2011-07-15 04:05:43 +00:00
Thomas Goyne f098e2fac8 Add an optional Validate method to commands
Originally committed to SVN as r5459.
2011-07-15 04:05:22 +00:00
Thomas Goyne 1d51dd20d2 Return a const reference from GetSelectedSet rather than copying it on every call
Originally committed to SVN as r5457.
2011-07-15 04:05:09 +00:00
Thomas Goyne df1dce3593 Kill SubtitlesGrid::ass and SubtitlesGrid::EditBox and convert everything that used them over to agi::Context
Originally committed to SVN as r5215.
2011-01-16 07:17:36 +00:00
Amar Takhar 167f09a610 Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 13:00:46 +00:00
Thomas Goyne e1e98d0ddd Only refresh the time columns of the subtitle grid when times change
Originally committed to SVN as r4913.
2010-12-08 08:09:55 +00:00
Amar Takhar c15777f844 Merge audio_display_rewrite branch to trunk. This is not a complete work, don't expect to time anything for a while.
Originally committed to SVN as r4903.
2010-12-08 03:36:10 +00:00
Thomas Goyne 2a51ad837e Fix non-precompiled header compilation
Originally committed to SVN as r4723.
2010-08-02 22:14:11 +00:00
Thomas Goyne a32bbab0b6 Add selection-preserving logic to BaseGrid::UpdateMaps and eliminate some unnecessary updates and clears of the maps. Fixes a pile of cases where operations would result in incorrect or no selections, or scrolling to the top of the file.
Originally committed to SVN as r4677.
2010-07-13 05:29:08 +00:00
Thomas Goyne acba2c6b63 Rewrite VFR handling in Aegisub.
Kill vfr.h and vfr.cpp and use the libaegisub versions of them instead.

Rather than the globals VFR_Input and VFR_Output, everything related to
frame rate is now part of the video context. Most things which used to
use VFR_Output now call VideoContext::TimeAtFrame etc.; video providers,
rather than modifying VFR_Input directly, now have getters for their
frame rates which VideoContext calls. Read-only public access to
VFR_Input and VFR_Output are still provided (hopefully temporarily) for
a few things which were awkward to do through VideoContext.

The Avisynth provider now might correctly handle VFR MKVs which can be
opened with DirectShowSource but not DSS2.

Rework keyframe handling as well, so that it continues to match the vfr
handling in design and implementation.

Originally committed to SVN as r4662.
2010-07-08 04:29:04 +00:00
Thomas Goyne 894d55d7a2 Add overload of GetSelectedSet that just returns the selection
Originally committed to SVN as r4627.
2010-06-28 07:12:52 +00:00
Niels Martin Hansen 22de62de77 Add selection change notification batching to the grid. This doesn't seem to actually improve performance, it might rather be line inserts that are glacial.
Originally committed to SVN as r4608.
2010-06-26 15:40:10 +00:00
Niels Martin Hansen c9c2fa6404 Move "active line" responsibility to the grid. There are at the very least a bunch of redraw issues that need to be sorted out, probably much worse things are hiding.
Originally committed to SVN as r4604.
2010-06-26 11:32:16 +00:00
Niels Martin Hansen c4a27da4fc Change the grid to use more sensible maps to keep track of index/object mappings for subtitle lines, and follow the SelectionController model. (Hopefully the new maps can also give slightly better performance.)
Try to keep the original API intact. Some redundant or unused functions in SubtitleGrid were removed. The LoadFromAss() function was renamed to UpdateMaps() since that was its real purpose. (Note that SubtitleGrid now has an UpdateMaps() function that overshadows BaseGrid::UpdateMaps(), but SubtitleGrid::UpdateMaps() calls the hidden function. They are not virtual.)
This does not yet fix visual tool feature selection.
Generally, things just feel more broken still. Further work will fix things.

Originally committed to SVN as r4603.
2010-06-26 07:26:27 +00:00
Niels Martin Hansen 70d41d31b2 Remove the SelectionChangeSubscriber mechanism from the grid and implement some basic selection change notification through SelectionController.
Change SelectionListener interface so it receives the set of lines added and removed from selection, instead of just the complete new selection.
Update VisualTool<> to use SelectionListener to receive selection change notifications.

This change (temporarily, I hope) breaks feature selection in visual drag mode, when changing selection via the grid. This is caused by the grid selection change first clearing the entire selection, which sends a separate notification about selection clear. This causes the last visual feature to be deselected, and then the visual tool base reselects the active line, causing a new notification for selection to be sent. The active line happens to be the newly clicked line, and the selection notification enters during the externalChange guard being set, and is then ignored for feature update purposes. When control returns to the original SelectRow call in the grid, the line to be selected has already been selected and then nothing happens.
The best fix is to avoid two notifications being required to deselect all then reselect one line in the first place, so making the grid selection handling saner is the best fix.

Originally committed to SVN as r4602.
2010-06-26 04:38:02 +00:00
Niels Martin Hansen e60d476f4a Turn BaseGrid into a do-nothing SelectionController<AssEntry>.
Originally committed to SVN as r4601.
2010-06-25 01:49:12 +00:00
Thomas Goyne 5ed401d23d Use vector<int> instead of vector<bool> for tracking which rows are selected. Makes undo roughly twice as fast.
Originally committed to SVN as r4563.
2010-06-22 00:03:22 +00:00
Thomas Goyne 877eabdce7 Fix selection issues with visual features
Selections in drag mode now follow the following rules:

 * If a line is selected in the grid, at least one visual feature
   corresponding to the line is selected.

 * If a line has any features selected, that line is selected in the
   grid.

In addition, all control points now start out selected in the vector
clip tool, and all tools should no longer discard the current selection
at unpredictable or unintended times.

Updates #513.

Originally committed to SVN as r4363.
2010-05-26 07:17:39 +00:00
Thomas Goyne d2a81d871b Make several methods in BaseGrid static or const and clean up some of the implementations.
Originally committed to SVN as r4362.
2010-05-26 07:17:34 +00:00
Amar Takhar 8504b4790d Remove '#pragma once' from 84 files that don't need it. Thanks to Plorkyeran for testing this on windows. The next step is to detangle the remaining files that currently require it.
Originally committed to SVN as r3533.
2009-09-11 18:51:48 +00:00
Amar Takhar 774fb0f674 Fix all the headers in *., this includes:
* Wrapping all headers that are in agi_pre.h with AGI_PRE.
  * Sorting alphabetically.
  * Same operation as r3515.

Note: This is broken when precompiled headers are not in use, I'll fix that after this commit so the two changes don't get jumbled up.

Originally committed to SVN as r3525.
2009-09-11 02:36:34 +00:00
Amar Takhar 7a8c5229fd * Remove wxprec.h from all files other than agi_pre.h. Including this in various headers is useless as it includes wx.h which includes dozens of 'common' wx headers. With this we're unable to tell which files rely on which interfaces. This commit removes them and manually places in required headers as-needed.
* Update agi_pre.h to include some missing headers, also move required windowsheaders to the top of the list
 * Use <> versus "" for the wx header in avisynth_wrap.cpp
 * Remove xx/wx.h from agi_pre.h as it's included by wxprec.h.

Originally committed to SVN as r3513.
2009-09-10 10:26:50 +00:00
Amar Takhar 2fd9b9d7e3 Fix a whole bunch of Doxygen warnings.
Originally committed to SVN as r3325.
2009-07-30 03:36:53 +00:00
Amar Takhar 6ee2f98349 Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs.  This isn't the actual document in itself but empty documentation using any old documentation if it was there.

This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.

Some notes:
 * Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
 * Some multiline comments may have been munged into single line comments
 * Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
 * Enum comments can go after the enumeration itself '[value] /// comment'
 * include/aegisub/*.h haven't been converted yet, this will be done in a later commit
 * Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.

See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.

Originally committed to SVN as r3312.
2009-07-29 22:59:22 +00:00
Amar Takhar 12aa34088a Switch all headers to using Doxygen and cleanup contact info
* Swap old email + website address with 'Aegisub Project http://www.aegisub.org/'
 * Set categories for all files (jfs)
 * Add descriptions for each file (jfs)
 * Add $Id$ keyword

Originally committed to SVN as r3310.
2009-07-29 05:43:02 +00:00
Karl Blomster 31aed4c1a7 Fix a number of odd quirks regarding how grid selection is moved after committing multiple lines, and how audio selection moves after committing. See #794 for full details. Patch by Harukalover.
closes #64, #420, #794

Originally committed to SVN as r2859.
2009-04-26 01:02:23 +00:00