Commit graph

514 commits

Author SHA1 Message Date
Thomas Goyne
ce358c1367 Move global_scripts to options.h
Not the perfect place for it by any means, but that's where the rest of
the application-global stuff is these days and it removed the need for
automation stuff to include main.h (and thus all the wxApp garbage).
2014-06-06 12:08:41 -07:00
Thomas Goyne
07cf50f7d3 Use non-deprecated wxIMPLEMENT_APP 2014-06-06 12:08:40 -07:00
Thomas Goyne
392c9ea35a Catch std::exceptions thrown during startup 2014-06-06 12:08:40 -07:00
Thomas Goyne
04efe2edfb Delete osx-run.sh
wxWidgets now supports running from outside application bundles, so it's
no longer needed.
2014-06-05 08:35:50 -07:00
Thomas Goyne
421d5ca52e Add #ifdef __cplusplus to the precompiled headers to make Xcode happy 2014-06-05 08:35:50 -07:00
Thomas Goyne
50dfa1cd42 Fix issues with selected line styles with the keyboard on OS X
Opening the style list dropdown and switching between values with the
arrow keys doesn't update the value returned from ctrl->GetValue() on
OS X, but the event contains the correct value so use that instread.
2014-06-05 08:35:50 -07:00
Thomas Goyne
238110e799 Set minimum widths for the columns of the hotkeys editor on OS X
The OS X implementation makes very poor choices for the default widths
if given the opportunity.
2014-06-05 06:33:03 -07:00
Thomas Goyne
fffb138b81 Add IME support on OS X
Closes #1247, #1672, #1695.
2014-06-04 14:29:37 -07:00
Thomas Goyne
acdc0e7cba Use less std::set 2014-06-04 14:15:27 -07:00
Thomas Goyne
9133293869 Use less std::bind 2014-06-04 14:15:27 -07:00
Thomas Goyne
745aa8fef0 Use less wxString in HotkeyDataViewModel 2014-06-04 14:15:26 -07:00
Thomas Goyne
970dd96959 Delete unused variable 2014-06-04 14:15:26 -07:00
Thomas Goyne
460b806038 Use non-deprecated wxFONT/wxPEN constants 2014-06-04 14:15:26 -07:00
Thomas Goyne
d3484e7382 Get the end time of the last line in a less dumb way 2014-06-04 14:15:26 -07:00
Thomas Goyne
f7532ff1ef Actually use the ?dictionary token. Closes #1761. 2014-06-04 14:15:26 -07:00
Thomas Goyne
0bf93ec263 Fix a bunch of crashes in the vector clip tool 2014-06-03 10:07:35 -07:00
Thomas Goyne
5fcb287ed0 Fix saving images with subtitles for frames other than the first 2014-06-03 07:21:07 -07:00
Thomas Goyne
4e5b81973b Set the initial audio volume when opening audio 2014-06-03 07:21:07 -07:00
Thomas Goyne
e6d7c4547a Fix compilation of the portaudio player 2014-06-03 07:21:07 -07:00
Thomas Goyne
b42086fdfd Use the customized default styles for SRT files opened from matroska 2014-06-02 13:02:06 -07:00
Thomas Goyne
e061ac8755 Pull even more of the subs load logic into Project
The relative order of the on-file-load logic matters, so signals don't
work very well for it. Doing it all explicitly in Project fixes a bunch
of inconsistent issues related to restoring saved state.

Closes #1759.
2014-06-02 13:02:06 -07:00
Thomas Goyne
917913b0ef Flush the clipboard before closing it, not after 2014-06-02 13:02:05 -07:00
Thomas Goyne
ff9beb850c Build wx without iostream support 2014-05-31 08:11:32 -07:00
Thomas Goyne
193b30af86 Eliminate a bunch of entirely pointless OptionPage subclasses 2014-05-31 08:11:32 -07:00
Thomas Goyne
76f0afecaf Eliminate pointless wxDialog subclasses
A lot of the wxDialog subclasses don't actually override any virtual
functions, so there's no particular need for them to be subclasses at
all, and wxDialog's vtable is so huge that they actually contribute
measureable to the size of the executable.
2014-05-31 08:11:32 -07:00
Thomas Goyne
060536824b Kill ScintillaTextCtrl and just always use the UTF-8 methods
Trivially improves performance and reduces the opportunities for wxSTC
to fuck up.
2014-05-30 13:24:38 -07:00
Thomas Goyne
fa68b5ee1a Fix compilation with UTF-8 wxString 2014-05-30 11:53:15 -07:00
Thomas Goyne
59489b8f8c Extract some of the string formatter implementation to format.cpp 2014-05-30 11:53:15 -07:00
Thomas Goyne
37c02ae127 Replace wxString::Format with agi::format
It's modestly faster, significantly more type-safe, and doesn't assert
when there's too few arguments, which causes problems for plural forms.

