Minor bugs fixed
Originally committed to SVN as r67.
This commit is contained in:
parent
6edfa51c21
commit
ff278ee099
|
@ -48,6 +48,7 @@
|
||||||
#include "vfr.h"
|
#include "vfr.h"
|
||||||
#include "subs_edit_box.h"
|
#include "subs_edit_box.h"
|
||||||
#include "frame_main.h"
|
#include "frame_main.h"
|
||||||
|
#include "video_display.h"
|
||||||
|
|
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
|
@ -266,9 +267,17 @@ void BaseGrid::DrawImage(wxDC &dc) {
|
||||||
|
|
||||||
// Row colors
|
// Row colors
|
||||||
std::vector<wxBrush> rowColors;
|
std::vector<wxBrush> rowColors;
|
||||||
rowColors.push_back(wxBrush(wxColour(255,255,255)));
|
std::vector<wxBrush> foreColors;
|
||||||
rowColors.push_back(wxBrush(wxColour(165,207,231)));
|
rowColors.push_back(wxBrush(wxColour(255,255,255))); // 0 = Standard
|
||||||
rowColors.push_back(wxBrush(Options.AsColour(_T("Grid selection background"))));
|
foreColors.push_back(wxBrush(wxColour(0,0,0)));
|
||||||
|
rowColors.push_back(wxBrush(wxColour(165,207,231))); // 1 = Header
|
||||||
|
foreColors.push_back(wxBrush(wxColour(0,0,0)));
|
||||||
|
rowColors.push_back(wxBrush(Options.AsColour(_T("Grid selection background")))); // 2 = Selected
|
||||||
|
foreColors.push_back(wxBrush(Options.AsColour(_T("Grid selection foreground"))));
|
||||||
|
rowColors.push_back(wxBrush(Options.AsColour(_T("Grid comment background")))); // 3 = Commented
|
||||||
|
foreColors.push_back(wxBrush(Options.AsColour(_T("Grid selection foreground"))));
|
||||||
|
rowColors.push_back(wxBrush(Options.AsColour(_T("Grid inframe background")))); // 4 = Video Highlighted
|
||||||
|
foreColors.push_back(wxBrush(Options.AsColour(_T("Grid selection foreground"))));
|
||||||
|
|
||||||
// First grid row
|
// First grid row
|
||||||
bool drawGrid = true;
|
bool drawGrid = true;
|
||||||
|
@ -314,8 +323,14 @@ void BaseGrid::DrawImage(wxDC &dc) {
|
||||||
// Set fields
|
// Set fields
|
||||||
strings.Add(wxString::Format(_T("%i"),curRow+1));
|
strings.Add(wxString::Format(_T("%i"),curRow+1));
|
||||||
strings.Add(wxString::Format(_T("%i"),curDiag->Layer));
|
strings.Add(wxString::Format(_T("%i"),curDiag->Layer));
|
||||||
|
if (byFrame) {
|
||||||
|
strings.Add(wxString::Format(_T("%i"),VFR_Output.CorrectFrameAtTime(curDiag->Start.GetMS(),true)));
|
||||||
|
strings.Add(wxString::Format(_T("%i"),VFR_Output.CorrectFrameAtTime(curDiag->End.GetMS(),true)));
|
||||||
|
}
|
||||||
|
else {
|
||||||
strings.Add(curDiag->Start.GetASSFormated());
|
strings.Add(curDiag->Start.GetASSFormated());
|
||||||
strings.Add(curDiag->End.GetASSFormated());
|
strings.Add(curDiag->End.GetASSFormated());
|
||||||
|
}
|
||||||
strings.Add(curDiag->Style);
|
strings.Add(curDiag->Style);
|
||||||
strings.Add(curDiag->Actor);
|
strings.Add(curDiag->Actor);
|
||||||
strings.Add(curDiag->Effect);
|
strings.Add(curDiag->Effect);
|
||||||
|
@ -350,12 +365,14 @@ void BaseGrid::DrawImage(wxDC &dc) {
|
||||||
else value = curDiag->Text;
|
else value = curDiag->Text;
|
||||||
|
|
||||||
// Cap length and set text
|
// Cap length and set text
|
||||||
if (value.Length() > 128) value = value.Left(128) + _T("...");
|
if (value.Length() > 512) value = value.Left(512) + _T("...");
|
||||||
strings.Add(value);
|
strings.Add(value);
|
||||||
|
|
||||||
// Set color
|
// Set color
|
||||||
curColor = 0;
|
curColor = 0;
|
||||||
if (IsInSelection(curRow,0)) curColor = 2;
|
if (IsInSelection(curRow,0)) curColor = 2;
|
||||||
|
else if (curDiag->Comment) curColor = 3;
|
||||||
|
else if (Options.AsBool(_T("Highlight subs in frame")) && IsDisplayed(curDiag)) curColor = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
@ -490,14 +507,15 @@ void BaseGrid::OnMouseEvent(wxMouseEvent &event) {
|
||||||
// Toggle selected
|
// Toggle selected
|
||||||
if (click && ctrl && !shift) {
|
if (click && ctrl && !shift) {
|
||||||
SelectRow(row,true,!IsInSelection(row,0));
|
SelectRow(row,true,!IsInSelection(row,0));
|
||||||
|
parentFrame->SetSelectionFlag(GetNumberSelection());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normal click
|
// Normal click
|
||||||
if (click && !shift && !ctrl && !alt) {
|
if (click && !shift && !ctrl && !alt) {
|
||||||
editBox->SetToLine(row);
|
editBox->SetToLine(row);
|
||||||
parentFrame->SetSelectionFlag(validRow);
|
|
||||||
SelectRow(row,false);
|
SelectRow(row,false);
|
||||||
|
parentFrame->SetSelectionFlag(GetNumberSelection());
|
||||||
lastRow = row;
|
lastRow = row;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -520,6 +538,7 @@ void BaseGrid::OnMouseEvent(wxMouseEvent &event) {
|
||||||
SelectRow(i,notFirst,true);
|
SelectRow(i,notFirst,true);
|
||||||
notFirst = true;
|
notFirst = true;
|
||||||
}
|
}
|
||||||
|
parentFrame->SetSelectionFlag(GetNumberSelection());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -553,7 +572,7 @@ void BaseGrid::AdjustScrollbar() {
|
||||||
GetClientSize(&w,&h);
|
GetClientSize(&w,&h);
|
||||||
scrollBar->Freeze();
|
scrollBar->Freeze();
|
||||||
scrollBar->GetSize(&sw,&sh);
|
scrollBar->GetSize(&sw,&sh);
|
||||||
scrollBar->SetSize(w-sw-4,0,sw,h-4);
|
scrollBar->SetSize(w-sw,0,sw,h);
|
||||||
|
|
||||||
// Set parameters
|
// Set parameters
|
||||||
int drawPerScreen = h/lineHeight;
|
int drawPerScreen = h/lineHeight;
|
||||||
|
@ -670,3 +689,14 @@ AssDialogue *BaseGrid::GetDialogue(int n) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////
|
||||||
|
// Check if line is being displayed
|
||||||
|
bool BaseGrid::IsDisplayed(AssDialogue *line) {
|
||||||
|
if (!video->loaded) return false;
|
||||||
|
int f1 = VFR_Output.CorrectFrameAtTime(line->Start.GetMS(),true);
|
||||||
|
int f2 = VFR_Output.CorrectFrameAtTime(line->End.GetMS(),false);
|
||||||
|
if (f1 <= video->frame_n && f2 >= video->frame_n) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
|
@ -51,6 +51,7 @@ class AssEntry;
|
||||||
class AssDialogue;
|
class AssDialogue;
|
||||||
class SubsEditBox;
|
class SubsEditBox;
|
||||||
class FrameMain;
|
class FrameMain;
|
||||||
|
class VideoDisplay;
|
||||||
typedef std::list<AssEntry*>::iterator entryIter;
|
typedef std::list<AssEntry*>::iterator entryIter;
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,7 +74,6 @@ private:
|
||||||
void OnMouseEvent(wxMouseEvent &event);
|
void OnMouseEvent(wxMouseEvent &event);
|
||||||
|
|
||||||
void AdjustScrollbar();
|
void AdjustScrollbar();
|
||||||
void SetColumnWidths();
|
|
||||||
void DrawImage(wxDC &dc);
|
void DrawImage(wxDC &dc);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -82,10 +82,13 @@ protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SubsEditBox *editBox;
|
SubsEditBox *editBox;
|
||||||
|
VideoDisplay *video;
|
||||||
|
|
||||||
bool byFrame;
|
bool byFrame;
|
||||||
std::vector<entryIter> diagMap;
|
std::vector<entryIter> diagMap;
|
||||||
std::vector<bool> selMap;
|
std::vector<bool> selMap;
|
||||||
|
|
||||||
|
void SetColumnWidths();
|
||||||
void BeginBatch();
|
void BeginBatch();
|
||||||
void EndBatch();
|
void EndBatch();
|
||||||
void MakeCellVisible(int row, int col);
|
void MakeCellVisible(int row, int col);
|
||||||
|
@ -93,6 +96,8 @@ public:
|
||||||
void SelectRow(int row, bool addToSelected = false, bool select=true);
|
void SelectRow(int row, bool addToSelected = false, bool select=true);
|
||||||
void ClearSelection();
|
void ClearSelection();
|
||||||
bool IsInSelection(int row, int col) const;
|
bool IsInSelection(int row, int col) const;
|
||||||
|
bool IsDisplayed(AssDialogue *line);
|
||||||
|
int GetNumberSelection();
|
||||||
|
|
||||||
int GetRows() const;
|
int GetRows() const;
|
||||||
int GetNumberRows() const { return GetRows(); }
|
int GetNumberRows() const { return GetRows(); }
|
||||||
|
|
|
@ -177,6 +177,7 @@ SubsEditBox::SubsEditBox (wxWindow *parent,SubtitlesGrid *gridp) : wxPanel(paren
|
||||||
// HACK: Fix colour of bg of editbox
|
// HACK: Fix colour of bg of editbox
|
||||||
origBgColour = TextEdit->GetBackgroundColour();
|
origBgColour = TextEdit->GetBackgroundColour();
|
||||||
disabledBgColour = GetBackgroundColour();
|
disabledBgColour = GetBackgroundColour();
|
||||||
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -924,100 +924,21 @@ void SubtitlesGrid::LoadFromAss (AssFile *_ass,bool keepSelection,bool dontModif
|
||||||
/////////////////////////////////////////
|
/////////////////////////////////////////
|
||||||
// Sets one line to a line from the subs
|
// Sets one line to a line from the subs
|
||||||
void SubtitlesGrid::SetRowToLine(int n,AssDialogue *line) {
|
void SubtitlesGrid::SetRowToLine(int n,AssDialogue *line) {
|
||||||
//BeginBatch();
|
Refresh(false);
|
||||||
|
|
||||||
//// Times
|
|
||||||
//if (byFrame) {
|
|
||||||
// SetCellValue(n,1,wxString::Format(_T("%i"),VFR_Output.CorrectFrameAtTime(line->Start.GetMS(),true)));
|
|
||||||
// SetCellValue(n,2,wxString::Format(_T("%i"),VFR_Output.CorrectFrameAtTime(line->End.GetMS(),false)));
|
|
||||||
//}
|
|
||||||
//else {
|
|
||||||
// SetCellValue(n,1,line->Start.GetASSFormated());
|
|
||||||
// SetCellValue(n,2,line->End.GetASSFormated());
|
|
||||||
//}
|
|
||||||
|
|
||||||
//// Fields
|
|
||||||
//SetCellValue(n,0,wxString::Format(_T("%d"),line->Layer));
|
|
||||||
//SetCellValue(n,3,line->Style);
|
|
||||||
//SetCellValue(n,4,line->Actor);
|
|
||||||
//SetCellValue(n,5,line->Effect);
|
|
||||||
//SetCellValue(n,6,wxString::Format(_T("%04d"),line->MarginL));
|
|
||||||
//SetCellValue(n,7,wxString::Format(_T("%04d"),line->MarginR));
|
|
||||||
//SetCellValue(n,8,wxString::Format(_T("%04d"),line->MarginV));
|
|
||||||
|
|
||||||
//// Text
|
|
||||||
//int mode = Options.AsInt(_T("Grid Hide Overrides"));
|
|
||||||
//wxString value = _T("");
|
|
||||||
|
|
||||||
//// Hid overrides
|
|
||||||
//if (mode == 1 || mode == 2) {
|
|
||||||
// wxString replaceWith = Options.AsText(_T("Grid hide overrides char"));
|
|
||||||
// line->ParseASSTags();
|
|
||||||
// size_t n = line->Blocks.size();
|
|
||||||
// for (size_t i=0;i<n;i++) {
|
|
||||||
// AssDialogueBlock *block = line->Blocks.at(i);
|
|
||||||
// AssDialogueBlockPlain *plain = AssDialogueBlock::GetAsPlain(block);
|
|
||||||
// if (plain) {
|
|
||||||
// value += plain->GetText();
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// if (mode == 1) {
|
|
||||||
// value += replaceWith;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
//// Show overrides
|
|
||||||
//else value = line->Text;
|
|
||||||
|
|
||||||
//// Cap length and set text
|
|
||||||
//if (value.Length() > 128) value = value.Left(128) + _T("...");
|
|
||||||
//SetCellValue(n,9,value);
|
|
||||||
|
|
||||||
//// Colour
|
|
||||||
//SetRowColour(n,line);
|
|
||||||
|
|
||||||
//// Size
|
|
||||||
//SetRowSize(n,RowHeight);
|
|
||||||
//EndBatch();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////
|
//////////////////
|
||||||
// Sets row color
|
// Sets row color
|
||||||
void SubtitlesGrid::SetRowColour(int n,AssDialogue *line) {
|
void SubtitlesGrid::SetRowColour(int n,AssDialogue *line) {
|
||||||
// Get line
|
Refresh(false);
|
||||||
if (!line) line = GetDialogue(n);
|
|
||||||
if (!line) return;
|
|
||||||
wxGridCellAttr* attr = new wxGridCellAttr;
|
|
||||||
|
|
||||||
// Comment
|
|
||||||
if (line->Comment) {
|
|
||||||
attr->SetTextColour(Options.AsColour(_T("Grid selection foreground")));
|
|
||||||
attr->SetBackgroundColour(Options.AsColour(_T("Grid comment background")));
|
|
||||||
}
|
|
||||||
|
|
||||||
// In video
|
|
||||||
else if (Options.AsBool(_T("Highlight subs in frame")) && IsDisplayed(line)) {
|
|
||||||
attr->SetTextColour(Options.AsColour(_T("Grid selection foreground")));
|
|
||||||
attr->SetBackgroundColour(Options.AsColour(_T("Grid inframe background")));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set
|
|
||||||
//SetRowAttr(n,attr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////
|
//////////////////////
|
||||||
// Update row colours
|
// Update row colours
|
||||||
void SubtitlesGrid::UpdateRowColours() {
|
void SubtitlesGrid::UpdateRowColours() {
|
||||||
BeginBatch();
|
Refresh(false);
|
||||||
int rows = GetRows();
|
|
||||||
for (int i=0;i<rows;i++) {
|
|
||||||
//SetRowColour(i);
|
|
||||||
}
|
|
||||||
EndBatch();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1505,29 +1426,8 @@ void SubtitlesGrid::SetByFrame (bool state) {
|
||||||
// Check if it's already the same
|
// Check if it's already the same
|
||||||
if (byFrame == state) return;
|
if (byFrame == state) return;
|
||||||
byFrame = state;
|
byFrame = state;
|
||||||
|
SetColumnWidths();
|
||||||
//// Update rows
|
Refresh(false);
|
||||||
//BeginBatch();
|
|
||||||
//int nrows = GetRows();
|
|
||||||
//AssDialogue *line;
|
|
||||||
//for (int i=0;i<nrows;i++) {
|
|
||||||
// line = GetDialogue(i);
|
|
||||||
// if (byFrame) {
|
|
||||||
// SetCellValue(i,1,wxString::Format(_T("%i"),VFR_Output.CorrectFrameAtTime(line->Start.GetMS(),true)));
|
|
||||||
// SetCellValue(i,2,wxString::Format(_T("%i"),VFR_Output.CorrectFrameAtTime(line->End.GetMS(),false)));
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// SetCellValue(i,1,line->Start.GetASSFormated());
|
|
||||||
// SetCellValue(i,2,line->End.GetASSFormated());
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
//// Update columns
|
|
||||||
////AutoSizeColumn(1,false);
|
|
||||||
////AutoSizeColumn(2,false);
|
|
||||||
//AutoSizeColumns();
|
|
||||||
//FitColumns();
|
|
||||||
//EndBatch();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1542,17 +1442,6 @@ wxString SubtitlesGrid::GetTempWorkFile () {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////
|
|
||||||
// Check if line is being displayed
|
|
||||||
bool SubtitlesGrid::IsDisplayed(AssDialogue *line) {
|
|
||||||
if (!video->loaded) return false;
|
|
||||||
int f1 = VFR_Output.CorrectFrameAtTime(line->Start.GetMS(),true);
|
|
||||||
int f2 = VFR_Output.CorrectFrameAtTime(line->End.GetMS(),false);
|
|
||||||
if (f1 <= video->frame_n && f2 >= video->frame_n) return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
// Selects visible lines
|
// Selects visible lines
|
||||||
void SubtitlesGrid::SelectVisible() {
|
void SubtitlesGrid::SelectVisible() {
|
||||||
|
|
|
@ -73,7 +73,6 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AssFile *ass;
|
AssFile *ass;
|
||||||
VideoDisplay *video;
|
|
||||||
|
|
||||||
SubtitlesGrid(FrameMain* parentFrame,wxWindow *parent, wxWindowID id, VideoDisplay* video, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxWANTS_CHARS, const wxString& name = wxPanelNameStr);
|
SubtitlesGrid(FrameMain* parentFrame,wxWindow *parent, wxWindowID id, VideoDisplay* video, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxWANTS_CHARS, const wxString& name = wxPanelNameStr);
|
||||||
~SubtitlesGrid();
|
~SubtitlesGrid();
|
||||||
|
@ -114,7 +113,6 @@ public:
|
||||||
void SetRowColour(int n,AssDialogue *line=NULL);
|
void SetRowColour(int n,AssDialogue *line=NULL);
|
||||||
void UpdateRowColours();
|
void UpdateRowColours();
|
||||||
void SelectVisible();
|
void SelectVisible();
|
||||||
bool IsDisplayed(AssDialogue *line);
|
|
||||||
void SetRowToLine(int n,AssDialogue *line);
|
void SetRowToLine(int n,AssDialogue *line);
|
||||||
void LoadFromAss(AssFile *ass=NULL,bool keepSelection=false,bool dontModify=false);
|
void LoadFromAss(AssFile *ass=NULL,bool keepSelection=false,bool dontModify=false);
|
||||||
void CommitChanges(bool force=false);
|
void CommitChanges(bool force=false);
|
||||||
|
|
Loading…
Reference in a new issue