[giv] Fixed problem with redundant contrast-changed signal from giv-histo.



commit 71a5c329f5b74a03f64018329443b00467d4011d
Author: Dov Grobgeld <dov grobgeld gmail com>
Date:   Sun Apr 10 07:17:46 2011 +0300

    Fixed problem with redundant contrast-changed signal from giv-histo.

 ChangeLog         |   10 ++++++++++
 TODO              |    4 ++--
 src/giv-histo.gob |   13 ++++++++++---
 src/giv-win.gob   |   11 +++++++++--
 4 files changed, 31 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c79fd60..aeb8e1d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2011-04-10  Dov Grobgeld  <dov grobgeld gmail com>
+
+        * giv-win.gob : Made GL of integer formats show all values as integers.
+
+2011-04-09  Dov Grobgeld  <dov grobgeld gmail com>
+
+        * giv-histo.gob : Optimized generation of the contrast_changed
+        signal so that it is only omitted if the contrast has actually
+        changed.
+
 2011-04-08  Dov Grobgeld  <dov grobgeld gmail com>
 
         * giv-win.gob : Fixed text drawing in caliper on windows.
diff --git a/TODO b/TODO
index 968591d..a0264e5 100644
--- a/TODO
+++ b/TODO
@@ -8,7 +8,7 @@ List of things to do.
 * Support contrast changing also for color images.
 * Add plugins for:
 ** HDF5
-** 16-bit png through libpng
+** PNM - So that comments will be accessible.
 * Explore other libraries to build plugins uponin order to use their importers, e.g:
 ** OpenCV - 
 ** The CImg Library - http://cimg.sourceforge.net/
@@ -16,7 +16,7 @@ List of things to do.
 * Support high-bit color.
 * Fix annoying resize bugs on reload. Fix flickering!
 * Add 3d support to npy plugin.
-* Add zoom of histogram.
 * Add option for setting the number of decimals to show
 * Add optional grid for high zoom in.
 * Make png plugin support backgrounds.
+* Linear interpolate colors in colormap for more colors in pseudo color.
\ No newline at end of file
diff --git a/src/giv-histo.gob b/src/giv-histo.gob
index 77f17e4..4f68327 100644
--- a/src/giv-histo.gob
+++ b/src/giv-histo.gob
@@ -34,6 +34,8 @@ class Giv:Histo from Gtk:Drawing:Area {
     private gdouble dragging_y = -1;
     private double contrast_gl_min = -1;
     private double contrast_gl_max = -1;
+    private double old_contrast_gl_min = -1;
+    private double old_contrast_gl_max = -1;
     private double img_gl_min = -1;
     private double img_gl_max = -1;
     private double scale = 1.0;
@@ -149,9 +151,14 @@ class Giv:Histo from Gtk:Drawing:Area {
 
         // Only notify listeners of the contrast change after
         // we have redrawn the histogram!
-        giv_histo_contrast_changed(self,
-                                   selfp->contrast_gl_min,
-                                   selfp->contrast_gl_max);
+        if (selfp->contrast_gl_min != selfp->old_contrast_gl_min
+            || selfp->contrast_gl_max != selfp->old_contrast_gl_max) {
+            giv_histo_contrast_changed(self,
+                                       selfp->contrast_gl_min,
+                                       selfp->contrast_gl_max);
+            selfp->old_contrast_gl_max = selfp->contrast_gl_max;
+            selfp->old_contrast_gl_min = selfp->contrast_gl_min;
+        }
 
         // Draw the gl cursor
         PangoLayout *layout = pango_cairo_create_layout(cr);
diff --git a/src/giv-win.gob b/src/giv-win.gob
index 3ae8050..6a5a655 100644
--- a/src/giv-win.gob
+++ b/src/giv-win.gob
@@ -994,7 +994,9 @@ class Giv:Win from Gtk:Window
         // Create a suitable gray level formatting for the image.
         if (selfp->format)
             g_free(selfp->format);
-        if (max-min > 1e-3 && max-min <= 1e-2) 
+        if (new_img->img_type <= GIVIMAGE_I32)
+            selfp->format = g_strdup("%.0f");
+        else if (max-min > 1e-3 && max-min <= 1e-2) 
             selfp->format = g_strdup("%.5f");
         else if (max-min > 1e-2 && max-min <= 1e-1) 
             selfp->format = g_strdup("%.4f");
@@ -1006,6 +1008,7 @@ class Giv:Win from Gtk:Window
             selfp->format = g_strdup("%.1f");
         else
             selfp->format = g_strdup("%.4g");
+        printf("selfp->format =%s\n", selfp->format);
 
         selfp->img_is_mono = giv_check_img_for_mono(selfp->img_org);
 
@@ -2058,7 +2061,7 @@ cb_menu_measure_distance (GtkAction *action, gpointer data)
                                           &my_lasso_draw,
                                           self);
         if (!selfp->cursor_plus) {
-            selfp->cursor_plus = gdk_cursor_new(GDK_TCROSS);
+            selfp->cursor_plus = gdk_cursor_new(GDK_PLUS);
         }
         gdk_window_set_cursor(selfp->w_imgv->window, selfp->cursor_plus);
     }
@@ -3593,7 +3596,11 @@ draw_caliper(cairo_t *cr,
     cairo_scaled_font_destroy(sf);
 #else
     // Draw the distance in the middle
+#ifdef _WIN32
+    PangoFontDescription *font_descr = pango_font_description_from_string("TimesNewRoman 15");
+#else
     PangoFontDescription *font_descr = pango_font_description_from_string("Sans 15");
+#endif
     PangoContext *context = pango_cairo_create_context(cr);
     cairo_font_options_t *options =  cairo_font_options_create();
     cairo_font_options_set_hint_style(options,CAIRO_HINT_STYLE_NONE);



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