Closes #1733.
2014-05-30 11:53:14 -07:00
Thomas Goyne
8d26c66d0f Remove a bunch of unused functionalty from agi::Exception 2014-05-30 11:53:14 -07:00
Thomas Goyne
b43788fa7f Replace boost::format with agi::format
boost::format is slow to compile, slow to run, and has an unpleasant
interface.
2014-05-30 08:30:31 -07:00
Thomas Goyne
e75fc089d3 Don't error on truncated wave files 2014-05-27 06:42:47 -07:00
Thomas Goyne
59a680e6e1 Fix saving audio clips from lines 2014-05-27 06:42:46 -07:00
Thomas Goyne
dfec6b73b7 Use free() on data returned by Hunspell, not delete 2014-05-27 06:42:46 -07:00
Thomas Goyne
eec83bb32b Cut down on FileNotFound exceptions thrown on startup 2014-05-27 06:42:46 -07:00
Thomas Goyne
ac5f40a543 Fix \N handling in EBU STL export 2014-05-27 06:42:46 -07:00
Thomas Goyne
02ca3360ca Handle missing recently used subtitle files better 2014-05-26 09:34:20 -07:00
Thomas Goyne
960dc3723b Don't get the duration from the audio controller on audio open
The audio controller's provider may not have been updated yet.
2014-05-26 09:34:20 -07:00
Thomas Goyne
cca97a58f6 Fully initialize the video when it's opened via drag-and-drop 2014-05-26 09:34:20 -07:00
Thomas Goyne
81b942ea6e Update agi_pre.h 2014-05-26 09:34:20 -07:00
Thomas Goyne
6c685daf98 Ditch boost.circular_buffer
It drags in a ton of crap, is kinda slow at runtime due to using
std::deque, and doesn't actually make the code much simpler than just
using a manual ring buffer.
2014-05-26 09:34:19 -07:00
Thomas Goyne
1f7c47239b Replace timeval junk with std::chrono 2014-05-26 09:34:19 -07:00
Thomas Goyne
fed99649e9 Cut down on pointless uses of std::list 2014-05-26 09:34:19 -07:00
Thomas Goyne
c0d3ecb6c2 Change Spline to a std::vector 2014-05-26 09:34:18 -07:00
Thomas Goyne
8ec9280ecc Change most uses of deques to vectors 2014-05-26 09:34:18 -07:00
Thomas Goyne
20a7ec786f Use initializer lists rather than std::make_pair 2014-05-26 09:34:18 -07:00
Thomas Goyne
4f65f79f1e Remove some pointless std::moves 2014-05-26 09:34:18 -07:00
Thomas Goyne
4598a23485 Fix the paste over dialog 2014-05-24 07:41:17 -07:00
Thomas Goyne
b370e1af53 Stop video playback when seeking due to switching active lines 2014-05-24 07:41:17 -07:00
Thomas Goyne
d73790805a Fix reloading the video provider after settings changes 2014-05-24 07:41:16 -07:00
Thomas Goyne
9ca61a2fb5 Delete unused stuff in the pulseaudio player 2014-05-24 07:41:16 -07:00
Thomas Goyne
55865d131a Add a missing check for if the video has an audio track 2014-05-23 13:03:10 -07:00
Thomas Goyne
99b46f6a14 Fix restoring video position from saved project info 2014-05-23 13:03:10 -07:00
Thomas Goyne
d004fc1856 Improve ALSA playback position reporting
Use std::chrono since it's a nicer API. Use a separate lock for playback
position so that the GUI thread isn't blocked for hundreds of ms while
snd_pcm_drain is waiting, and update the playback position after
decoding audio rather than before to avoid it being significantly wrong
when not using a cache.
2014-05-23 13:03:10 -07:00
Thomas Goyne
e36ecbde49 Reuse a decoding buffer for ALSA rather than constantly allocating new ones 2014-05-23 13:03:10 -07:00
Thomas Goyne
1bf6197869 Use std::thread rather than pthreads for AlsaPlayer 2014-05-23 13:03:10 -07:00
Thomas Goyne
c2b8892b33 Use unique_ptr in AlsaPlayer 2014-05-23 13:03:10 -07:00
Thomas Goyne
9d3067ae75 Return absolute paths for files in project_properties() 2014-05-23 07:28:26 -07:00
Thomas Goyne
384f87f399 Use more plural forms for translatable strings 2014-05-23 07:28:25 -07:00
Thomas Goyne
60fd44163e Don't clear project properties on undo/redo 2014-05-23 07:28:25 -07:00
Thomas Goyne
40ac2f9b44 Fix crash when opening video
If video was previously open and the user chooses to resample the script
for the new video, VideoController would try to update the subs for the
now-deleted old provider.
2014-05-23 07:28:25 -07:00
Thomas Goyne
e2754bcd90 Make video providers report whether their file has audio tracks
Fixes errors when trying to automatically open audio from dummy video
and improves UX a little by disabling the Open Audio From Video menu
item when there are no audio tracks.
2014-05-23 07:28:25 -07:00
Thomas Goyne
692b354713 Don't compile the FFT code if FFTW is enabled 2014-05-23 07:28:25 -07:00
Thomas Goyne
e0b8c21590 Use unique_ptr for AudioWaveformRenderer's decode buffer 2014-05-23 07:28:25 -07:00
Thomas Goyne
09e325a1c3 Clean up unused includes 2014-05-23 07:28:24 -07:00
Thomas Goyne
df406d5452 Fix compilation with GCC 2014-05-22 14:58:39 -07:00
Thomas Goyne
2bf23af00a Remove a lot of pointless headers for dialogs
Most of the dialogs in Aegisub have a public interface consisting of a
single function, so there's really no need to expose the actual dialog
classes to the rest of the program. Add dialogs.h with the declarations
of all of those functions (most of which are just ShowFooDialog()), and
kill a million other headers.
2014-05-22 14:58:39 -07:00
Thomas Goyne
49357eec20 Add missing subs_controller.h include for release builds 2014-05-22 09:54:59 -07:00
Thomas Goyne
9ae9da4aab Support loading keyframes and timecodes files via drag-and-drop
Closes #1749.
2014-05-22 09:29:16 -07:00
Thomas Goyne
de2e1e23de List the files to be (un)loaded in the Load/Unload files dialog
Updates #880.
2014-05-22 09:29:16 -07:00
Thomas Goyne
aa21b3d77d Add aegisub.project_properties()
Returns a table with all of the project metadata junk that used to be in
the script info section of the file.

Closes #1747.
2014-05-22 09:29:16 -07:00
Thomas Goyne
9c7119fdc2 Redesign how project metadata is stored in the file
Remove it from the script info section and put it in its own section
that isn't tracked by undo and make it not stringly typed. Removes the
need for the gross hack where changes are slipped in just before saving
to circumvent the undo system, cuts down on the uses of string literals
to identify fields, and probably improves performance a little.
2014-05-22 09:29:15 -07:00
Thomas Goyne
19e8f19e52 Redesign project file handling
Add a new Project class which is responsible for everything related to
opening and closing audio, video, subtitles, timecodes and keyframes.
This pulls almost everything not directly related to playing audio/video
out of the audio and video controllers, pulls more crap out of
FrameMain, and happens to make things a little simpler in the process.
2014-05-22 09:29:12 -07:00
Thomas Goyne
a345b8c4d5 Undelete the script resolution mismatch option from default_config 2014-05-22 06:14:59 -07:00
Thomas Goyne
5830fc4225 Don't limit CodecPrivate to 256KB 2014-05-20 09:46:58 -07:00
Thomas Goyne
5f4d6ad386 Return zero bytes when MatroskaFile asks for data past the end of the file 2014-05-20 09:46:57 -07:00
Thomas Goyne
53f02d33a6 Fix a bunch of warnings when building with gcc on linux 2014-05-20 09:46:57 -07:00
Thomas Goyne
c2455cccb6 Enable loading audio when opening video by default
Main reason not to do this was that loading audio blocked the UI, which
has now been fixed, and having to separately load audio confuses
beginners.
2014-05-20 09:46:57 -07:00
Thomas Goyne
7645b447be Set the correct variable for whether to commit subs after opening video 2014-05-19 19:32:25 -07:00
Thomas Goyne
6edb38501b Update the YCbCr matrix used by the video display when the header is changed 2014-05-19 19:32:25 -07:00
Thomas Goyne
ad33fdb109 Add color matrix conversion to the resolution resampler 2014-05-19 19:32:25 -07:00
Thomas Goyne
7a06e08ad0 Use ycbcr_converter in YUV4MPEGVideoProvider 2014-05-19 19:32:25 -07:00
Thomas Goyne
9774352a77 Fix compilation with gcc 4.8. Closes #1756. 2014-05-19 06:53:44 -07:00
Thomas Goyne
a376ed90b9 Insert \\N on shift-enter in the edit box 2014-05-18 07:50:23 -07:00
Thomas Goyne
402aa509a0 Fix non-pch compilation 2014-05-17 18:01:41 -07:00
Thomas Goyne
d0ce26d7df Add an option to resample the script to the resolution mismatch dialog
Closes #1382.
2014-05-17 18:01:41 -07:00
Thomas Goyne
32fae528b0 Don't try to shift line margins that are 0 2014-05-17 18:01:41 -07:00
Thomas Goyne
c78db67cba Round negative drawing coordinates correctly 2014-05-17 18:01:41 -07:00
Thomas Goyne
229b6cf63d Fix resampling drawings with AR changes
The shift from margins should be applied only to the line's position,
not to each point in the drawing, and the scale needs to compensate for
that the scale on the style is being changed as well.
2014-05-17 18:01:41 -07:00
Thomas Goyne
0f030c45f3 Make AR-changing resampling more user-friendly
Add modes where the borders to add or remove are automatically
calculated rather than forcing the user to do it manually, and hopefully
make it a bit clearer what exactly will happen.
2014-05-17 18:01:41 -07:00
Thomas Goyne
7e2780f57a Make both source and destination resolution overridable in the resampler 2014-05-17 18:01:40 -07:00
Thomas Goyne
6886436ddc Add YCbCr Matrix to the script properties dialog 2014-05-17 18:01:40 -07:00
Thomas Goyne
26cfd3ecbd Add missing check for if the context has been initialized in the crash handler 2014-05-15 12:07:46 -07:00
Thomas Goyne
79fd39d6ca Default to the language selected in the installer 2014-05-15 11:09:38 -07:00
Thomas Goyne
0a1660c03b Add version information to the windows executable
Closes #913.
2014-05-15 08:39:09 -07:00
Thomas Goyne
8a49cf1c34 Shove simple getters in AudioTimingControllerDialogue into the class declaration 2014-05-15 07:44:13 -07:00
Thomas Goyne
6f36c75cfd Fix snapping audio markers to markers from other selected lines 2014-05-15 07:31:33 -07:00
Thomas Goyne
e593843da7 Significantly speed up marker snapping with large selections 2014-05-14 12:48:59 -07:00
Thomas Goyne
fc662e0278 Use INT_MIN as the invalid click position sentinel rather than -1 2014-05-14 12:13:40 -07:00
Thomas Goyne
c13b026598 Snap based on all markers being dragged rather than just the mouse position 2014-05-14 12:04:19 -07:00
Thomas Goyne
9168484fc6 Allow clicking anywhere in the audio display for alt-dragging 2014-05-14 08:37:03 -07:00
Thomas Goyne
fff59982f4 Clear the clicked marker on right click 2014-05-13 12:44:28 -07:00
Thomas Goyne
66ba65774a Add custom build system for wxWidgets 2014-05-13 11:02:46 -07:00
Thomas Goyne
1651446e0f Drag the entire audio selection when Alt is held down
Closes #691.
2014-05-12 12:07:46 -07:00
Thomas Goyne
5da847e1ef Use more NSDMIs 2014-05-12 10:05:36 -07:00
Thomas Goyne
562a2259f5 Check for uses of styles other than "Default" in CanSave rather than customized styles
Customizable default styles makes the latter check awkward to implement,
and the previous logic of comparing against the hardcoded default wrong.
2014-05-12 08:34:28 -07:00
Thomas Goyne
164ad33753 Fix RTL painting of the subtitles grid
wx comes very close to just making it work automatically, but it doesn't
translate the origin to the top-right corner and wxBufferedPaintDC
doesn't handle RTL at all, so reimplement it with some hacks.

Closes #1354.
2014-05-12 08:04:24 -07:00
Thomas Goyne
0909d137b0 Mirror toolbar button images for RTL locales
Some of the toolbar buttons are seriously wrong when mirrored and there
doesn't seem to be a way to disable mirroring for the images while using
RTL layout for the toolbar itself, so double-mirror them so that they
end up with their original appearance.

Ideally the button images would be localizable as some of them actually
should be mirrored, but that's probably not worth the work involved.

See #1354.
2014-05-11 07:31:22 -07:00
Thomas Goyne
3d0e2baf4e Force the video display to LTR layout direction
Mirroring the video is not useful or desirable.

See #1354.
2014-05-11 06:59:59 -07:00
Thomas Goyne
b96edfebcc Remove check for customized styles in SRTSubtitleFormat::CanSave
It doesn't work with customizable default styles.
2014-05-09 09:24:27 -07:00
Thomas Goyne
73d64870af Fix writing files as non-utf-8 2014-05-09 07:00:48 -07:00
Thomas Goyne
eadf555da3 Pass exceptions in async workers back to the main thread 2014-05-09 07:00:48 -07:00
Thomas Goyne
d3a4bed994 Port respack to lua
Simplifies the build system a little by cutting down on the number of
helpers that need to be built.
2014-05-08 10:39:18 -07:00
Thomas Goyne
571c9d9b7a Don't hardcode the size of buttons with translatable labels. Closes #1750. 2014-05-07 10:43:01 -07:00
Thomas Goyne
049142f6f6 Make the check for faux bold match libass's logic for when to embolden 2014-05-07 07:13:32 -07:00
Thomas Goyne
8e5d4c48bc Print usage information for faux bold/itatlic warnings 2014-05-07 06:51:35 -07:00
Thomas Goyne
26e7880c8b Fix compilation with non-16-bit wchar_t 2014-05-06 18:31:19 -07:00
Thomas Goyne
77a2c1bb16 Verify that we're actually using a UTF-8 locale and switch to en_US.UTF-8 if not
Should fix #1587 and #1675, but I was never able to reproduce either of
them so maybe not.
2014-05-06 18:16:36 -07:00
Thomas Goyne
432640c045 Use localized language names from ICU rather than English names 2014-05-06 17:32:10 -07:00
Thomas Goyne
32f5e00bf8 Eliminate a pointless check 2014-05-06 10:32:19 -07:00
Thomas Goyne
50d0744e9c Skip prompting the user for a language on first start if we have a translation for their OS UI language 2014-05-06 10:29:53 -07:00
Thomas Goyne
47b8627ad3 Keep the old subtitles file alive until the new one is fully announced
This fixes crashes from touching dangling references to lines in the old
subtitle file in the handlers for the various signals triggered when a
new file is opened.
2014-05-06 09:36:07 -07:00
Thomas Goyne
ca86b0da33 Actually initialize the initial MatchState in the search replace engine 2014-05-05 18:52:16 -07:00
Thomas Goyne
a00e5dc967 Update which style the Edit button edits when the line's style is changed 2014-05-05 18:42:06 -07:00
Thomas Goyne
2674c702d1 Silence incorrect warning 2014-05-05 17:53:14 -07:00
Thomas Goyne
7e2724c22c Add support for submenus in the automation menu
Split the menu text on /, with each segment before the last used as the
submenu name and the last as the actual menu text.

