-
Notifications
You must be signed in to change notification settings - Fork 509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Miscellaneous bugfixes #186
Conversation
f38a360
to
64f26f6
Compare
Float edits with a spinner are sized to fit their full min-max range of possible values, so after wx stopped displaying large values in scientific notation, many float edits would be drawn far too wide. This commit makes min and max default to 0 and 100 (matching wx's defaults) instead of -DOUBLE_MAX and DOUBLE_MAX. Note that this does change the behavior of lua dialogs, but does not contradict existing documentation or specification. It should only affect scripts who either disobey the specification by specifying only one value out of max/min, or scripts displaying these large float edits by specifing a step, but no max or min.
These were giving false negatives on samba shares, which broke the font collector. Windows also recommends to not use access checks in these cases, and instead just see if the operations succeeds or not.
These alignment flags would cause an assertion error "Horizontal alignment flags are ignored in horizontal sizers" when opening the dialog (mainly when importing styles from another script). As the assertion error says, the flags are ignored anyway, so they're safe to remove.
64f26f6
to
49e3095
Compare
@@ -286,6 +286,10 @@ namespace Automation4 { | |||
max = DBL_MAX; | |||
min = -DBL_MAX; | |||
} | |||
if (step != 0.0) { | |||
min = min == -DBL_MAX ? 0.0 : min; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this impact any scripts that you know of seeing significant use? In particular, if it's anything we can fix preemptively in TSTools we should.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ones I know of are Aegisub-Motion (https://github.com/TypesettingTools/Aegisub-Motion/blob/9719ce019a33b2a27a0e874d944e2d476738a63f/Aegisub-Motion.moon#L97) and lyger's Blur Clip (https://github.com/TypesettingTools/lyger-Aegisub-Scripts/blob/caa697513ec22087faaa357cbc89231e7b2e94a3/macros/lyger.ClipBlur.lua#L283).
When cancelling an automation macro from the progress dialog, the dialog throws a UserCancelException. If the macro still runs to the end afterwards (instead of calling aegisub.cancel or causing an exception), the return values are left on the stack. This causes assertion errors due to check_stack when those are enabled.
To see how the previous implementation was faulty, see either the added tests, or - In Aegisub, open a dummy video with a frame rate of 23.976 - Make a subtitle event with start time 04:44.41 - Double-click the line to (supposedly) seek to its first frame - This will seek one frame earlier than it should, and the event will not be displayed on the resulting frame. The new formula is the mathematical inverse of the TimeAtFrame formula (for the EXACT case). The derivation is the following: FrameAtTime(ms, EXACT) should be the largest possible integer `frame` such that: ms >= floor(((frame - timecodes.size() + 1) * 1000 * denominator + last + floor(numerator / 2)) / numerator) where `/` denotes division of real numbers (i.e. without rounding down). The expression on the right is the formula used in TimeAtFrame. This inequality can be transformed as follows: ms >= floor(((frame - timecodes.size() + 1) * 1000 * denominator + last + floor(numerator / 2)) / numerator) ((frame - timecodes.size() + 1) * 1000 * denominator + last + floor(numerator / 2)) / numerator < ms + 1 (frame - timecodes.size() + 1) * 1000 * denominator + last + floor(numerator / 2) < (ms + 1) * numerator (frame - timecodes.size() + 1) * 1000 * denominator < (ms + 1) * numerator - last - floor(numerator / 2) frame - timecodes.size() + 1 < ((ms + 1) * numerator - last - floor(numerator / 2)) / (1000 * denominator) frame - timecodes.size() + 1 < ceil(((ms + 1) * numerator - last - floor(numerator / 2)) / (1000 * denominator)) frame - timecodes.size() + 1 < floor(((ms + 1) * numerator - last - floor(numerator / 2) + (1000 * denominator - 1)) / (1000 * denominator)) frame < floor(((ms + 1) * numerator - last - floor(numerator / 2) + (1000 * denominator - 1)) / (1000 * denominator)) + timecodes.size() - 1 frame <= floor(((ms + 1) * numerator - last - floor(numerator / 2) + (1000 * denominator - 1)) / (1000 * denominator)) + timecodes.size() - 2 Since we are looking for the largest integer `frame` satisfying this inequality, FrameAtTime(ms, EXACT) must be equal to the right-hand side in the last inequality.
The percent values used for the overscan masks follow the BBC's guidelines, as in https://en.wikipedia.org/wiki/Overscan#Overscan_amounts . However, these measure the per-side width as opposed to the total percentage of width/height being cut off. Thus, they should not be divided by two when drawing the mask.
This fixes a crash on Windows when double-clicking the draggable separator between the column headers "Command" and "Description" in the hotkey configuration dialog.
Fixes #168 Fixes arch1t3cht#15
... ever wondered why you can't drag .webm files into Aegisub? This is why.
It should not be in alt-dragging mode by default. Fix #32
wx doesn't seem to like the dialogs being created on some other worker thread, which makes file dialogs opened by lua scripts crash in various ways on Linux. Doing everything on the main thread hopefully fixes this. Fixes #51 .
Previously different menus may use conflict ids in range 10000~. Fix #53 See also Aegisub#131
These commands were revamped in 0ef9963 but the default hotkeys were never updated. The hotkeys were automatically migrated, but resetting the settings back to defaults would still set invalid settings.
msg can be nil, which would previously error out when trying to print it.
IsConversionSupported unconditionally calls iconv_close on the descriptor returned by iconv_open. This may result in crashes if iconv_open returns iconv_invalid.
4f66435
to
8760c3a
Compare
This would cause an assertion failure in functions like lua_for_each when the given closure throws an error and thus leaves some values on the stack. This can make Aegisub crash entirely instead of just catching and reporting the error. Instead, these stack_checks can be done manually.
Various bugfixes that accumulated at arch1t3cht/Aegisub. This one is a bit more involved but can again be checked commit for commit.