Made middle click on audio display jump video to position, fixed a few uninitialized variable warnings and removed the GetString() method from AssFile, since it was only used by the old libass provider.

Originally committed to SVN as r1017.
This commit is contained in:
Rodrigo Braz Monteiro 2007-04-07 03:12:55 +00:00
parent 263df94e69
commit 6d988bdf4d
8 changed files with 46 additions and 32 deletions

View File

@ -270,19 +270,19 @@ bool AssFile::CanSave() {
//////////////////////////////////// ////////////////////////////////////
// Returns script as a single string // Returns script as a single string
wxString AssFile::GetString() { //wxString AssFile::GetString() {
using std::list; // using std::list;
wxString ret; // wxString ret;
AssEntry *entry; // AssEntry *entry;
ret += 0xfeff; // ret += 0xfeff;
for (list<AssEntry*>::iterator cur=Line.begin();cur!=Line.end();) { // for (list<AssEntry*>::iterator cur=Line.begin();cur!=Line.end();) {
entry = *cur; // entry = *cur;
ret += entry->GetEntryData(); // ret += entry->GetEntryData();
ret += L"\n"; // ret += L"\n";
cur++; // cur++;
} // }
return ret; // return ret;
} //}
/////////////////////// ///////////////////////

View File

@ -90,7 +90,7 @@ public:
wxArrayString GetStyles(); // Gets a list of all styles available wxArrayString GetStyles(); // Gets a list of all styles available
AssStyle *GetStyle(wxString name); // Gets style by its name AssStyle *GetStyle(wxString name); // Gets style by its name
wxString GetString(); // Returns the whole file as a single string //wxString GetString(); // Returns the whole file as a single string
void Load(wxString file,wxString charset=_T(""),bool addToRecent=true); // Load from a file void Load(wxString file,wxString charset=_T(""),bool addToRecent=true); // Load from a file
void Save(wxString file,bool setfilename=false,bool addToRecent=true,const wxString encoding=_T("")); // Save to a file. Pass true to second argument if this isn't a copy void Save(wxString file,bool setfilename=false,bool addToRecent=true,const wxString encoding=_T("")); // Save to a file. Pass true to second argument if this isn't a copy
void SaveMemory(std::vector<char> &dst,const wxString encoding=_T("")); // Save to a memory string void SaveMemory(std::vector<char> &dst,const wxString encoding=_T("")); // Save to a memory string

View File

@ -1165,12 +1165,22 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event) {
else if (y < h+timelineHeight) onScale = true; else if (y < h+timelineHeight) onScale = true;
} }
// Buttons
bool leftIsDown = event.ButtonIsDown(wxMOUSE_BTN_LEFT);
bool rightIsDown = event.ButtonIsDown(wxMOUSE_BTN_RIGHT);
bool buttonIsDown = leftIsDown || rightIsDown;
bool leftClick = event.ButtonDown(wxMOUSE_BTN_LEFT);
bool rightClick = event.ButtonDown(wxMOUSE_BTN_RIGHT);
bool middleClick = event.Button(wxMOUSE_BTN_MIDDLE);
bool buttonClick = leftClick || rightClick;
bool defCursor = true;
// Click type // Click type
if (event.ButtonDown(wxMOUSE_BTN_LEFT) && !holding) { if (buttonClick && !holding) {
holding = true; holding = true;
CaptureMouse(); CaptureMouse();
} }
if (!event.ButtonIsDown(wxMOUSE_BTN_LEFT) && holding) { if (!buttonIsDown && holding) {
holding = false; holding = false;
if (HasCapture()) ReleaseMouse(); if (HasCapture()) ReleaseMouse();
} }
@ -1266,13 +1276,13 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event) {
// Outside // Outside
if (!inside && hold == 0) return; if (!inside && hold == 0) return;
// Left/middle click // Left click
if (event.ButtonDown(wxMOUSE_BTN_LEFT) || event.Button(wxMOUSE_BTN_MIDDLE)) { if (leftClick) {
SetFocus(); SetFocus();
} }
// Right click // Right click
if (event.ButtonDown(wxMOUSE_BTN_RIGHT)) { if (rightClick) {
SetFocus(); SetFocus();
if (karaoke->enabled) { if (karaoke->enabled) {
int syl = GetSyllableAtX(x); int syl = GetSyllableAtX(x);
@ -1285,14 +1295,13 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event) {
} }
} }
// Buttons // Middle click
bool leftIsDown = event.ButtonIsDown(wxMOUSE_BTN_LEFT); if (middleClick) {
bool rightIsDown = event.ButtonIsDown(wxMOUSE_BTN_RIGHT); SetFocus();
bool buttonIsDown = leftIsDown || rightIsDown; if (VideoContext::Get()->IsLoaded()) {
bool leftClick = event.ButtonDown(wxMOUSE_BTN_LEFT); VideoContext::Get()->JumpToTime(GetMSAtX(x),true);
bool rightClick = event.ButtonDown(wxMOUSE_BTN_RIGHT); }
bool buttonClick = leftClick || rightClick; }
bool defCursor = true;
// Timing // Timing
if (hasSel) { if (hasSel) {

View File

@ -500,7 +500,7 @@ namespace Automation4 {
{ {
try { try {
VALUE cfg; VALUE cfg = 0;
if (has_config && config_dialog) { if (has_config && config_dialog) {
cfg = config_dialog->RubyReadBack(); cfg = config_dialog->RubyReadBack();
// TODO, write back stored options here // TODO, write back stored options here

View File

@ -651,7 +651,7 @@ void SubtitlesGrid::OnRecombine(wxCommandEvent &event) {
////////////// //////////////
// Export audio clip of line // Export audio clip of line
void SubtitlesGrid::OnAudioClip(wxCommandEvent &event) { void SubtitlesGrid::OnAudioClip(wxCommandEvent &event) {
__int64 num_samples,start,end,temp; __int64 num_samples,start=0,end=0,temp;
AudioDisplay *audioDisplay = parentFrame->audioBox->audioDisplay; AudioDisplay *audioDisplay = parentFrame->audioBox->audioDisplay;
AudioProvider *provider = audioDisplay->provider; AudioProvider *provider = audioDisplay->provider;
AssDialogue *cur; AssDialogue *cur;

View File

@ -59,6 +59,8 @@ enum ASS_FrameRateType {
/////////////////// ///////////////////
// Framerate class // Framerate class
class FrameRate { class FrameRate {
friend class VideoContext;
private: private:
double last_time; double last_time;
int last_frame; int last_frame;

View File

@ -387,8 +387,11 @@ void VideoContext::JumpToFrame(int n) {
//////////////////////////// ////////////////////////////
// Jumps to a specific time // Jumps to a specific time
void VideoContext::JumpToTime(int ms) { void VideoContext::JumpToTime(int ms,bool exact) {
JumpToFrame(VFR_Output.GetFrameAtTime(ms)); int frame;
if (exact) frame = VFR_Output.PFrameAtTime(ms);
else frame = VFR_Output.GetFrameAtTime(ms);
JumpToFrame(frame);
} }

View File

@ -154,7 +154,7 @@ public:
void Reset(); void Reset();
void JumpToFrame(int n); void JumpToFrame(int n);
void JumpToTime(int ms); void JumpToTime(int ms,bool exact=false);
void Refresh(bool video,bool subtitles); void Refresh(bool video,bool subtitles);
void UpdateDisplays(bool full); void UpdateDisplays(bool full);