mirror of https://github.com/odrling/Aegisub
More fixes and tweaks to new grid
Originally committed to SVN as r68.
This commit is contained in:
parent
ff278ee099
commit
518e2272a0
|
@ -177,6 +177,18 @@ bool BaseGrid::IsInSelection(int row, int col) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////
|
||||||
|
// Number of selected rows
|
||||||
|
int BaseGrid::GetNumberSelection() {
|
||||||
|
int count = 0;
|
||||||
|
int rows = selMap.size();
|
||||||
|
for (int i=0;i<rows;i++) {
|
||||||
|
if (selMap[i]) count++;
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////
|
//////////////////////
|
||||||
// Get number of rows
|
// Get number of rows
|
||||||
int BaseGrid::GetRows() const {
|
int BaseGrid::GetRows() const {
|
||||||
|
@ -507,7 +519,7 @@ 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());
|
parentFrame->UpdateToolbar();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -515,7 +527,7 @@ void BaseGrid::OnMouseEvent(wxMouseEvent &event) {
|
||||||
if (click && !shift && !ctrl && !alt) {
|
if (click && !shift && !ctrl && !alt) {
|
||||||
editBox->SetToLine(row);
|
editBox->SetToLine(row);
|
||||||
SelectRow(row,false);
|
SelectRow(row,false);
|
||||||
parentFrame->SetSelectionFlag(GetNumberSelection());
|
parentFrame->UpdateToolbar();
|
||||||
lastRow = row;
|
lastRow = row;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -538,7 +550,7 @@ void BaseGrid::OnMouseEvent(wxMouseEvent &event) {
|
||||||
SelectRow(i,notFirst,true);
|
SelectRow(i,notFirst,true);
|
||||||
notFirst = true;
|
notFirst = true;
|
||||||
}
|
}
|
||||||
parentFrame->SetSelectionFlag(GetNumberSelection());
|
parentFrame->UpdateToolbar();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -390,6 +390,7 @@ void FrameMain::UpdateToolbar() {
|
||||||
// Collect flags
|
// Collect flags
|
||||||
bool isVideo = (curMode == 1) || (curMode == 2);
|
bool isVideo = (curMode == 1) || (curMode == 2);
|
||||||
HasSelection = true;
|
HasSelection = true;
|
||||||
|
int selRows = SubsBox->GetNumberSelection();
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
wxToolBar* toolbar = GetToolBar();
|
wxToolBar* toolbar = GetToolBar();
|
||||||
|
@ -397,13 +398,13 @@ void FrameMain::UpdateToolbar() {
|
||||||
toolbar->FindById(Menu_Video_Zoom_In)->Enable(isVideo);
|
toolbar->FindById(Menu_Video_Zoom_In)->Enable(isVideo);
|
||||||
toolbar->FindById(Menu_Video_Zoom_Out)->Enable(isVideo);
|
toolbar->FindById(Menu_Video_Zoom_Out)->Enable(isVideo);
|
||||||
ZoomBox->Enable(isVideo);
|
ZoomBox->Enable(isVideo);
|
||||||
toolbar->FindById(Menu_Subs_Snap_Start_To_Video)->Enable(isVideo && HasSelection);
|
toolbar->FindById(Menu_Subs_Snap_Start_To_Video)->Enable(isVideo && selRows > 0);
|
||||||
toolbar->FindById(Menu_Subs_Snap_End_To_Video)->Enable(isVideo && HasSelection);
|
toolbar->FindById(Menu_Subs_Snap_End_To_Video)->Enable(isVideo && selRows > 0);
|
||||||
toolbar->FindById(Menu_Subs_Snap_Video_To_Start)->Enable(isVideo && HasSelection);
|
toolbar->FindById(Menu_Subs_Snap_Video_To_Start)->Enable(isVideo && selRows == 1);
|
||||||
toolbar->FindById(Menu_Subs_Snap_Video_To_End)->Enable(isVideo && HasSelection);
|
toolbar->FindById(Menu_Subs_Snap_Video_To_End)->Enable(isVideo && selRows == 1);
|
||||||
toolbar->FindById(Menu_Video_Select_Visible)->Enable(isVideo);
|
toolbar->FindById(Menu_Video_Select_Visible)->Enable(isVideo);
|
||||||
toolbar->FindById(Menu_Video_Snap_To_Scene)->Enable(isVideo && HasSelection);
|
toolbar->FindById(Menu_Video_Snap_To_Scene)->Enable(isVideo && selRows > 0);
|
||||||
toolbar->FindById(Menu_Video_Shift_To_Frame)->Enable(isVideo && HasSelection);
|
toolbar->FindById(Menu_Video_Shift_To_Frame)->Enable(isVideo && selRows > 0);
|
||||||
toolbar->Realize();
|
toolbar->Realize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -946,16 +947,6 @@ void FrameMain::OpenHelp(wxString page) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////
|
|
||||||
// Set selection flag
|
|
||||||
void FrameMain::SetSelectionFlag(bool sel) {
|
|
||||||
if (HasSelection != sel) {
|
|
||||||
HasSelection = sel;
|
|
||||||
UpdateToolbar();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////
|
/////////////////
|
||||||
// Get encodings
|
// Get encodings
|
||||||
wxArrayString FrameMain::GetEncodings() {
|
wxArrayString FrameMain::GetEncodings() {
|
||||||
|
|
|
@ -212,7 +212,6 @@ private:
|
||||||
void AppendBitmapMenuItem (wxMenu* parentMenu,int id,wxString text,wxString help,wxBitmap bmp);
|
void AppendBitmapMenuItem (wxMenu* parentMenu,int id,wxString text,wxString help,wxBitmap bmp);
|
||||||
wxMenuItem *RebuildMenuItem(wxMenu *menu,int id,wxBitmap bmp1,wxBitmap bmp2,bool state);
|
wxMenuItem *RebuildMenuItem(wxMenu *menu,int id,wxBitmap bmp1,wxBitmap bmp2,bool state);
|
||||||
void MenuItemEnable(int id,bool state,wxBitmap &bmp1,wxBitmap &bmp2);
|
void MenuItemEnable(int id,bool state,wxBitmap &bmp1,wxBitmap &bmp2);
|
||||||
void UpdateToolbar();
|
|
||||||
void SynchronizeProject(bool FromSubs=false);
|
void SynchronizeProject(bool FromSubs=false);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -228,11 +227,11 @@ public:
|
||||||
static void OpenHelp(wxString page=_T(""));
|
static void OpenHelp(wxString page=_T(""));
|
||||||
static wxArrayString GetEncodings();
|
static wxArrayString GetEncodings();
|
||||||
void UpdateTitle();
|
void UpdateTitle();
|
||||||
void SetSelectionFlag (bool HasSelection);
|
|
||||||
void StatusTimeout(wxString text,int ms=10000);
|
void StatusTimeout(wxString text,int ms=10000);
|
||||||
|
|
||||||
void SetAccelerators();
|
void SetAccelerators();
|
||||||
void InitMenu();
|
void InitMenu();
|
||||||
|
void UpdateToolbar();
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
|
@ -55,10 +55,7 @@
|
||||||
///////////////
|
///////////////
|
||||||
// Event table
|
// Event table
|
||||||
BEGIN_EVENT_TABLE(SubtitlesGrid, BaseGrid)
|
BEGIN_EVENT_TABLE(SubtitlesGrid, BaseGrid)
|
||||||
EVT_GRID_CELL_LEFT_CLICK(SubtitlesGrid::OnCellLeftClick)
|
|
||||||
EVT_GRID_SELECT_CELL(SubtitlesGrid::OnSelectCell)
|
|
||||||
EVT_KEY_DOWN(SubtitlesGrid::OnKeyDown)
|
EVT_KEY_DOWN(SubtitlesGrid::OnKeyDown)
|
||||||
|
|
||||||
EVT_MENU(MENU_SWAP,SubtitlesGrid::OnSwap)
|
EVT_MENU(MENU_SWAP,SubtitlesGrid::OnSwap)
|
||||||
EVT_MENU(MENU_DUPLICATE,SubtitlesGrid::OnDuplicate)
|
EVT_MENU(MENU_DUPLICATE,SubtitlesGrid::OnDuplicate)
|
||||||
EVT_MENU(MENU_DUPLICATE_NEXT_FRAME,SubtitlesGrid::OnDuplicateNextFrame)
|
EVT_MENU(MENU_DUPLICATE_NEXT_FRAME,SubtitlesGrid::OnDuplicateNextFrame)
|
||||||
|
@ -800,31 +797,6 @@ void SubtitlesGrid::On112Recombine(wxCommandEvent &event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////
|
|
||||||
// Cell left click
|
|
||||||
void SubtitlesGrid::OnCellLeftClick (wxGridEvent &event) {
|
|
||||||
//SetGridCursor(GetGridCursorRow(),0);
|
|
||||||
event.Skip();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////
|
|
||||||
// Cell change selection
|
|
||||||
void SubtitlesGrid::OnSelectCell(wxGridEvent &event) {
|
|
||||||
int row = event.GetRow();
|
|
||||||
|
|
||||||
// Update editbox
|
|
||||||
if (editBox && event.Selecting() && ready) {
|
|
||||||
editBox->SetToLine(row);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update parent
|
|
||||||
parentFrame->SetSelectionFlag(row >= 0);
|
|
||||||
|
|
||||||
event.Skip();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
// Clears grid and sets it to default
|
// Clears grid and sets it to default
|
||||||
void SubtitlesGrid::LoadDefault (AssFile *_ass) {
|
void SubtitlesGrid::LoadDefault (AssFile *_ass) {
|
||||||
|
|
Loading…
Reference in New Issue