Fixed undo scrolling (#25), Line selection (#24) and font collector (#10) bugs

Originally committed to SVN as r165.
This commit is contained in:
Rodrigo Braz Monteiro 2006-02-25 03:04:52 +00:00
parent 6b17ec30b1
commit bd6ec35e33
7 changed files with 38 additions and 24 deletions

View File

@ -104,7 +104,6 @@ public:
volatile bool stopping; volatile bool stopping;
bool softStop; bool softStop;
bool playing; bool playing;
bool spectrum;
float volume; float volume;
volatile __int64 playPos; volatile __int64 playPos;

View File

@ -638,7 +638,7 @@ void BaseGrid::OnMouseEvent(wxMouseEvent &event) {
} }
// Block select // Block select
if ((click && shift && !ctrl && !alt) || (holding)) { if ((click && shift && !ctrl && !alt) || (holding && !ctrl && !alt && !shift)) {
if (lastRow != -1) { if (lastRow != -1) {
// Set boundaries // Set boundaries
int i1 = row; int i1 = row;

View File

@ -34,12 +34,12 @@
// Tracker Menu // Tracker Menu
void FrameMain::OnVideoTrackerMenu(wxCommandEvent &event) { void FrameMain::OnVideoTrackerMenu(wxCommandEvent &event) {
wxMenu menu( _("FexTracker") ); 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(); menu.AppendSeparator();
AppendBitmapMenuItem(&menu, Video_Track_Point_Add, _("Add points to movement"), _(""), wxBITMAP(button_track_point_add)); 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"), _(""), wxBITMAP(button_track_point_del)); AppendBitmapMenuItem(&menu, Video_Track_Point_Del, _("Remove points from movement"), _T(""), wxBITMAP(button_track_point_del));
menu.AppendSeparator(); 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); PopupMenu(&menu);
} }
@ -48,13 +48,13 @@ void FrameMain::OnVideoTrackerMenu(wxCommandEvent &event) {
// Movement Menu // Movement Menu
void FrameMain::OnVideoTrackerMenu2(wxCommandEvent &event) { void FrameMain::OnVideoTrackerMenu2(wxCommandEvent &event) {
wxMenu menu( _("FexMovement") ); 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(); menu.AppendSeparator();
AppendBitmapMenuItem(&menu, Video_Track_Movement_MoveBefore, _("Move subtitle (this frame and preceeding 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)"), _(""), 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)"), _(""), wxBITMAP(button_track_move)); AppendBitmapMenuItem(&menu, Video_Track_Movement_MoveAfter, _("Move subtitle (this frame and following frames)"), _T(""), wxBITMAP(button_track_move));
menu.AppendSeparator(); 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); PopupMenu(&menu);
} }

View File

@ -291,6 +291,8 @@ void FontsCollectorThread::Collect() {
LogBox->SetDefaultStyle(wxTextAttr(wxColour(0,0,180))); LogBox->SetDefaultStyle(wxTextAttr(wxColour(0,0,180)));
LogBox->AppendText(_("Searching for fonts in file...\n")); LogBox->AppendText(_("Searching for fonts in file...\n"));
LogBox->SetDefaultStyle(wxTextAttr(wxColour(0,0,0))); LogBox->SetDefaultStyle(wxTextAttr(wxColour(0,0,0)));
LogBox->Refresh();
LogBox->Update();
wxSafeYield(); wxSafeYield();
wxMutexGuiLeave(); wxMutexGuiLeave();
@ -305,6 +307,8 @@ void FontsCollectorThread::Collect() {
AddFont(curStyle->font,true); AddFont(curStyle->font,true);
wxMutexGuiEnter(); wxMutexGuiEnter();
LogBox->AppendText(wxString(_T("\"")) + curStyle->font + _("\" found on style \"") + curStyle->name + _T("\".\n")); LogBox->AppendText(wxString(_T("\"")) + curStyle->font + _("\" found on style \"") + curStyle->name + _T("\".\n"));
LogBox->Refresh();
LogBox->Update();
wxSafeYield(); wxSafeYield();
wxMutexGuiLeave(); wxMutexGuiLeave();
} }
@ -365,6 +369,8 @@ void FontsCollectorThread::Collect() {
wxMutexGuiEnter(); wxMutexGuiEnter();
LogBox->SetDefaultStyle(wxTextAttr(wxColour(255,128,0))); LogBox->SetDefaultStyle(wxTextAttr(wxColour(255,128,0)));
LogBox->AppendText(wxString(_T("\"")) + work[j] + _("\" already exists on destination.\n")); LogBox->AppendText(wxString(_T("\"")) + work[j] + _("\" already exists on destination.\n"));
LogBox->Refresh();
LogBox->Update();
wxSafeYield(); wxSafeYield();
wxMutexGuiLeave(); wxMutexGuiLeave();
} }
@ -379,11 +385,14 @@ void FontsCollectorThread::Collect() {
if (success) { if (success) {
LogBox->SetDefaultStyle(wxTextAttr(wxColour(0,180,0))); LogBox->SetDefaultStyle(wxTextAttr(wxColour(0,180,0)));
LogBox->AppendText(wxString(_T("\"")) + work[j] + _("\" copied.\n")); LogBox->AppendText(wxString(_T("\"")) + work[j] + _("\" copied.\n"));
} }
else { else {
LogBox->SetDefaultStyle(wxTextAttr(wxColour(220,0,0))); LogBox->SetDefaultStyle(wxTextAttr(wxColour(220,0,0)));
LogBox->AppendText(wxString(_("Failed copying \"")) + srcFile + _T("\".\n")); LogBox->AppendText(wxString(_("Failed copying \"")) + srcFile + _T("\".\n"));
} }
LogBox->Refresh();
LogBox->Update();
wxSafeYield(); wxSafeYield();
wxMutexGuiLeave(); wxMutexGuiLeave();
} }

View File

@ -590,9 +590,13 @@ void SubtitlesGrid::LoadFromAss (AssFile *_ass,bool keepSelection,bool dontModif
} }
} }
// Clear grid and choose subtitles file // Clear grid
BeginBatch(); BeginBatch();
int oldPos = yPos;
Clear(); Clear();
if (keepSelection) yPos = oldPos;
// Get subtitles
if (_ass) ass = _ass; if (_ass) ass = _ass;
else { else {
if (!ass) throw _T("Trying to set subs grid to current ass file, but there is none"); 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); SelectRow(0);
} }
// Finish setting layout
AdjustScrollbar();
EndBatch();
// Commit // Commit
if (!AssFile::Popping) { if (!AssFile::Popping) {
if (dontModify) AssFile::StackPush(); if (dontModify) AssFile::StackPush();
@ -649,6 +649,10 @@ void SubtitlesGrid::LoadFromAss (AssFile *_ass,bool keepSelection,bool dontModif
editBox->UpdateGlobals(); editBox->UpdateGlobals();
if (_ass) editBox->SetToLine(firstsel); if (_ass) editBox->SetToLine(firstsel);
} }
// Finish setting layout
AdjustScrollbar();
EndBatch();
} }

View File

@ -74,13 +74,18 @@ bool Copy(wxString src,wxString dst) {
//////////////// ////////////////
// Backup a file // Backup a file
bool Backup(wxString src,wxString dst) { bool Backup(wxString src,wxString dst) {
#if defined(__WIN32__) // Windows
#if defined(__WIN32__)
return Copy(src,dst); return Copy(src,dst);
#elif defined(__UNIX__)
// Linux
#elif defined(__UNIX__)
return link(src.mb_str(),dst.mb_str()) != 0; return link(src.mb_str(),dst.mb_str()) != 0;
#else
#error don't know how to backup files // Error
#endif #else
#error "don't know how to backup files"
#endif
} }
///////////////////////////////////// /////////////////////////////////////

View File

@ -302,9 +302,6 @@ wxBitmap LAVCVideoProvider::GetFrame(int n) {
bool ok = true; bool ok = true;
do { do {
ok = GetNextFrame(); ok = GetNextFrame();
//if (!ok) {
// return wxBitmap(GetWidth(),GetHeight());
//}
} while (lastDecodeTime <= n && ok); } while (lastDecodeTime <= n && ok);
} }