Tasedit - frame delete keyboard shortcut and related fixes

This commit is contained in:
mart0258 2009-11-23 01:48:17 +00:00
parent b949a21fc4
commit ca6f2be5f8
2 changed files with 25 additions and 14 deletions

View File

@ -232,7 +232,7 @@ BEGIN
MENUITEM "&Copy\tCtrl+C", ID_TASEDIT_COPY, INACTIVE MENUITEM "&Copy\tCtrl+C", ID_TASEDIT_COPY, INACTIVE
MENUITEM "&Paste\tCtrl+V", ID_TASEDIT_PASTE, INACTIVE MENUITEM "&Paste\tCtrl+V", ID_TASEDIT_PASTE, INACTIVE
MENUITEM "Paste to &New\tCtrl+Shift+V", ID_TASEDIT_PASTETONEW, INACTIVE MENUITEM "Paste to &New\tCtrl+Shift+V", ID_TASEDIT_PASTETONEW, INACTIVE
MENUITEM "&Delete\tCtrl+Delete", ID_TASEDIT_DELETE, INACTIVE MENUITEM "&Delete\tCtrl+Delete", ID_TASEDIT_DELETE
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Add Marker", ID_EDIT_ADDMARKER, INACTIVE MENUITEM "&Add Marker", ID_EDIT_ADDMARKER, INACTIVE
MENUITEM "&Remove Marker", ID_EDIT_REMOVEMARKER, INACTIVE MENUITEM "&Remove Marker", ID_EDIT_REMOVEMARKER, INACTIVE

View File

@ -326,7 +326,7 @@ void DoubleClick(LPNMITEMACTIVATE info)
currMovieData.records[*it].toggleBit(joy,bit); currMovieData.records[*it].toggleBit(joy,bit);
} }
index=*selectionFrames.begin() index=*selectionFrames.begin();
} }
else else
{ {
@ -355,17 +355,21 @@ void DoubleClick(LPNMITEMACTIVATE info)
static void ClearSelection() static void ClearSelection()
{ {
int frameCount = ListView_GetItemCount(hwndList); int frameCount = ListView_GetItemCount(hwndList);
LVITEM lvi; //LVITEM lvi;
lvi.mask = LVIF_STATE; //lvi.mask = LVIF_STATE;
lvi.state = 0; //lvi.state = 0;
lvi.stateMask = LVIS_SELECTED; //lvi.stateMask = LVIS_SELECTED;
for(int i=0;i<frameCount;i++)
{ ListView_SetItemState(hwndList,-1,0, LVIS_SELECTED);
lvi.iItem = i;
ListView_SetItem(hwndList,&lvi); //for(int i=0;i<frameCount;i++)
} //{
// lvi.iItem = i;
// ListView_SetItem(hwndList,&lvi);
//}
selectionFrames.clear(); selectionFrames.clear();
lastCursor=-1;
} }
//insert frames at the currently selected positions. //insert frames at the currently selected positions.
@ -408,11 +412,14 @@ static void DeleteFrames()
currMovieData.records.erase(currMovieData.records.begin()+*it); currMovieData.records.erase(currMovieData.records.begin()+*it);
} }
InvalidateGreenZone(*selectionFrames.begin()); int index = *selectionFrames.begin();
if (index>0) --index;
InvalidateGreenZone(index);
//in the particular case of deletion, we need to make sure we reset currFrameCounter to something reasonable //in the particular case of deletion, we need to make sure we reset currFrameCounter to something reasonable
//why not the current green zone max? //why not the current green zone max?
currFrameCounter = currMovieData.greenZoneCount-1; if (currFrameCounter>=index)
JumpToFrame(index);
ClearSelection(); ClearSelection();
UpdateTasEdit(); UpdateTasEdit();
RedrawList(); RedrawList();
@ -472,9 +479,12 @@ static void ColumnSet(int column)
//Highlights all frames in current input log //Highlights all frames in current input log
static void SelectAll() static void SelectAll()
{ {
for(int i=0;i<=currMovieData.records.size();i++) ClearSelection();
for(int i=0;i<currMovieData.records.size();i++)
selectionFrames.insert(i); selectionFrames.insert(i);
UpdateTasEdit();
RedrawList();
} }
//cuts the current selection and copies to the clipboard //cuts the current selection and copies to the clipboard
@ -500,6 +510,7 @@ static void PastetoNew()
//removes the current selection (does not put in clipboard) //removes the current selection (does not put in clipboard)
static void Delete() static void Delete()
{ {
DeleteFrames();
} }
//Adds a marker to left column at selected frame (if multiple frames selected, it is placed at end of selection) //Adds a marker to left column at selected frame (if multiple frames selected, it is placed at end of selection)