X-Git-Url: http://git.euphorik.ch/?p=master-thesis.git;a=blobdiff_plain;f=Parasitemia%2FParasitemiaUI%2FGUI.fs;fp=Parasitemia%2FParasitemiaUI%2FGUI.fs;h=74aba278a90043356b76910dfd14d4db3b87e60b;hp=89f38e31dfb015326743b3fe782e462240567686;hb=be048d85a1519bd45f516a88720a629d693a2be2;hpb=3c43609ff19e07331977fb7b62757cc3abd73387 diff --git a/Parasitemia/ParasitemiaUI/GUI.fs b/Parasitemia/ParasitemiaUI/GUI.fs index 89f38e3..74aba27 100644 --- a/Parasitemia/ParasitemiaUI/GUI.fs +++ b/Parasitemia/ParasitemiaUI/GUI.fs @@ -81,14 +81,18 @@ let run (defaultConfig : Config) (fileToOpen : string option) = statusMessageTimer.Stop () statusMessageTimer.Start () - let highlightRBCFrame (frame : RBCFrame) (highlight : bool) = - let rbc = frame.Tag :?> RBC - if highlight then - frame.border.StrokeThickness <- 3. * frame.border.StrokeThickness - if not rbc.infected && not rbc.setManually && not displayHealthy then frame.Opacity <- 1. - else - frame.border.StrokeThickness <- frame.border.StrokeThickness / 3. - if not rbc.infected && not rbc.setManually && not displayHealthy then frame.Opacity <- 0. + let highlightRBC (rbc : RBC) (highlight : bool) = + // let rbc = frame.Tag :?> RBC + // Find the two frames in previews and current image. + + for rbcFrame in (win.stackRBC.Children |> Seq.cast).Concat(win.canvasCurrentImage.Children |> Seq.cast) do + if (rbcFrame.Tag :?> RBC) = rbc then + if highlight then + rbcFrame.border.StrokeThickness <- 3. * rbcFrame.border.StrokeThickness + if not rbc.infected && not rbc.setManually && not displayHealthy then rbcFrame.Opacity <- 1. + else + rbcFrame.border.StrokeThickness <- rbcFrame.border.StrokeThickness / 3. + if not rbc.infected && not rbc.setManually && not displayHealthy then rbcFrame.Opacity <- 0. let zoomToRBC (rbc : RBC) = win.scrollViewCurrentImage.ScrollToHorizontalOffset (rbc.center.X * currentScale - win.scrollViewCurrentImage.ViewportWidth / 2. + win.borderCurrentImage.BorderThickness.Left) @@ -194,9 +198,9 @@ let run (defaultConfig : Config) (fileToOpen : string option) = frame.menuRBCSetAsHealthy.Visibility <- Visibility.Collapsed frame.menuRBCSetAsInfected.Visibility <- Visibility.Visible ) - frame.ContextMenuClosing.AddHandler (fun obj args -> if not frame.IsMouseOver then highlightRBCFrame frame false ) - frame.MouseEnter.AddHandler (fun obj args -> highlightRBCFrame frame true) - frame.MouseLeave.AddHandler (fun obj args -> if not frame.grid.ContextMenu.IsOpen then highlightRBCFrame frame false) + frame.ContextMenuClosing.AddHandler (fun obj args -> if not frame.IsMouseOver then highlightRBC (frame.Tag :?> RBC) false ) + frame.MouseEnter.AddHandler (fun obj args -> highlightRBC (frame.Tag :?> RBC) true) + frame.MouseLeave.AddHandler (fun obj args -> if not frame.grid.ContextMenu.IsOpen then highlightRBC (frame.Tag :?> RBC) false) frame and updateRBCFramesPreview () =