# HG changeset patch # User zas_ # Date 1235409640 0 # Node ID fcf0e7a6143ea8965682f1eddaa74c8ec5c6a912 # Parent 024863909378db59c02760b482a295462cbfa985 Introduce helpers histogram_toggle_channel() and histogram_toggle_mode(). diff -r 024863909378 -r fcf0e7a6143e src/histogram.c --- a/src/histogram.c Sun Feb 22 17:46:42 2009 +0000 +++ b/src/histogram.c Mon Feb 23 17:20:40 2009 +0000 @@ -97,6 +97,18 @@ return histogram->log_mode; } +gint histogram_toggle_channel(Histogram *histogram) +{ + if (!histogram) return 0; + return histogram_set_channel(histogram, (histogram_get_channel(histogram)+1)%HCHAN_COUNT); +} + +gint histogram_toggle_mode(Histogram *histogram) +{ + if (!histogram) return 0; + return histogram_set_mode(histogram, !histogram_get_mode(histogram)); +} + const gchar *histogram_label(Histogram *histogram) { const gchar *t1 = ""; diff -r 024863909378 -r fcf0e7a6143e src/histogram.h --- a/src/histogram.h Sun Feb 22 17:46:42 2009 +0000 +++ b/src/histogram.h Mon Feb 23 17:20:40 2009 +0000 @@ -28,6 +28,8 @@ gint histogram_get_channel(Histogram *histogram); gint histogram_set_mode(Histogram *histogram, gint mode); gint histogram_get_mode(Histogram *histogram); +gint histogram_toggle_channel(Histogram *histogram); +gint histogram_toggle_mode(Histogram *histogram); const gchar *histogram_label(Histogram *histogram); const HistMap *histmap_get(FileData *fd); gint histogram_draw(Histogram *histogram, const HistMap *histmap, GdkPixbuf *pixbuf, gint x, gint y, gint width, gint height); diff -r 024863909378 -r fcf0e7a6143e src/image-overlay.c --- a/src/image-overlay.c Sun Feb 22 17:46:42 2009 +0000 +++ b/src/image-overlay.c Mon Feb 23 17:20:40 2009 +0000 @@ -130,7 +130,7 @@ if (!osd || !osd->histogram) return; - histogram_set_channel(osd->histogram, (histogram_get_channel(osd->histogram) +1)%HCHAN_COUNT); + histogram_toggle_channel(osd->histogram); image_osd_update(imd); } @@ -140,7 +140,7 @@ if (!osd || !osd->histogram) return; - histogram_set_mode(osd->histogram, !histogram_get_mode(osd->histogram)); + histogram_toggle_mode(osd->histogram); image_osd_update(imd); }