Originally committed to SVN as r106.
This commit is contained in:
parent
5d490b988f
commit
82bfd00da8
2 changed files with 49 additions and 25 deletions
|
@ -828,6 +828,11 @@ void BaseGrid::UpdateMaps() {
|
||||||
/////////////
|
/////////////
|
||||||
// Key press
|
// Key press
|
||||||
void BaseGrid::OnKeyPress(wxKeyEvent &event) {
|
void BaseGrid::OnKeyPress(wxKeyEvent &event) {
|
||||||
|
// Get size
|
||||||
|
int w,h;
|
||||||
|
GetClientSize(&w,&h);
|
||||||
|
|
||||||
|
// Get scan code
|
||||||
int key = event.KeyCode();
|
int key = event.KeyCode();
|
||||||
|
|
||||||
// Left/right, forward to seek bar if video is loaded
|
// Left/right, forward to seek bar if video is loaded
|
||||||
|
@ -843,8 +848,25 @@ void BaseGrid::OnKeyPress(wxKeyEvent &event) {
|
||||||
|
|
||||||
// Up/down
|
// Up/down
|
||||||
int dir = 0;
|
int dir = 0;
|
||||||
|
int step = 1;
|
||||||
if (key == WXK_UP) dir = -1;
|
if (key == WXK_UP) dir = -1;
|
||||||
if (key == WXK_DOWN) dir = 1;
|
if (key == WXK_DOWN) dir = 1;
|
||||||
|
if (key == WXK_PRIOR) {
|
||||||
|
dir = -1;
|
||||||
|
step = h/lineHeight - 2;
|
||||||
|
}
|
||||||
|
if (key == WXK_NEXT) {
|
||||||
|
dir = 1;
|
||||||
|
step = h/lineHeight - 2;
|
||||||
|
}
|
||||||
|
if (key == WXK_HOME) {
|
||||||
|
dir = -1;
|
||||||
|
step = GetRows();
|
||||||
|
}
|
||||||
|
if (key == WXK_END) {
|
||||||
|
dir = 1;
|
||||||
|
step = GetRows();
|
||||||
|
}
|
||||||
|
|
||||||
// Moving
|
// Moving
|
||||||
if (dir) {
|
if (dir) {
|
||||||
|
@ -855,50 +877,52 @@ void BaseGrid::OnKeyPress(wxKeyEvent &event) {
|
||||||
|
|
||||||
// Move selection
|
// Move selection
|
||||||
if (!ctrl && !shift && !alt) {
|
if (!ctrl && !shift && !alt) {
|
||||||
int next = editBox->linen+dir;
|
// Move to extent first
|
||||||
|
int curLine = editBox->linen;
|
||||||
|
if (extendRow != -1) {
|
||||||
|
curLine = extendRow;
|
||||||
|
extendRow = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int next = MID(0,curLine+dir*step,GetRows()-1);
|
||||||
editBox->SetToLine(next);
|
editBox->SetToLine(next);
|
||||||
SelectRow(next);
|
SelectRow(next);
|
||||||
MakeCellVisible(next,0,false);
|
MakeCellVisible(next,0,false);
|
||||||
extendRow = -1;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move active only
|
// Move active only
|
||||||
if (alt && !shift && !ctrl) {
|
if (alt && !shift && !ctrl) {
|
||||||
int next = editBox->linen+dir;
|
extendRow = -1;
|
||||||
|
int next = MID(0,editBox->linen+dir*step,GetRows()-1);
|
||||||
editBox->SetToLine(next);
|
editBox->SetToLine(next);
|
||||||
Refresh(false);
|
Refresh(false);
|
||||||
MakeCellVisible(next,0,false);
|
MakeCellVisible(next,0,false);
|
||||||
extendRow = -1;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add to selection
|
// Shift-selection
|
||||||
if (shift && !ctrl && !alt) {
|
if (shift && !ctrl && !alt) {
|
||||||
if (extendRow == -1) {
|
// Find end
|
||||||
extendRow = editBox->linen+dir;
|
if (extendRow == -1) extendRow = editBox->linen;
|
||||||
extendRow = MID(0,extendRow,GetRows());
|
extendRow = MID(0,extendRow+dir*step,GetRows()-1);
|
||||||
SelectRow(extendRow,true);
|
|
||||||
|
// Set range
|
||||||
|
int i1 = editBox->linen;
|
||||||
|
int i2 = extendRow;
|
||||||
|
if (i2 < i1) {
|
||||||
|
int aux = i1;
|
||||||
|
i1 = i2;
|
||||||
|
i2 = aux;
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
// Select range
|
||||||
// Add
|
ClearSelection();
|
||||||
if ((extendRow > editBox->linen && dir == 1) || (extendRow < editBox->linen && dir == -1) || extendRow == editBox->linen) {
|
for (int i=i1;i<=i2;i++) {
|
||||||
extendRow += dir;
|
SelectRow(i,true);
|
||||||
extendRow = MID(0,extendRow,GetRows());
|
|
||||||
SelectRow(extendRow,true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove (moving back)
|
|
||||||
else {
|
|
||||||
SelectRow(extendRow,true,false);
|
|
||||||
extendRow += dir;
|
|
||||||
extendRow = MID(0,extendRow,GetRows());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MakeCellVisible(extendRow,0,false);
|
MakeCellVisible(extendRow,0,false);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -867,7 +867,7 @@ void FrameMain::OnShiftToFrame (wxCommandEvent &event) {
|
||||||
////////
|
////////
|
||||||
// Undo
|
// Undo
|
||||||
void FrameMain::OnUndo(wxCommandEvent& WXUNUSED(event)) {
|
void FrameMain::OnUndo(wxCommandEvent& WXUNUSED(event)) {
|
||||||
// Block if it's on a editbox (doesn't work for whatever reason)
|
// Block if it's on a editbox
|
||||||
//wxWindow *focused = wxWindow::FindFocus();
|
//wxWindow *focused = wxWindow::FindFocus();
|
||||||
//if (focused && focused->IsKindOf(CLASSINFO(wxTextCtrl))) return;
|
//if (focused && focused->IsKindOf(CLASSINFO(wxTextCtrl))) return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue