From bd6ec35e33ae095b4a4d78ea368c2556b2887468 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Sat, 25 Feb 2006 03:04:52 +0000 Subject: [PATCH] Fixed undo scrolling (#25), Line selection (#24) and font collector (#10) bugs Originally committed to SVN as r165. --- core/audio_provider.h | 1 - core/base_grid.cpp | 2 +- core/fextracker_main_events.cpp | 18 +++++++++--------- core/fonts_collector.cpp | 9 +++++++++ core/subs_grid.cpp | 14 +++++++++----- core/utils.cpp | 15 ++++++++++----- core/video_provider_lavc.cpp | 3 --- 7 files changed, 38 insertions(+), 24 deletions(-) diff --git a/core/audio_provider.h b/core/audio_provider.h index 8318bc068..e6c93920d 100644 --- a/core/audio_provider.h +++ b/core/audio_provider.h @@ -104,7 +104,6 @@ public: volatile bool stopping; bool softStop; bool playing; - bool spectrum; float volume; volatile __int64 playPos; diff --git a/core/base_grid.cpp b/core/base_grid.cpp index 65c0104ea..48165205b 100644 --- a/core/base_grid.cpp +++ b/core/base_grid.cpp @@ -638,7 +638,7 @@ void BaseGrid::OnMouseEvent(wxMouseEvent &event) { } // Block select - if ((click && shift && !ctrl && !alt) || (holding)) { + if ((click && shift && !ctrl && !alt) || (holding && !ctrl && !alt && !shift)) { if (lastRow != -1) { // Set boundaries int i1 = row; diff --git a/core/fextracker_main_events.cpp b/core/fextracker_main_events.cpp index 00f55688f..0a34bf654 100644 --- a/core/fextracker_main_events.cpp +++ b/core/fextracker_main_events.cpp @@ -34,12 +34,12 @@ // Tracker Menu void FrameMain::OnVideoTrackerMenu(wxCommandEvent &event) { wxMenu menu( _("FexTracker") ); - AppendBitmapMenuItem(&menu, Video_Track_Points, _("Track points"), _(""), wxBITMAP(button_track_points)); + AppendBitmapMenuItem(&menu, Video_Track_Points, _("Track points"), _T(""), wxBITMAP(button_track_points)); menu.AppendSeparator(); - AppendBitmapMenuItem(&menu, Video_Track_Point_Add, _("Add points to movement"), _(""), wxBITMAP(button_track_point_add)); - AppendBitmapMenuItem(&menu, Video_Track_Point_Del, _("Remove points from movement"), _(""), wxBITMAP(button_track_point_del)); + AppendBitmapMenuItem(&menu, Video_Track_Point_Add, _("Add points to movement"), _T(""), wxBITMAP(button_track_point_add)); + AppendBitmapMenuItem(&menu, Video_Track_Point_Del, _("Remove points from movement"), _T(""), wxBITMAP(button_track_point_del)); menu.AppendSeparator(); - AppendBitmapMenuItem(&menu, Video_Track_Movement, _("Generate movement from points"), _(""), wxBITMAP(button_track_movement)); + AppendBitmapMenuItem(&menu, Video_Track_Movement, _("Generate movement from points"), _T(""), wxBITMAP(button_track_movement)); PopupMenu(&menu); } @@ -48,13 +48,13 @@ void FrameMain::OnVideoTrackerMenu(wxCommandEvent &event) { // Movement Menu void FrameMain::OnVideoTrackerMenu2(wxCommandEvent &event) { wxMenu menu( _("FexMovement") ); - AppendBitmapMenuItem(&menu, Video_Track_Movement_MoveAll, _("Move subtitle"), _(""), wxBITMAP(button_track_move)); + AppendBitmapMenuItem(&menu, Video_Track_Movement_MoveAll, _("Move subtitle"), _T(""), wxBITMAP(button_track_move)); menu.AppendSeparator(); - AppendBitmapMenuItem(&menu, Video_Track_Movement_MoveBefore, _("Move subtitle (this frame and preceeding frames)"), _(""), wxBITMAP(button_track_move)); - AppendBitmapMenuItem(&menu, Video_Track_Movement_MoveOne, _("Move subtitle (this frame)"), _(""), wxBITMAP(button_track_move)); - AppendBitmapMenuItem(&menu, Video_Track_Movement_MoveAfter, _("Move subtitle (this frame and following frames)"), _(""), wxBITMAP(button_track_move)); + AppendBitmapMenuItem(&menu, Video_Track_Movement_MoveBefore, _("Move subtitle (this frame and preceeding frames)"), _T(""), wxBITMAP(button_track_move)); + AppendBitmapMenuItem(&menu, Video_Track_Movement_MoveOne, _("Move subtitle (this frame)"), _T(""), wxBITMAP(button_track_move)); + AppendBitmapMenuItem(&menu, Video_Track_Movement_MoveAfter, _("Move subtitle (this frame and following frames)"), _T(""), wxBITMAP(button_track_move)); menu.AppendSeparator(); - AppendBitmapMenuItem(&menu, Video_Track_Split_Line, _("Split line for movement"), _(""), wxBITMAP(button_track_split_line)); + AppendBitmapMenuItem(&menu, Video_Track_Split_Line, _("Split line for movement"), _T(""), wxBITMAP(button_track_split_line)); PopupMenu(&menu); } diff --git a/core/fonts_collector.cpp b/core/fonts_collector.cpp index 3ae1c9dbe..6e0dd9bc5 100644 --- a/core/fonts_collector.cpp +++ b/core/fonts_collector.cpp @@ -291,6 +291,8 @@ void FontsCollectorThread::Collect() { LogBox->SetDefaultStyle(wxTextAttr(wxColour(0,0,180))); LogBox->AppendText(_("Searching for fonts in file...\n")); LogBox->SetDefaultStyle(wxTextAttr(wxColour(0,0,0))); + LogBox->Refresh(); + LogBox->Update(); wxSafeYield(); wxMutexGuiLeave(); @@ -305,6 +307,8 @@ void FontsCollectorThread::Collect() { AddFont(curStyle->font,true); wxMutexGuiEnter(); LogBox->AppendText(wxString(_T("\"")) + curStyle->font + _("\" found on style \"") + curStyle->name + _T("\".\n")); + LogBox->Refresh(); + LogBox->Update(); wxSafeYield(); wxMutexGuiLeave(); } @@ -365,6 +369,8 @@ void FontsCollectorThread::Collect() { wxMutexGuiEnter(); LogBox->SetDefaultStyle(wxTextAttr(wxColour(255,128,0))); LogBox->AppendText(wxString(_T("\"")) + work[j] + _("\" already exists on destination.\n")); + LogBox->Refresh(); + LogBox->Update(); wxSafeYield(); wxMutexGuiLeave(); } @@ -379,11 +385,14 @@ void FontsCollectorThread::Collect() { if (success) { LogBox->SetDefaultStyle(wxTextAttr(wxColour(0,180,0))); LogBox->AppendText(wxString(_T("\"")) + work[j] + _("\" copied.\n")); + } else { LogBox->SetDefaultStyle(wxTextAttr(wxColour(220,0,0))); LogBox->AppendText(wxString(_("Failed copying \"")) + srcFile + _T("\".\n")); } + LogBox->Refresh(); + LogBox->Update(); wxSafeYield(); wxMutexGuiLeave(); } diff --git a/core/subs_grid.cpp b/core/subs_grid.cpp index 1c997404b..6633e359c 100644 --- a/core/subs_grid.cpp +++ b/core/subs_grid.cpp @@ -590,9 +590,13 @@ void SubtitlesGrid::LoadFromAss (AssFile *_ass,bool keepSelection,bool dontModif } } - // Clear grid and choose subtitles file + // Clear grid BeginBatch(); + int oldPos = yPos; Clear(); + if (keepSelection) yPos = oldPos; + + // Get subtitles if (_ass) ass = _ass; else { if (!ass) throw _T("Trying to set subs grid to current ass file, but there is none"); @@ -625,10 +629,6 @@ void SubtitlesGrid::LoadFromAss (AssFile *_ass,bool keepSelection,bool dontModif SelectRow(0); } - // Finish setting layout - AdjustScrollbar(); - EndBatch(); - // Commit if (!AssFile::Popping) { if (dontModify) AssFile::StackPush(); @@ -649,6 +649,10 @@ void SubtitlesGrid::LoadFromAss (AssFile *_ass,bool keepSelection,bool dontModif editBox->UpdateGlobals(); if (_ass) editBox->SetToLine(firstsel); } + + // Finish setting layout + AdjustScrollbar(); + EndBatch(); } diff --git a/core/utils.cpp b/core/utils.cpp index 24e3b4cf1..327427f78 100644 --- a/core/utils.cpp +++ b/core/utils.cpp @@ -74,13 +74,18 @@ bool Copy(wxString src,wxString dst) { //////////////// // Backup a file bool Backup(wxString src,wxString dst) { -#if defined(__WIN32__) + // Windows + #if defined(__WIN32__) return Copy(src,dst); -#elif defined(__UNIX__) + + // Linux + #elif defined(__UNIX__) return link(src.mb_str(),dst.mb_str()) != 0; -#else -#error don't know how to backup files -#endif + + // Error + #else + #error "don't know how to backup files" + #endif } ///////////////////////////////////// diff --git a/core/video_provider_lavc.cpp b/core/video_provider_lavc.cpp index 21991517b..85c5931a5 100644 --- a/core/video_provider_lavc.cpp +++ b/core/video_provider_lavc.cpp @@ -302,9 +302,6 @@ wxBitmap LAVCVideoProvider::GetFrame(int n) { bool ok = true; do { ok = GetNextFrame(); - //if (!ok) { - // return wxBitmap(GetWidth(),GetHeight()); - //} } while (lastDecodeTime <= n && ok); }