Closes #852.
2014-05-05 14:27:01 -07:00
Thomas Goyne
c5608a4725 Add Comment field to the paste over dialog 2014-05-05 07:01:57 -07:00
Thomas Goyne
26a9e57006 Eliminate an extra commit when using the color picker buttons 2014-05-05 06:28:27 -07:00
Thomas Goyne
f261688b11 Don't ignore the contents of override blocks when counting characters for selection preserving 2014-05-05 06:27:37 -07:00
Thomas Goyne
3983719e3f Add an Edit button next to the style list dropdown. Closes #1746. 2014-05-04 12:53:22 -07:00
Thomas Goyne
57f6e9a869 Actually serialize the styles for the subtitle renderers 2014-05-04 11:16:57 -07:00
Niels Martin Hansen
e1c575b7a1 MicroDVD import should also use default styles 2014-05-04 13:14:28 +02:00
Niels Martin Hansen
1dc2ae09a0 Forgot OSX default config in 6b827abec0 2014-05-04 13:07:25 +02:00
Niels Martin Hansen
82d7979f04 Pass style catalog names instead of file names to AssFile::LoadDefault 2014-05-04 13:04:48 +02:00
Niels Martin Hansen
79b6ce2583 Move style catalog indexing and naming logic 2014-05-04 13:03:04 +02:00
Thomas Goyne
c30ca1a321 Remove progress throttling from ffms indexing 2014-05-03 17:22:38 -07:00
Thomas Goyne
d672e75109 Filter out redundant progress updates sooner
Sending events from background threads to the main thread is somewhat
expensive, so filter out progress updates which don't actually change
the progress on the background thread.
2014-05-03 17:22:38 -07:00
Thomas Goyne
6a1321e1df Move the serialization for the subtitles providers to SubtitlesProvider 2014-05-03 17:22:38 -07:00
Niels Martin Hansen
451c6751de Preferences page for default style catalogs 2014-05-03 22:23:01 +02:00
Niels Martin Hansen
6b827abec0 Config options for default style catalogs for various formats 2014-05-03 21:08:37 +02:00
Niels Martin Hansen
f45f73151e Copy styles from Default catalog to new files 2014-05-03 20:02:52 +02:00
Niels Martin Hansen
3260a5fa1a Update about box 3rd-party library credits 2014-05-03 02:14:12 +02:00
Niels Martin Hansen
9c2f12a786 Clearer error messages when audio open fails
The existing chain of errors from all providers can be really confusing,
so instead try to interpret the exception type to add some meaning.
2014-05-03 01:05:09 +02:00
Thomas Goyne
2587625af4 Fix non-pch compilation 2014-05-01 13:48:46 -07:00
Thomas Goyne
f7f6c2b90b Switch to using csri_open_mem 2014-05-01 13:39:35 -07:00
Thomas Goyne
af20d31699 Push the dropping of non-visible lines into the serialization logic
Makes things way less gross and trivially faster.
2014-05-01 13:39:35 -07:00
Thomas Goyne
7a5c92aaee Speed up TextFileWriter a bit
Write the text and the newline separately rather than appending the
newline to the text to eliminate a copy of the text.
2014-05-01 13:39:35 -07:00
Thomas Goyne
4366ece827 Speed up passing subtitles to VSFilter a little
Use temp_file_mapping so that it normally never actually hits the disk
on Windows and use AssSubtitleFormat directly.
2014-04-30 06:29:37 -07:00
Thomas Goyne
1eba2f035c Add a separate SSA subtitle format and move all of the SSA writing stuff there 2014-04-30 06:29:37 -07:00
Thomas Goyne
31af9c575f Extract duplicated ASS writing code from libass provider 2014-04-30 06:29:37 -07:00
Thomas Goyne
431b096f51 Fix loading modules with UTF-8 BOMs
Ensure MoonScript gets loaded before we install our package loader to
avoid having its package loader used over ours.
2014-04-28 14:19:16 -07:00
Thomas Goyne
606e3f4882 Fix crash on script load errors 2014-04-28 13:36:56 -07:00
Thomas Goyne
e3fa270345 Process any pending log text when a progress dialog completes 2014-04-28 11:01:57 -07:00
Thomas Goyne
8aa3c8761c Unswap the actor and effect columns in the grid 2014-04-28 10:10:33 -07:00
Thomas Goyne
aa850688f4 Don't try to open compressed subtitle tracks
Actually supporting them would be even better of course, but at least
don't crash on them.
2014-04-28 08:43:25 -07:00
Thomas Goyne
c74045cf20 Use spin controls for numeric fields in the style editor
Closes #1741.
2014-04-28 07:38:33 -07:00
Thomas Goyne
63f4bf1beb Switch from regular Lua to LuaJIT 2014-04-28 07:38:30 -07:00
Thomas Goyne
9492192b73 Switch back to building Lua as C
In preparation for switching to LuaJIT, which doesn't support PUC Lua's
thing of using C++ exceptions for lua_error.

