[chronojump] Selected curves with better color on DoPlot



commit 28bdab92c79441cccb222ba1f0cb4b6f4963b6ea
Author: Xavier de Blas <xaviblas gmail com>
Date:   Sun May 18 10:11:17 2014 +0200

    Selected curves with better color on DoPlot

 src/gui/encoder.cs |   17 ++++++++++-------
 src/utilGtk.cs     |   10 +++++++++-
 2 files changed, 19 insertions(+), 8 deletions(-)
---
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 45e5c76..ee87491 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -250,7 +250,7 @@ public partial class ChronoJumpWindow
        Gdk.GC pen_green_encoder_capture;
        Gdk.GC pen_red_encoder_capture;
        Gdk.GC pen_white_encoder_capture;
-       Gdk.GC pen_yellow_encoder_capture;
+       Gdk.GC pen_selected_encoder_capture;
 
        //TODO:put zoom,unzoom (at side of delete curve)  in capture curves (for every curve)
        //TODO: treeview on analyze (doing in separated window)
@@ -3937,13 +3937,14 @@ Log.WriteLine(str);
                                textHeight = 1;
                                layout_encoder_capture_curves_bars.GetPixelSize(out textWidth, out 
textHeight); 
                                int myX = Convert.ToInt32( startX - textWidth/2);
-                               int myY = Convert.ToInt32(graphHeight - (bottom_margin /2) - textHeight/2);
+                               //int myY = Convert.ToInt32(graphHeight - (bottom_margin /2) - textHeight/2);
+                               int myY = Convert.ToInt32(dTop + dHeight + (bottom_margin /2) - textHeight/2);
                                
                                //plot a rectangle if this curve it is checked (in the near future checked 
will mean saved)
                                if(iterOk)
                                        if(((EncoderCurve) encoderCaptureListStore.GetValue (iter, 
0)).Record) {
-                                               rect = new Rectangle(myX -2, myY -2, textWidth +4, textHeight 
+4);
-                                               
encoder_capture_curves_bars_pixmap.DrawRectangle(pen_yellow_encoder_capture, true, rect);
+                                               rect = new Rectangle(myX -2, myY -1, textWidth +4, 
graphHeight - (myY -1) -1);
+                                               
encoder_capture_curves_bars_pixmap.DrawRectangle(pen_selected_encoder_capture, false, rect);
                                        }
                                
                                //write the text
@@ -4225,7 +4226,7 @@ Log.WriteLine(str);
                pen_green_encoder_capture = new Gdk.GC(encoder_capture_signal_drawingarea.GdkWindow);
                pen_red_encoder_capture = new Gdk.GC(encoder_capture_signal_drawingarea.GdkWindow);
                pen_white_encoder_capture = new Gdk.GC(encoder_capture_signal_drawingarea.GdkWindow);
-               pen_yellow_encoder_capture = new Gdk.GC(encoder_capture_signal_drawingarea.GdkWindow);
+               pen_selected_encoder_capture = new Gdk.GC(encoder_capture_signal_drawingarea.GdkWindow);
 
                Gdk.Colormap colormap = Gdk.Colormap.System;
                colormap.AllocColor (ref UtilGtk.BLACK,true,true);
@@ -4233,14 +4234,16 @@ Log.WriteLine(str);
                colormap.AllocColor (ref UtilGtk.GREEN_PLOTS,true,true);
                colormap.AllocColor (ref UtilGtk.RED_PLOTS,true,true);
                colormap.AllocColor (ref UtilGtk.WHITE,true,true);
-               colormap.AllocColor (ref UtilGtk.YELLOW,true,true);
+               colormap.AllocColor (ref UtilGtk.SELECTED,true,true);
 
                pen_black_encoder_capture.Foreground = UtilGtk.BLACK;
                pen_azul_encoder_capture.Foreground = UtilGtk.BLUE_PLOTS;
                pen_green_encoder_capture.Foreground = UtilGtk.GREEN_PLOTS;
                pen_red_encoder_capture.Foreground = UtilGtk.RED_PLOTS;
                pen_white_encoder_capture.Foreground = UtilGtk.WHITE;
-               pen_yellow_encoder_capture.Foreground = UtilGtk.YELLOW;
+               pen_selected_encoder_capture.Foreground = UtilGtk.SELECTED;
+
+               pen_selected_encoder_capture.SetLineAttributes (2, Gdk.LineStyle.Solid, Gdk.CapStyle.NotLast, 
Gdk.JoinStyle.Miter);
        }
 
        private bool pulseGTKEncoderCaptureAndCurves ()
diff --git a/src/utilGtk.cs b/src/utilGtk.cs
index 6c9aca5..4b91f26 100644
--- a/src/utilGtk.cs
+++ b/src/utilGtk.cs
@@ -261,6 +261,14 @@ public class UtilGtk
        public static Gdk.Color BLUE_PLOTS = new Gdk.Color(0,0,238);
        public static Gdk.Color BLUE_CHRONOJUMP = new Gdk.Color(14,30,70); //so dark, can be used only for 
background
        
+       public static Gdk.Color SELECTED = GetBackgroundColorSelected();
+
+
+       public static Gdk.Color GetBackgroundColorSelected() {
+               Gtk.Style regularLabel = Gtk.Rc.GetStyle (new Gtk.Label());
+
+               return regularLabel.Background (StateType.Selected);
+       }
 
        public static void ColorsMenuLabel(Gtk.Viewport v, Gtk.Label l) {
                l.ModifyFg(StateType.Active, v.Style.Foreground(StateType.Selected));
@@ -319,7 +327,7 @@ public class UtilGtk
                        l2.ModifyFg(StateType.Normal, WHITE);
                }
        }
-
+       
        /*
         *
         * PRETTY THINGS


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]