Commit graph

204 commits

Author SHA1 Message Date
Thomas Goyne
983ffc1e83 Add some dumb heuristics to detect binary files in the charset detector to avoid taking forever feeding hundreds of MB through it. Closes #1438.
Originally committed to SVN as r6405.
2012-01-31 04:03:55 +00:00
Thomas Goyne
d68a395499 Open files in binary mode for charset detection
Originally committed to SVN as r6404.
2012-01-31 04:03:50 +00:00
Thomas Goyne
a4eb7ef528 Fix crash with empty hotkeys. Closes #1420.
Originally committed to SVN as r6360.
2012-01-25 19:07:18 +00:00
Thomas Goyne
46986c6944 Fix new[]/delete mismatch
Originally committed to SVN as r6306.
2012-01-18 20:08:24 +00:00
Thomas Goyne
7dd6cfe37d Derive agi::acs exceptions from agi::FileSystemError and friends rather than having two sets of errors for the same thing
Originally committed to SVN as r6278.
2012-01-12 22:31:54 +00:00
Thomas Goyne
3c62a38c7a Replace MyThes thesaurus implementation with a custom one
Fixes a pile of unicode-related issues, such as dictionaries in a path
which does not fit into the system's local charset, and significantly
cuts down on the amount of code.

Originally committed to SVN as r6250.
2012-01-08 01:36:50 +00:00
Thomas Goyne
e2d31b708e Split the json log writing into a seperate class from LogSink
Originally committed to SVN as r6248.
2012-01-08 01:36:23 +00:00
Thomas Goyne
d148bbbf2a Make agi::log::LogSink take ownership of the emitters passed to it
Originally committed to SVN as r6246.
2012-01-08 01:36:09 +00:00
Thomas Goyne
d2d28401bd Change how local config mode works
Rather than loading both the local and user config files and saving to
the local directory if an option is set, simply try to load the local
config file, and if it exists switch to local mode and never even touch
the user file.

Originally committed to SVN as r6244.
2012-01-08 01:35:56 +00:00
Thomas Goyne
84d1315736 Write the config and MRU files to ?data in portable mode rather than ?user
Originally committed to SVN as r6187.
2011-12-30 01:21:03 +00:00
Thomas Goyne
cae10121ed Fix a bunch of -pedantic stuff
Originally committed to SVN as r6181.
2011-12-28 21:27:06 +00:00
Thomas Goyne
7adbe07b4e Silence a bunch of PREFast warnings
Originally committed to SVN as r6162.
2011-12-26 22:20:49 +00:00
Thomas Goyne
1fbf2ef218 Remove pointless operator=, copy constructor and destructor from agi::vfr::Framerate
Originally committed to SVN as r6120.
2011-12-22 21:28:23 +00:00
Thomas Goyne
93ce90cbf9 Store a numerator and denominator in agi::vfr::Framerate rather than a fps. Fixes minor rounding issues with 24000/1001 and 30000/1001 frame rates.
Originally committed to SVN as r6115.
2011-12-22 21:27:35 +00:00
Thomas Goyne
fe090969f4 Actually use the value from the "Always" context in Hotkey::GetHotkey
Originally committed to SVN as r6113.
2011-12-22 21:27:17 +00:00
Thomas Goyne
7bb749b51f Return the name of the command found or an empty string if none from Hotkey::Scan rather than using an out reference
Originally committed to SVN as r6112.
2011-12-22 21:27:06 +00:00
Thomas Goyne
022c711409 Clear the command output variable when a hotkey fails to match to be safe
Originally committed to SVN as r6111.
2011-12-22 21:26:57 +00:00
Thomas Goyne
48526bf341 Delete libmedia
It's nowhere close to working and just getting further away from working
as time goes on.

