Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
// Copyright (c) 2005-2010, Niels Martin Hansen
|
|
|
|
// Copyright (c) 2005-2010, Rodrigo Braz Monteiro
|
|
|
|
// Copyright (c) 2010, Amar Takhar
|
|
|
|
// All rights reserved.
|
|
|
|
//
|
|
|
|
// Redistribution and use in source and binary forms, with or without
|
|
|
|
// modification, are permitted provided that the following conditions are met:
|
|
|
|
//
|
|
|
|
// * Redistributions of source code must retain the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer.
|
|
|
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer in the documentation
|
|
|
|
// and/or other materials provided with the distribution.
|
|
|
|
// * Neither the name of the Aegisub Group nor the names of its contributors
|
|
|
|
// may be used to endorse or promote products derived from this software
|
|
|
|
// without specific prior written permission.
|
|
|
|
//
|
|
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
// POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
//
|
|
|
|
// Aegisub Project http://www.aegisub.org/
|
|
|
|
//
|
|
|
|
// $Id$
|
|
|
|
|
|
|
|
/// @file time.cpp
|
|
|
|
/// @brief time/ commands.
|
|
|
|
/// @ingroup command
|
|
|
|
///
|
|
|
|
|
2011-01-05 19:40:37 +01:00
|
|
|
#include "../config.h"
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
|
|
|
|
#ifndef AGI_PRE
|
2011-01-08 13:10:40 +01:00
|
|
|
#include <algorithm>
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "command.h"
|
|
|
|
|
2011-01-18 00:53:59 +01:00
|
|
|
#include "../ass_dialogue.h"
|
|
|
|
#include "../ass_file.h"
|
|
|
|
#include "../audio_controller.h"
|
|
|
|
#include "../audio_timing.h"
|
|
|
|
#include "../dialog_shift_times.h"
|
2011-01-05 19:40:37 +01:00
|
|
|
#include "../include/aegisub/context.h"
|
2011-07-15 06:04:07 +02:00
|
|
|
#include "../main.h"
|
2011-07-15 06:04:13 +02:00
|
|
|
#include "../selection_controller.h"
|
2011-01-05 19:40:37 +01:00
|
|
|
#include "../subs_grid.h"
|
|
|
|
#include "../video_context.h"
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
|
|
|
|
namespace cmd {
|
|
|
|
/// @defgroup cmd-time Time manipulation commands.
|
|
|
|
/// @{
|
|
|
|
|
|
|
|
|
|
|
|
/// Changes times of subs so end times begin on next's start time.
|
2011-01-16 08:17:46 +01:00
|
|
|
struct time_continuous_end : public Command {
|
|
|
|
CMD_NAME("time/continuous/end")
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
STR_MENU("Change &End")
|
|
|
|
STR_DISP("Change End")
|
|
|
|
STR_HELP("Changes times of subs so end times begin on next's start time.")
|
|
|
|
|
|
|
|
void operator()(agi::Context *c) {
|
2011-01-16 08:16:54 +01:00
|
|
|
wxArrayInt sels = c->subsGrid->GetSelection();
|
|
|
|
c->subsGrid->AdjoinLines(sels.front(), sels.back(), false);
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// Changes times of subs so start times begin on previous's end time.
|
2011-01-16 08:17:46 +01:00
|
|
|
struct time_continuous_start : public Command {
|
|
|
|
CMD_NAME("time/continuous/start")
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
STR_MENU("Change &Start")
|
|
|
|
STR_DISP("Change Start")
|
|
|
|
STR_HELP("Changes times of subs so start times begin on previous's end time.")
|
|
|
|
|
|
|
|
void operator()(agi::Context *c) {
|
2011-01-16 08:16:54 +01:00
|
|
|
wxArrayInt sels = c->subsGrid->GetSelection();
|
|
|
|
c->subsGrid->AdjoinLines(sels.front(), sels.back(), true);
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// Shift selection so first selected line starts at current frame.
|
2011-01-16 08:15:32 +01:00
|
|
|
struct time_frame_current : public Command {
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
CMD_NAME("time/frame/current")
|
|
|
|
STR_MENU("Shift to Current Frame")
|
|
|
|
STR_DISP("Shift to Current Frame")
|
|
|
|
STR_HELP("Shift selection so first selected line starts at current frame.")
|
|
|
|
|
|
|
|
void operator()(agi::Context *c) {
|
2011-01-16 08:16:54 +01:00
|
|
|
if (!c->videoController->IsLoaded()) return;
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
|
2011-01-16 08:16:54 +01:00
|
|
|
wxArrayInt sels = c->subsGrid->GetSelection();
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
size_t n=sels.Count();
|
|
|
|
if (n == 0) return;
|
|
|
|
|
|
|
|
// Get shifting in ms
|
2011-01-16 08:16:54 +01:00
|
|
|
AssDialogue *cur = c->subsGrid->GetDialogue(sels[0]);
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
if (!cur) return;
|
2011-01-16 08:16:54 +01:00
|
|
|
int shiftBy = c->videoController->TimeAtFrame(c->videoController->GetFrameN(),agi::vfr::START) - cur->Start.GetMS();
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
|
|
|
|
// Update
|
|
|
|
for (size_t i=0;i<n;i++) {
|
2011-01-16 08:16:54 +01:00
|
|
|
cur = c->subsGrid->GetDialogue(sels[i]);
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
if (cur) {
|
|
|
|
cur->Start.SetMS(cur->Start.GetMS()+shiftBy);
|
|
|
|
cur->End.SetMS(cur->End.GetMS()+shiftBy);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Commit
|
2011-01-16 08:17:36 +01:00
|
|
|
c->ass->Commit(_("shift to frame"), AssFile::COMMIT_TIMES);
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// Shift subtitles by time or frames.
|
2011-01-16 08:15:32 +01:00
|
|
|
struct time_shift : public Command {
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
CMD_NAME("time/shift")
|
|
|
|
STR_MENU("S&hift Times..")
|
|
|
|
STR_DISP("Shift Times")
|
|
|
|
STR_HELP("Shift subtitles by time or frames.")
|
|
|
|
|
|
|
|
void operator()(agi::Context *c) {
|
2011-01-16 08:16:54 +01:00
|
|
|
c->videoController->Stop();
|
2011-01-16 08:17:36 +01:00
|
|
|
DialogShiftTimes(c).ShowModal();
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Set end of selected subtitles to current video frame.
|
2011-01-16 08:15:32 +01:00
|
|
|
struct time_snap_end_video : public Command {
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
CMD_NAME("time/snap/end_video")
|
|
|
|
STR_MENU("Snap End to Video")
|
|
|
|
STR_DISP("Snap End to Video")
|
|
|
|
STR_HELP("Set end of selected subtitles to current video frame.")
|
|
|
|
|
|
|
|
void operator()(agi::Context *c) {
|
2011-01-16 08:16:54 +01:00
|
|
|
c->subsGrid->SetSubsToVideo(false);
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// Shift selected subtitles so first selected starts at this frame.
|
2011-01-16 08:15:32 +01:00
|
|
|
struct time_snap_frame : public Command {
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
CMD_NAME("time/snap/frame")
|
|
|
|
STR_MENU("Shift Subtitles to Frame")
|
|
|
|
STR_DISP("Shift Subtitles to Frame")
|
|
|
|
STR_HELP("Shift selected subtitles so first selected starts at this frame.")
|
|
|
|
|
|
|
|
void operator()(agi::Context *c) {
|
2011-01-16 08:16:54 +01:00
|
|
|
if (c->videoController->IsLoaded()) return;
|
2011-01-16 08:15:24 +01:00
|
|
|
|
2011-01-16 08:16:54 +01:00
|
|
|
wxArrayInt sels = c->subsGrid->GetSelection();
|
2011-01-16 08:15:24 +01:00
|
|
|
if (sels.empty()) return;
|
|
|
|
|
2011-01-16 08:16:54 +01:00
|
|
|
AssDialogue *cur = c->subsGrid->GetDialogue(sels[0]);
|
2011-01-16 08:15:24 +01:00
|
|
|
if (!cur) return;
|
2011-01-16 08:16:54 +01:00
|
|
|
int shiftBy = c->videoController->TimeAtFrame(c->videoController->GetFrameN(),agi::vfr::START) - cur->Start.GetMS();
|
2011-01-16 08:15:24 +01:00
|
|
|
|
|
|
|
for (size_t i = 0; i < sels.size(); ++i) {
|
2011-01-16 08:16:54 +01:00
|
|
|
if (cur = c->subsGrid->GetDialogue(sels[i])) {
|
2011-01-16 08:15:24 +01:00
|
|
|
cur->Start.SetMS(cur->Start.GetMS() + shiftBy);
|
|
|
|
cur->End.SetMS(cur->End.GetMS() + shiftBy);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
c->ass->Commit(_("shift to frame"));
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// Set start and end of subtitles to the keyframes around current video frame.
|
2011-01-16 08:15:32 +01:00
|
|
|
struct time_snap_scene : public Command {
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
CMD_NAME("time/snap/scene")
|
|
|
|
STR_MENU("Snap to Scene")
|
|
|
|
STR_DISP("Snap to Scene")
|
|
|
|
STR_HELP("Set start and end of subtitles to the keyframes around current video frame.")
|
|
|
|
|
|
|
|
void operator()(agi::Context *c) {
|
2011-01-16 08:16:54 +01:00
|
|
|
VideoContext *con = c->videoController;
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
if (!con->IsLoaded() || !con->KeyFramesLoaded()) return;
|
|
|
|
|
|
|
|
// Get frames
|
2011-01-16 08:16:54 +01:00
|
|
|
wxArrayInt sel = c->subsGrid->GetSelection();
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
int curFrame = con->GetFrameN();
|
|
|
|
int prev = 0;
|
|
|
|
int next = 0;
|
|
|
|
|
|
|
|
const std::vector<int> &keyframes = con->GetKeyFrames();
|
|
|
|
if (curFrame < keyframes.front()) {
|
|
|
|
next = keyframes.front();
|
|
|
|
}
|
|
|
|
else if (curFrame >= keyframes.back()) {
|
|
|
|
prev = keyframes.back();
|
|
|
|
next = con->GetLength();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
std::vector<int>::const_iterator kf = std::lower_bound(keyframes.begin(), keyframes.end(), curFrame);
|
|
|
|
if (*kf == curFrame) {
|
|
|
|
prev = *kf;
|
|
|
|
next = *(kf + 1);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
prev = *(kf - 1);
|
|
|
|
next = *kf;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get times
|
|
|
|
int start_ms = con->TimeAtFrame(prev,agi::vfr::START);
|
|
|
|
int end_ms = con->TimeAtFrame(next-1,agi::vfr::END);
|
|
|
|
AssDialogue *cur;
|
|
|
|
|
|
|
|
// Update rows
|
|
|
|
for (size_t i=0;i<sel.Count();i++) {
|
2011-01-16 08:16:54 +01:00
|
|
|
cur = c->subsGrid->GetDialogue(sel[i]);
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
cur->Start.SetMS(start_ms);
|
|
|
|
cur->End.SetMS(end_ms);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Commit
|
2011-01-16 08:17:36 +01:00
|
|
|
c->ass->Commit(_("snap to scene"), AssFile::COMMIT_TIMES);
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2011-01-18 00:53:59 +01:00
|
|
|
struct time_add_lead_in : public Command {
|
|
|
|
CMD_NAME("time/lead/in")
|
|
|
|
STR_MENU("Add lead in")
|
|
|
|
STR_DISP("Add lead in")
|
|
|
|
STR_HELP("Add lead in")
|
|
|
|
void operator()(agi::Context *c) {
|
2011-07-15 06:04:07 +02:00
|
|
|
if (AssDialogue *line = c->selectionController->GetActiveLine()) {
|
|
|
|
line->Start.SetMS(line->Start.GetMS() - OPT_GET("Audio/Lead/IN")->GetInt());
|
|
|
|
c->ass->Commit(_("add lead in"), AssFile::COMMIT_TIMES);
|
|
|
|
}
|
2011-01-18 00:53:59 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct time_add_lead_out : public Command {
|
|
|
|
CMD_NAME("time/lead/out")
|
|
|
|
STR_MENU("Add lead out")
|
|
|
|
STR_DISP("Add lead out")
|
|
|
|
STR_HELP("Add lead out")
|
|
|
|
void operator()(agi::Context *c) {
|
2011-07-15 06:04:07 +02:00
|
|
|
if (AssDialogue *line = c->selectionController->GetActiveLine()) {
|
|
|
|
line->End.SetMS(line->End.GetMS() + OPT_GET("Audio/Lead/OUT")->GetInt());
|
|
|
|
c->ass->Commit(_("add lead out"), AssFile::COMMIT_TIMES);
|
|
|
|
}
|
2011-01-18 00:53:59 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
|
|
|
|
/// Set start of selected subtitles to current video frame.
|
2011-01-16 08:15:32 +01:00
|
|
|
struct time_snap_start_video : public Command {
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
CMD_NAME("time/snap/start_video")
|
|
|
|
STR_MENU("Snap Start to Video")
|
|
|
|
STR_DISP("Snap Start to Video")
|
|
|
|
STR_HELP("Set start of selected subtitles to current video frame.")
|
|
|
|
|
|
|
|
void operator()(agi::Context *c) {
|
2011-01-16 08:16:54 +01:00
|
|
|
c->subsGrid->SetSubsToVideo(false);
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// Sort all subtitles by their end times.
|
2011-01-16 08:15:32 +01:00
|
|
|
struct time_sort_end : public Command {
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
CMD_NAME("time/sort/end")
|
|
|
|
STR_MENU("&End Time")
|
|
|
|
STR_DISP("End Time")
|
|
|
|
STR_HELP("Sort all subtitles by their end times.")
|
|
|
|
|
|
|
|
void operator()(agi::Context *c) {
|
|
|
|
c->ass->Sort(AssFile::CompEnd);
|
|
|
|
c->ass->Commit(_("sort"));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// Sort all subtitles by their start times.
|
2011-01-16 08:15:32 +01:00
|
|
|
struct time_sort_start : public Command {
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
CMD_NAME("time/sort/start")
|
|
|
|
STR_MENU("&Start Time")
|
|
|
|
STR_DISP("Start Time")
|
|
|
|
STR_HELP("Sort all subtitles by their start times.")
|
|
|
|
|
|
|
|
void operator()(agi::Context *c) {
|
|
|
|
c->ass->Sort();
|
|
|
|
c->ass->Commit(_("sort"));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// Sort all subtitles by their style names.
|
2011-01-16 08:15:32 +01:00
|
|
|
struct time_sort_style : public Command {
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
CMD_NAME("time/sort/style")
|
|
|
|
STR_MENU("St&yle Name")
|
|
|
|
STR_DISP("Style Name")
|
|
|
|
STR_HELP("Sort all subtitles by their style names.")
|
|
|
|
|
|
|
|
void operator()(agi::Context *c) {
|
|
|
|
c->ass->Sort(AssFile::CompStyle);
|
|
|
|
c->ass->Commit(_("sort"));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2011-01-18 00:53:59 +01:00
|
|
|
/// Switch to the next timeable thing (line or syllable)
|
|
|
|
struct time_next : public Command {
|
|
|
|
CMD_NAME("time/next")
|
|
|
|
STR_MENU("Next line")
|
|
|
|
STR_DISP("Next line")
|
2011-01-18 00:54:05 +01:00
|
|
|
STR_HELP("Next line or syllable")
|
2011-01-18 00:53:59 +01:00
|
|
|
void operator()(agi::Context *c) {
|
|
|
|
c->audioController->Stop();
|
|
|
|
if (c->audioController->GetTimingController())
|
|
|
|
c->audioController->GetTimingController()->Next();
|
|
|
|
c->audioController->PlayPrimaryRange();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/// Switch to the previous timeable thing (line or syllable)
|
|
|
|
struct time_prev : public Command {
|
|
|
|
CMD_NAME("time/prev")
|
|
|
|
STR_MENU("Previous line")
|
|
|
|
STR_DISP("Previous line")
|
2011-01-18 00:54:05 +01:00
|
|
|
STR_HELP("Previous line or syllable")
|
2011-01-18 00:53:59 +01:00
|
|
|
void operator()(agi::Context *c) {
|
|
|
|
c->audioController->Stop();
|
|
|
|
if (c->audioController->GetTimingController())
|
|
|
|
c->audioController->GetTimingController()->Prev();
|
|
|
|
c->audioController->PlayPrimaryRange();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
/// @}
|
|
|
|
|
|
|
|
/// Init time/ commands.
|
|
|
|
void init_time(CommandManager *cm) {
|
2011-01-18 00:53:59 +01:00
|
|
|
cm->reg(new time_add_lead_in);
|
|
|
|
cm->reg(new time_add_lead_out);
|
|
|
|
cm->reg(new time_continuous_end);
|
|
|
|
cm->reg(new time_continuous_start);
|
|
|
|
cm->reg(new time_frame_current);
|
|
|
|
cm->reg(new time_next);
|
|
|
|
cm->reg(new time_prev);
|
|
|
|
cm->reg(new time_shift);
|
|
|
|
cm->reg(new time_snap_end_video);
|
|
|
|
cm->reg(new time_snap_frame);
|
|
|
|
cm->reg(new time_snap_scene);
|
|
|
|
cm->reg(new time_snap_start_video);
|
|
|
|
cm->reg(new time_sort_end);
|
|
|
|
cm->reg(new time_sort_start);
|
|
|
|
cm->reg(new time_sort_style);
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace cmd
|