Requires replacing all uses of lua_error (and things calling lua_error)
with custom versions that throw an exception instead and adding an
exception -> lua error wrapper at all C++ -> Lua boundaries.
2014-04-27 10:37:23 -07:00
Thomas Goyne
e3eb28ffd1 Extract some duplicated table pushing code 2014-04-27 09:15:35 -07:00
Thomas Goyne
689c16deb3 Use lua_createtable where applicable 2014-04-27 09:15:35 -07:00
Thomas Goyne
50e27d8247 Shut up warning 2014-04-26 08:16:38 -07:00
Thomas Goyne
2adcc76cf6 Switch automation tests to busted
This requires shuffling a bunch of stuff around to get a CLI lua
executable that uses an automation-like environment, but that's
something that'll be nice to have in the future anyway.

Busted indirectly depends on lfs and we currently can't use external
binary modules, so add a copy of lfs to the repo and build it with
Aegisub.
2014-04-26 08:16:38 -07:00
Thomas Goyne
b8af29da0d Move some of the automation machinery to libaegisub 2014-04-25 15:03:18 -07:00
Thomas Goyne
15ae2b0ccc Eliminate a bunch of explicit constructors/destructors
Use explicitly defaulted destructors for base cases when possible,
eliminate aggregate initialization constructors where possible, and push
some more stuff to NSDMIs.
2014-04-25 14:53:24 -07:00
Thomas Goyne
4cd92ee532 Move stuff only ever used in auto4_lua.cpp to an anonymous namespace there 2014-04-25 09:27:27 -07:00
Thomas Goyne
e7734e642d Use nullptr 2014-04-25 08:59:43 -07:00
Thomas Goyne
d0603fde88 Don't check for used extradata ids if there are none 2014-04-25 08:59:43 -07:00
Niels Martin Hansen
d53c36e67f Merge branch 'extradata'
Conflicts:
	src/ass_parser.cpp
2014-04-25 17:22:15 +02:00
Thomas Goyne
d4fbe3040d Preserve the insertion point (but not selection) when switching between lines 2014-04-25 08:00:45 -07:00
Niels Martin Hansen
f278c35f3f Dynamically use either inline_string escaping or uuencoding for extradata
Since luabins generates binary data which grows up to 3x by escaping,
it's more efficient to uuencode that instead.
A marker is placed as the first character of the value field, either
'e' for inline_string escaped text, or 'u' for uuencoded binary data.
The key is always inline_string escaped, as it will typically be
human readable.
2014-04-25 16:04:08 +02:00
Thomas Goyne
6ee1b8ca52 Update the start sample between blocks in the ram audio provider correctly 2014-04-24 19:08:05 -07:00
Thomas Goyne
cef07785d7 Remove a pointless ++ and make stuff const 2014-04-24 18:51:54 -07:00
Niels Martin Hansen
7839e8c983 Fix bug in extradata id list reading 2014-04-25 00:05:32 +02:00
Niels Martin Hansen
b2768b7abd Work around boost::format bug
See https://svn.boost.org/trac/boost/ticket/9360
It seems that the %X specifier is ignored if the input value is a char type
and the char is instead output verbatim and not in its integer value.
Casting it to an int works around this.
2014-04-24 23:54:42 +02:00
Niels Martin Hansen
3f08b1d057 Use lua_pushlstring() so strings with embedded NULs also work 2014-04-24 23:49:36 +02:00
Niels Martin Hansen
18f55eaebf Load luabins library into Auto4 Lua environment 2014-04-24 23:01:27 +02:00
Thomas Goyne
7161ce167c Use lambdas rather than std::bind(std::ref(Signal)) for signal forwarding 2014-04-23 15:48:39 -07:00
Thomas Goyne
6fc4c8da14 Move make_unique to its own header file
Rebuilding the entire project after touching util.h gets old fast.
2014-04-23 15:29:23 -07:00
Niels Martin Hansen
cf81e91383 Perform extradata garbage collection on save 2014-04-23 22:54:01 +02:00
Niels Martin Hansen
159dfcde39 Add extradata reading/writing to Auto4 Lua 2014-04-23 22:54:01 +02:00
Niels Martin Hansen
040b467090 Add undo support for extradata 2014-04-23 22:54:01 +02:00
Niels Martin Hansen
8076fb2791 Basic storage and loading/saving for extradata 2014-04-23 22:54:01 +02:00
Thomas Goyne
c248dc56da Make the visual tool drag handles a little smaller 2014-04-23 07:15:28 -07:00
Thomas Goyne
7b0b74fbb0 Fix off-by-one error in the bounds check for restoring the active line 2014-04-23 06:22:18 -07:00
Thomas Goyne
ec6f14eef4 Make double-click in the edit box smarter
Use the syntax highlighting's word splitting to decide what to select so
that double-clicking on \Nword only selects 'word'.
2014-04-22 17:01:22 -07:00
Thomas Goyne
b4284efb38 Trigger the audio selection change logic when switching timing controllers
Results in the display seeking to the active line when audio is opened
(if seeking to active line is enabled), and initializes the scrollbar
properly.