Originally committed to SVN as r6096.
2011-12-22 21:24:20 +00:00
Thomas Goyne
863e7070a6 Add a bunch of missing config.h includes
Originally committed to SVN as r6072.
2011-12-22 21:20:44 +00:00
Thomas Goyne
b29606759a Only include character encodings actually supported by the iconv implementation used in the list returned from GetEncodingsList
Originally committed to SVN as r6026.
2011-12-22 21:13:39 +00:00
Thomas Goyne
61b1741376 Remove all the json::Reader::Read overloads, as we never actually use them
Originally committed to SVN as r6021.
2011-12-22 21:12:55 +00:00
Thomas Goyne
ba1d1596de Eliminate a pile of duplicated code in elements.cpp
Originally committed to SVN as r6020.
2011-12-22 21:12:46 +00:00
Thomas Goyne
07da6f6f1b Split json::Number into json::Double and json::Integer
Trying to decide whether an option should be an int or double after
discarding the differences between "1.0" and "1" simply isn't possible,
and even if an option was initialized correctly, if it was changed to a
round number it could get written as an int and break later.

Also convert cajun to tabs because three spaces to indent is terrible.

Originally committed to SVN as r6018.
2011-12-22 21:12:25 +00:00
Thomas Goyne
daff67b150 Simply log errors and continue when type errors occur while loading the user config file, rather than only loading the portion of the file before the error
Originally committed to SVN as r6017.
2011-12-22 21:12:15 +00:00
Thomas Goyne
d7ae51a5af Remove some unused members of agi::Options
Originally committed to SVN as r6016.
2011-12-22 21:12:06 +00:00
Thomas Goyne
4c3d191de8 Significantly simplify agi::Options::PutOption
Originally committed to SVN as r6014.
2011-12-22 21:11:46 +00:00
Thomas Goyne
56165305a4 Change the check for duplicate keys when writing the options file to an assertion as it can't actually happen
Originally committed to SVN as r6013.
2011-12-22 21:11:38 +00:00
Thomas Goyne
ef3414931f Fix off-by-one error in MRU::GetEntry
Originally committed to SVN as r6009.
2011-12-22 21:11:01 +00:00
Thomas Goyne
d0ee3029de Make the MRU tests significantly less worthless
Originally committed to SVN as r6008.
2011-12-22 21:10:50 +00:00
Thomas Goyne
522e634122 Simplify some uses of cajun types and eliminate some copies
Originally committed to SVN as r6007.
2011-12-22 21:10:41 +00:00
Thomas Goyne
9cbaa01e63 Update and significantly expand the cajun tests
Originally committed to SVN as r6006.
2011-12-22 21:10:32 +00:00
Thomas Goyne
3097dc634e Only automatically convert json objects to other types when they are uninitialized
Originally committed to SVN as r6005.
2011-12-22 21:10:22 +00:00
Thomas Goyne
a78417177a Move cajun implementations from .inl files included by the headers to .cpp files
Originally committed to SVN as r6004.
2011-12-22 21:10:10 +00:00
Thomas Goyne
dfc68a4db9 Make the int/double option type detection slightly less broken
Choosing between int and double based on whether the default value is an
int is dumb and broken enough, but with the "ceil" the detection didn't
even work for negative numbers.

