forked from mia/Aegisub
Detangle the visual tools from SubsEditBox a bit by making changes to the file no longer go through the edit box.
Originally committed to SVN as r4317.
This commit is contained in:
parent
34a7d21a42
commit
e023831134
11 changed files with 63 additions and 430 deletions
|
@ -32,8 +32,6 @@
|
||||||
/// @file audio_display.cpp
|
/// @file audio_display.cpp
|
||||||
/// @brief Display audio in the main UI
|
/// @brief Display audio in the main UI
|
||||||
/// @ingroup audio_ui
|
/// @ingroup audio_ui
|
||||||
///
|
|
||||||
|
|
||||||
|
|
||||||
///////////
|
///////////
|
||||||
// Headers
|
// Headers
|
||||||
|
@ -68,8 +66,6 @@
|
||||||
#include "vfr.h"
|
#include "vfr.h"
|
||||||
#include "video_context.h"
|
#include "video_context.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
|
@ -80,10 +76,8 @@
|
||||||
# define AudioDisplayWindowStyle wxSUNKEN_BORDER | wxWANTS_CHARS
|
# define AudioDisplayWindowStyle wxSUNKEN_BORDER | wxWANTS_CHARS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/// @brief Constructor
|
/// @brief Constructor
|
||||||
/// @param parent
|
/// @param parent
|
||||||
///
|
|
||||||
AudioDisplay::AudioDisplay(wxWindow *parent)
|
AudioDisplay::AudioDisplay(wxWindow *parent)
|
||||||
: wxWindow (parent, -1, wxDefaultPosition, wxSize(200,Options.AsInt(_T("Audio Display Height"))), AudioDisplayWindowStyle , _T("Audio Display"))
|
: wxWindow (parent, -1, wxDefaultPosition, wxSize(200,Options.AsInt(_T("Audio Display Height"))), AudioDisplayWindowStyle , _T("Audio Display"))
|
||||||
{
|
{
|
||||||
|
@ -134,10 +128,7 @@ AudioDisplay::AudioDisplay(wxWindow *parent)
|
||||||
//wxLog::SetActiveTarget(new wxLogWindow(NULL,_T("Log"),true,false));
|
//wxLog::SetActiveTarget(new wxLogWindow(NULL,_T("Log"),true,false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Destructor
|
/// @brief Destructor
|
||||||
///
|
|
||||||
AudioDisplay::~AudioDisplay() {
|
AudioDisplay::~AudioDisplay() {
|
||||||
if (player) player->CloseStream();
|
if (player) player->CloseStream();
|
||||||
delete provider;
|
delete provider;
|
||||||
|
@ -158,10 +149,7 @@ AudioDisplay::~AudioDisplay() {
|
||||||
min = NULL;
|
min = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Reset
|
/// @brief Reset
|
||||||
///
|
|
||||||
void AudioDisplay::Reset() {
|
void AudioDisplay::Reset() {
|
||||||
wxLogDebug(_T("AudioDisplay::Reset"));
|
wxLogDebug(_T("AudioDisplay::Reset"));
|
||||||
hasSel = false;
|
hasSel = false;
|
||||||
|
@ -174,11 +162,8 @@ void AudioDisplay::Reset() {
|
||||||
dialogue = NULL;
|
dialogue = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Update image
|
/// @brief Update image
|
||||||
/// @param weak
|
/// @param weak
|
||||||
///
|
|
||||||
void AudioDisplay::UpdateImage(bool weak) {
|
void AudioDisplay::UpdateImage(bool weak) {
|
||||||
// Update samples
|
// Update samples
|
||||||
UpdateSamples();
|
UpdateSamples();
|
||||||
|
@ -191,9 +176,7 @@ void AudioDisplay::UpdateImage(bool weak) {
|
||||||
Refresh(false);
|
Refresh(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// @brief Actually update the image on the display
|
/// @brief Actually update the image on the display
|
||||||
///
|
|
||||||
/// This is where most actual drawing of the audio display happens, or other functions
|
/// This is where most actual drawing of the audio display happens, or other functions
|
||||||
/// to draw specific parts are called from.
|
/// to draw specific parts are called from.
|
||||||
void AudioDisplay::DoUpdateImage() {
|
void AudioDisplay::DoUpdateImage() {
|
||||||
|
@ -415,11 +398,8 @@ void AudioDisplay::DoUpdateImage() {
|
||||||
needImageUpdateWeak = true;
|
needImageUpdateWeak = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Draw other lines than the current active
|
/// @brief Draw other lines than the current active
|
||||||
/// @param dc The DC to draw to.
|
/// @param dc The DC to draw to.
|
||||||
///
|
|
||||||
/// Draws markers for inactive lines, eg. the previous line, per configuration.
|
/// Draws markers for inactive lines, eg. the previous line, per configuration.
|
||||||
void AudioDisplay::DrawInactiveLines(wxDC &dc) {
|
void AudioDisplay::DrawInactiveLines(wxDC &dc) {
|
||||||
// Check if there is anything to do
|
// Check if there is anything to do
|
||||||
|
@ -492,8 +472,6 @@ void AudioDisplay::DrawInactiveLines(wxDC &dc) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Draw keyframe markers
|
/// @brief Draw keyframe markers
|
||||||
/// @param dc The DC to draw to.
|
/// @param dc The DC to draw to.
|
||||||
void AudioDisplay::DrawKeyframes(wxDC &dc) {
|
void AudioDisplay::DrawKeyframes(wxDC &dc) {
|
||||||
|
@ -516,8 +494,6 @@ void AudioDisplay::DrawKeyframes(wxDC &dc) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Draw timescale at bottom of audio display
|
/// @brief Draw timescale at bottom of audio display
|
||||||
/// @param dc The DC to draw to.
|
/// @param dc The DC to draw to.
|
||||||
void AudioDisplay::DrawTimescale(wxDC &dc) {
|
void AudioDisplay::DrawTimescale(wxDC &dc) {
|
||||||
|
@ -582,8 +558,6 @@ void AudioDisplay::DrawTimescale(wxDC &dc) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Draw audio waveform
|
/// @brief Draw audio waveform
|
||||||
/// @param dc The DC to draw to.
|
/// @param dc The DC to draw to.
|
||||||
/// @param weak False if the visible portion of the display has changed.
|
/// @param weak False if the visible portion of the display has changed.
|
||||||
|
@ -626,12 +600,9 @@ void AudioDisplay::DrawWaveform(wxDC &dc,bool weak) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Draw spectrum analyzer
|
/// @brief Draw spectrum analyzer
|
||||||
/// @param finaldc The DC to draw to.
|
/// @param finaldc The DC to draw to.
|
||||||
/// @param weak False if the visible portion of the display has changed.
|
/// @param weak False if the visible portion of the display has changed.
|
||||||
///
|
|
||||||
/// @bug Slow when non-weak and the selection has to be drawn, see:
|
/// @bug Slow when non-weak and the selection has to be drawn, see:
|
||||||
/// @ticket{951} Spectrum view scrolls/updates considerably slower when selection is visible
|
/// @ticket{951} Spectrum view scrolls/updates considerably slower when selection is visible
|
||||||
void AudioDisplay::DrawSpectrum(wxDC &finaldc,bool weak) {
|
void AudioDisplay::DrawSpectrum(wxDC &finaldc,bool weak) {
|
||||||
|
@ -684,12 +655,10 @@ void AudioDisplay::DrawSpectrum(wxDC &finaldc,bool weak) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// @brief Get selection position
|
/// @brief Get selection position
|
||||||
/// @param selStart
|
/// @param selStart
|
||||||
/// @param selEnd
|
/// @param selEnd
|
||||||
/// @param cap
|
/// @param cap
|
||||||
///
|
|
||||||
void AudioDisplay::GetDialoguePos(int64_t &selStart,int64_t &selEnd, bool cap) {
|
void AudioDisplay::GetDialoguePos(int64_t &selStart,int64_t &selEnd, bool cap) {
|
||||||
selStart = GetXAtMS(curStartMS);
|
selStart = GetXAtMS(curStartMS);
|
||||||
selEnd = GetXAtMS(curEndMS);
|
selEnd = GetXAtMS(curEndMS);
|
||||||
|
@ -702,13 +671,10 @@ void AudioDisplay::GetDialoguePos(int64_t &selStart,int64_t &selEnd, bool cap) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Get karaoke position
|
/// @brief Get karaoke position
|
||||||
/// @param karStart
|
/// @param karStart
|
||||||
/// @param karEnd
|
/// @param karEnd
|
||||||
/// @param cap
|
/// @param cap
|
||||||
///
|
|
||||||
void AudioDisplay::GetKaraokePos(int64_t &karStart,int64_t &karEnd, bool cap) {
|
void AudioDisplay::GetKaraokePos(int64_t &karStart,int64_t &karEnd, bool cap) {
|
||||||
try {
|
try {
|
||||||
// Wrap around
|
// Wrap around
|
||||||
|
@ -736,11 +702,8 @@ void AudioDisplay::GetKaraokePos(int64_t &karStart,int64_t &karEnd, bool cap) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Update
|
/// @brief Update
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
void AudioDisplay::Update() {
|
void AudioDisplay::Update() {
|
||||||
if (blockUpdate) return;
|
if (blockUpdate) return;
|
||||||
if (loaded) {
|
if (loaded) {
|
||||||
|
@ -751,10 +714,7 @@ void AudioDisplay::Update() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Recreate the image
|
/// @brief Recreate the image
|
||||||
///
|
|
||||||
void AudioDisplay::RecreateImage() {
|
void AudioDisplay::RecreateImage() {
|
||||||
GetClientSize(&w,&h);
|
GetClientSize(&w,&h);
|
||||||
h -= Options.AsBool(_T("Audio Draw Timeline")) ? 20 : 0;
|
h -= Options.AsBool(_T("Audio Draw Timeline")) ? 20 : 0;
|
||||||
|
@ -763,11 +723,8 @@ void AudioDisplay::RecreateImage() {
|
||||||
UpdateImage(false);
|
UpdateImage(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Make dialogue visible
|
/// @brief Make dialogue visible
|
||||||
/// @param force
|
/// @param force
|
||||||
///
|
|
||||||
void AudioDisplay::MakeDialogueVisible(bool force) {
|
void AudioDisplay::MakeDialogueVisible(bool force) {
|
||||||
wxLogDebug(_T("AudioDisplay::MakeDialogueVisible(force=%d)"), force?1:0);
|
wxLogDebug(_T("AudioDisplay::MakeDialogueVisible(force=%d)"), force?1:0);
|
||||||
// Variables
|
// Variables
|
||||||
|
@ -799,11 +756,8 @@ void AudioDisplay::MakeDialogueVisible(bool force) {
|
||||||
UpdateImage();
|
UpdateImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Set position
|
/// @brief Set position
|
||||||
/// @param pos
|
/// @param pos
|
||||||
///
|
|
||||||
void AudioDisplay::SetPosition(int pos) {
|
void AudioDisplay::SetPosition(int pos) {
|
||||||
wxLogDebug(_T("AudioDisplay::SetPosition(pos=%d)"), pos);
|
wxLogDebug(_T("AudioDisplay::SetPosition(pos=%d)"), pos);
|
||||||
Position = pos;
|
Position = pos;
|
||||||
|
@ -811,13 +765,10 @@ void AudioDisplay::SetPosition(int pos) {
|
||||||
UpdateImage();
|
UpdateImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Update position
|
/// @brief Update position
|
||||||
/// @param pos
|
/// @param pos
|
||||||
/// @param IsSample
|
/// @param IsSample
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
void AudioDisplay::UpdatePosition (int pos,bool IsSample) {
|
void AudioDisplay::UpdatePosition (int pos,bool IsSample) {
|
||||||
// Safeguards
|
// Safeguards
|
||||||
if (!provider) return;
|
if (!provider) return;
|
||||||
|
@ -832,14 +783,11 @@ void AudioDisplay::UpdatePosition (int pos,bool IsSample) {
|
||||||
UpdateScrollbar();
|
UpdateScrollbar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Note: aka Horizontal Zoom Set samples in percentage
|
/// @brief Note: aka Horizontal Zoom Set samples in percentage
|
||||||
/// @param percent
|
/// @param percent
|
||||||
/// @param update
|
/// @param update
|
||||||
/// @param pivot
|
/// @param pivot
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
void AudioDisplay::SetSamplesPercent(int percent,bool update,float pivot) {
|
void AudioDisplay::SetSamplesPercent(int percent,bool update,float pivot) {
|
||||||
// Calculate
|
// Calculate
|
||||||
if (percent < 1) percent = 1;
|
if (percent < 1) percent = 1;
|
||||||
|
@ -863,11 +811,8 @@ void AudioDisplay::SetSamplesPercent(int percent,bool update,float pivot) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Update samples
|
/// @brief Update samples
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
void AudioDisplay::UpdateSamples() {
|
void AudioDisplay::UpdateSamples() {
|
||||||
// Set samples
|
// Set samples
|
||||||
if (!provider) return;
|
if (!provider) return;
|
||||||
|
@ -891,24 +836,18 @@ void AudioDisplay::UpdateSamples() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Set scale
|
/// @brief Set scale
|
||||||
/// @param _scale
|
/// @param _scale
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
void AudioDisplay::SetScale(float _scale) {
|
void AudioDisplay::SetScale(float _scale) {
|
||||||
if (scale == _scale) return;
|
if (scale == _scale) return;
|
||||||
scale = _scale;
|
scale = _scale;
|
||||||
UpdateImage();
|
UpdateImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Load from file
|
/// @brief Load from file
|
||||||
/// @param file
|
/// @param file
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
void AudioDisplay::SetFile(wxString file) {
|
void AudioDisplay::SetFile(wxString file) {
|
||||||
wxLogDebug(_T("AudioDisplay::SetFile(file=%s)"), file.c_str());
|
wxLogDebug(_T("AudioDisplay::SetFile(file=%s)"), file.c_str());
|
||||||
// Unload
|
// Unload
|
||||||
|
@ -1017,10 +956,7 @@ void AudioDisplay::SetFile(wxString file) {
|
||||||
wxLogDebug(_T("AudioDisplay::SetFile: returning"));
|
wxLogDebug(_T("AudioDisplay::SetFile: returning"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Load from video
|
/// @brief Load from video
|
||||||
///
|
|
||||||
void AudioDisplay::SetFromVideo() {
|
void AudioDisplay::SetFromVideo() {
|
||||||
wxLogDebug(_T("AudioDisplay::SetFromVideo"));
|
wxLogDebug(_T("AudioDisplay::SetFromVideo"));
|
||||||
if (VideoContext::Get()->IsLoaded()) {
|
if (VideoContext::Get()->IsLoaded()) {
|
||||||
|
@ -1031,20 +967,14 @@ void AudioDisplay::SetFromVideo() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Reload audio
|
/// @brief Reload audio
|
||||||
///
|
|
||||||
void AudioDisplay::Reload() {
|
void AudioDisplay::Reload() {
|
||||||
wxLogDebug(_T("AudioDisplay::Reload"));
|
wxLogDebug(_T("AudioDisplay::Reload"));
|
||||||
if (provider) SetFile(provider->GetFilename());
|
if (provider) SetFile(provider->GetFilename());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Update scrollbar
|
/// @brief Update scrollbar
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
void AudioDisplay::UpdateScrollbar() {
|
void AudioDisplay::UpdateScrollbar() {
|
||||||
if (!provider) return;
|
if (!provider) return;
|
||||||
int page = w/12;
|
int page = w/12;
|
||||||
|
@ -1053,73 +983,52 @@ void AudioDisplay::UpdateScrollbar() {
|
||||||
ScrollBar->SetScrollbar(Position/12,page,len,int(page*0.7),true);
|
ScrollBar->SetScrollbar(Position/12,page,len,int(page*0.7),true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Gets the sample number at the x coordinate
|
/// @brief Gets the sample number at the x coordinate
|
||||||
/// @param x
|
/// @param x
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
int64_t AudioDisplay::GetSampleAtX(int x) {
|
int64_t AudioDisplay::GetSampleAtX(int x) {
|
||||||
return (x+Position)*samples;
|
return (x+Position)*samples;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Gets the x coordinate corresponding to sample
|
/// @brief Gets the x coordinate corresponding to sample
|
||||||
/// @param n
|
/// @param n
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
int AudioDisplay::GetXAtSample(int64_t n) {
|
int AudioDisplay::GetXAtSample(int64_t n) {
|
||||||
return samples ? (n/samples)-Position : 0;
|
return samples ? (n/samples)-Position : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Get MS from X
|
/// @brief Get MS from X
|
||||||
/// @param x
|
/// @param x
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
int AudioDisplay::GetMSAtX(int64_t x) {
|
int AudioDisplay::GetMSAtX(int64_t x) {
|
||||||
return (PositionSample+(x*samples)) * 1000 / provider->GetSampleRate();
|
return (PositionSample+(x*samples)) * 1000 / provider->GetSampleRate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Get X from MS
|
/// @brief Get X from MS
|
||||||
/// @param ms
|
/// @param ms
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
int AudioDisplay::GetXAtMS(int64_t ms) {
|
int AudioDisplay::GetXAtMS(int64_t ms) {
|
||||||
return ((ms * provider->GetSampleRate() / 1000)-PositionSample)/samples;
|
return ((ms * provider->GetSampleRate() / 1000)-PositionSample)/samples;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Get MS At sample
|
/// @brief Get MS At sample
|
||||||
/// @param x
|
/// @param x
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
int AudioDisplay::GetMSAtSample(int64_t x) {
|
int AudioDisplay::GetMSAtSample(int64_t x) {
|
||||||
return x * 1000 / provider->GetSampleRate();
|
return x * 1000 / provider->GetSampleRate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Get Sample at MS
|
/// @brief Get Sample at MS
|
||||||
/// @param ms
|
/// @param ms
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
int64_t AudioDisplay::GetSampleAtMS(int64_t ms) {
|
int64_t AudioDisplay::GetSampleAtMS(int64_t ms) {
|
||||||
return ms * provider->GetSampleRate() / 1000;
|
return ms * provider->GetSampleRate() / 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Play
|
/// @brief Play
|
||||||
/// @param start
|
/// @param start
|
||||||
/// @param end
|
/// @param end
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
void AudioDisplay::Play(int start,int end) {
|
void AudioDisplay::Play(int start,int end) {
|
||||||
wxLogDebug(_T("AudioDisplay::Play"));
|
wxLogDebug(_T("AudioDisplay::Play"));
|
||||||
Stop();
|
Stop();
|
||||||
|
@ -1153,23 +1062,17 @@ void AudioDisplay::Play(int start,int end) {
|
||||||
wxLogDebug(_T("AudioDisplay::Play: playback started, returning"));
|
wxLogDebug(_T("AudioDisplay::Play: playback started, returning"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Stop
|
/// @brief Stop
|
||||||
///
|
|
||||||
void AudioDisplay::Stop() {
|
void AudioDisplay::Stop() {
|
||||||
wxLogDebug(_T("AudioDisplay::Stop"));
|
wxLogDebug(_T("AudioDisplay::Stop"));
|
||||||
if (VideoContext::Get()->IsPlaying()) VideoContext::Get()->Stop();
|
if (VideoContext::Get()->IsPlaying()) VideoContext::Get()->Stop();
|
||||||
if (player) player->Stop();
|
if (player) player->Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Get samples of dialogue
|
/// @brief Get samples of dialogue
|
||||||
/// @param start
|
/// @param start
|
||||||
/// @param end
|
/// @param end
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
void AudioDisplay::GetTimesDialogue(int &start,int &end) {
|
void AudioDisplay::GetTimesDialogue(int &start,int &end) {
|
||||||
wxLogDebug(_T("AudioDisplay::GetTimesDialogue"));
|
wxLogDebug(_T("AudioDisplay::GetTimesDialogue"));
|
||||||
if (!dialogue) {
|
if (!dialogue) {
|
||||||
|
@ -1182,13 +1085,10 @@ void AudioDisplay::GetTimesDialogue(int &start,int &end) {
|
||||||
end = dialogue->End.GetMS();
|
end = dialogue->End.GetMS();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Get samples of selection
|
/// @brief Get samples of selection
|
||||||
/// @param start
|
/// @param start
|
||||||
/// @param end
|
/// @param end
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
void AudioDisplay::GetTimesSelection(int &start,int &end) {
|
void AudioDisplay::GetTimesSelection(int &start,int &end) {
|
||||||
wxLogDebug(_T("AudioDisplay::GetTimesSelection"));
|
wxLogDebug(_T("AudioDisplay::GetTimesSelection"));
|
||||||
start = 0;
|
start = 0;
|
||||||
|
@ -1210,12 +1110,9 @@ void AudioDisplay::GetTimesSelection(int &start,int &end) {
|
||||||
catch (...) {}
|
catch (...) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Set the current selection
|
/// @brief Set the current selection
|
||||||
/// @param start
|
/// @param start
|
||||||
/// @param end
|
/// @param end
|
||||||
///
|
|
||||||
void AudioDisplay::SetSelection(int start, int end) {
|
void AudioDisplay::SetSelection(int start, int end) {
|
||||||
wxLogDebug(_T("AudioDisplay::SetSelection(start=%d, end=%d)"), start, end);
|
wxLogDebug(_T("AudioDisplay::SetSelection(start=%d, end=%d)"), start, end);
|
||||||
curStartMS = start;
|
curStartMS = start;
|
||||||
|
@ -1223,14 +1120,11 @@ void AudioDisplay::SetSelection(int start, int end) {
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Set dialogue
|
/// @brief Set dialogue
|
||||||
/// @param _grid
|
/// @param _grid
|
||||||
/// @param diag
|
/// @param diag
|
||||||
/// @param n
|
/// @param n
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
void AudioDisplay::SetDialogue(SubtitlesGrid *_grid,AssDialogue *diag,int n) {
|
void AudioDisplay::SetDialogue(SubtitlesGrid *_grid,AssDialogue *diag,int n) {
|
||||||
wxLogDebug(_T("AudioDisplay::SetDialogue"));
|
wxLogDebug(_T("AudioDisplay::SetDialogue"));
|
||||||
// Actual parameters
|
// Actual parameters
|
||||||
|
@ -1275,12 +1169,9 @@ void AudioDisplay::SetDialogue(SubtitlesGrid *_grid,AssDialogue *diag,int n) {
|
||||||
wxLogDebug(_T("AudioDisplay::SetDialogue: returning"));
|
wxLogDebug(_T("AudioDisplay::SetDialogue: returning"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Commit changes
|
/// @brief Commit changes
|
||||||
/// @param nextLine
|
/// @param nextLine
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
void AudioDisplay::CommitChanges (bool nextLine) {
|
void AudioDisplay::CommitChanges (bool nextLine) {
|
||||||
wxLogDebug(_T("AudioDisplay::CommitChanges(nextLine=%d)"), nextLine?1:0);
|
wxLogDebug(_T("AudioDisplay::CommitChanges(nextLine=%d)"), nextLine?1:0);
|
||||||
// Loaded?
|
// Loaded?
|
||||||
|
@ -1392,12 +1283,9 @@ void AudioDisplay::CommitChanges (bool nextLine) {
|
||||||
wxLogDebug(_T("AudioDisplay::CommitChanges: returning"));
|
wxLogDebug(_T("AudioDisplay::CommitChanges: returning"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Add lead
|
/// @brief Add lead
|
||||||
/// @param in
|
/// @param in
|
||||||
/// @param out
|
/// @param out
|
||||||
///
|
|
||||||
void AudioDisplay::AddLead(bool in,bool out) {
|
void AudioDisplay::AddLead(bool in,bool out) {
|
||||||
// Lead in
|
// Lead in
|
||||||
if (in) {
|
if (in) {
|
||||||
|
@ -1417,7 +1305,6 @@ void AudioDisplay::AddLead(bool in,bool out) {
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
// Event table
|
// Event table
|
||||||
BEGIN_EVENT_TABLE(AudioDisplay, wxWindow)
|
BEGIN_EVENT_TABLE(AudioDisplay, wxWindow)
|
||||||
|
@ -1430,12 +1317,9 @@ BEGIN_EVENT_TABLE(AudioDisplay, wxWindow)
|
||||||
EVT_KILL_FOCUS(AudioDisplay::OnLoseFocus)
|
EVT_KILL_FOCUS(AudioDisplay::OnLoseFocus)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Paint
|
/// @brief Paint
|
||||||
/// @param event
|
/// @param event
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
void AudioDisplay::OnPaint(wxPaintEvent& event) {
|
void AudioDisplay::OnPaint(wxPaintEvent& event) {
|
||||||
if (w == 0 || h == 0) return;
|
if (w == 0 || h == 0) return;
|
||||||
DoUpdateImage();
|
DoUpdateImage();
|
||||||
|
@ -1444,12 +1328,9 @@ void AudioDisplay::OnPaint(wxPaintEvent& event) {
|
||||||
if (origImage) dc.DrawBitmap(*origImage,0,0);
|
if (origImage) dc.DrawBitmap(*origImage,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Mouse event
|
/// @brief Mouse event
|
||||||
/// @param event
|
/// @param event
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
void AudioDisplay::OnMouseEvent(wxMouseEvent& event) {
|
void AudioDisplay::OnMouseEvent(wxMouseEvent& event) {
|
||||||
// Get x,y
|
// Get x,y
|
||||||
int64_t x = event.GetX();
|
int64_t x = event.GetX();
|
||||||
|
@ -1854,15 +1735,12 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event) {
|
||||||
if (defCursor) SetCursor(wxNullCursor);
|
if (defCursor) SetCursor(wxNullCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Get snap to boundary
|
/// @brief Get snap to boundary
|
||||||
/// @param ms
|
/// @param ms
|
||||||
/// @param rangeX
|
/// @param rangeX
|
||||||
/// @param shiftHeld
|
/// @param shiftHeld
|
||||||
/// @param start
|
/// @param start
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
int AudioDisplay::GetBoundarySnap(int ms,int rangeX,bool shiftHeld,bool start) {
|
int AudioDisplay::GetBoundarySnap(int ms,int rangeX,bool shiftHeld,bool start) {
|
||||||
// Range?
|
// Range?
|
||||||
if (rangeX <= 0) return ms;
|
if (rangeX <= 0) return ms;
|
||||||
|
@ -1935,7 +1813,6 @@ int AudioDisplay::GetBoundarySnap(int ms,int rangeX,bool shiftHeld,bool start) {
|
||||||
return bestMS;
|
return bestMS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// SCRUBBING CODE, REMOVED FROM THE FUNCTION ABOVE
|
// SCRUBBING CODE, REMOVED FROM THE FUNCTION ABOVE
|
||||||
/*
|
/*
|
||||||
|
@ -2050,11 +1927,8 @@ int AudioDisplay::GetBoundarySnap(int ms,int rangeX,bool shiftHeld,bool start) {
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Size event
|
/// @brief Size event
|
||||||
/// @param event
|
/// @param event
|
||||||
///
|
|
||||||
void AudioDisplay::OnSize(wxSizeEvent &event) {
|
void AudioDisplay::OnSize(wxSizeEvent &event) {
|
||||||
// Set size
|
// Set size
|
||||||
GetClientSize(&w,&h);
|
GetClientSize(&w,&h);
|
||||||
|
@ -2071,12 +1945,9 @@ void AudioDisplay::OnSize(wxSizeEvent &event) {
|
||||||
UpdateScrollbar();
|
UpdateScrollbar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Timer event
|
/// @brief Timer event
|
||||||
/// @param event
|
/// @param event
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
void AudioDisplay::OnUpdateTimer(wxTimerEvent &event) {
|
void AudioDisplay::OnUpdateTimer(wxTimerEvent &event) {
|
||||||
if (!origImage)
|
if (!origImage)
|
||||||
return;
|
return;
|
||||||
|
@ -2161,11 +2032,8 @@ void AudioDisplay::OnUpdateTimer(wxTimerEvent &event) {
|
||||||
oldCurPos = curpos;
|
oldCurPos = curpos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Key down
|
/// @brief Key down
|
||||||
/// @param event
|
/// @param event
|
||||||
///
|
|
||||||
void AudioDisplay::OnKeyDown(wxKeyEvent &event) {
|
void AudioDisplay::OnKeyDown(wxKeyEvent &event) {
|
||||||
int key = event.GetKeyCode();
|
int key = event.GetKeyCode();
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
@ -2332,13 +2200,10 @@ void AudioDisplay::OnKeyDown(wxKeyEvent &event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Change line
|
/// @brief Change line
|
||||||
/// @param delta
|
/// @param delta
|
||||||
/// @param block
|
/// @param block
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
void AudioDisplay::ChangeLine(int delta, bool block) {
|
void AudioDisplay::ChangeLine(int delta, bool block) {
|
||||||
wxLogDebug(_T("AudioDisplay::ChangeLine(delta=%d)"), delta);
|
wxLogDebug(_T("AudioDisplay::ChangeLine(delta=%d)"), delta);
|
||||||
if (dialogue) {
|
if (dialogue) {
|
||||||
|
@ -2365,12 +2230,9 @@ void AudioDisplay::ChangeLine(int delta, bool block) {
|
||||||
wxLogDebug(_T("AudioDisplay::ChangeLine: returning"));
|
wxLogDebug(_T("AudioDisplay::ChangeLine: returning"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Next
|
/// @brief Next
|
||||||
/// @param play
|
/// @param play
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
void AudioDisplay::Next(bool play) {
|
void AudioDisplay::Next(bool play) {
|
||||||
wxLogDebug(_T("AudioDisplay::Next"));
|
wxLogDebug(_T("AudioDisplay::Next"));
|
||||||
// Karaoke
|
// Karaoke
|
||||||
|
@ -2423,12 +2285,9 @@ void AudioDisplay::Next(bool play) {
|
||||||
wxLogDebug(_T("AudioDisplay::Next: returning"));
|
wxLogDebug(_T("AudioDisplay::Next: returning"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Previous
|
/// @brief Previous
|
||||||
/// @param play
|
/// @param play
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
void AudioDisplay::Prev(bool play) {
|
void AudioDisplay::Prev(bool play) {
|
||||||
wxLogDebug(_T("AudioDisplay::Prev"));
|
wxLogDebug(_T("AudioDisplay::Prev"));
|
||||||
// Karaoke
|
// Karaoke
|
||||||
|
@ -2479,12 +2338,9 @@ void AudioDisplay::Prev(bool play) {
|
||||||
wxLogDebug(_T("AudioDisplay::Prev: returning"));
|
wxLogDebug(_T("AudioDisplay::Prev: returning"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Gets syllable at x position
|
/// @brief Gets syllable at x position
|
||||||
/// @param x
|
/// @param x
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
int AudioDisplay::GetSyllableAtX(int x) {
|
int AudioDisplay::GetSyllableAtX(int x) {
|
||||||
if (!karaoke->enabled) return -1;
|
if (!karaoke->enabled) return -1;
|
||||||
int ms = GetMSAtX(x);
|
int ms = GetMSAtX(x);
|
||||||
|
@ -2502,11 +2358,8 @@ int AudioDisplay::GetSyllableAtX(int x) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Focus events
|
/// @brief Focus events
|
||||||
/// @param event
|
/// @param event
|
||||||
///
|
|
||||||
void AudioDisplay::OnGetFocus(wxFocusEvent &event) {
|
void AudioDisplay::OnGetFocus(wxFocusEvent &event) {
|
||||||
if (!hasFocus) {
|
if (!hasFocus) {
|
||||||
hasFocus = true;
|
hasFocus = true;
|
||||||
|
@ -2514,10 +2367,8 @@ void AudioDisplay::OnGetFocus(wxFocusEvent &event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
/// @param event
|
/// @param event
|
||||||
///
|
|
||||||
void AudioDisplay::OnLoseFocus(wxFocusEvent &event) {
|
void AudioDisplay::OnLoseFocus(wxFocusEvent &event) {
|
||||||
if (hasFocus && loaded) {
|
if (hasFocus && loaded) {
|
||||||
hasFocus = false;
|
hasFocus = false;
|
||||||
|
@ -2526,14 +2377,10 @@ void AudioDisplay::OnLoseFocus(wxFocusEvent &event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Update time edit controls
|
/// @brief Update time edit controls
|
||||||
///
|
|
||||||
void AudioDisplay::UpdateTimeEditCtrls() {
|
void AudioDisplay::UpdateTimeEditCtrls() {
|
||||||
grid->editBox->StartTime->SetTime(curStartMS,true);
|
grid->editBox->StartTime->SetTime(curStartMS,true);
|
||||||
grid->editBox->EndTime->SetTime(curEndMS,true);
|
grid->editBox->EndTime->SetTime(curEndMS,true);
|
||||||
grid->editBox->Duration->SetTime(curEndMS-curStartMS,true);
|
grid->editBox->Duration->SetTime(curEndMS-curStartMS,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,6 @@
|
||||||
/// @file dialog_style_manager.cpp
|
/// @file dialog_style_manager.cpp
|
||||||
/// @brief Style Manager dialogue box and partial logic
|
/// @brief Style Manager dialogue box and partial logic
|
||||||
/// @ingroup style_editor
|
/// @ingroup style_editor
|
||||||
///
|
|
||||||
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
@ -61,7 +59,6 @@
|
||||||
/// @brief Constructor
|
/// @brief Constructor
|
||||||
/// @param parent
|
/// @param parent
|
||||||
/// @param _grid
|
/// @param _grid
|
||||||
///
|
|
||||||
DialogStyleManager::DialogStyleManager (wxWindow *parent,SubtitlesGrid *_grid)
|
DialogStyleManager::DialogStyleManager (wxWindow *parent,SubtitlesGrid *_grid)
|
||||||
: wxDialog (parent,-1,_("Styles Manager"),wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE,_T("DialogStylesManager"))
|
: wxDialog (parent,-1,_("Styles Manager"),wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE,_T("DialogStylesManager"))
|
||||||
{
|
{
|
||||||
|
@ -368,7 +365,6 @@ BEGIN_EVENT_TABLE(DialogStyleManager, wxDialog)
|
||||||
EVT_BUTTON(BUTTON_STORAGE_SORT, DialogStyleManager::OnStorageSort)
|
EVT_BUTTON(BUTTON_STORAGE_SORT, DialogStyleManager::OnStorageSort)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
// Events
|
// Events
|
||||||
|
|
||||||
|
@ -1160,8 +1156,6 @@ int DialogStyleManager::lastx = -1;
|
||||||
/// DOCME
|
/// DOCME
|
||||||
int DialogStyleManager::lasty = -1;
|
int DialogStyleManager::lasty = -1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief DialogStyleManagerEvent stuff
|
/// @brief DialogStyleManagerEvent stuff
|
||||||
/// @param ctrl
|
/// @param ctrl
|
||||||
DialogStyleManagerEvent::DialogStyleManagerEvent(DialogStyleManager *ctrl) {
|
DialogStyleManagerEvent::DialogStyleManagerEvent(DialogStyleManager *ctrl) {
|
||||||
|
@ -1171,7 +1165,6 @@ BEGIN_EVENT_TABLE(DialogStyleManagerEvent, wxEvtHandler)
|
||||||
EVT_KEY_DOWN(DialogStyleManagerEvent::OnKeyDown)
|
EVT_KEY_DOWN(DialogStyleManagerEvent::OnKeyDown)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
void DialogStyleManagerEvent::OnKeyDown(wxKeyEvent &event) {
|
void DialogStyleManagerEvent::OnKeyDown(wxKeyEvent &event) {
|
||||||
control->OnKeyDown(event); //we need to access controls, so rather than make the controls public...
|
control->OnKeyDown(event); //we need to access controls, so rather than make the controls public...
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,11 +32,7 @@
|
||||||
/// @file visual_tool.cpp
|
/// @file visual_tool.cpp
|
||||||
/// @brief Base class for visual typesetting functions
|
/// @brief Base class for visual typesetting functions
|
||||||
/// @ingroup visual_ts
|
/// @ingroup visual_ts
|
||||||
///
|
|
||||||
|
|
||||||
|
|
||||||
//////////////
|
|
||||||
// Headers
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#ifndef AGI_PRE
|
#ifndef AGI_PRE
|
||||||
|
@ -83,7 +79,6 @@ VisualTool::VisualTool(VideoDisplay *parent, VideoState const& video)
|
||||||
frame_n = VideoContext::Get()->GetFrameN();
|
frame_n = VideoContext::Get()->GetFrameN();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Features
|
|
||||||
if (CanDrag()) PopulateFeatureList();
|
if (CanDrag()) PopulateFeatureList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,13 +91,11 @@ VisualTool::~VisualTool() {
|
||||||
void VisualTool::OnMouseEvent (wxMouseEvent &event) {
|
void VisualTool::OnMouseEvent (wxMouseEvent &event) {
|
||||||
bool realTime = Options.AsBool(L"Video Visual Realtime");
|
bool realTime = Options.AsBool(L"Video Visual Realtime");
|
||||||
|
|
||||||
// Mouse leaving control
|
|
||||||
if (event.Leaving()) {
|
if (event.Leaving()) {
|
||||||
Update();
|
Update();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clicks
|
|
||||||
leftClick = event.ButtonDown(wxMOUSE_BTN_LEFT);
|
leftClick = event.ButtonDown(wxMOUSE_BTN_LEFT);
|
||||||
leftDClick = event.LeftDClick();
|
leftDClick = event.LeftDClick();
|
||||||
shiftDown = event.m_shiftDown;
|
shiftDown = event.m_shiftDown;
|
||||||
|
@ -115,7 +108,6 @@ void VisualTool::OnMouseEvent (wxMouseEvent &event) {
|
||||||
|
|
||||||
// Drag a feature
|
// Drag a feature
|
||||||
if (CanDrag()) {
|
if (CanDrag()) {
|
||||||
// Populate list if needed
|
|
||||||
if (!dragListOK) {
|
if (!dragListOK) {
|
||||||
PopulateFeatureList();
|
PopulateFeatureList();
|
||||||
dragListOK = true;
|
dragListOK = true;
|
||||||
|
@ -129,25 +121,20 @@ void VisualTool::OnMouseEvent (wxMouseEvent &event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start dragging
|
|
||||||
if (!dragging && leftClick && DragEnabled()) {
|
if (!dragging && leftClick && DragEnabled()) {
|
||||||
// Get a feature
|
|
||||||
curFeature = GetHighlightedFeature();
|
curFeature = GetHighlightedFeature();
|
||||||
if (curFeature != -1) {
|
if (curFeature != -1) {
|
||||||
// Initialize drag
|
|
||||||
InitializeDrag(features[curFeature]);
|
InitializeDrag(features[curFeature]);
|
||||||
if (features[curFeature].lineN != -1) {
|
if (features[curFeature].lineN != -1) {
|
||||||
VideoContext::Get()->grid->editBox->SetToLine(features[curFeature].lineN,true);
|
VideoContext::Get()->grid->editBox->SetToLine(features[curFeature].lineN,true);
|
||||||
VideoContext::Get()->grid->SelectRow(features[curFeature].lineN);
|
VideoContext::Get()->grid->SelectRow(features[curFeature].lineN);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set start value
|
|
||||||
dragStartX = video.x;
|
dragStartX = video.x;
|
||||||
dragStartY = video.y;
|
dragStartY = video.y;
|
||||||
dragOrigX = features[curFeature].x;
|
dragOrigX = features[curFeature].x;
|
||||||
dragOrigY = features[curFeature].y;
|
dragOrigY = features[curFeature].y;
|
||||||
|
|
||||||
// Set flags
|
|
||||||
dragging = true;
|
dragging = true;
|
||||||
parent->CaptureMouse();
|
parent->CaptureMouse();
|
||||||
if (realTime) AssLimitToVisibleFilter::SetFrame(frame_n);
|
if (realTime) AssLimitToVisibleFilter::SetFrame(frame_n);
|
||||||
|
@ -155,7 +142,6 @@ void VisualTool::OnMouseEvent (wxMouseEvent &event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dragging) {
|
if (dragging) {
|
||||||
// Dragging
|
|
||||||
if (event.LeftIsDown()) {
|
if (event.LeftIsDown()) {
|
||||||
features[curFeature].x = (video.x - dragStartX + dragOrigX);
|
features[curFeature].x = (video.x - dragStartX + dragOrigX);
|
||||||
features[curFeature].y = (video.y - dragStartY + dragOrigY);
|
features[curFeature].y = (video.y - dragStartY + dragOrigY);
|
||||||
|
@ -167,47 +153,34 @@ void VisualTool::OnMouseEvent (wxMouseEvent &event) {
|
||||||
features[curFeature].x = dragOrigX;
|
features[curFeature].x = dragOrigX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update drag
|
|
||||||
UpdateDrag(features[curFeature]);
|
UpdateDrag(features[curFeature]);
|
||||||
|
|
||||||
if (realTime) {
|
if (realTime) {
|
||||||
// Commit
|
|
||||||
CommitDrag(features[curFeature]);
|
CommitDrag(features[curFeature]);
|
||||||
Commit();
|
Commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Release
|
|
||||||
else {
|
else {
|
||||||
// Disable limiting
|
|
||||||
if (realTime) AssLimitToVisibleFilter::SetFrame(-1);
|
if (realTime) AssLimitToVisibleFilter::SetFrame(-1);
|
||||||
|
|
||||||
// Commit
|
|
||||||
dragging = false;
|
dragging = false;
|
||||||
CommitDrag(features[curFeature]);
|
CommitDrag(features[curFeature]);
|
||||||
Commit(true);
|
Commit(true);
|
||||||
|
|
||||||
// Clean up
|
|
||||||
curFeature = -1;
|
curFeature = -1;
|
||||||
parent->ReleaseMouse();
|
parent->ReleaseMouse();
|
||||||
parent->SetFocus();
|
parent->SetFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hold
|
// Hold
|
||||||
if (!dragging && CanHold()) {
|
if (!dragging && CanHold()) {
|
||||||
// Start holding
|
|
||||||
if (!holding && event.LeftIsDown() && HoldEnabled()) {
|
if (!holding && event.LeftIsDown() && HoldEnabled()) {
|
||||||
// Get a dialogue
|
|
||||||
curDiag = GetActiveDialogueLine();
|
curDiag = GetActiveDialogueLine();
|
||||||
if (curDiag) {
|
if (curDiag) {
|
||||||
// Initialize Drag
|
|
||||||
InitializeHold();
|
InitializeHold();
|
||||||
|
|
||||||
// Set flags
|
|
||||||
holding = true;
|
holding = true;
|
||||||
parent->CaptureMouse();
|
parent->CaptureMouse();
|
||||||
if (realTime) AssLimitToVisibleFilter::SetFrame(frame_n);
|
if (realTime) AssLimitToVisibleFilter::SetFrame(frame_n);
|
||||||
|
@ -215,29 +188,21 @@ void VisualTool::OnMouseEvent (wxMouseEvent &event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (holding) {
|
if (holding) {
|
||||||
// Holding
|
|
||||||
if (event.LeftIsDown()) {
|
if (event.LeftIsDown()) {
|
||||||
// Update drag
|
|
||||||
UpdateHold();
|
UpdateHold();
|
||||||
|
|
||||||
if (realTime) {
|
if (realTime) {
|
||||||
// Commit
|
|
||||||
CommitHold();
|
CommitHold();
|
||||||
Commit();
|
Commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Release
|
|
||||||
else {
|
else {
|
||||||
// Disable limiting
|
|
||||||
if (realTime) AssLimitToVisibleFilter::SetFrame(-1);
|
if (realTime) AssLimitToVisibleFilter::SetFrame(-1);
|
||||||
|
|
||||||
// Commit
|
|
||||||
holding = false;
|
holding = false;
|
||||||
CommitHold();
|
CommitHold();
|
||||||
Commit(true);
|
Commit(true);
|
||||||
|
|
||||||
// Clean up
|
|
||||||
curDiag = NULL;
|
curDiag = NULL;
|
||||||
parent->ReleaseMouse();
|
parent->ReleaseMouse();
|
||||||
parent->SetFocus();
|
parent->SetFocus();
|
||||||
|
@ -245,31 +210,18 @@ void VisualTool::OnMouseEvent (wxMouseEvent &event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update
|
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Commit
|
/// @brief Commit
|
||||||
/// @param full
|
/// @param full
|
||||||
void VisualTool::Commit(bool full) {
|
void VisualTool::Commit(bool full) {
|
||||||
// Get grid
|
|
||||||
SubtitlesGrid *grid = VideoContext::Get()->grid;
|
SubtitlesGrid *grid = VideoContext::Get()->grid;
|
||||||
|
|
||||||
// See if anything actually changed
|
|
||||||
// Fix by jfs: Only if not doing a full commit. Not sure why, but this avoids bug #532
|
|
||||||
if (!full) {
|
|
||||||
AssDialogue *diag = grid->GetDialogue(grid->editBox->linen);
|
|
||||||
if (diag && grid->editBox->TextEdit->GetText() == diag->Text) return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Commit changes
|
|
||||||
grid->editBox->CommitText();
|
|
||||||
if (full) grid->ass->FlagAsModified(_("visual typesetting"));
|
if (full) grid->ass->FlagAsModified(_("visual typesetting"));
|
||||||
grid->CommitChanges(false,!full);
|
grid->CommitChanges(false,!full);
|
||||||
|
grid->editBox->Update(false, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Get active dialogue line
|
/// @brief Get active dialogue line
|
||||||
/// @return
|
/// @return
|
||||||
AssDialogue* VisualTool::GetActiveDialogueLine() {
|
AssDialogue* VisualTool::GetActiveDialogueLine() {
|
||||||
|
@ -281,7 +233,6 @@ AssDialogue* VisualTool::GetActiveDialogueLine() {
|
||||||
int f1 = VFR_Output.GetFrameAtTime(diag->Start.GetMS(),true);
|
int f1 = VFR_Output.GetFrameAtTime(diag->Start.GetMS(),true);
|
||||||
int f2 = VFR_Output.GetFrameAtTime(diag->End.GetMS(),false);
|
int f2 = VFR_Output.GetFrameAtTime(diag->End.GetMS(),false);
|
||||||
|
|
||||||
// Invisible
|
|
||||||
if (f1 > frame_n || f2 < frame_n) return NULL;
|
if (f1 > frame_n || f2 < frame_n) return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,17 +255,14 @@ int VisualTool::GetHighlightedFeature() {
|
||||||
|
|
||||||
/// @brief Draw all features
|
/// @brief Draw all features
|
||||||
void VisualTool::DrawAllFeatures() {
|
void VisualTool::DrawAllFeatures() {
|
||||||
// Populate list, if needed
|
|
||||||
if (!dragListOK) {
|
if (!dragListOK) {
|
||||||
PopulateFeatureList();
|
PopulateFeatureList();
|
||||||
dragListOK = true;
|
dragListOK = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get feature that mouse is over
|
|
||||||
int mouseOver = curFeature;
|
int mouseOver = curFeature;
|
||||||
if (curFeature == -1) mouseOver = GetHighlightedFeature();
|
if (curFeature == -1) mouseOver = GetHighlightedFeature();
|
||||||
|
|
||||||
// Draw features
|
|
||||||
for (size_t i=0;i<features.size();i++) {
|
for (size_t i=0;i<features.size();i++) {
|
||||||
SetFillColour(colour[(signed)i == mouseOver ? 2 : 1],0.6f);
|
SetFillColour(colour[(signed)i == mouseOver ? 2 : 1],0.6f);
|
||||||
SetLineColour(colour[0],1.0f,2);
|
SetLineColour(colour[0],1.0f,2);
|
||||||
|
@ -345,7 +293,6 @@ void VisualTool::GetLinePosition(AssDialogue *diag,int &x, int &y) {
|
||||||
/// @param orgx
|
/// @param orgx
|
||||||
/// @param orgy
|
/// @param orgy
|
||||||
void VisualTool::GetLinePosition(AssDialogue *diag,int &x, int &y, int &orgx, int &orgy) {
|
void VisualTool::GetLinePosition(AssDialogue *diag,int &x, int &y, int &orgx, int &orgy) {
|
||||||
// No dialogue
|
|
||||||
if (!diag) {
|
if (!diag) {
|
||||||
x = INT_MIN;
|
x = INT_MIN;
|
||||||
y = INT_MIN;
|
y = INT_MIN;
|
||||||
|
@ -354,12 +301,10 @@ void VisualTool::GetLinePosition(AssDialogue *diag,int &x, int &y, int &orgx, in
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default values
|
|
||||||
int margin[4];
|
int margin[4];
|
||||||
for (int i=0;i<4;i++) margin[i] = diag->Margin[i];
|
for (int i=0;i<4;i++) margin[i] = diag->Margin[i];
|
||||||
int align = 2;
|
int align = 2;
|
||||||
|
|
||||||
// Get style
|
|
||||||
AssStyle *style = VideoContext::Get()->grid->ass->GetStyle(diag->Style);
|
AssStyle *style = VideoContext::Get()->grid->ass->GetStyle(diag->Style);
|
||||||
if (style) {
|
if (style) {
|
||||||
align = style->alignment;
|
align = style->alignment;
|
||||||
|
@ -368,7 +313,6 @@ void VisualTool::GetLinePosition(AssDialogue *diag,int &x, int &y, int &orgx, in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Script size
|
|
||||||
int sw,sh;
|
int sw,sh;
|
||||||
VideoContext::Get()->GetScriptSize(sw,sh);
|
VideoContext::Get()->GetScriptSize(sw,sh);
|
||||||
|
|
||||||
|
@ -581,8 +525,6 @@ void VisualTool::GetLineScale(AssDialogue *diag,float &scalX,float &scalY) {
|
||||||
diag->ClearBlocks();
|
diag->ClearBlocks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Get line's clip
|
/// @brief Get line's clip
|
||||||
/// @param diag
|
/// @param diag
|
||||||
/// @param x1
|
/// @param x1
|
||||||
|
@ -636,8 +578,6 @@ void VisualTool::GetLineClip(AssDialogue *diag,int &x1,int &y1,int &x2,int &y2,b
|
||||||
parent->FromScriptCoords(&x2, &y2);
|
parent->FromScriptCoords(&x2, &y2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Get line vector clip, if it exists
|
/// @brief Get line vector clip, if it exists
|
||||||
/// @param diag
|
/// @param diag
|
||||||
/// @param scale
|
/// @param scale
|
||||||
|
@ -687,7 +627,46 @@ wxString VisualTool::GetLineVectorClip(AssDialogue *diag,int &scale,bool &invers
|
||||||
/// @brief Set override
|
/// @brief Set override
|
||||||
/// @param tag
|
/// @param tag
|
||||||
/// @param value
|
/// @param value
|
||||||
void VisualTool::SetOverride(wxString tag,wxString value) {
|
void VisualTool::SetOverride(AssDialogue* line, wxString tag, wxString value) {
|
||||||
VideoContext::Get()->grid->editBox->SetOverride(tag,value,0,false);
|
if (!line) return;
|
||||||
//parent->SetFocus();
|
|
||||||
|
wxString removeTag;
|
||||||
|
if (tag == L"\\1c") removeTag = L"\\c";
|
||||||
|
else if (tag == L"\\fr") removeTag = L"\\frz";
|
||||||
|
else if (tag == L"\\pos") removeTag = L"\\move";
|
||||||
|
else if (tag == L"\\move") removeTag = L"\\pos";
|
||||||
|
else if (tag == L"\\clip") removeTag = L"\\iclip";
|
||||||
|
else if (tag == L"\\iclip") removeTag = L"\\clip";
|
||||||
|
|
||||||
|
wxString insert = tag + value;
|
||||||
|
|
||||||
|
// Get block at start
|
||||||
|
line->ParseASSTags();
|
||||||
|
AssDialogueBlock *block = line->Blocks.at(0);
|
||||||
|
|
||||||
|
// Get current block as plain or override
|
||||||
|
AssDialogueBlockPlain *plain = dynamic_cast<AssDialogueBlockPlain*>(block);
|
||||||
|
AssDialogueBlockOverride *ovr = dynamic_cast<AssDialogueBlockOverride*>(block);
|
||||||
|
|
||||||
|
if (plain) {
|
||||||
|
line->Text = L"{" + insert + L"}" + line->Text;
|
||||||
|
}
|
||||||
|
else if (ovr) {
|
||||||
|
ovr->text += insert;
|
||||||
|
ovr->ParseTags();
|
||||||
|
|
||||||
|
// Remove old of same
|
||||||
|
for (size_t i = 0; i < ovr->Tags.size() - 1; i++) {
|
||||||
|
wxString name = ovr->Tags.at(i)->Name;
|
||||||
|
if (tag == name || removeTag == name) {
|
||||||
|
delete ovr->Tags.at(i);
|
||||||
|
ovr->Tags.erase(ovr->Tags.begin() + i);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
line->UpdateText();
|
||||||
|
}
|
||||||
|
|
||||||
|
parent->SetFocus();
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,12 +32,9 @@
|
||||||
/// @file visual_tool.h
|
/// @file visual_tool.h
|
||||||
/// @see visual_tool.cpp
|
/// @see visual_tool.cpp
|
||||||
/// @ingroup visual_ts
|
/// @ingroup visual_ts
|
||||||
///
|
|
||||||
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
///////////
|
///////////
|
||||||
// Headers
|
// Headers
|
||||||
#ifndef AGI_PRE
|
#ifndef AGI_PRE
|
||||||
|
@ -51,7 +48,6 @@
|
||||||
#include "gl_wrap.h"
|
#include "gl_wrap.h"
|
||||||
#include "visual_feature.h"
|
#include "visual_feature.h"
|
||||||
|
|
||||||
|
|
||||||
//////////////
|
//////////////
|
||||||
// Prototypes
|
// Prototypes
|
||||||
class VideoDisplay;
|
class VideoDisplay;
|
||||||
|
@ -59,20 +55,15 @@ class AssDialogue;
|
||||||
class VisualTool;
|
class VisualTool;
|
||||||
struct VideoState;
|
struct VideoState;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
#define VISUAL_SUB_TOOL_START 1300
|
#define VISUAL_SUB_TOOL_START 1300
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
#define VISUAL_SUB_TOOL_END (VISUAL_SUB_TOOL_START+100)
|
#define VISUAL_SUB_TOOL_END (VISUAL_SUB_TOOL_START+100)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
/// @class VisualTool
|
/// @class VisualTool
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
///
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
class VisualTool : public OpenGLWrapper {
|
class VisualTool : public OpenGLWrapper {
|
||||||
int GetHighlightedFeature();
|
int GetHighlightedFeature();
|
||||||
|
@ -83,14 +74,12 @@ protected:
|
||||||
/// DOCME
|
/// DOCME
|
||||||
static const wxColour colour[4];
|
static const wxColour colour[4];
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
bool holding;
|
bool holding;
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
AssDialogue *curDiag;
|
AssDialogue *curDiag;
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
bool dragging;
|
bool dragging;
|
||||||
|
|
||||||
|
@ -112,13 +101,11 @@ protected:
|
||||||
/// DOCME
|
/// DOCME
|
||||||
bool dragListOK;
|
bool dragListOK;
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
int frame_n;
|
int frame_n;
|
||||||
|
|
||||||
VideoState const& video;
|
VideoState const& video;
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
bool leftClick;
|
bool leftClick;
|
||||||
|
|
||||||
|
@ -141,8 +128,7 @@ protected:
|
||||||
void GetLineScale(AssDialogue *diag,float &scalX,float &scalY);
|
void GetLineScale(AssDialogue *diag,float &scalX,float &scalY);
|
||||||
void GetLineClip(AssDialogue *diag,int &x1,int &y1,int &x2,int &y2,bool &inverse);
|
void GetLineClip(AssDialogue *diag,int &x1,int &y1,int &x2,int &y2,bool &inverse);
|
||||||
wxString GetLineVectorClip(AssDialogue *diag,int &scale,bool &inverse);
|
wxString GetLineVectorClip(AssDialogue *diag,int &scale,bool &inverse);
|
||||||
void SetOverride(wxString tag,wxString value);
|
void SetOverride(AssDialogue* line, wxString tag, wxString value);
|
||||||
|
|
||||||
|
|
||||||
AssDialogue *GetActiveDialogueLine();
|
AssDialogue *GetActiveDialogueLine();
|
||||||
void DrawAllFeatures();
|
void DrawAllFeatures();
|
||||||
|
@ -171,7 +157,6 @@ protected:
|
||||||
///
|
///
|
||||||
virtual void CommitHold() {}
|
virtual void CommitHold() {}
|
||||||
|
|
||||||
|
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
|
@ -206,7 +191,6 @@ protected:
|
||||||
///
|
///
|
||||||
virtual void ClickedFeature(VisualDraggableFeature &feature) {}
|
virtual void ClickedFeature(VisualDraggableFeature &feature) {}
|
||||||
|
|
||||||
|
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
///
|
///
|
||||||
virtual void DoRefresh() {}
|
virtual void DoRefresh() {}
|
||||||
|
@ -226,6 +210,3 @@ public:
|
||||||
virtual ~VisualTool();
|
virtual ~VisualTool();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,6 @@
|
||||||
/// @file visual_tool_clip.cpp
|
/// @file visual_tool_clip.cpp
|
||||||
/// @brief Rectangular clipping visual typesetting tool
|
/// @brief Rectangular clipping visual typesetting tool
|
||||||
/// @ingroup visual_ts
|
/// @ingroup visual_ts
|
||||||
///
|
|
||||||
|
|
||||||
|
|
||||||
///////////
|
///////////
|
||||||
// Headers
|
// Headers
|
||||||
|
@ -47,10 +45,8 @@
|
||||||
#include "video_display.h"
|
#include "video_display.h"
|
||||||
#include "visual_tool_clip.h"
|
#include "visual_tool_clip.h"
|
||||||
|
|
||||||
|
|
||||||
/// @brief Constructor
|
/// @brief Constructor
|
||||||
/// @param _parent
|
/// @param _parent
|
||||||
///
|
|
||||||
VisualToolClip::VisualToolClip(VideoDisplay *parent, VideoState const& video, wxToolBar *)
|
VisualToolClip::VisualToolClip(VideoDisplay *parent, VideoState const& video, wxToolBar *)
|
||||||
: VisualTool(parent, video)
|
: VisualTool(parent, video)
|
||||||
, curX1(0)
|
, curX1(0)
|
||||||
|
@ -114,10 +110,7 @@ void VisualToolClip::InitializeHold() {
|
||||||
curDiag->StripTag(L"\\iclip");
|
curDiag->StripTag(L"\\iclip");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Update hold
|
/// @brief Update hold
|
||||||
///
|
|
||||||
void VisualToolClip::UpdateHold() {
|
void VisualToolClip::UpdateHold() {
|
||||||
// Coordinates
|
// Coordinates
|
||||||
curX1 = startX;
|
curX1 = startX;
|
||||||
|
@ -139,10 +132,7 @@ void VisualToolClip::UpdateHold() {
|
||||||
if (CanDrag()) PopulateFeatureList();
|
if (CanDrag()) PopulateFeatureList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Commit hold
|
/// @brief Commit hold
|
||||||
///
|
|
||||||
void VisualToolClip::CommitHold() {
|
void VisualToolClip::CommitHold() {
|
||||||
int x1 = curX1;
|
int x1 = curX1;
|
||||||
int x2 = curX2;
|
int x2 = curX2;
|
||||||
|
@ -153,10 +143,7 @@ void VisualToolClip::CommitHold() {
|
||||||
SetOverride(GetActiveDialogueLine(), inverse ? L"\\iclip" : L"\\clip",wxString::Format(L"(%i,%i,%i,%i)",x1,y1,x2,y2));
|
SetOverride(GetActiveDialogueLine(), inverse ? L"\\iclip" : L"\\clip",wxString::Format(L"(%i,%i,%i,%i)",x1,y1,x2,y2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Populate feature list
|
/// @brief Populate feature list
|
||||||
///
|
|
||||||
void VisualToolClip::PopulateFeatureList() {
|
void VisualToolClip::PopulateFeatureList() {
|
||||||
// Clear
|
// Clear
|
||||||
if (features.size() != 4) {
|
if (features.size() != 4) {
|
||||||
|
@ -202,22 +189,16 @@ void VisualToolClip::PopulateFeatureList() {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Initialize
|
/// @brief Initialize
|
||||||
/// @param feature
|
/// @param feature
|
||||||
///
|
|
||||||
void VisualToolClip::InitializeDrag(VisualDraggableFeature &feature) {
|
void VisualToolClip::InitializeDrag(VisualDraggableFeature &feature) {
|
||||||
curDiag = GetActiveDialogueLine();
|
curDiag = GetActiveDialogueLine();
|
||||||
curDiag->StripTag(L"\\clip");
|
curDiag->StripTag(L"\\clip");
|
||||||
curDiag->StripTag(L"\\iclip");
|
curDiag->StripTag(L"\\iclip");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Update drag
|
/// @brief Update drag
|
||||||
/// @param feature
|
/// @param feature
|
||||||
///
|
|
||||||
void VisualToolClip::UpdateDrag(VisualDraggableFeature &feature) {
|
void VisualToolClip::UpdateDrag(VisualDraggableFeature &feature) {
|
||||||
// Update brothers
|
// Update brothers
|
||||||
features[feature.brother[0]].y = feature.y;
|
features[feature.brother[0]].y = feature.y;
|
||||||
|
@ -234,11 +215,8 @@ void VisualToolClip::UpdateDrag(VisualDraggableFeature &feature) {
|
||||||
if (curY1 > curY2) IntSwap(curY1,curY2);
|
if (curY1 > curY2) IntSwap(curY1,curY2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Done dragging
|
/// @brief Done dragging
|
||||||
/// @param feature
|
/// @param feature
|
||||||
///
|
|
||||||
void VisualToolClip::CommitDrag(VisualDraggableFeature &feature) {
|
void VisualToolClip::CommitDrag(VisualDraggableFeature &feature) {
|
||||||
CommitHold();
|
CommitHold();
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,8 +32,6 @@
|
||||||
/// @file visual_tool_cross.cpp
|
/// @file visual_tool_cross.cpp
|
||||||
/// @brief Crosshair double-click-to-position visual typesetting tool
|
/// @brief Crosshair double-click-to-position visual typesetting tool
|
||||||
/// @ingroup visual_ts
|
/// @ingroup visual_ts
|
||||||
///
|
|
||||||
|
|
||||||
|
|
||||||
///////////
|
///////////
|
||||||
// Headers
|
// Headers
|
||||||
|
@ -47,10 +45,8 @@
|
||||||
#include "video_display.h"
|
#include "video_display.h"
|
||||||
#include "visual_tool_cross.h"
|
#include "visual_tool_cross.h"
|
||||||
|
|
||||||
|
|
||||||
/// @brief Constructor
|
/// @brief Constructor
|
||||||
/// @param _parent
|
/// @param _parent
|
||||||
///
|
|
||||||
VisualToolCross::VisualToolCross(VideoDisplay *parent, VideoState const& video, wxToolBar *)
|
VisualToolCross::VisualToolCross(VideoDisplay *parent, VideoState const& video, wxToolBar *)
|
||||||
: VisualTool(parent, video)
|
: VisualTool(parent, video)
|
||||||
{
|
{
|
||||||
|
@ -58,7 +54,6 @@ VisualToolCross::VisualToolCross(VideoDisplay *parent, VideoState const& video,
|
||||||
VisualToolCross::~VisualToolCross() { }
|
VisualToolCross::~VisualToolCross() { }
|
||||||
|
|
||||||
/// @brief Update
|
/// @brief Update
|
||||||
///
|
|
||||||
void VisualToolCross::Update() {
|
void VisualToolCross::Update() {
|
||||||
// Position
|
// Position
|
||||||
if (leftDClick) {
|
if (leftDClick) {
|
||||||
|
@ -66,15 +61,13 @@ void VisualToolCross::Update() {
|
||||||
int vy = video.y;
|
int vy = video.y;
|
||||||
parent->ToScriptCoords(&vx, &vy);
|
parent->ToScriptCoords(&vx, &vy);
|
||||||
SubtitlesGrid *grid = VideoContext::Get()->grid;
|
SubtitlesGrid *grid = VideoContext::Get()->grid;
|
||||||
SetOverride(L"\\pos",wxString::Format(L"(%i,%i)",vx,vy));
|
SetOverride(GetActiveDialogueLine(), L"\\pos",wxString::Format(L"(%i,%i)",vx,vy));
|
||||||
grid->editBox->CommitText();
|
|
||||||
grid->ass->FlagAsModified(_("positioning"));
|
grid->ass->FlagAsModified(_("positioning"));
|
||||||
grid->CommitChanges(false,true);
|
grid->CommitChanges(false,true);
|
||||||
|
grid->editBox->Update(false, true, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Draw
|
/// @brief Draw
|
||||||
void VisualToolCross::Draw() {
|
void VisualToolCross::Draw() {
|
||||||
// Draw cross
|
// Draw cross
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
/// @file visual_tool_drag.cpp
|
/// @file visual_tool_drag.cpp
|
||||||
/// @brief Position all visible subtitles by dragging visual typesetting tool
|
/// @brief Position all visible subtitles by dragging visual typesetting tool
|
||||||
/// @ingroup visual_ts
|
/// @ingroup visual_ts
|
||||||
///
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
@ -51,12 +50,9 @@ enum {
|
||||||
BUTTON_TOGGLE_MOVE = VISUAL_SUB_TOOL_START
|
BUTTON_TOGGLE_MOVE = VISUAL_SUB_TOOL_START
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Constructor
|
/// @brief Constructor
|
||||||
/// @param _parent
|
/// @param _parent
|
||||||
/// @param toolBar
|
/// @param toolBar
|
||||||
///
|
|
||||||
VisualToolDrag::VisualToolDrag(VideoDisplay *parent, VideoState const& video, wxToolBar * toolBar)
|
VisualToolDrag::VisualToolDrag(VideoDisplay *parent, VideoState const& video, wxToolBar * toolBar)
|
||||||
: VisualTool(parent, video)
|
: VisualTool(parent, video)
|
||||||
, toolBar(toolBar)
|
, toolBar(toolBar)
|
||||||
|
@ -67,11 +63,8 @@ VisualToolDrag::VisualToolDrag(VideoDisplay *parent, VideoState const& video, wx
|
||||||
toolBar->Show(true);
|
toolBar->Show(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Update toggle buttons
|
/// @brief Update toggle buttons
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
void VisualToolDrag::UpdateToggleButtons() {
|
void VisualToolDrag::UpdateToggleButtons() {
|
||||||
// Check which bitmap to use
|
// Check which bitmap to use
|
||||||
bool toMove = true;
|
bool toMove = true;
|
||||||
|
@ -96,8 +89,6 @@ void VisualToolDrag::UpdateToggleButtons() {
|
||||||
toggleMoveOnMove = toMove;
|
toggleMoveOnMove = toMove;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Toggle button pressed
|
/// @brief Toggle button pressed
|
||||||
/// @param event
|
/// @param event
|
||||||
/// @return
|
/// @return
|
||||||
|
@ -117,8 +108,8 @@ void VisualToolDrag::OnSubTool(wxCommandEvent &event) {
|
||||||
parent->ToScriptCoords(&x2, &y2);
|
parent->ToScriptCoords(&x2, &y2);
|
||||||
|
|
||||||
// Replace tag
|
// Replace tag
|
||||||
if (hasMove) SetOverride(L"\\pos",wxString::Format(L"(%i,%i)",x1,y1));
|
if (hasMove) SetOverride(line, L"\\pos",wxString::Format(L"(%i,%i)",x1,y1));
|
||||||
else SetOverride(L"\\move",wxString::Format(L"(%i,%i,%i,%i,%i,%i)",x1,y1,x1,y1,0,line->End.GetMS() - line->Start.GetMS()));
|
else SetOverride(line, L"\\move",wxString::Format(L"(%i,%i,%i,%i,%i,%i)",x1,y1,x1,y1,0,line->End.GetMS() - line->Start.GetMS()));
|
||||||
Commit(true);
|
Commit(true);
|
||||||
|
|
||||||
// Update display
|
// Update display
|
||||||
|
@ -126,16 +117,12 @@ void VisualToolDrag::OnSubTool(wxCommandEvent &event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Refresh
|
/// @brief Refresh
|
||||||
///
|
|
||||||
void VisualToolDrag::DoRefresh() {
|
void VisualToolDrag::DoRefresh() {
|
||||||
UpdateToggleButtons();
|
UpdateToggleButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Draw
|
/// @brief Draw
|
||||||
///
|
|
||||||
void VisualToolDrag::Draw() {
|
void VisualToolDrag::Draw() {
|
||||||
DrawAllFeatures();
|
DrawAllFeatures();
|
||||||
|
|
||||||
|
@ -189,10 +176,7 @@ void VisualToolDrag::Draw() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Populate list
|
/// @brief Populate list
|
||||||
///
|
|
||||||
void VisualToolDrag::PopulateFeatureList() {
|
void VisualToolDrag::PopulateFeatureList() {
|
||||||
// Clear features
|
// Clear features
|
||||||
features.clear();
|
features.clear();
|
||||||
|
@ -271,25 +255,21 @@ void VisualToolDrag::PopulateFeatureList() {
|
||||||
|
|
||||||
/// @brief Update drag
|
/// @brief Update drag
|
||||||
/// @param feature
|
/// @param feature
|
||||||
///
|
|
||||||
void VisualToolDrag::UpdateDrag(VisualDraggableFeature &feature) {
|
void VisualToolDrag::UpdateDrag(VisualDraggableFeature &feature) {
|
||||||
// Update "value" to reflect the time of the frame in which the feature is being dragged
|
// Update "value" to reflect the time of the frame in which the feature is being dragged
|
||||||
int time = VFR_Output.GetTimeAtFrame(frame_n,true,true);
|
int time = VFR_Output.GetTimeAtFrame(frame_n,true,true);
|
||||||
feature.value = MID(0,time - feature.line->Start.GetMS(),feature.line->End.GetMS()-feature.line->Start.GetMS());
|
feature.value = MID(0,time - feature.line->Start.GetMS(),feature.line->End.GetMS()-feature.line->Start.GetMS());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Commit drag
|
/// @brief Commit drag
|
||||||
/// @param feature
|
/// @param feature
|
||||||
///
|
|
||||||
void VisualToolDrag::CommitDrag(VisualDraggableFeature &feature) {
|
void VisualToolDrag::CommitDrag(VisualDraggableFeature &feature) {
|
||||||
// Origin
|
// Origin
|
||||||
if (feature.type == DRAG_BIG_TRIANGLE) {
|
if (feature.type == DRAG_BIG_TRIANGLE) {
|
||||||
int x = feature.x;
|
int x = feature.x;
|
||||||
int y = feature.y;
|
int y = feature.y;
|
||||||
parent->ToScriptCoords(&x, &y);
|
parent->ToScriptCoords(&x, &y);
|
||||||
SetOverride(L"\\org",wxString::Format(L"(%i,%i)",x,y));
|
SetOverride(feature.line, L"\\org",wxString::Format(L"(%i,%i)",x,y));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Position
|
// Position
|
||||||
|
@ -297,7 +277,7 @@ void VisualToolDrag::CommitDrag(VisualDraggableFeature &feature) {
|
||||||
int x = feature.x;
|
int x = feature.x;
|
||||||
int y = feature.y;
|
int y = feature.y;
|
||||||
parent->ToScriptCoords(&x, &y);
|
parent->ToScriptCoords(&x, &y);
|
||||||
SetOverride(L"\\pos",wxString::Format(L"(%i,%i)",x,y));
|
SetOverride(feature.line, L"\\pos",wxString::Format(L"(%i,%i)",x,y));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move
|
// Move
|
||||||
|
@ -316,8 +296,6 @@ void VisualToolDrag::CommitDrag(VisualDraggableFeature &feature) {
|
||||||
parent->ToScriptCoords(&x2, &y2);
|
parent->ToScriptCoords(&x2, &y2);
|
||||||
|
|
||||||
// Set override
|
// Set override
|
||||||
SetOverride(L"\\move", wxString::Format(L"(%i,%i,%i,%i,%i,%i)", x1, y1, x2, y2, p1->value, p2->value));
|
SetOverride(feature.line, L"\\move", wxString::Format(L"(%i,%i,%i,%i,%i,%i)", x1, y1, x2, y2, p1->value, p2->value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
/// @file visual_tool_rotatexy.cpp
|
/// @file visual_tool_rotatexy.cpp
|
||||||
/// @brief 3D rotation in X/Y axes visual typesetting tool
|
/// @brief 3D rotation in X/Y axes visual typesetting tool
|
||||||
/// @ingroup visual_ts
|
/// @ingroup visual_ts
|
||||||
///
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
@ -48,10 +47,8 @@
|
||||||
#include "video_display.h"
|
#include "video_display.h"
|
||||||
#include "visual_tool_rotatexy.h"
|
#include "visual_tool_rotatexy.h"
|
||||||
|
|
||||||
|
|
||||||
/// @brief Constructor
|
/// @brief Constructor
|
||||||
/// @param _parent
|
/// @param _parent
|
||||||
///
|
|
||||||
VisualToolRotateXY::VisualToolRotateXY(VideoDisplay *parent, VideoState const& video, wxToolBar *)
|
VisualToolRotateXY::VisualToolRotateXY(VideoDisplay *parent, VideoState const& video, wxToolBar *)
|
||||||
: VisualTool(parent, video)
|
: VisualTool(parent, video)
|
||||||
{
|
{
|
||||||
|
@ -168,10 +165,7 @@ void VisualToolRotateXY::Draw() {
|
||||||
glShadeModel(GL_FLAT);
|
glShadeModel(GL_FLAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Start holding
|
/// @brief Start holding
|
||||||
///
|
|
||||||
void VisualToolRotateXY::InitializeHold() {
|
void VisualToolRotateXY::InitializeHold() {
|
||||||
GetLinePosition(curDiag,odx,ody,orgx,orgy);
|
GetLinePosition(curDiag,odx,ody,orgx,orgy);
|
||||||
GetLineRotation(curDiag,origAngleX,origAngleY,rz);
|
GetLineRotation(curDiag,origAngleX,origAngleY,rz);
|
||||||
|
@ -183,10 +177,7 @@ void VisualToolRotateXY::InitializeHold() {
|
||||||
curDiag->StripTag(L"\\fry");
|
curDiag->StripTag(L"\\fry");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Update hold
|
/// @brief Update hold
|
||||||
///
|
|
||||||
void VisualToolRotateXY::UpdateHold() {
|
void VisualToolRotateXY::UpdateHold() {
|
||||||
// Find screen angles
|
// Find screen angles
|
||||||
float screenAngleX = (orgy-video.x)*2.0;
|
float screenAngleX = (orgy-video.x)*2.0;
|
||||||
|
@ -213,19 +204,14 @@ void VisualToolRotateXY::UpdateHold() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Commit hold
|
/// @brief Commit hold
|
||||||
///
|
|
||||||
void VisualToolRotateXY::CommitHold() {
|
void VisualToolRotateXY::CommitHold() {
|
||||||
SetOverride(L"\\frx",wxString::Format(L"(%0.3g)",curAngleX));
|
AssDialogue* line = GetActiveDialogueLine();
|
||||||
SetOverride(L"\\fry",wxString::Format(L"(%0.3g)",curAngleY));
|
SetOverride(line, L"\\frx",wxString::Format(L"(%0.3g)",curAngleX));
|
||||||
|
SetOverride(line, L"\\fry",wxString::Format(L"(%0.3g)",curAngleY));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Get \\org pivot
|
/// @brief Get \\org pivot
|
||||||
///
|
|
||||||
void VisualToolRotateXY::PopulateFeatureList() {
|
void VisualToolRotateXY::PopulateFeatureList() {
|
||||||
// Get line
|
// Get line
|
||||||
curDiag = GetActiveDialogueLine();
|
curDiag = GetActiveDialogueLine();
|
||||||
|
@ -240,36 +226,26 @@ void VisualToolRotateXY::PopulateFeatureList() {
|
||||||
feat.type = DRAG_BIG_TRIANGLE;
|
feat.type = DRAG_BIG_TRIANGLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Update dragging of \\org
|
/// @brief Update dragging of \\org
|
||||||
/// @param feature
|
/// @param feature
|
||||||
///
|
|
||||||
void VisualToolRotateXY::UpdateDrag(VisualDraggableFeature &feature) {
|
void VisualToolRotateXY::UpdateDrag(VisualDraggableFeature &feature) {
|
||||||
orgx = feature.x;
|
orgx = feature.x;
|
||||||
orgy = feature.y;
|
orgy = feature.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Commit dragging of \\org
|
/// @brief Commit dragging of \\org
|
||||||
/// @param feature
|
/// @param feature
|
||||||
///
|
|
||||||
void VisualToolRotateXY::CommitDrag(VisualDraggableFeature &feature) {
|
void VisualToolRotateXY::CommitDrag(VisualDraggableFeature &feature) {
|
||||||
int x = feature.x;
|
int x = feature.x;
|
||||||
int y = feature.y;
|
int y = feature.y;
|
||||||
parent->ToScriptCoords(&x, &y);
|
parent->ToScriptCoords(&x, &y);
|
||||||
SetOverride(L"\\org",wxString::Format(L"(%i,%i)",x,y));
|
SetOverride(feature.line, L"\\org",wxString::Format(L"(%i,%i)",x,y));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Refresh
|
/// @brief Refresh
|
||||||
///
|
|
||||||
void VisualToolRotateXY::DoRefresh() {
|
void VisualToolRotateXY::DoRefresh() {
|
||||||
AssDialogue *line = GetActiveDialogueLine();
|
AssDialogue *line = GetActiveDialogueLine();
|
||||||
GetLinePosition(line,odx,ody,orgx,orgy);
|
GetLinePosition(line,odx,ody,orgx,orgy);
|
||||||
GetLineRotation(line,curAngleX,curAngleY,rz);
|
GetLineRotation(line,curAngleX,curAngleY,rz);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
/// @file visual_tool_rotatez.cpp
|
/// @file visual_tool_rotatez.cpp
|
||||||
/// @brief 2D rotation in Z axis visual typesetting tool
|
/// @brief 2D rotation in Z axis visual typesetting tool
|
||||||
/// @ingroup visual_ts
|
/// @ingroup visual_ts
|
||||||
///
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
@ -48,10 +47,8 @@
|
||||||
#include "video_display.h"
|
#include "video_display.h"
|
||||||
#include "visual_tool_rotatez.h"
|
#include "visual_tool_rotatez.h"
|
||||||
|
|
||||||
|
|
||||||
/// @brief Constructor
|
/// @brief Constructor
|
||||||
/// @param _parent
|
/// @param _parent
|
||||||
///
|
|
||||||
VisualToolRotateZ::VisualToolRotateZ(VideoDisplay *parent, VideoState const& video, wxToolBar *)
|
VisualToolRotateZ::VisualToolRotateZ(VideoDisplay *parent, VideoState const& video, wxToolBar *)
|
||||||
: VisualTool(parent, video)
|
: VisualTool(parent, video)
|
||||||
{
|
{
|
||||||
|
@ -153,10 +150,7 @@ void VisualToolRotateZ::Draw() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Start holding
|
/// @brief Start holding
|
||||||
///
|
|
||||||
void VisualToolRotateZ::InitializeHold() {
|
void VisualToolRotateZ::InitializeHold() {
|
||||||
GetLinePosition(curDiag,odx,ody,orgx,orgy);
|
GetLinePosition(curDiag,odx,ody,orgx,orgy);
|
||||||
startAngle = atan2(double(orgy-video.y),double(video.x-orgx)) * 180.0 / 3.1415926535897932;
|
startAngle = atan2(double(orgy-video.y),double(video.x-orgx)) * 180.0 / 3.1415926535897932;
|
||||||
|
@ -166,10 +160,7 @@ void VisualToolRotateZ::InitializeHold() {
|
||||||
curDiag->StripTag(L"\\fr");
|
curDiag->StripTag(L"\\fr");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Update hold
|
/// @brief Update hold
|
||||||
///
|
|
||||||
void VisualToolRotateZ::UpdateHold() {
|
void VisualToolRotateZ::UpdateHold() {
|
||||||
// Find angle
|
// Find angle
|
||||||
float screenAngle = atan2(double(orgy-video.y),double(video.x-orgx)) * 180.0 / 3.1415926535897932;
|
float screenAngle = atan2(double(orgy-video.y),double(video.x-orgx)) * 180.0 / 3.1415926535897932;
|
||||||
|
@ -182,18 +173,12 @@ void VisualToolRotateZ::UpdateHold() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Commit hold
|
/// @brief Commit hold
|
||||||
///
|
|
||||||
void VisualToolRotateZ::CommitHold() {
|
void VisualToolRotateZ::CommitHold() {
|
||||||
SetOverride(L"\\frz",wxString::Format(L"(%0.3g)",curAngle));
|
SetOverride(GetActiveDialogueLine(), L"\\frz",wxString::Format(L"(%0.3g)",curAngle));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Get \\org pivot
|
/// @brief Get \\org pivot
|
||||||
///
|
|
||||||
void VisualToolRotateZ::PopulateFeatureList() {
|
void VisualToolRotateZ::PopulateFeatureList() {
|
||||||
// Get line
|
// Get line
|
||||||
curDiag = GetActiveDialogueLine();
|
curDiag = GetActiveDialogueLine();
|
||||||
|
@ -208,36 +193,26 @@ void VisualToolRotateZ::PopulateFeatureList() {
|
||||||
feat.type = DRAG_BIG_TRIANGLE;
|
feat.type = DRAG_BIG_TRIANGLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Update dragging of \\org
|
/// @brief Update dragging of \\org
|
||||||
/// @param feature
|
/// @param feature
|
||||||
///
|
|
||||||
void VisualToolRotateZ::UpdateDrag(VisualDraggableFeature &feature) {
|
void VisualToolRotateZ::UpdateDrag(VisualDraggableFeature &feature) {
|
||||||
orgx = feature.x;
|
orgx = feature.x;
|
||||||
orgy = feature.y;
|
orgy = feature.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Commit dragging of \\org
|
/// @brief Commit dragging of \\org
|
||||||
/// @param feature
|
/// @param feature
|
||||||
///
|
|
||||||
void VisualToolRotateZ::CommitDrag(VisualDraggableFeature &feature) {
|
void VisualToolRotateZ::CommitDrag(VisualDraggableFeature &feature) {
|
||||||
int x = feature.x;
|
int x = feature.x;
|
||||||
int y = feature.y;
|
int y = feature.y;
|
||||||
parent->ToScriptCoords(&x, &y);
|
parent->ToScriptCoords(&x, &y);
|
||||||
SetOverride(L"\\org",wxString::Format(L"(%i,%i)",x,y));
|
SetOverride(feature.line, L"\\org",wxString::Format(L"(%i,%i)",x,y));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Refresh
|
/// @brief Refresh
|
||||||
///
|
|
||||||
void VisualToolRotateZ::DoRefresh() {
|
void VisualToolRotateZ::DoRefresh() {
|
||||||
AssDialogue *line = GetActiveDialogueLine();
|
AssDialogue *line = GetActiveDialogueLine();
|
||||||
GetLinePosition(line,odx,ody,orgx,orgy);
|
GetLinePosition(line,odx,ody,orgx,orgy);
|
||||||
GetLineRotation(line,rx,ry,curAngle);
|
GetLineRotation(line,rx,ry,curAngle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
/// @file visual_tool_scale.cpp
|
/// @file visual_tool_scale.cpp
|
||||||
/// @brief X/Y scaling visual typesetting tool
|
/// @brief X/Y scaling visual typesetting tool
|
||||||
/// @ingroup visual_ts
|
/// @ingroup visual_ts
|
||||||
///
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
@ -48,10 +47,8 @@
|
||||||
#include "video_display.h"
|
#include "video_display.h"
|
||||||
#include "visual_tool_scale.h"
|
#include "visual_tool_scale.h"
|
||||||
|
|
||||||
|
|
||||||
/// @brief Constructor
|
/// @brief Constructor
|
||||||
/// @param _parent
|
/// @param _parent
|
||||||
///
|
|
||||||
VisualToolScale::VisualToolScale(VideoDisplay *parent, VideoState const& video, wxToolBar *)
|
VisualToolScale::VisualToolScale(VideoDisplay *parent, VideoState const& video, wxToolBar *)
|
||||||
: VisualTool(parent, video)
|
: VisualTool(parent, video)
|
||||||
{
|
{
|
||||||
|
@ -126,10 +123,7 @@ void VisualToolScale::Draw() {
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Start holding
|
/// @brief Start holding
|
||||||
///
|
|
||||||
void VisualToolScale::InitializeHold() {
|
void VisualToolScale::InitializeHold() {
|
||||||
startX = video.x;
|
startX = video.x;
|
||||||
startY = video.y;
|
startY = video.y;
|
||||||
|
@ -140,10 +134,7 @@ void VisualToolScale::InitializeHold() {
|
||||||
curDiag->StripTag(_T("\\fscy"));
|
curDiag->StripTag(_T("\\fscy"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Update hold
|
/// @brief Update hold
|
||||||
///
|
|
||||||
void VisualToolScale::UpdateHold() {
|
void VisualToolScale::UpdateHold() {
|
||||||
using std::max;
|
using std::max;
|
||||||
// Deltas
|
// Deltas
|
||||||
|
@ -165,13 +156,9 @@ void VisualToolScale::UpdateHold() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Commit hold
|
/// @brief Commit hold
|
||||||
///
|
|
||||||
void VisualToolScale::CommitHold() {
|
void VisualToolScale::CommitHold() {
|
||||||
SetOverride(_T("\\fscx"),wxString::Format(L"(%0.3g)",curScaleX));
|
SetOverride(GetActiveDialogueLine(), _T("\\fscx"),wxString::Format(L"(%0.3g)",curScaleX));
|
||||||
SetOverride(_T("\\fscy"),wxString::Format(L"(%0.3g)",curScaleY));
|
SetOverride(GetActiveDialogueLine(), _T("\\fscy"),wxString::Format(L"(%0.3g)",curScaleY));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
/// @file visual_tool_vector_clip.cpp
|
/// @file visual_tool_vector_clip.cpp
|
||||||
/// @brief Vector clipping visual typesetting tool
|
/// @brief Vector clipping visual typesetting tool
|
||||||
/// @ingroup visual_ts
|
/// @ingroup visual_ts
|
||||||
///
|
|
||||||
|
|
||||||
#ifndef AGI_PRE
|
#ifndef AGI_PRE
|
||||||
#include <wx/toolbar.h>
|
#include <wx/toolbar.h>
|
||||||
|
@ -45,7 +44,6 @@
|
||||||
#include "video_display.h"
|
#include "video_display.h"
|
||||||
#include "visual_tool_vector_clip.h"
|
#include "visual_tool_vector_clip.h"
|
||||||
|
|
||||||
|
|
||||||
///////
|
///////
|
||||||
// IDs
|
// IDs
|
||||||
enum {
|
enum {
|
||||||
|
@ -78,12 +76,9 @@ enum {
|
||||||
BUTTON_LAST // Leave this at the end and don't use it
|
BUTTON_LAST // Leave this at the end and don't use it
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Constructor
|
/// @brief Constructor
|
||||||
/// @param parent
|
/// @param parent
|
||||||
/// @param _toolBar
|
/// @param _toolBar
|
||||||
///
|
|
||||||
VisualToolVectorClip::VisualToolVectorClip(VideoDisplay *parent, VideoState const& video, wxToolBar * toolBar)
|
VisualToolVectorClip::VisualToolVectorClip(VideoDisplay *parent, VideoState const& video, wxToolBar * toolBar)
|
||||||
: VisualTool(parent, video), toolBar(toolBar), spline(*parent)
|
: VisualTool(parent, video), toolBar(toolBar), spline(*parent)
|
||||||
{
|
{
|
||||||
|
@ -110,20 +105,14 @@ VisualToolVectorClip::VisualToolVectorClip(VideoDisplay *parent, VideoState cons
|
||||||
if (features.size() == 0) SetMode(1);
|
if (features.size() == 0) SetMode(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Sub-tool pressed
|
/// @brief Sub-tool pressed
|
||||||
/// @param event
|
/// @param event
|
||||||
///
|
|
||||||
void VisualToolVectorClip::OnSubTool(wxCommandEvent &event) {
|
void VisualToolVectorClip::OnSubTool(wxCommandEvent &event) {
|
||||||
SetMode(event.GetId() - BUTTON_DRAG);
|
SetMode(event.GetId() - BUTTON_DRAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Set mode
|
/// @brief Set mode
|
||||||
/// @param _mode
|
/// @param _mode
|
||||||
///
|
|
||||||
void VisualToolVectorClip::SetMode(int _mode) {
|
void VisualToolVectorClip::SetMode(int _mode) {
|
||||||
// Make sure clicked is checked and everything else isn't. (Yes, this is radio behavior, but the separators won't let me use it)
|
// Make sure clicked is checked and everything else isn't. (Yes, this is radio behavior, but the separators won't let me use it)
|
||||||
for (int i=BUTTON_DRAG;i<BUTTON_LAST;i++) {
|
for (int i=BUTTON_DRAG;i<BUTTON_LAST;i++) {
|
||||||
|
@ -213,10 +202,7 @@ void VisualToolVectorClip::Draw() {
|
||||||
if (mode == 4) DrawCircle(pt.x,pt.y,4);
|
if (mode == 4) DrawCircle(pt.x,pt.y,4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Populate feature list
|
/// @brief Populate feature list
|
||||||
///
|
|
||||||
void VisualToolVectorClip::PopulateFeatureList() {
|
void VisualToolVectorClip::PopulateFeatureList() {
|
||||||
// Clear
|
// Clear
|
||||||
features.clear();
|
features.clear();
|
||||||
|
@ -276,42 +262,27 @@ void VisualToolVectorClip::PopulateFeatureList() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Can drag?
|
/// @brief Can drag?
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
bool VisualToolVectorClip::DragEnabled() {
|
bool VisualToolVectorClip::DragEnabled() {
|
||||||
return mode <= 4;
|
return mode <= 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Update
|
/// @brief Update
|
||||||
/// @param feature
|
/// @param feature
|
||||||
///
|
|
||||||
void VisualToolVectorClip::UpdateDrag(VisualDraggableFeature &feature) {
|
void VisualToolVectorClip::UpdateDrag(VisualDraggableFeature &feature) {
|
||||||
spline.MovePoint(feature.value,feature.value2,wxPoint(feature.x,feature.y));
|
spline.MovePoint(feature.value,feature.value2,wxPoint(feature.x,feature.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Commit
|
/// @brief Commit
|
||||||
/// @param feature
|
/// @param feature
|
||||||
///
|
|
||||||
void VisualToolVectorClip::CommitDrag(VisualDraggableFeature &feature) {
|
void VisualToolVectorClip::CommitDrag(VisualDraggableFeature &feature) {
|
||||||
if (inverse)
|
SetOverride(GetActiveDialogueLine(), inverse ? L"\\iclip" : L"\\clip", L"(" + spline.EncodeToASS() + L")");
|
||||||
SetOverride(L"\\iclip",L"(" + spline.EncodeToASS() + L")");
|
|
||||||
else
|
|
||||||
SetOverride(L"\\clip",L"(" + spline.EncodeToASS() + L")");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Clicked a feature
|
/// @brief Clicked a feature
|
||||||
/// @param feature
|
/// @param feature
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
void VisualToolVectorClip::ClickedFeature(VisualDraggableFeature &feature) {
|
void VisualToolVectorClip::ClickedFeature(VisualDraggableFeature &feature) {
|
||||||
// Delete a control point
|
// Delete a control point
|
||||||
if (mode == 5) {
|
if (mode == 5) {
|
||||||
|
@ -327,10 +298,7 @@ void VisualToolVectorClip::ClickedFeature(VisualDraggableFeature &feature) {
|
||||||
|
|
||||||
// Erase and save changes
|
// Erase and save changes
|
||||||
spline.curves.erase(cur);
|
spline.curves.erase(cur);
|
||||||
if (inverse)
|
CommitDrag(feature);
|
||||||
SetOverride(L"\\iclip",L"(" + spline.EncodeToASS() + L")");
|
|
||||||
else
|
|
||||||
SetOverride(L"\\clip",L"(" + spline.EncodeToASS() + L")");
|
|
||||||
curFeature = -1;
|
curFeature = -1;
|
||||||
Commit(true);
|
Commit(true);
|
||||||
return;
|
return;
|
||||||
|
@ -339,20 +307,14 @@ void VisualToolVectorClip::ClickedFeature(VisualDraggableFeature &feature) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Can hold?
|
/// @brief Can hold?
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
bool VisualToolVectorClip::HoldEnabled() {
|
bool VisualToolVectorClip::HoldEnabled() {
|
||||||
return mode <= 4 || mode == 6 || mode == 7;
|
return mode <= 4 || mode == 6 || mode == 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Initialize hold
|
/// @brief Initialize hold
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
void VisualToolVectorClip::InitializeHold() {
|
void VisualToolVectorClip::InitializeHold() {
|
||||||
// Insert line/bicubic
|
// Insert line/bicubic
|
||||||
if (mode == 1 || mode == 2) {
|
if (mode == 1 || mode == 2) {
|
||||||
|
@ -429,10 +391,7 @@ void VisualToolVectorClip::InitializeHold() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commit
|
// Commit
|
||||||
if (inverse)
|
SetOverride(GetActiveDialogueLine(), inverse ? L"\\iclip" : L"\\clip", L"(" + spline.EncodeToASS() + L")");
|
||||||
SetOverride(L"\\iclip",L"(" + spline.EncodeToASS() + L")");
|
|
||||||
else
|
|
||||||
SetOverride(L"\\clip",L"(" + spline.EncodeToASS() + L")");
|
|
||||||
Commit(true);
|
Commit(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,11 +404,8 @@ void VisualToolVectorClip::InitializeHold() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Update hold
|
/// @brief Update hold
|
||||||
/// @return
|
/// @return
|
||||||
///
|
|
||||||
void VisualToolVectorClip::UpdateHold() {
|
void VisualToolVectorClip::UpdateHold() {
|
||||||
// Insert line
|
// Insert line
|
||||||
if (mode == 1) {
|
if (mode == 1) {
|
||||||
|
@ -497,30 +453,21 @@ void VisualToolVectorClip::UpdateHold() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Commit hold
|
/// @brief Commit hold
|
||||||
///
|
|
||||||
void VisualToolVectorClip::CommitHold() {
|
void VisualToolVectorClip::CommitHold() {
|
||||||
// Smooth spline
|
// Smooth spline
|
||||||
if (!holding && mode == 7) spline.Smooth();
|
if (!holding && mode == 7) spline.Smooth();
|
||||||
|
|
||||||
// Save it
|
// Save it
|
||||||
if (mode != 3 && mode != 4) {
|
if (mode != 3 && mode != 4) {
|
||||||
if (inverse)
|
SetOverride(GetActiveDialogueLine(), inverse ? L"\\iclip" : L"\\clip", L"(" + spline.EncodeToASS() + L")");
|
||||||
SetOverride(L"\\iclip",L"(" + spline.EncodeToASS() + L")");
|
|
||||||
else
|
|
||||||
SetOverride(L"\\clip",L"(" + spline.EncodeToASS() + L")");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// End freedraw
|
// End freedraw
|
||||||
if (!holding && (mode == 6 || mode == 7)) SetMode(0);
|
if (!holding && (mode == 6 || mode == 7)) SetMode(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Refresh
|
/// @brief Refresh
|
||||||
///
|
|
||||||
void VisualToolVectorClip::DoRefresh() {
|
void VisualToolVectorClip::DoRefresh() {
|
||||||
if (!dragging && !holding) {
|
if (!dragging && !holding) {
|
||||||
// Get line
|
// Get line
|
||||||
|
@ -536,4 +483,3 @@ void VisualToolVectorClip::DoRefresh() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue