Skip to content

Commit

Permalink
[#57] Support for KryoFlux and associated images (Part 18: Added comm…
Browse files Browse the repository at this point in the history
…ands to navigate between index pulses)
  • Loading branch information
tomas-nestorovic committed Nov 16, 2020
1 parent 90d0d1d commit fd8e49c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Main/res/resource.rc
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ BEGIN
"-", ID_ZOOM_OUT, ASCII, NOINVERT
"0", ID_ZOOM_FIT, VIRTKEY, CONTROL, NOINVERT
VK_ESCAPE, IDCANCEL, VIRTKEY, NOINVERT
VK_NEXT, ID_NEXT, VIRTKEY, CONTROL, NOINVERT
VK_PRIOR, ID_PREV, VIRTKEY, CONTROL, NOINVERT
END


Expand Down Expand Up @@ -653,6 +655,12 @@ IDR_TRACK_EDITOR MENU DISCARDABLE
BEGIN
POPUP "Preview"
BEGIN
POPUP "Go to"
BEGIN
MENUITEM "Previous index\tCtrl+PgUp", ID_PREV
MENUITEM "Next index\tCtrl+PgDown", ID_NEXT
END
MENUITEM SEPARATOR
MENUITEM "Zoom in\t+", ID_ZOOM_IN
MENUITEM "Zoom out\t�", ID_ZOOM_OUT
MENUITEM "Zoom to fit\tCtrl+0", ID_ZOOM_FIT
Expand Down
31 changes: 31 additions & 0 deletions Main/src/Image_TrackEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,17 @@
painter.repaintEvent.SetEvent();
}

TLogTime GetCenterTime() const{
CRect rc;
GetClientRect(&rc);
return scrollTime+timeline.GetTime( rc.Width()/(Utils::LogicalUnitScaleFactor*2.f) );
}

void SetCenterTime(TLogTime t){
scrollTime=0; // base time for GetCenterTime
SetScrollTime( t-GetCenterTime() );
}

inline PCLogTime GetInspectionWindowEndTimes() const{
return iwEndTimes;
}
Expand Down Expand Up @@ -426,6 +437,12 @@
case ID_RECOGNIZE:
pCmdUi->SetCheck( timeEditor.GetInspectionWindowEndTimes()!=nullptr );
return TRUE;
case ID_PREV:
pCmdUi->SetCheck( tr.GetIndexCount()>0 && timeEditor.GetCenterTime()>tr.GetIndexTime(0) );
return TRUE;
case ID_NEXT:
pCmdUi->SetCheck( tr.GetIndexCount()>0 && timeEditor.GetCenterTime()<tr.GetIndexTime(tr.GetIndexCount()-1) );
return TRUE;
}
break;
}
Expand Down Expand Up @@ -456,6 +473,20 @@
timeEditor.SetInspectionWindowEndTimes(iwEndTimes);
}
return TRUE;
case ID_PREV:{
BYTE i=0;
for( const TLogTime tCenter=timeEditor.GetCenterTime(); i<tr.GetIndexCount()&&tCenter>tr.GetIndexTime(i); i++ );
if (i>0)
timeEditor.SetCenterTime( tr.GetIndexTime(i-1) );
return TRUE;
}
case ID_NEXT:{
BYTE i=0;
for( const TLogTime tCenter=timeEditor.GetCenterTime(); i<tr.GetIndexCount()&&tCenter>=tr.GetIndexTime(i); i++ );
if (i<tr.GetIndexCount())
timeEditor.SetCenterTime( tr.GetIndexTime(i) );
return TRUE;
}
}
break;
}
Expand Down

0 comments on commit fd8e49c

Please sign in to comment.