Originally committed to SVN as r5937.
2011-11-29 23:18:34 +00:00
Thomas Goyne
893ec95841 Don't load the FPS from Aegisub keyframes. The format breaks vfr and setting the fps should be done with timecode files.
Originally committed to SVN as r5900.
2011-11-20 17:35:00 +00:00
Thomas Goyne
1073b3f7f0 Remove bogus (and pointless) initialization in the glibc iconv-backed converter
Originally committed to SVN as r5833.
2011-11-08 03:44:46 +00:00
Thomas Goyne
2f394a7792 Fix compilation with clang (but not linking because wxAny is currently broken with it)
Originally committed to SVN as r5826.
2011-11-07 06:18:34 +00:00
Thomas Goyne
5176ae4407 Flush hotkeys after they're modified
Originally committed to SVN as r5821.
2011-11-06 17:18:08 +00:00
Thomas Goyne
092ecafe58 Make ConfigVisitor::AddOptionValue less dumb
Originally committed to SVN as r5818.
2011-11-04 19:42:50 +00:00
Thomas Goyne
8fcd3daf28 Rewrite the array config visitor so that it doesn't need the OptionValueList base class
Originally committed to SVN as r5817.
2011-11-04 19:42:40 +00:00
Thomas Goyne
84c545b978 Return const references from OptionValue::GetList* rather than taking an output parameter. Eliminates some copies of lists and makes the calling code less awkward.
Originally committed to SVN as r5816.
2011-11-04 19:42:31 +00:00
Thomas Goyne
ba2794b2fe Replace some const strings with const references to strings
Originally committed to SVN as r5815.
2011-11-04 19:42:21 +00:00
Thomas Goyne
6c995e7780 Add support for modifying hotkeys while the program is running
Originally committed to SVN as r5793.
2011-10-28 20:40:32 +00:00
Thomas Goyne
ffa622d698 Fix compilation without precompiled headers
Originally committed to SVN as r5791.
2011-10-28 20:15:10 +00:00
Thomas Goyne
dd46c7af7f Completely ditch json::Array and json::Object's custom implementations and switch to typedefs to STL types.
Originally committed to SVN as r5752.
2011-10-17 22:00:38 +00:00
Thomas Goyne
4e8848c110 Eliminate a bunch of now unneccesary explicit casts to/from json types
Originally committed to SVN as r5751.
2011-10-17 22:00:28 +00:00
Thomas Goyne
0dee6ea223 Add some convenience overloads to UnknownElement's constructor
Originally committed to SVN as r5749.
2011-10-17 22:00:09 +00:00
Thomas Goyne
36280b7a2b Kill TrivialType_T as it's completely pointless
Originally committed to SVN as r5748.
2011-10-17 21:59:59 +00:00
Thomas Goyne
9dc9047c11 Change json::Object's backing store from a list to a map. Cajun used list to preserve order, but json objects do not guarantee that order will be preserved
Originally committed to SVN as r5747.
2011-10-17 21:59:47 +00:00
Thomas Goyne
2f64a116a7 Make cajun containers implement the STL container interfaces rather than being retarded special snowflakes
Originally committed to SVN as r5746.
2011-10-17 21:59:35 +00:00
Thomas Goyne
91ab2ee9ba Make option names not dumb and wrong
Originally committed to SVN as r5731.
2011-10-11 00:06:34 +00:00
Thomas Goyne
34a7f16214 Skip over invalid entries in the MRU file rather than crashing on startup
Originally committed to SVN as r5670.
2011-09-29 00:37:18 +00:00
Thomas Goyne
6a49b5392d Write MRU data to disk whenever a change is made rather than only on program exit
Originally committed to SVN as r5667.
2011-09-28 19:52:46 +00:00
Thomas Goyne
a25c5c1909 Rewrite the subtitles edit control's syntax highlighting
Simplify and clean up the parsing code to better represent how VSFilter
actually handles many odd edge cases as well as making it significantly
faster.

Use an enum for syntax style IDs rather than magic numbers.

Add styles for comments, draw mode and karaoke templater variables
rather than reusing other styles and move some hardcoded style
information to the config file.

Operate on the utf-8 representation of the edit box text rather than a
wxString, as it's both faster and simpler.

Originally committed to SVN as r5615.
2011-09-28 19:44:34 +00:00
Thomas Goyne
0c1794a93f Don't silently fail to start up if a config file is invalid
Originally committed to SVN as r5535.
2011-08-17 05:32:09 +00:00
Thomas Goyne
3c18ed542c Clean up libaegisub includes
Consistently use the C++ names for headers rather than a combination of the
C and C++ names.

Remove empty LAGI_PRE blocks.

Remove checks for both AGI_PRE and LAGI_PRE and change a check for only
AGI_PRE to LAGI_PRE.