Updates #1732.
2014-04-22 16:42:47 -07:00
Thomas Goyne
feec511227 Use more make_unique 2014-04-22 16:37:12 -07:00
Thomas Goyne
c53e8f6139 Pass around newly created AudioTimingControllers in a unique_ptr 2014-04-22 16:21:53 -07:00
Thomas Goyne
f83f8b73a0 Hide the CPS value if it's over 100 2014-04-22 12:35:41 -07:00
Thomas Goyne
a30d6121fd Don't block the UI while decoding audio for the caches
Simply zero the memory for audio which hasn't been decoded yet, modify
the audio renderer to avoid caching blocks which aren't ready yet, and
add a progress indiciator to the audio display scrollbar.
2014-04-22 12:34:20 -07:00
Thomas Goyne
1bd3572054 Make the CPS warning thresholds and color customizable 2014-04-21 11:11:40 -07:00
Thomas Goyne
7bc35cecb7 Don't show a CPS value for lines under 100 ms long 2014-04-21 11:11:40 -07:00
Thomas Goyne
543034b96b Change the background color of the CPS column when the value is excessively high 2014-04-21 11:11:40 -07:00
Thomas Goyne
a1a289c4c0 Push more of the painting logic into the grid column classes 2014-04-21 11:11:40 -07:00
Thomas Goyne
6e0160d730 Fix ugly extra grid line drawn when the first row is selected 2014-04-20 19:46:03 -07:00
Thomas Goyne
5646c05be7 Draw the active line box on top of the grid columns 2014-04-20 19:39:48 -07:00
Thomas Goyne
f14cef7321 Remove pointless vertical alignment logic
The only time it has an effect is when font substitution occurs, and the
end result tends to be worse than doing nothing at all.
2014-04-20 19:32:39 -07:00
Thomas Goyne
d886a5916d Create the output directory when collecting fonts to a zip 2014-04-20 07:01:49 -07:00
Thomas Goyne
1677e700b2 Add missing error checking for opening the output zip file in the fonts collector 2014-04-20 07:01:49 -07:00
Thomas Goyne
3ed99b5cb2 Make SubsEditBox::PopulateList less pointlessly slow 2014-04-20 07:01:49 -07:00
Thomas Goyne
2387b31cee Rearrange BaseGrid's data members 2014-04-20 07:01:49 -07:00
Thomas Goyne
c3e024954c Make frame mode handling in grid columns a little less ugly 2014-04-20 07:01:48 -07:00
Thomas Goyne
6c6f60eb98 Add an option to ignore punctuation for the character counter 2014-04-18 20:11:38 -07:00
Thomas Goyne
cff3c0a3df Don't repopulate the actor/effect fields when the active line changes
Speeds up switching lines on a totally arbitrary test file that doesn't
even use very many actors or effects by ~20%.
2014-04-18 20:11:38 -07:00
Thomas Goyne
8aea747b88 Update the character counter synchronously
It's not longer even vaguely in the realm of slow enough to justify
dumping off on a background thread.
2014-04-18 20:11:38 -07:00
Thomas Goyne
af32733797 Move character count stuff to libaegisub 2014-04-18 20:11:38 -07:00
Thomas Goyne
bd53302907 Remove unused variable 2014-04-18 14:28:55 -07:00
Thomas Goyne
744717a164 Skip calculating the CPS for lines where it's very unlikely to be meaningful 2014-04-18 14:08:12 -07:00
Thomas Goyne
5143c34d70 Fix right and vertical margin columns 2014-04-18 14:05:31 -07:00
Thomas Goyne
5df871f599 Extract all of the column-specific logic from BaseGrid 2014-04-18 12:17:03 -07:00
Thomas Goyne
909be4494a Use a struct for the cached grid brushes rather than an array+enum 2014-04-18 07:17:38 -07:00
Thomas Goyne
d5274b72d4 Cap CPS column at 999 2014-04-18 07:07:03 -07:00
Thomas Goyne
867eaae7a8 Add basic characters-per-second column to the grid 2014-04-17 19:11:35 -07:00
Thomas Goyne
393d1dd269 Fix combine lines commands 2014-04-17 18:08:03 -07:00
Thomas Goyne
c93d38cc34 Clean up BaseGrid a little
Eliminate the hardcoded uses of 11 all over the place and cache the
calculation of the header widths.
2014-04-17 18:08:03 -07:00
Thomas Goyne
27c1522622 Use AssDialogue::Row more places 2014-04-17 17:30:06 -07:00
Thomas Goyne
e729d38164 Add a warning for faux bold/italic to the fonts collector 2014-04-17 16:07:01 -07:00
Thomas Goyne
1a67ee1fdf Add SelectionController::GetSortedSelection and use it where useful 2014-04-17 14:32:18 -07:00
Thomas Goyne
df42fdb2d2 Restore the text selection and cursor position on undo 2014-04-17 11:46:28 -07:00
Thomas Goyne
56699e4800 Mark move constructors as noexcept
Or just default them for non-MSVC when possible.
2014-04-17 11:46:28 -07:00
Thomas Goyne
09d0d039e0 Convert signal.h to variadic templates 2014-04-17 11:46:27 -07:00
Thomas Goyne
ecdf7c4fc3 Cut the width of the lines for the visual features in half 2014-04-17 11:46:27 -07:00
Thomas Goyne
18d9a43edb Cut the opacity of visual tool features in half 2014-04-17 11:46:27 -07:00
Thomas Goyne
73c2e92655 Clean up VideoBox a little 2014-04-17 11:46:27 -07:00
Thomas Goyne
00a3547453 Make find/replace and automation text fields unlimited length
On Windows text fields default to a maximum of 30,000 characters.
2014-04-16 08:11:38 -07:00
Thomas Goyne
d07cba4875 Keep the old active line when an automation script changes the selection but not active line 2014-04-16 08:11:38 -07:00
Thomas Goyne
162e119afa Make subs.delete accept a table of rows to delete
Lua has a limit to how many arguments can be pushed onto the stack, so
when deleting very large numbers of lines at once unpacking a table can
fail.
2014-04-16 08:11:38 -07:00
Thomas Goyne
1d5292fdee Kill config.h and just force-include acconf.h in non-pch builds 2014-04-16 08:11:37 -07:00
Thomas Goyne
dcf1270fc4 Ensure boost.locale is initialized with a UTF-8 locale on OS X
This fixes the find/replace dialog stripping non-us-ascii characters
from the file.

