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
|
||||
int BaseGrid::GetRows() const {
|
||||
|
@ -507,7 +519,7 @@ void BaseGrid::OnMouseEvent(wxMouseEvent &event) {
|
|||
// Toggle selected
|
||||
if (click && ctrl && !shift) {
|
||||
SelectRow(row,true,!IsInSelection(row,0));
|
||||
parentFrame->SetSelectionFlag(GetNumberSelection());
|
||||
parentFrame->UpdateToolbar();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -515,7 +527,7 @@ void BaseGrid::OnMouseEvent(wxMouseEvent &event) {
|
|||
if (click && !shift && !ctrl && !alt) {
|
||||
editBox->SetToLine(row);
|
||||
SelectRow(row,false);
|
||||
parentFrame->SetSelectionFlag(GetNumberSelection());
|
||||
parentFrame->UpdateToolbar();
|
||||
lastRow = row;
|
||||
return;
|
||||
}
|
||||
|
@ -538,7 +550,7 @@ void BaseGrid::OnMouseEvent(wxMouseEvent &event) {
|
|||
SelectRow(i,notFirst,true);
|
||||
notFirst = true;
|
||||
}
|
||||
parentFrame->SetSelectionFlag(GetNumberSelection());
|
||||
parentFrame->UpdateToolbar();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -390,6 +390,7 @@ void FrameMain::UpdateToolbar() {
|
|||
// Collect flags
|
||||
bool isVideo = (curMode == 1) || (curMode == 2);
|
||||
HasSelection = true;
|
||||
int selRows = SubsBox->GetNumberSelection();
|
||||
|
||||
// Update
|
||||
wxToolBar* toolbar = GetToolBar();
|
||||
|
@ -397,13 +398,13 @@ void FrameMain::UpdateToolbar() {
|
|||
toolbar->FindById(Menu_Video_Zoom_In)->Enable(isVideo);
|
||||
toolbar->FindById(Menu_Video_Zoom_Out)->Enable(isVideo);
|
||||
ZoomBox->Enable(isVideo);
|
||||
toolbar->FindById(Menu_Subs_Snap_Start_To_Video)->Enable(isVideo && HasSelection);
|
||||
toolbar->FindById(Menu_Subs_Snap_End_To_Video)->Enable(isVideo && HasSelection);
|
||||
toolbar->FindById(Menu_Subs_Snap_Video_To_Start)->Enable(isVideo && HasSelection);
|
||||
toolbar->FindById(Menu_Subs_Snap_Video_To_End)->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 && selRows > 0);
|
||||
toolbar->FindById(Menu_Subs_Snap_Video_To_Start)->Enable(isVideo && selRows == 1);
|
||||
toolbar->FindById(Menu_Subs_Snap_Video_To_End)->Enable(isVideo && selRows == 1);
|
||||
toolbar->FindById(Menu_Video_Select_Visible)->Enable(isVideo);
|
||||
toolbar->FindById(Menu_Video_Snap_To_Scene)->Enable(isVideo && HasSelection);
|
||||
toolbar->FindById(Menu_Video_Shift_To_Frame)->Enable(isVideo && HasSelection);
|
||||
toolbar->FindById(Menu_Video_Snap_To_Scene)->Enable(isVideo && selRows > 0);
|
||||
toolbar->FindById(Menu_Video_Shift_To_Frame)->Enable(isVideo && selRows > 0);
|
||||
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
|
||||
wxArrayString FrameMain::GetEncodings() {
|
||||
|
|
|
@ -212,7 +212,6 @@ private:
|
|||
void AppendBitmapMenuItem (wxMenu* parentMenu,int id,wxString text,wxString help,wxBitmap bmp);
|
||||
wxMenuItem *RebuildMenuItem(wxMenu *menu,int id,wxBitmap bmp1,wxBitmap bmp2,bool state);
|
||||
void MenuItemEnable(int id,bool state,wxBitmap &bmp1,wxBitmap &bmp2);
|
||||
void UpdateToolbar();
|
||||
void SynchronizeProject(bool FromSubs=false);
|
||||
|
||||
public:
|
||||
|
@ -228,11 +227,11 @@ public:
|
|||
static void OpenHelp(wxString page=_T(""));
|
||||
static wxArrayString GetEncodings();
|
||||
void UpdateTitle();
|
||||
void SetSelectionFlag (bool HasSelection);
|
||||
void StatusTimeout(wxString text,int ms=10000);
|
||||
|
||||
void SetAccelerators();
|
||||
void InitMenu();
|
||||
void UpdateToolbar();
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
|
|
@ -55,10 +55,7 @@
|
|||
///////////////
|
||||
// Event table
|
||||
BEGIN_EVENT_TABLE(SubtitlesGrid, BaseGrid)
|
||||
EVT_GRID_CELL_LEFT_CLICK(SubtitlesGrid::OnCellLeftClick)
|
||||
EVT_GRID_SELECT_CELL(SubtitlesGrid::OnSelectCell)
|
||||
EVT_KEY_DOWN(SubtitlesGrid::OnKeyDown)
|
||||
|
||||
EVT_MENU(MENU_SWAP,SubtitlesGrid::OnSwap)
|
||||
EVT_MENU(MENU_DUPLICATE,SubtitlesGrid::OnDuplicate)
|
||||
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
|
||||
void SubtitlesGrid::LoadDefault (AssFile *_ass) {
|
||||
|
|
Loading…
Reference in New Issue