From c0edbb271064a3add6ee66ad8b2cea38a8d69058 Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Wed, 9 Nov 2022 09:36:32 +0100 Subject: [PATCH 1/4] Fix syntax highlighting with empty clip --- libaegisub/ass/dialogue_parser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libaegisub/ass/dialogue_parser.cpp b/libaegisub/ass/dialogue_parser.cpp index 8cd1743e7..cb88f3e4c 100644 --- a/libaegisub/ass/dialogue_parser.cpp +++ b/libaegisub/ass/dialogue_parser.cpp @@ -259,7 +259,7 @@ void MarkDrawings(std::string const& str, std::vector &tokens) { goto tag_p; if (!drawing_start) drawing_start = i + 2; - if (drawing_end == drawing_start + 1) + if (drawing_end == drawing_start) goto tag_p; // We found a clip between drawing_start and drawing_end. Now, join From 3b7cb30e1f9a2058e400c79ca634b8fa3f2d6de4 Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Wed, 30 Nov 2022 22:35:27 +0100 Subject: [PATCH 2/4] Raise size limit of dummy video in config dialog This is to facilitate some tricks with tracing rendered subtitles in programs like GIMP with higher accuracy. Use at your own risk. --- src/dialog_dummy_video.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dialog_dummy_video.cpp b/src/dialog_dummy_video.cpp index d6e61b6d6..9792fe5ab 100644 --- a/src/dialog_dummy_video.cpp +++ b/src/dialog_dummy_video.cpp @@ -107,9 +107,9 @@ DialogDummyVideo::DialogDummyVideo(wxWindow *parent) d.SetIcon(GETICON(use_dummy_video_menu_16)); auto res_sizer = new wxBoxSizer(wxHORIZONTAL); - res_sizer->Add(spin_ctrl(&d, 1, 10000, &width), wxSizerFlags(1).Expand()); + res_sizer->Add(spin_ctrl(&d, 1, 100000, &width), wxSizerFlags(1).Expand()); res_sizer->Add(new wxStaticText(&d, -1, " x "), wxSizerFlags().Center()); - res_sizer->Add(spin_ctrl(&d, 1, 10000, &height), wxSizerFlags(1).Expand()); + res_sizer->Add(spin_ctrl(&d, 1, 100000, &height), wxSizerFlags(1).Expand()); auto color_sizer = new wxBoxSizer(wxHORIZONTAL); auto color_btn = new ColourButton(&d, wxSize(30, 17), false, color); From 74b9353038d21b091c7e0d344e042eafb6f2a592 Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Wed, 30 Nov 2022 22:40:16 +0100 Subject: [PATCH 3/4] Allow higher decimal precision in style editor Also, allow negative fsp. This doesn't change the behaviour of the SpinCtrl increment/decrement buttons, just the precision that can manually be set. Small values of fsp can be useful as a hack to disable all ligatures. Precise values of fscx/fscy can be useful to compensate for anamorphic resolutions. The other fields were made more precise for consistency. --- src/dialog_style_editor.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/dialog_style_editor.cpp b/src/dialog_style_editor.cpp index b186e5fd7..03c7629fe 100644 --- a/src/dialog_style_editor.cpp +++ b/src/dialog_style_editor.cpp @@ -149,9 +149,10 @@ DialogStyleEditor::DialogStyleEditor(wxWindow *parent, AssStyle *style, agi::Con sizer->Add(ctrl, wxSizerFlags(1).Left().Expand()); }; - auto num_text_ctrl = [&](double *value, double min, double max, double step) -> wxSpinCtrlDouble * { + auto num_text_ctrl = [&](double *value, double min, double max, double step, int precision) -> wxSpinCtrlDouble * { auto scd = new wxSpinCtrlDouble(this, -1, "", wxDefaultPosition, wxSize(75, -1), wxSP_ARROW_KEYS, min, max, *value, step); + scd->SetDigits(precision); scd->SetValidator(DoubleSpinValidator(value)); scd->Bind(wxEVT_SPINCTRLDOUBLE, [=](wxSpinDoubleEvent &evt) { evt.Skip(); @@ -186,7 +187,7 @@ DialogStyleEditor::DialogStyleEditor(wxWindow *parent, AssStyle *style, agi::Con // Create controls StyleName = new wxTextCtrl(this, -1, to_wx(style->name)); FontName = new wxComboBox(this, -1, to_wx(style->font), wxDefaultPosition, wxSize(150, -1), 0, nullptr, wxCB_DROPDOWN); - auto FontSize = num_text_ctrl(&work->fontsize, 0, 10000.0, 1.0); + auto FontSize = num_text_ctrl(&work->fontsize, 0, 10000.0, 1.0, 0); BoxBold = new wxCheckBox(this, -1, _("&Bold")); BoxItalic = new wxCheckBox(this, -1, _("&Italic")); BoxUnderline = new wxCheckBox(this, -1, _("&Underline")); @@ -203,13 +204,13 @@ DialogStyleEditor::DialogStyleEditor(wxWindow *parent, AssStyle *style, agi::Con wxSP_ARROW_KEYS, -9999, 99999, style->Margin[i]); Alignment = new wxRadioBox(this, -1, _("Alignment"), wxDefaultPosition, wxDefaultSize, 9, alignValues, 3, wxRA_SPECIFY_COLS); - auto Outline = num_text_ctrl(&work->outline_w, 0.0, 1000.0, 0.1); - auto Shadow = num_text_ctrl(&work->shadow_w, 0.0, 1000.0, 0.1); + auto Outline = num_text_ctrl(&work->outline_w, 0.0, 1000.0, 0.1, 2); + auto Shadow = num_text_ctrl(&work->shadow_w, 0.0, 1000.0, 0.1, 2); OutlineType = new wxCheckBox(this, -1, _("&Opaque box")); - auto ScaleX = num_text_ctrl(&work->scalex, 0.0, 10000.0, 1.0); - auto ScaleY = num_text_ctrl(&work->scaley, 0.0, 10000.0, 1.0); - auto Angle = num_text_ctrl(&work->angle, -360.0, 360.0, 1.0); - auto Spacing = num_text_ctrl(&work->spacing, 0.0, 1000.0, 0.1); + auto ScaleX = num_text_ctrl(&work->scalex, 0.0, 10000.0, 1, 2); + auto ScaleY = num_text_ctrl(&work->scaley, 0.0, 10000.0, 1, 2); + auto Angle = num_text_ctrl(&work->angle, -360.0, 360.0, 1.0, 2); + auto Spacing = num_text_ctrl(&work->spacing, -1000.0, 1000.0, 0.1, 3); Encoding = new wxComboBox(this, -1, "", wxDefaultPosition, wxDefaultSize, encodingStrings, wxCB_READONLY); // Set control tooltips From c0f337a992d0cbd16e2a382c6b69c2bd9d68ef99 Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Mon, 2 Jan 2023 02:30:25 +0100 Subject: [PATCH 4/4] Allow '+' and 'E' in numbers when tokenizing drawings --- libaegisub/ass/dialogue_parser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libaegisub/ass/dialogue_parser.cpp b/libaegisub/ass/dialogue_parser.cpp index cb88f3e4c..554395fa3 100644 --- a/libaegisub/ass/dialogue_parser.cpp +++ b/libaegisub/ass/dialogue_parser.cpp @@ -165,7 +165,7 @@ class WordSplitter { bool valid = true; for (size_t k = 0; k < tokens[j].length; k++) { char c = text[dpos + k]; - if (!((c >= '0' && c <= '9') || c == '.' || c == '-' || c == 'e')) { + if (!((c >= '0' && c <= '9') || c == '.' || c == '+' || c == '-' || c == 'e' || c == 'E')) { valid = false; } }