From fd8e49c44352f155368a333a1de85c455dddf358 Mon Sep 17 00:00:00 2001 From: tomascz Date: Mon, 16 Nov 2020 20:55:38 +0100 Subject: [PATCH] [#57] Support for KryoFlux and associated images (Part 18: Added commands to navigate between index pulses) --- Main/res/resource.rc | 8 ++++++++ Main/src/Image_TrackEditor.cpp | 31 +++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/Main/res/resource.rc b/Main/res/resource.rc index d9fc9c0c..ff5b6f7c 100644 --- a/Main/res/resource.rc +++ b/Main/res/resource.rc @@ -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 @@ -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 diff --git a/Main/src/Image_TrackEditor.cpp b/Main/src/Image_TrackEditor.cpp index c4fc8101..f4735e6b 100644 --- a/Main/src/Image_TrackEditor.cpp +++ b/Main/src/Image_TrackEditor.cpp @@ -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; } @@ -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(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.GetIndexTime(i); i++ ); + if (i