Skip to content

Commit

Permalink
CI-Build 2022-08-23
Browse files Browse the repository at this point in the history
  • Loading branch information
arch1t3cht committed Aug 23, 2022
2 parents ec23330 + bb16cdf commit 0dddddf
Show file tree
Hide file tree
Showing 15 changed files with 108 additions and 15 deletions.
6 changes: 6 additions & 0 deletions src/ass_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,12 @@ bool AssFile::CompEffect(AssDialogue const& lft, AssDialogue const& rgt) {
bool AssFile::CompLayer(AssDialogue const& lft, AssDialogue const& rgt) {
return lft.Layer < rgt.Layer;
}
bool AssFile::CompText(AssDialogue const& lft, AssDialogue const& rgt) {
return lft.Text < rgt.Text;
}
bool AssFile::CompTextStripped(AssDialogue const& lft, AssDialogue const& rgt) {
return lft.GetStrippedText() < rgt.GetStrippedText();
}

void AssFile::Sort(CompFunc comp, std::set<AssDialogue*> const& limit) {
Sort(Events, comp, limit);
Expand Down
4 changes: 4 additions & 0 deletions src/ass_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ class AssFile {
static bool CompEffect(AssDialogue const& lft, AssDialogue const& rgt);
/// Compare based on layer
static bool CompLayer(AssDialogue const& lft, AssDialogue const& rgt);
/// Compare based on text
static bool CompText(AssDialogue const& lft, AssDialogue const& rgt);
/// Compare based on stripped text
static bool CompTextStripped(AssDialogue const& lft, AssDialogue const& rgt);

/// @brief Sort the dialogue lines in this file
/// @param comp Comparison function to use. Defaults to sorting by start time.
Expand Down
Binary file modified 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 modified 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 modified 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 modified 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 modified 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.
12 changes: 12 additions & 0 deletions src/command/audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,17 @@ struct audio_open_video final : public Command {
}
};

struct audio_reload final : public Command {
CMD_NAME("audio/reload")
STR_MENU("Reload Audio")
STR_DISP("Reload Audio")
STR_HELP("Reload the current audio file")

void operator()(agi::Context *c) override {
c->project->ReloadAudio();
}
};

struct audio_view_spectrum final : public Command {
CMD_NAME("audio/view/spectrum")
STR_MENU("&Spectrum Display")
Expand Down Expand Up @@ -549,6 +560,7 @@ namespace cmd {
reg(agi::make_unique<audio_open_blank>());
reg(agi::make_unique<audio_open_noise>());
reg(agi::make_unique<audio_open_video>());
reg(agi::make_unique<audio_reload>());
reg(agi::make_unique<audio_play_after>());
reg(agi::make_unique<audio_play_before>());
reg(agi::make_unique<audio_play_begin>());
Expand Down
52 changes: 52 additions & 0 deletions src/command/grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,54 @@ struct grid_sort_style_selected final : public validate_sel_multiple {
}
};

struct grid_sort_text final : public Command {
CMD_NAME("grid/sort/text")
STR_MENU("Te&xt")
STR_DISP("Text")
STR_HELP("Sort all subtitles by their text, including styling tags")

void operator()(agi::Context *c) override {
c->ass->Sort(AssFile::CompText);
c->ass->Commit(_("sort"), AssFile::COMMIT_ORDER);
}
};

struct grid_sort_text_selected final : public validate_sel_multiple {
CMD_NAME("grid/sort/text/selected")
STR_MENU("Te&xt")
STR_DISP("Text")
STR_HELP("Sort selected subtitles by their text, including styling tags")

void operator()(agi::Context *c) override {
c->ass->Sort(AssFile::CompText, c->selectionController->GetSelectedSet());
c->ass->Commit(_("sort"), AssFile::COMMIT_ORDER);
}
};

struct grid_sort_text_stripped final : public Command {
CMD_NAME("grid/sort/text_stripped")
STR_MENU("Stri&pped Text")
STR_DISP("Stripped Text")
STR_HELP("Sort all subtitles by their stripped text")

void operator()(agi::Context *c) override {
c->ass->Sort(AssFile::CompTextStripped);
c->ass->Commit(_("sort"), AssFile::COMMIT_ORDER);
}
};

struct grid_sort_text_stripped_selected final : public validate_sel_multiple {
CMD_NAME("grid/sort/text_stripped/selected")
STR_MENU("Stri&pped Text")
STR_DISP("Stripped Text")
STR_HELP("Sort selected subtitles by their stripped text")

void operator()(agi::Context *c) override {
c->ass->Sort(AssFile::CompTextStripped, c->selectionController->GetSelectedSet());
c->ass->Commit(_("sort"), AssFile::COMMIT_ORDER);
}
};

struct grid_tag_cycle_hiding final : public Command {
CMD_NAME("grid/tag/cycle_hiding")
CMD_ICON(toggle_tag_hiding)
Expand Down Expand Up @@ -529,12 +577,16 @@ namespace cmd {
reg(agi::make_unique<grid_sort_layer>());
reg(agi::make_unique<grid_sort_start>());
reg(agi::make_unique<grid_sort_style>());
reg(agi::make_unique<grid_sort_text>());
reg(agi::make_unique<grid_sort_text_stripped>());
reg(agi::make_unique<grid_sort_actor_selected>());
reg(agi::make_unique<grid_sort_effect_selected>());
reg(agi::make_unique<grid_sort_end_selected>());
reg(agi::make_unique<grid_sort_layer_selected>());
reg(agi::make_unique<grid_sort_start_selected>());
reg(agi::make_unique<grid_sort_style_selected>());
reg(agi::make_unique<grid_sort_text_selected>());
reg(agi::make_unique<grid_sort_text_stripped_selected>());
reg(agi::make_unique<grid_move_down>());
reg(agi::make_unique<grid_move_up>());
reg(agi::make_unique<grid_swap>());
Expand Down
12 changes: 12 additions & 0 deletions src/command/video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,17 @@ struct video_open_dummy final : public Command {
}
};

struct video_reload final : public Command {
CMD_NAME("video/reload")
STR_MENU("Reload Video")
STR_DISP("Reload Video")
STR_HELP("Reload the current video file")

void operator()(agi::Context *c) override {
c->project->ReloadVideo();
}
};

struct video_opt_autoscroll final : public Command {
CMD_NAME("video/opt/autoscroll")
CMD_ICON(toggle_video_autoscroll)
Expand Down Expand Up @@ -823,6 +834,7 @@ namespace cmd {
reg(agi::make_unique<video_jump_start>());
reg(agi::make_unique<video_open>());
reg(agi::make_unique<video_open_dummy>());
reg(agi::make_unique<video_reload>());
reg(agi::make_unique<video_opt_autoscroll>());
reg(agi::make_unique<video_pan_reset>());
reg(agi::make_unique<video_play>());
Expand Down
4 changes: 4 additions & 0 deletions src/libresrc/default_menu.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@
{ "command" : "grid/sort/style" },
{ "command" : "grid/sort/actor" },
{ "command" : "grid/sort/effect" },
{ "command" : "grid/sort/text" },
{ "command" : "grid/sort/text_stripped" },
{ "command" : "grid/sort/layer" }
],
"main/subtitle/sort selected lines" : [
Expand All @@ -125,6 +127,8 @@
{ "command" : "grid/sort/style/selected" },
{ "command" : "grid/sort/actor/selected" },
{ "command" : "grid/sort/effect/selected" },
{ "command" : "grid/sort/text/selected" },
{ "command" : "grid/sort/text_stripped/selected" },
{ "command" : "grid/sort/layer/selected" }
],
"main/timing" : [
Expand Down
4 changes: 4 additions & 0 deletions src/libresrc/osx/default_menu.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@
{ "command" : "grid/sort/style" },
{ "command" : "grid/sort/actor" },
{ "command" : "grid/sort/effect" },
{ "command" : "grid/sort/text" },
{ "command" : "grid/sort/text_stripped" },
{ "command" : "grid/sort/layer" }
],
"main/subtitle/sort selected lines" : [
Expand All @@ -127,6 +129,8 @@
{ "command" : "grid/sort/style/selected" },
{ "command" : "grid/sort/actor/selected" },
{ "command" : "grid/sort/effect/selected" },
{ "command" : "grid/sort/text/selected" },
{ "command" : "grid/sort/text_stripped/selected" },
{ "command" : "grid/sort/layer/selected" }
],
"main/timing" : [
Expand Down
4 changes: 2 additions & 2 deletions src/project.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ class Project {

void LoadUnloadFiles(ProjectProperties properties);
void UpdateRelativePaths();
void ReloadAudio();
void ReloadVideo();

void SetPath(agi::fs::path& var, const char *token, const char *mru, agi::fs::path const& value);

Expand All @@ -74,11 +72,13 @@ class Project {
bool CanLoadSubtitlesFromVideo() const { return video_has_subtitles; }

void LoadAudio(agi::fs::path path);
void ReloadAudio();
void CloseAudio();
agi::AudioProvider *AudioProvider() const { return audio_provider.get(); }
agi::fs::path const& AudioName() const { return audio_file; }

void LoadVideo(agi::fs::path path);
void ReloadVideo();
void CloseVideo();
AsyncVideoProvider *VideoProvider() const { return video_provider.get(); }
agi::fs::path const& VideoName() const { return video_file; }
Expand Down
23 changes: 11 additions & 12 deletions src/subtitle_format_ass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,21 +108,20 @@ struct Writer {
WriteIfNotZero("Scroll Position: ", properties.scroll_position);
WriteIfNotZero("Active Line: ", properties.active_row);
WriteIfNotZero("Video Position: ", properties.video_position);
}

std::string foldsdata;
for (LineFold fold : properties.folds) {
if (!foldsdata.empty()) {
foldsdata += ",";
}
foldsdata += std::to_string(fold.start);
foldsdata += ":";
foldsdata += std::to_string(fold.end);
foldsdata += ":";
foldsdata += fold.collapsed ? "1" : "0";
std::string foldsdata;
for (LineFold fold : properties.folds) {
if (!foldsdata.empty()) {
foldsdata += ",";
}

WriteIfNotEmpty("Line Folds: ", foldsdata);
foldsdata += std::to_string(fold.start);
foldsdata += ":";
foldsdata += std::to_string(fold.end);
foldsdata += ":";
foldsdata += fold.collapsed ? "1" : "0";
}
WriteIfNotEmpty("Line Folds: ", foldsdata);
}

void WriteIfNotEmpty(const char *key, std::string const& value) {
Expand Down
2 changes: 1 addition & 1 deletion src/video_provider_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace {
{"Avisynth", CreateAvisynthVideoProvider, false},
#endif
#ifdef WITH_BESTSOURCE
{"BestSource", CreateBSVideoProvider, false},
{"BestSource (SLOW)", CreateBSVideoProvider, false},
#endif
#ifdef WITH_VAPOURSYNTH
{"Vapoursynth", CreateVapoursynthVideoProvider, false},
Expand Down

0 comments on commit 0dddddf

Please sign in to comment.