diff --git a/aegisub/ass_file.cpp b/aegisub/ass_file.cpp index 59d80629f..0e3014a73 100644 --- a/aegisub/ass_file.cpp +++ b/aegisub/ass_file.cpp @@ -270,19 +270,19 @@ bool AssFile::CanSave() { //////////////////////////////////// // Returns script as a single string -wxString AssFile::GetString() { - using std::list; - wxString ret; - AssEntry *entry; - ret += 0xfeff; - for (list::iterator cur=Line.begin();cur!=Line.end();) { - entry = *cur; - ret += entry->GetEntryData(); - ret += L"\n"; - cur++; - } - return ret; -} +//wxString AssFile::GetString() { +// using std::list; +// wxString ret; +// AssEntry *entry; +// ret += 0xfeff; +// for (list::iterator cur=Line.begin();cur!=Line.end();) { +// entry = *cur; +// ret += entry->GetEntryData(); +// ret += L"\n"; +// cur++; +// } +// return ret; +//} /////////////////////// diff --git a/aegisub/ass_file.h b/aegisub/ass_file.h index d39b61f85..8b81fbe1f 100644 --- a/aegisub/ass_file.h +++ b/aegisub/ass_file.h @@ -90,7 +90,7 @@ public: wxArrayString GetStyles(); // Gets a list of all styles available 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 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 &dst,const wxString encoding=_T("")); // Save to a memory string diff --git a/aegisub/audio_display.cpp b/aegisub/audio_display.cpp index dd92b9572..1551a5ab3 100644 --- a/aegisub/audio_display.cpp +++ b/aegisub/audio_display.cpp @@ -1165,12 +1165,22 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event) { 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 - if (event.ButtonDown(wxMOUSE_BTN_LEFT) && !holding) { + if (buttonClick && !holding) { holding = true; CaptureMouse(); } - if (!event.ButtonIsDown(wxMOUSE_BTN_LEFT) && holding) { + if (!buttonIsDown && holding) { holding = false; if (HasCapture()) ReleaseMouse(); } @@ -1266,13 +1276,13 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event) { // Outside if (!inside && hold == 0) return; - // Left/middle click - if (event.ButtonDown(wxMOUSE_BTN_LEFT) || event.Button(wxMOUSE_BTN_MIDDLE)) { + // Left click + if (leftClick) { SetFocus(); } // Right click - if (event.ButtonDown(wxMOUSE_BTN_RIGHT)) { + if (rightClick) { SetFocus(); if (karaoke->enabled) { int syl = GetSyllableAtX(x); @@ -1285,14 +1295,13 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event) { } } - // 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 buttonClick = leftClick || rightClick; - bool defCursor = true; + // Middle click + if (middleClick) { + SetFocus(); + if (VideoContext::Get()->IsLoaded()) { + VideoContext::Get()->JumpToTime(GetMSAtX(x),true); + } + } // Timing if (hasSel) { diff --git a/aegisub/auto4_ruby.cpp b/aegisub/auto4_ruby.cpp index 1e89ea3b2..8f8eaf61f 100644 --- a/aegisub/auto4_ruby.cpp +++ b/aegisub/auto4_ruby.cpp @@ -500,7 +500,7 @@ namespace Automation4 { { try { - VALUE cfg; + VALUE cfg = 0; if (has_config && config_dialog) { cfg = config_dialog->RubyReadBack(); // TODO, write back stored options here diff --git a/aegisub/subs_grid.cpp b/aegisub/subs_grid.cpp index 778ebfb8d..eebeec33f 100644 --- a/aegisub/subs_grid.cpp +++ b/aegisub/subs_grid.cpp @@ -651,7 +651,7 @@ void SubtitlesGrid::OnRecombine(wxCommandEvent &event) { ////////////// // Export audio clip of line void SubtitlesGrid::OnAudioClip(wxCommandEvent &event) { - __int64 num_samples,start,end,temp; + __int64 num_samples,start=0,end=0,temp; AudioDisplay *audioDisplay = parentFrame->audioBox->audioDisplay; AudioProvider *provider = audioDisplay->provider; AssDialogue *cur; diff --git a/aegisub/vfr.h b/aegisub/vfr.h index ce252e226..195aee2b6 100644 --- a/aegisub/vfr.h +++ b/aegisub/vfr.h @@ -59,6 +59,8 @@ enum ASS_FrameRateType { /////////////////// // Framerate class class FrameRate { + friend class VideoContext; + private: double last_time; int last_frame; diff --git a/aegisub/video_context.cpp b/aegisub/video_context.cpp index fcda137c4..7d85a63f0 100644 --- a/aegisub/video_context.cpp +++ b/aegisub/video_context.cpp @@ -387,8 +387,11 @@ void VideoContext::JumpToFrame(int n) { //////////////////////////// // Jumps to a specific time -void VideoContext::JumpToTime(int ms) { - JumpToFrame(VFR_Output.GetFrameAtTime(ms)); +void VideoContext::JumpToTime(int ms,bool exact) { + int frame; + if (exact) frame = VFR_Output.PFrameAtTime(ms); + else frame = VFR_Output.GetFrameAtTime(ms); + JumpToFrame(frame); } diff --git a/aegisub/video_context.h b/aegisub/video_context.h index 765b11791..ab99b44e7 100644 --- a/aegisub/video_context.h +++ b/aegisub/video_context.h @@ -154,7 +154,7 @@ public: void Reset(); void JumpToFrame(int n); - void JumpToTime(int ms); + void JumpToTime(int ms,bool exact=false); void Refresh(bool video,bool subtitles); void UpdateDisplays(bool full);