See #1587 for the same issue on Windows.
2014-04-15 16:57:45 -07:00
Thomas Goyne
489eca221d Fix compilation with clang 2014-04-15 11:09:25 -07:00
Thomas Goyne
a141ef1264 Remove the never-actually-used BASE block type 2014-04-15 11:09:25 -07:00
Thomas Goyne
3528e49286 Make the duration field not completely wrong in frame mode 2014-04-15 11:09:25 -07:00
Thomas Goyne
780c93ed4d Make modifying multiple lines at once less brittle
Only count characters outside of override blocks for the relative
positions to do the edits on each line, which handles the case where the
lines have different lengths of stuff in override blocks but the same
text.
2014-04-15 06:19:12 -07:00
Thomas Goyne
7ed3fbade0 Eliminate some awful in/out arguments 2014-04-15 06:19:12 -07:00
Thomas Goyne
0e04794ffd Make the edit box buttons less dumb with multiple lines selected
Apply the modification at the cursor position to each selected line
rather than just setting all selected lines to the active line's text.
Still doesn't have good results in any nontrivial cases, but it's at
least sometimes useful.
2014-04-14 13:52:14 -07:00
Thomas Goyne
7fc78d40ab Switch from boost::ptr_vector to a vector of unique_ptr
ptr_vector hasn't been updated for C++11, so despite being specifically
designed to store pointers to objects it's less safe and not really any
easier to use than a regular vector of unique_ptrs
2014-04-14 13:52:14 -07:00
Thomas Goyne
f53d840520 Unbind the progress dialog's idle handler when it's unneeded 2014-04-06 09:57:01 -07:00
Thomas Goyne
3e4b6a725f Change both selection and active line in SetSelectionAndActive before announcing 2014-04-04 09:01:03 -07:00
Thomas Goyne
df762b5b99 Add a checked iterator_to() to AssFile
iterator_to requires that the object be in the list, which is sometimes
not the case when processing a commit which removed the active line or a
selected line. To handle this, add a checked version that returns
Events.end() when it is not in the list rather than crashing.
2014-04-04 09:01:02 -07:00
Thomas Goyne
9c4574ed34 Add a missing word to a help string 2014-04-04 09:01:02 -07:00
Thomas Goyne
54fa37c855 Fix compilation on linux
Closes tgoyne/aegisub#4.
2014-04-03 17:43:41 -07:00
Thomas Goyne
b8d67b3d8e Update row numbers after an order-changing commit 2014-04-01 09:19:30 -07:00
Thomas Goyne
caf5ac9cd7 Sort the audio display markers
This was accidentally removed in 5d3bc0d. Closes #1731.
2014-04-01 09:19:30 -07:00
Thomas Goyne
c59b9d59b8 Clean up OptionValue
Make the vtables less absurdly huge (knocks 100KB off aegisub32.exe),
eliminate some copies of the values when constructing the options, and
use an enum class for the value type.
2014-03-31 10:23:36 -07:00
Thomas Goyne
fcd0df2e96 Preserve the old selection when an automation script doesn't return a new one 2014-03-31 08:11:43 -07:00
Thomas Goyne
3bbbc56053 Add the line's row number to AssDialogue
The grid needs to be able to map AssDialogue * to a row number, and just
storing it in the AssDialogue is nearly strictly better than a std::map
mapping events to rows. Probably will be of use elsewhere as well.
2014-03-31 08:11:43 -07:00
Thomas Goyne
84c5eb25b3 Actually check lines other than the active line in the spellchecker dialog 2014-03-31 08:11:43 -07:00
Thomas Goyne
dbec5ff0bc Fix out-of-bounds read when looking for subtitles in a matroska file with no subtitles 2014-03-28 09:15:09 -07:00
Thomas Goyne
4a46f09d31 Force the final progress of operations to 100%. Closes #1728. 2014-03-27 19:17:24 -07:00
Thomas Goyne
f07a2559b8 Update the grid scrollbar after dialogue count changes 2014-03-27 18:49:16 -07:00