Add some key shortcut.
authorGreg Burri <greg.burri@gmail.com>
Wed, 29 Mar 2017 10:59:54 +0000 (12:59 +0200)
committerGreg Burri <greg.burri@gmail.com>
Wed, 29 Mar 2017 10:59:54 +0000 (12:59 +0200)
Parasitemia/ParasitemiaCore/ParasitemiaCore.fsproj
Parasitemia/ParasitemiaCore/packages.config
Parasitemia/ParasitemiaUI/GUI.fs
Parasitemia/ParasitemiaUI/ParasitemiaUI.fsproj
Parasitemia/ParasitemiaUI/XAML/MainWindow.xaml
Parasitemia/ParasitemiaUI/packages.config

index f3210a9..a0dda64 100644 (file)
@@ -78,9 +78,8 @@
       <HintPath>..\packages\FSharp.Collections.ParallelSeq.1.0.2\lib\net40\FSharp.Collections.ParallelSeq.dll</HintPath>
       <Private>True</Private>
     </Reference>
-    <Reference Include="FSharp.Core, Version=4.4.1.0">
-      <HintPath>..\packages\FSharp.Core.4.0.0.1\lib\net40\FSharp.Core.dll</HintPath>
-      <Private>True</Private>
+    <Reference Include="FSharp.Core">
+      <HintPath>..\packages\FSharp.Core.4.1.2\lib\net45\FSharp.Core.dll</HintPath>
     </Reference>
     <Reference Include="MathNet.Numerics">
       <HintPath>..\packages\MathNet.Numerics.3.17.0\lib\net40\MathNet.Numerics.dll</HintPath>
index 0bdf2f7..cbdda29 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
   <package id="FSharp.Collections.ParallelSeq" version="1.0.2" targetFramework="net452" />
-  <package id="FSharp.Core" version="4.1.0.2" targetFramework="net462" />
+  <package id="FSharp.Core" version="4.1.2" targetFramework="net462" />
   <package id="MathNet.Numerics" version="3.17.0" targetFramework="net462" />
   <package id="MathNet.Numerics.FSharp" version="3.17.0" targetFramework="net462" />
   <package id="System.ValueTuple" version="4.3.0" targetFramework="net462" />
index ade197e..985c8a4 100644 (file)
@@ -438,6 +438,16 @@ let run (defaultConfig : Config) (fileToOpen : string option) =
             if noSourceImage then
                 updateCurrentImage ()
 
+    let showAnalysisWindow () =
+        if Analysis.showWindow win state then
+            updateGlobalParasitemia ()
+            updateCurrentImage ()
+
+    let setHighlightRBC (highlight : bool) =
+        displayHealthy <- highlight
+        updateRBCFramesPreview ()
+        updateRBCFramesCurrent ()
+
     win.txtPatient.TextChanged.AddHandler(fun obj args -> state.PatientID <- win.txtPatient.Text)
 
     win.menuExit.Click.AddHandler(fun obj args -> win.Close())
@@ -451,17 +461,9 @@ let run (defaultConfig : Config) (fileToOpen : string option) =
 
     win.menuAnalysis.SubmenuOpened.AddHandler(fun obj args -> win.menuStartAnalysis.IsEnabled <- state.SourceImages.Count() > 0)
 
-    win.menuStartAnalysis.Click.AddHandler(fun obj args ->
-        if Analysis.showWindow win state then
-            updateGlobalParasitemia ()
-            updateCurrentImage ()
-    )
+    win.menuStartAnalysis.Click.AddHandler(fun obj args -> showAnalysisWindow ())
 
-    win.menuHightlightRBC.Click.AddHandler(fun obj args ->
-        displayHealthy <- win.menuHightlightRBC.IsChecked
-        updateRBCFramesPreview ()
-        updateRBCFramesCurrent ()
-    )
+    win.menuHightlightRBC.Click.AddHandler(fun obj args -> setHighlightRBC win.menuHightlightRBC.IsChecked)
 
     win.menuAbout.Click.AddHandler(fun obj args -> About.showWindow win)
 
@@ -601,6 +603,29 @@ let run (defaultConfig : Config) (fileToOpen : string option) =
         )
     ) |> ignore
 
+    // Show analysis dialog.
+    win.InputBindings.Add(
+        Input.KeyBinding(
+            ViewModule.FunCommand((fun obj -> showAnalysisWindow ()), (fun obj -> state.SourceImages.Count() > 0)),
+            Input.KeyGesture(Input.Key.Y, Input.ModifierKeys.Control)
+        )
+    ) |> ignore
+
+    // Toggle RBC highlight.
+    win.InputBindings.Add(
+        Input.KeyBinding(
+            ViewModule.FunCommand(
+                (
+                    fun obj ->
+                        win.menuHightlightRBC.IsChecked <- not win.menuHightlightRBC.IsChecked
+                        setHighlightRBC win.menuHightlightRBC.IsChecked
+                ),
+                (fun obj -> true)
+            ),
+            Input.KeyGesture(Input.Key.H, Input.ModifierKeys.Control)
+        )
+    ) |> ignore
+
     // Viewport preview.
     win.scrollViewCurrentImage.ScrollChanged.AddHandler(fun obj args -> updateViewportPreview ())
 
index 96b0732..365cc93 100644 (file)
@@ -99,9 +99,8 @@
     <Reference Include="Emgu.CV.World">
       <HintPath>..\..\..\Emgu\emgucv-windesktop 3.1.0.2282\bin\Emgu.CV.World.dll</HintPath>
     </Reference>
-    <Reference Include="FSharp.Core, Version=4.4.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
-      <HintPath>..\packages\FSharp.Core.4.0.0.1\lib\net40\FSharp.Core.dll</HintPath>
-      <Private>True</Private>
+    <Reference Include="FSharp.Core">
+      <HintPath>..\packages\FSharp.Core.4.1.2\lib\net45\FSharp.Core.dll</HintPath>
     </Reference>
     <Reference Include="FSharp.ViewModule">
       <HintPath>..\packages\FSharp.ViewModule.Core.1.0.7.0\lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1\FSharp.ViewModule.dll</HintPath>
index e84bd54..9ce3f20 100644 (file)
             <MenuItem x:Name="menuExit" Header="_Exit" />
          </MenuItem>
          <MenuItem x:Name="menuAnalysis" Header="_Analysis">
-            <MenuItem x:Name="menuStartAnalysis" Header="_Show Analysis Window" />
+            <MenuItem x:Name="menuStartAnalysis" Header="_Show Analysis Window" InputGestureText="Ctrl+Y" />
          </MenuItem>
          <MenuItem x:Name="menuView" Header="_View">
-            <MenuItem x:Name="menuHightlightRBC" Header="_Highlight All Erythrocytes" IsCheckable="True" />
+            <MenuItem x:Name="menuHightlightRBC" Header="_Highlight All Erythrocytes" IsCheckable="True" InputGestureText="Ctrl+H" />
          </MenuItem>
          <MenuItem x:Name="menuHelp" Header="_Help">
             <MenuItem x:Name="menuAbout" Header="_About" />
index 79af972..432eb3c 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
   <package id="Expression.Blend.Sdk" version="1.0.2" targetFramework="net46" />
-  <package id="FSharp.Core" version="4.1.0.2" targetFramework="net462" />
+  <package id="FSharp.Core" version="4.1.2" targetFramework="net462" />
   <package id="FSharp.ViewModule.Core" version="1.0.7.0" targetFramework="net462" />
   <package id="FsXaml.Wpf" version="3.1.6" targetFramework="net462" />
   <package id="Newtonsoft.Json" version="10.0.1" targetFramework="net462" />