Originally committed to SVN as r5516.
2011-07-26 22:25:21 +00:00
Thomas Goyne
263d161d26 Don't pointlessly store a copy of the default hotkeys json in memory
Originally committed to SVN as r5510.
2011-07-26 20:26:09 +00:00
Thomas Goyne
af484a469d Make get_hotkey_str_first more likely to return the desired hotkey when multiple are available
Originally committed to SVN as r5508.
2011-07-26 19:52:57 +00:00
Thomas Goyne
dd38e1f07f Don't swallow errors when parsing json and make agi::json_util::file actually work
Originally committed to SVN as r5507.
2011-07-26 19:52:47 +00:00
Thomas Goyne
dabcdb2e8b Uninvert hotkey::Scan's return value
Originally committed to SVN as r5506.
2011-07-26 19:52:36 +00:00
Thomas Goyne
ffe8c7a5d6 Only enable the 'Always' hotkey context when medusa mode is on
Originally committed to SVN as r5505.
2011-07-26 19:52:25 +00:00
Thomas Goyne
7deebf759b Remove the concept of disabled hotkeys; it's unnessesary and wasn't actually used
Originally committed to SVN as r5504.
2011-07-26 19:52:15 +00:00
Thomas Goyne
87abcddd87 Make the MRU code not so bizzarely overcomplicated
Originally committed to SVN as r5502.
2011-07-26 19:51:56 +00:00
Thomas Goyne
7824348f10 Include the name of the option in the exception thrown when an option is not found
Originally committed to SVN as r5501.
2011-07-26 19:51:47 +00:00
Thomas Goyne
a33da9cba5 Replace all uses of std::cout in libaegisub with logging statements and eliminate a lot of nonsense in the windows implementation of acs::Check
Originally committed to SVN as r5500.
2011-07-26 19:51:38 +00:00
Thomas Goyne
64a3cc94ae Fix error checking in agi::util::strtoi
Originally committed to SVN as r5499.
2011-07-26 19:51:28 +00:00
Thomas Goyne
52e60f09dc Fix path to config.h in path.cpp
Originally committed to SVN as r5493.
2011-07-20 20:08:51 +00:00
Thomas Goyne
72bc33fda3 Fix compilation errors with precompiled headers disabled
Originally committed to SVN as r5484.
2011-07-16 06:42:55 +00:00
Thomas Goyne
c32e372dd4 Fix leak of the Options object in agi::Path and potential overwriting of the config file with an out of date version on shutdown
Originally committed to SVN as r5477.
2011-07-15 17:36:53 +00:00
Thomas Goyne
a8a30d6ac1 Fix hotkey memory leaks
Originally committed to SVN as r5472.
2011-07-15 17:36:06 +00:00
Thomas Goyne
b25066e3c3 Remove a write-only variable in option.cpp
Originally committed to SVN as r5453.
2011-07-15 04:04:42 +00:00
Thomas Goyne
6ec63cdde1 Clean up libaegisub includes
Remove cajun includes from all public headers and the precompiled header

Add a pile of missing standard library headers used in multiple files
to lagi_pre

Originally committed to SVN as r5452.
2011-07-15 04:04:34 +00:00
Thomas Goyne
67e9384ef4 Remove a bunch of pointless consts from agi::Path and rename the windows implementation so that it's actually used
Originally committed to SVN as r5442.
2011-07-15 04:03:28 +00:00
Amar Takhar
c53492edcd Remove <sys/param.h> and <sys/mount.h> from common/util.cpp this stems from my accident involving placing code meant for unix/util.cpp into unix/common.cpp which was partially fixed in r5366.
Originally committed to SVN as r5371.
2011-02-23 03:34:23 +00:00
Karl Blomster
7db22972a7 sys/mount.h and statfs(2) do not exist on windows
Originally committed to SVN as r5366.
2011-02-22 19:03:03 +00:00
Amar Takhar
8240d3e6b6 Add util::freespace to check for free space on a path. (with tests)
Originally committed to SVN as r5346.
2011-02-10 23:55:59 +00:00
Amar Takhar
2c6abb9a98 Instead of throwing return 0 for invalid values. This happens anyway if the input is invalid so it makes the most sense to return 0 for invalid ranges.
Originally committed to SVN as r5343.
2011-02-10 01:36:25 +00:00
Amar Takhar
3522c0b4bd Add a strtoi function. (with unit tests)
Originally committed to SVN as r5340.
2011-02-10 00:41:15 +00:00
Amar Takhar
75e07c7aa7 Add a short method to make an std::string lowercase.
Originally committed to SVN as r5335.
2011-02-09 22:31:44 +00:00
Niels Martin Hansen
7638375282 Get rid of a few unused variable warnings.
Originally committed to SVN as r5333.
2011-02-09 21:56:10 +00:00
Amar Takhar
961c1245f7 Remove const in path.cpp (missed in r5320)
Originally committed to SVN as r5321.
2011-02-08 03:53:34 +00:00
Amar Takhar
bf05289495 * Remove misplaced const on a void method.
* Forward declare Options to avoid including options.h in the header.

Originally committed to SVN as r5320.
2011-02-08 03:48:00 +00:00
Amar Takhar
a35962923f Finish agi::Path so we can actually use it, our current path system is brutal and I needed this for libmedia. I'll be adding OS X support shortly: someone else will have to figure out what to do with windows it's completely trivial see unix/path.cpp and check libaegisub/path.h for the return values.
Originally committed to SVN as r5315.
2011-02-07 16:39:49 +00:00
Amar Takhar
7b06c334aa Add missing headers and change StdioProgressSink() to use std::cout and friends.
Originally committed to SVN as r5314.
2011-02-07 00:46:49 +00:00
Amar Takhar
e27c3e15b8 Add several progress factories to handle progress bars. The GUI version will come from code within aegisub.
Originally committed to SVN as r5313.
2011-02-07 00:12:57 +00:00
Amar Takhar
73913fb0b8 Remove mutex.h from common/log.cpp until the windows build is fixed.
Originally committed to SVN as r5312.
2011-02-06 20:45:46 +00:00
Amar Takhar
bcafbe2083 Move ffms_* files over to media/
Originally committed to SVN as r5274.
2011-02-03 01:18:43 +00:00
Amar Takhar
f5308fe65b Move video_provider_ffmpegsource.(cpp|h) and change the license to fit the rest of libaegisub with permission of the current license holder (Karl Blomster)
Originally committed to SVN as r5272.
2011-02-03 01:17:15 +00:00
Amar Takhar
cddfe3ed20 Wrap code under the agi namespace.
Originally committed to SVN as r5271.
2011-02-02 23:23:48 +00:00
Amar Takhar
cacc3516c1 This should have gone into r5269: These files were re-licensed with permission of the original author. (Karl Blomster).
Originally committed to SVN as r5270.
2011-02-02 23:20:03 +00:00
Amar Takhar
1219b069b1 Copy audio_provider_ffmpegsource.(cpp|h) to ./ffms_audio.(cpp|h) and remove wx usage.. The plan is to move a/v support to libaegisub and write unit tests to make sure we can open/close/seek the "official" formats we want to support.
Originally committed to SVN as r5269.
2011-02-02 23:11:17 +00:00
Thomas Goyne
3f9bead41a Use the tr1 version of <tuple> when building with gcc
Originally committed to SVN as r5235.
2011-01-18 00:29:40 +00:00
Thomas Goyne
04a4c074b0 Add function to get the string representation of the hotkeys for a command, use it when generating the menu
Originally committed to SVN as r5230.
2011-01-17 23:53:46 +00:00
Thomas Goyne
cd4b032c25 Make agi::hotkey::Scan const
Originally committed to SVN as r5229.
2011-01-17 23:53:38 +00:00
Thomas Goyne
403d465475 Fix hotkeys with non-alphanumeric keys other than back, return, escape, space and delete
Originally committed to SVN as r5217.
2011-01-16 07:17:53 +00:00
Amar Takhar
c2a81a5dd7 Add a cast to make x64 build on windows happy.
Originally committed to SVN as r5155.
2011-01-09 02:49:49 +00:00
Niels Martin Hansen
a13e0ddedf Clear out some warnings emitted by Visual C++ 2010.
On 32 bit VC 2010, std::streamsize is 64 bit while size_t is 32 bit.

Originally committed to SVN as r5151.
2011-01-08 21:58:48 +00:00
Amar Takhar
319ac2d4bb Catch all exceptions when deciding whether to load the default config.
Originally committed to SVN as r5136.
2011-01-08 12:13:24 +00:00
Amar Takhar
0d7b2c6e76 Add missing headers when not using precompiled header support. Some minor formatting in libaegisub/common/hotkey.cpp.
Originally committed to SVN as r5135.
2011-01-08 12:10:40 +00:00
Thomas Goyne
e450cb3e7e Fix include paths
Originally committed to SVN as r5132.
2011-01-05 18:40:37 +00:00