mirror of https://github.com/odrling/Aegisub
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:
parent
263df94e69
commit
6d988bdf4d
|
@ -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<AssEntry*>::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<AssEntry*>::iterator cur=Line.begin();cur!=Line.end();) {
|
||||
// entry = *cur;
|
||||
// ret += entry->GetEntryData();
|
||||
// ret += L"\n";
|
||||
// cur++;
|
||||
// }
|
||||
// return ret;
|
||||
//}
|
||||
|
||||
|
||||
///////////////////////
|
||||
|
|
|
@ -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<char> &dst,const wxString encoding=_T("")); // Save to a memory string
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -59,6 +59,8 @@ enum ASS_FrameRateType {
|
|||
///////////////////
|
||||
// Framerate class
|
||||
class FrameRate {
|
||||
friend class VideoContext;
|
||||
|
||||
private:
|
||||
double last_time;
|
||||
int last_frame;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue