Skip to content

Commit

Permalink
CI-Build 2022-08-01
Browse files Browse the repository at this point in the history
  • Loading branch information
arch1t3cht committed Aug 1, 2022
2 parents d0c8ffd + e849397 commit 4e8c02d
Show file tree
Hide file tree
Showing 28 changed files with 1,300 additions and 11 deletions.
541 changes: 541 additions & 0 deletions CMakeLists.txt

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ The `cibuilds` branch makes some CI builds of snapshots of `feature` at relevant

### Branch/Feature list
- [`folding`](https://github.com/arch1t3cht/Aegisub/tree/folding): Add the ability to visually group and collapse lines in the subtitle grid
- [`lua_api`](https://github.com/arch1t3cht/Aegisub/tree/lua_api): Add new functions to the Lua automation API, like controlling the selection or cursor in the text edit box
- [`vector_clip_actions`](https://github.com/arch1t3cht/Aegisub/tree/vector_clip_actions): Make the different modes of the vector clip tool (lines, bezier curves, adding points, etc) bindable to hotkeys
- [`color_picker_fix2`](https://github.com/arch1t3cht/Aegisub/tree/color_picker_fix2): Add an option (under "Interface") to restrict the color picker to the window, which fixes the color picker on Linux in a lot of cases.
- [`avisynth`](https://github.com/arch1t3cht/Aegisub/tree/avisynth): Reenable Avisynth support on Windows (Still occasionally crashes)
- [`bugfixes`](https://github.com/arch1t3cht/Aegisub/tree/bugfixes): Various fixes, mostly relevant for compilation
- [`misc_dc`](https://github.com/arch1t3cht/Aegisub/tree/misc_dc): Miscellaneous changes taken from AegisubDC
- [`video_panning_feature`](https://github.com/arch1t3cht/Aegisub/tree/video_panning_feature): Merge [moex3's video zoom and panning](https://github.com/TypesettingTools/Aegisub/pull/150), with an OSX fix and an option to toggle the behavior of Ctrl+Zoom
- [`video_panning_feature`](https://github.com/arch1t3cht/Aegisub/tree/video_panning_feature): Merge [moex3's video zoom and panning](https://github.com/TypesettingTools/Aegisub/pull/150), with an OSX fix and more options to control zoom behavior
- [`spectrum-frequency-mapping`](https://github.com/arch1t3cht/Aegisub/tree/spectrum-frequency-mapping): Merge EleonoreMizo's [spectrum display improvements](https://github.com/TypesettingTools/Aegisub/pull/94), and also make Shift+Scroll vertically zoom the audio display
- [`wangqr_time_video`](https://github.com/arch1t3cht/Aegisub/tree/wangqr_time_video): Merge wangqr's feature adding a tool for timing subtitles to changes in the video

### Troubleshooting
#### Building fails with a "CMake sandbox violation"
Expand All @@ -43,6 +45,9 @@ The changes to `default_config.json` or similar files weren't detected by meson
#### The video is desynced / Frames don't appear at the right time
This is probably due to the ffms2 seeking bug ([#394](https://github.com/FFMS/ffms2/issues/394)). On Windows, this shouldn't happen anymore. On Linux, you need to install the latest git version of ffms2 - for example the [`ffms2-git`](https://aur.archlinux.org/packages/ffms2-git) AUR package on Arch linux, or just compile it yourself.

#### On Windows: Aegisub crashes whenever I open a video
If you're compiling yourself, try adding `--force-fallback-for=zlib` to the meson options.


# Aegisub

Expand Down
57 changes: 57 additions & 0 deletions automation/v4-docs/gui.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
Automation 4 Gui Functions

This document describes the available Automation 4 functions for
controlling the editor's graphical interface. These all reside in the
table aegisub.gui .

---

Getting and setting the selection and cursor in the text edit box

This set of functions controls the selection in the text edit box.
All indices are counted starting from 1, following Lua conventions.
The setter functions are applied after all subtitle changes have been
applied. Only the latest update is applied.
The getter functions return the state after the latest update by
the setter functions, or the original state if there were none.


function aegisub.gui.get_cursor()

Returns: 1 number
1. The position of the cursor in the text edit field.

---

function aegisub.get_selection()

Returns: 2 values, all numbers.
1. Starting position of the selection.
2. Ending position of the selection, always larger or equal
than the stating position.

---

function aegisub.gui.set_cursor(position)

@position (number)
The new position of the cursor.

Returns: 0 values

---

function aegisub.gui.set_selection(start, end)

@start (number)
The new start of the selection.

@end (number)
The new end of the selection, i.e. where the cursor will be.
Can be smaller than the start, in which case the cursor will
be on the left side of the selection.

Returns: 0 values

---

42 changes: 42 additions & 0 deletions src/auto4_lua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#include "selection_controller.h"
#include "subs_controller.h"
#include "video_controller.h"
#include "text_selection_controller.h"
#include "utils.h"

#include <libaegisub/dispatch.h>
Expand Down Expand Up @@ -285,6 +286,39 @@ namespace {
return 0;
}

int lua_get_text_cursor(lua_State *L)
{
push_value(L, get_context(L)->textSelectionController->GetStagedInsertionPoint() + 1);
return 1;
}

int lua_set_text_cursor(lua_State *L)
{
int point = lua_tointeger(L, -1) - 1;
lua_pop(L, 1);
get_context(L)->textSelectionController->StageSetInsertionPoint(point);
return 0;
}

int lua_get_text_selection(lua_State *L)
{
const agi::Context *c = get_context(L);
int start = c->textSelectionController->GetStagedSelectionStart() + 1;
int end = c->textSelectionController->GetStagedSelectionEnd() + 1;
push_value(L, start <= end ? start : end);
push_value(L, start <= end ? end : start);
return 2;
}

int lua_set_text_selection(lua_State *L)
{
int start = lua_tointeger(L, -2) - 1;
int end = lua_tointeger(L, -1) - 1;
lua_pop(L, 2);
get_context(L)->textSelectionController->StageSetSelection(start, end);
return 0;
}

int project_properties(lua_State *L)
{
const agi::Context *c = get_context(L);
Expand Down Expand Up @@ -489,6 +523,12 @@ namespace {
set_field<project_properties>(L, "project_properties");
set_field<lua_get_audio_selection>(L, "get_audio_selection");
set_field<lua_set_status_text>(L, "set_status_text");
lua_createtable(L, 0, 4);
set_field<lua_get_text_cursor>(L, "get_cursor");
set_field<lua_set_text_cursor>(L, "set_cursor");
set_field<lua_get_text_selection>(L, "get_selection");
set_field<lua_set_text_selection>(L, "set_selection");
lua_setfield(L, -2, "gui");

// store aegisub table to globals
lua_settable(L, LUA_GLOBALSINDEX);
Expand Down Expand Up @@ -786,6 +826,7 @@ namespace {

void LuaCommand::operator()(agi::Context *c)
{
c->textSelectionController->DropStagedChanges();
LuaStackcheck stackcheck(L);
set_context(L, c);
stackcheck.check_stack(0);
Expand Down Expand Up @@ -883,6 +924,7 @@ namespace {
new_active = *new_sel.begin();
c->selectionController->SetSelectionAndActive(std::move(new_sel), new_active);
}
c->textSelectionController->CommitStagedChanges();

stackcheck.check_stack(0);
}
Expand Down
14 changes: 11 additions & 3 deletions src/auto4_lua_assfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,19 @@ namespace {
}

template<typename T>
void get_userdata_field(lua_State *L, const char *name, const char *line_class, T *target)
bool get_userdata_field(lua_State *L, const char *name, const char *line_class, T *target, bool required)
{
lua_getfield(L, -1, name);
if (!lua_isuserdata(L, -1))
if (!lua_isuserdata(L, -1)) {
if (!required) {
lua_pop(L, 1);
return false;
}
throw bad_field("userdata", name, line_class);
}
*target = *static_cast<T *>(lua_touserdata(L, -1));
lua_pop(L, 1);
return true;
}

using namespace Automation4;
Expand Down Expand Up @@ -316,7 +322,9 @@ namespace Automation4 {
dia->Margin[2] = get_int_field(L, "margin_t", "dialogue");
dia->Effect = get_string_field(L, "effect", "dialogue");
dia->Text = get_string_field(L, "text", "dialogue");
get_userdata_field(L, "_foldinfo", "dialogue", &dia->Fold);
if (!get_userdata_field(L, "_foldinfo", "dialogue", &dia->Fold, false)) {
dia->Fold = FoldInfo();
}

std::vector<uint32_t> new_ids;

Expand Down
Binary file added src/bitmaps/button/button_align_16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/bitmaps/button/button_align_24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/bitmaps/button/button_align_32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/bitmaps/button/button_align_48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/bitmaps/button/button_align_64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/bitmaps/manifest.respack
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ button/bugtracker_button_24.png
button/bugtracker_button_32.png
button/bugtracker_button_48.png
button/bugtracker_button_64.png
button/button_align_16.png
button/button_align_24.png
button/button_align_32.png
button/button_align_48.png
button/button_align_64.png
button/button_audio_commit_16.png
button/button_audio_commit_24.png
button/button_audio_commit_32.png
Expand Down
6 changes: 6 additions & 0 deletions src/colour_button.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ class ColourButton: public wxButton {

/// Get the currently selected color
agi::Color GetColor() { return colour; }

void SetColor(agi::Color color)
{
colour = color;
UpdateBitmap();
}
};

struct ColorValidator final : public wxValidator {
Expand Down
13 changes: 13 additions & 0 deletions src/command/time.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,18 @@ struct time_snap_scene final : public validate_video_loaded {
}
};

struct time_align_subtitle_to_point final : public validate_video_loaded {
CMD_NAME("time/align")
CMD_ICON(button_align)
STR_MENU("Align subtitle to video")
STR_DISP("Align subtitle to video")
STR_HELP("Align subtitle to video by key points")
void operator()(agi::Context* c) override {
c->videoController->Stop();
ShowAlignToVideoDialog(c);
}
};

struct time_add_lead_both final : public Command {
CMD_NAME("time/lead/both")
STR_MENU("Add lead in and out")
Expand Down Expand Up @@ -393,6 +405,7 @@ namespace cmd {
reg(agi::make_unique<time_snap_end_video>());
reg(agi::make_unique<time_snap_scene>());
reg(agi::make_unique<time_snap_start_video>());
reg(agi::make_unique<time_align_subtitle_to_point>());
reg(agi::make_unique<time_start_decrease>());
reg(agi::make_unique<time_start_increase>());
}
Expand Down
Loading

0 comments on commit 4e8c02d

Please sign in to comment.