annotate src/bar_histogram.c @ 1684:a14d7bfe666c

add desktop.in files to the tarball
author nadvornik
date Tue, 30 Jun 2009 19:12:25 +0000
parents 0806ccdfe06b
children 6146ec0c9ab9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
1 /*
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
2 * Geeqie
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
3 * (C) 2004 John Ellis
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
4 * Copyright (C) 2008 - 2009 The Geeqie Team
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
5 *
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
6 * Author: Vladimir Nadvornik
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
7 *
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
8 * This software is released under the GNU General Public License (GNU GPL).
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
9 * Please read the included file COPYING for more information.
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
10 * This software comes with no warranty of any kind, use at your own risk!
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
11 */
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
12
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
13
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
14 #include "main.h"
1339
45bcfcb69f56 fixed bar_histogram headers
nadvornik
parents: 1331
diff changeset
15 #include "bar_histogram.h"
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
16
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
17 #include "bar.h"
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
18 #include "metadata.h"
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
19 #include "filedata.h"
1319
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
20 #include "menu.h"
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
21 #include "ui_menu.h"
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
22 #include "ui_misc.h"
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
23 #include "histogram.h"
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
24 #include "rcfile.h"
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
25
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
26 /*
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
27 *-------------------------------------------------------------------
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
28 * keyword / comment utils
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
29 *-------------------------------------------------------------------
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
30 */
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
31
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
32
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
33
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
34 typedef struct _PaneHistogramData PaneHistogramData;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
35 struct _PaneHistogramData
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
36 {
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
37 PaneData pane;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
38 GtkWidget *widget;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
39 GtkWidget *drawing_area;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
40 Histogram *histogram;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
41 gint histogram_width;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
42 gint histogram_height;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
43 GdkPixbuf *pixbuf;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
44 FileData *fd;
1331
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
45 gboolean need_update;
1523
24a12aa0cb54 Fix up event source ids type: gint -> guint.
zas_
parents: 1498
diff changeset
46 guint idle_id; /* event source id */
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
47 };
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
48
1331
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
49 static gboolean bar_pane_histogram_update_cb(gpointer data);
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
50
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
51
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
52 static void bar_pane_histogram_update(PaneHistogramData *phd)
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
53 {
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
54 if (phd->pixbuf) g_object_unref(phd->pixbuf);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
55 phd->pixbuf = NULL;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
56
1344
3f9be528787c show histogram label in the title
nadvornik
parents: 1343
diff changeset
57 gtk_label_set_text(GTK_LABEL(phd->pane.title), histogram_label(phd->histogram));
3f9be528787c show histogram label in the title
nadvornik
parents: 1343
diff changeset
58
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
59 if (!phd->histogram_width || !phd->histogram_height || !phd->fd) return;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
60
1331
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
61 /* histmap_get is relatively expensive, run it only when we really need it
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
62 and with lower priority than pixbuf_renderer
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
63 FIXME: this does not work for fullscreen*/
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
64 if (GTK_WIDGET_DRAWABLE(phd->drawing_area))
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
65 {
1523
24a12aa0cb54 Fix up event source ids type: gint -> guint.
zas_
parents: 1498
diff changeset
66 if (!phd->idle_id)
24a12aa0cb54 Fix up event source ids type: gint -> guint.
zas_
parents: 1498
diff changeset
67 {
24a12aa0cb54 Fix up event source ids type: gint -> guint.
zas_
parents: 1498
diff changeset
68 phd->idle_id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, bar_pane_histogram_update_cb, phd, NULL);
24a12aa0cb54 Fix up event source ids type: gint -> guint.
zas_
parents: 1498
diff changeset
69 }
1331
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
70 }
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
71 else
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
72 {
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
73 phd->need_update = TRUE;
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
74 }
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
75 }
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
76
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
77 static gboolean bar_pane_histogram_update_cb(gpointer data)
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
78 {
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
79 const HistMap *histmap;
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
80 PaneHistogramData *phd = data;
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
81
1523
24a12aa0cb54 Fix up event source ids type: gint -> guint.
zas_
parents: 1498
diff changeset
82 phd->idle_id = 0;
1331
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
83 phd->need_update = FALSE;
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
84
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
85 gtk_widget_queue_draw_area(GTK_WIDGET(phd->drawing_area), 0, 0, phd->histogram_width, phd->histogram_height);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
86
1474
aec6992e5116 fixed segfault in histogram
nadvornik
parents: 1471
diff changeset
87 if (phd->fd == NULL) return FALSE;
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
88 histmap = histmap_get(phd->fd);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
89
1439
2441a90c4bcf compute histogram in idle time
nadvornik
parents: 1419
diff changeset
90 if (!histmap)
2441a90c4bcf compute histogram in idle time
nadvornik
parents: 1419
diff changeset
91 {
2441a90c4bcf compute histogram in idle time
nadvornik
parents: 1419
diff changeset
92 histmap_start_idle(phd->fd);
2441a90c4bcf compute histogram in idle time
nadvornik
parents: 1419
diff changeset
93 return FALSE;
2441a90c4bcf compute histogram in idle time
nadvornik
parents: 1419
diff changeset
94 }
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
95
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
96 phd->pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, phd->histogram_width, phd->histogram_height);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
97 gdk_pixbuf_fill(phd->pixbuf, 0xffffffff);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
98 histogram_draw(phd->histogram, histmap, phd->pixbuf, 0, 0, phd->histogram_width, phd->histogram_height);
1330
8b6e2a47adc7 Add a tooltip showing current histogram state on bar histogram.
zas_
parents: 1329
diff changeset
99
1331
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
100 return FALSE;
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
101 }
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
102
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
103
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
104 static void bar_pane_histogram_set_fd(GtkWidget *pane, FileData *fd)
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
105 {
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
106 PaneHistogramData *phd;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
107
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
108 phd = g_object_get_data(G_OBJECT(pane), "pane_data");
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
109 if (!phd) return;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
110
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
111 file_data_unref(phd->fd);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
112 phd->fd = file_data_ref(fd);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
113
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
114 bar_pane_histogram_update(phd);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
115 }
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
116
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
117 static void bar_pane_histogram_write_config(GtkWidget *pane, GString *outstr, gint indent)
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
118 {
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
119 PaneHistogramData *phd;
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
120
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
121 phd = g_object_get_data(G_OBJECT(pane), "pane_data");
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
122 if (!phd) return;
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
123
1461
e015b6573d36 improved config file formatting
nadvornik
parents: 1439
diff changeset
124 WRITE_NL(); WRITE_STRING("<pane_histogram ");
1469
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
125 write_char_option(outstr, indent, "id", phd->pane.id);
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
126 write_char_option(outstr, indent, "title", gtk_label_get_text(GTK_LABEL(phd->pane.title)));
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
127 WRITE_BOOL(phd->pane, expanded);
1329
1fc356f629fe Clean up histogram stuff: options saving/restoring, osd histogram separation, tidy up.
zas_
parents: 1324
diff changeset
128 WRITE_INT(*phd->histogram, histogram_channel);
1fc356f629fe Clean up histogram stuff: options saving/restoring, osd histogram separation, tidy up.
zas_
parents: 1324
diff changeset
129 WRITE_INT(*phd->histogram, histogram_mode);
1461
e015b6573d36 improved config file formatting
nadvornik
parents: 1439
diff changeset
130 WRITE_STRING("/>");
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
131 }
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
132
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
133 static void bar_pane_histogram_notify_cb(FileData *fd, NotifyType type, gpointer data)
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
134 {
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
135 PaneHistogramData *phd = data;
1498
5f49f305a6b6 improved debug messages
nadvornik
parents: 1485
diff changeset
136 if ((type & (NOTIFY_REREAD | NOTIFY_CHANGE | NOTIFY_HISTMAP | NOTIFY_PIXBUF)) && fd == phd->fd)
5f49f305a6b6 improved debug messages
nadvornik
parents: 1485
diff changeset
137 {
5f49f305a6b6 improved debug messages
nadvornik
parents: 1485
diff changeset
138 DEBUG_1("Notify pane_histogram: %s %04x", fd->path, type);
5f49f305a6b6 improved debug messages
nadvornik
parents: 1485
diff changeset
139 bar_pane_histogram_update(phd);
5f49f305a6b6 improved debug messages
nadvornik
parents: 1485
diff changeset
140 }
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
141 }
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
142
1346
c9949c19a6d0 No space between function name and first parenthesis, it eases greping (see CODING).
zas_
parents: 1344
diff changeset
143 static gboolean bar_pane_histogram_expose_event_cb(GtkWidget *widget, GdkEventExpose *event, gpointer data)
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
144 {
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
145 PaneHistogramData *phd = data;
1331
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
146 if (!phd) return TRUE;
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
147
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
148 if (phd->need_update)
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
149 {
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
150 bar_pane_histogram_update(phd);
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
151 }
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
152
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
153 if (!phd->pixbuf) return TRUE;
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
154
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
155 gdk_draw_pixbuf(widget->window,
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
156 widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
157 phd->pixbuf,
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
158 0, 0,
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
159 0, 0,
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
160 -1, -1,
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
161 GDK_RGB_DITHER_NORMAL, 0, 0);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
162 return TRUE;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
163 }
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
164
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
165 static void bar_pane_histogram_size_cb(GtkWidget *widget, GtkAllocation *allocation, gpointer data)
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
166 {
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
167 PaneHistogramData *phd = data;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
168
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
169 phd->histogram_width = allocation->width;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
170 phd->histogram_height = allocation->height;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
171 bar_pane_histogram_update(phd);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
172 }
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
173
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
174 static void bar_pane_histogram_close(GtkWidget *pane)
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
175 {
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
176 PaneHistogramData *phd;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
177
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
178 phd = g_object_get_data(G_OBJECT(pane), "pane_data");
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
179 if (!phd) return;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
180
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
181 gtk_widget_destroy(phd->widget);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
182 }
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
183
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
184 static void bar_pane_histogram_destroy(GtkWidget *widget, gpointer data)
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
185 {
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
186 PaneHistogramData *phd = data;
1331
a5c15bf32cdb compute histmap in idle callback and only if the histogram is expanded
nadvornik
parents: 1330
diff changeset
187
1523
24a12aa0cb54 Fix up event source ids type: gint -> guint.
zas_
parents: 1498
diff changeset
188 if (phd->idle_id) g_source_remove(phd->idle_id);
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
189 file_data_unregister_notify_func(bar_pane_histogram_notify_cb, phd);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
190
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
191 file_data_unref(phd->fd);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
192 histogram_free(phd->histogram);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
193 if (phd->pixbuf) g_object_unref(phd->pixbuf);
1469
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
194 g_free(phd->pane.id);
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
195
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
196 g_free(phd);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
197 }
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
198
1319
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
199 static void bar_pane_histogram_popup_channels_cb(GtkWidget *widget, gpointer data)
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
200 {
1667
0806ccdfe06b simplified menu_item_add_radio usage
nadvornik
parents: 1523
diff changeset
201 PaneHistogramData *phd = data;
1319
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
202 gint channel;
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
203
1323
50ab4016ae0b Fix up bar pane histogram contextual menu: show current state for channel and log mode.
zas_
parents: 1319
diff changeset
204 if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) return;
50ab4016ae0b Fix up bar pane histogram contextual menu: show current state for channel and log mode.
zas_
parents: 1319
diff changeset
205
1319
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
206 if (!phd) return;
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
207
1667
0806ccdfe06b simplified menu_item_add_radio usage
nadvornik
parents: 1523
diff changeset
208 channel = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "menu_item_radio_data"));
1323
50ab4016ae0b Fix up bar pane histogram contextual menu: show current state for channel and log mode.
zas_
parents: 1319
diff changeset
209 if (channel == histogram_get_channel(phd->histogram)) return;
50ab4016ae0b Fix up bar pane histogram contextual menu: show current state for channel and log mode.
zas_
parents: 1319
diff changeset
210
1319
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
211 histogram_set_channel(phd->histogram, channel);
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
212 bar_pane_histogram_update(phd);
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
213 }
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
214
1667
0806ccdfe06b simplified menu_item_add_radio usage
nadvornik
parents: 1523
diff changeset
215 static void bar_pane_histogram_popup_mode_cb(GtkWidget *widget, gpointer data)
1319
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
216 {
1667
0806ccdfe06b simplified menu_item_add_radio usage
nadvornik
parents: 1523
diff changeset
217 PaneHistogramData *phd = data;
1319
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
218 gint logmode;
1323
50ab4016ae0b Fix up bar pane histogram contextual menu: show current state for channel and log mode.
zas_
parents: 1319
diff changeset
219
50ab4016ae0b Fix up bar pane histogram contextual menu: show current state for channel and log mode.
zas_
parents: 1319
diff changeset
220 if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) return;
1319
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
221
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
222 if (!phd) return;
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
223
1667
0806ccdfe06b simplified menu_item_add_radio usage
nadvornik
parents: 1523
diff changeset
224 logmode = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "menu_item_radio_data"));
1323
50ab4016ae0b Fix up bar pane histogram contextual menu: show current state for channel and log mode.
zas_
parents: 1319
diff changeset
225 if (logmode == histogram_get_mode(phd->histogram)) return;
50ab4016ae0b Fix up bar pane histogram contextual menu: show current state for channel and log mode.
zas_
parents: 1319
diff changeset
226
1319
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
227 histogram_set_mode(phd->histogram, logmode);
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
228 bar_pane_histogram_update(phd);
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
229 }
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
230
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
231 static GtkWidget *bar_pane_histogram_menu(PaneHistogramData *phd)
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
232 {
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
233 GtkWidget *menu;
1667
0806ccdfe06b simplified menu_item_add_radio usage
nadvornik
parents: 1523
diff changeset
234 gint channel = histogram_get_channel(phd->histogram);
0806ccdfe06b simplified menu_item_add_radio usage
nadvornik
parents: 1523
diff changeset
235 gint mode = histogram_get_mode(phd->histogram);
1319
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
236
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
237 menu = popup_menu_short_lived();
1667
0806ccdfe06b simplified menu_item_add_radio usage
nadvornik
parents: 1523
diff changeset
238
0806ccdfe06b simplified menu_item_add_radio usage
nadvornik
parents: 1523
diff changeset
239 /* use the same strings as in layout_util.c */
0806ccdfe06b simplified menu_item_add_radio usage
nadvornik
parents: 1523
diff changeset
240 menu_item_add_radio(menu, _("Histogram on _Red"), GINT_TO_POINTER(HCHAN_R), (channel == HCHAN_R), G_CALLBACK(bar_pane_histogram_popup_channels_cb), phd);
0806ccdfe06b simplified menu_item_add_radio usage
nadvornik
parents: 1523
diff changeset
241 menu_item_add_radio(menu, _("Histogram on _Green"), GINT_TO_POINTER(HCHAN_G), (channel == HCHAN_G), G_CALLBACK(bar_pane_histogram_popup_channels_cb), phd);
0806ccdfe06b simplified menu_item_add_radio usage
nadvornik
parents: 1523
diff changeset
242 menu_item_add_radio(menu, _("Histogram on _Blue"), GINT_TO_POINTER(HCHAN_B), (channel == HCHAN_B), G_CALLBACK(bar_pane_histogram_popup_channels_cb), phd);
0806ccdfe06b simplified menu_item_add_radio usage
nadvornik
parents: 1523
diff changeset
243 menu_item_add_radio(menu, _("_Histogram on RGB"), GINT_TO_POINTER(HCHAN_RGB), (channel == HCHAN_RGB), G_CALLBACK(bar_pane_histogram_popup_channels_cb), phd);
0806ccdfe06b simplified menu_item_add_radio usage
nadvornik
parents: 1523
diff changeset
244 menu_item_add_radio(menu, _("Histogram on _Value"), GINT_TO_POINTER(HCHAN_MAX), (channel == HCHAN_MAX), G_CALLBACK(bar_pane_histogram_popup_channels_cb), phd);
0806ccdfe06b simplified menu_item_add_radio usage
nadvornik
parents: 1523
diff changeset
245
0806ccdfe06b simplified menu_item_add_radio usage
nadvornik
parents: 1523
diff changeset
246 menu_item_add_divider(menu);
0806ccdfe06b simplified menu_item_add_radio usage
nadvornik
parents: 1523
diff changeset
247
0806ccdfe06b simplified menu_item_add_radio usage
nadvornik
parents: 1523
diff changeset
248 menu_item_add_radio(menu, _("Li_near Histogram"), GINT_TO_POINTER(0), (mode == 0), G_CALLBACK(bar_pane_histogram_popup_mode_cb), phd);
0806ccdfe06b simplified menu_item_add_radio usage
nadvornik
parents: 1523
diff changeset
249 menu_item_add_radio(menu, _("L_og Histogram"), GINT_TO_POINTER(1), (mode == 1), G_CALLBACK(bar_pane_histogram_popup_mode_cb), phd);
1319
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
250
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
251 return menu;
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
252 }
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
253
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
254 static gboolean bar_pane_histogram_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
255 {
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
256 PaneHistogramData *phd = data;
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
257
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
258 if (bevent->button == MOUSE_BUTTON_RIGHT)
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
259 {
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
260 GtkWidget *menu;
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
261
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
262 menu = bar_pane_histogram_menu(phd);
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
263 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, bevent->button, bevent->time);
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
264 return TRUE;
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
265 }
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
266
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
267 return FALSE;
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
268 }
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
269
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
270
1485
0e82a03c165b pane interface cleanup
nadvornik
parents: 1474
diff changeset
271 static GtkWidget *bar_pane_histogram_new(const gchar *id, const gchar *title, gint height, gboolean expanded, gint histogram_channel, gint histogram_mode)
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
272 {
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
273 PaneHistogramData *phd;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
274
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
275 phd = g_new0(PaneHistogramData, 1);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
276
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
277 phd->pane.pane_set_fd = bar_pane_histogram_set_fd;
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
278 phd->pane.pane_write_config = bar_pane_histogram_write_config;
1389
c44f21235ffe Use a common function bar_pane_expander_title() to set expanders title widget.
zas_
parents: 1387
diff changeset
279 phd->pane.title = bar_pane_expander_title(title);
1469
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
280 phd->pane.id = g_strdup(id);
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
281 phd->pane.type = PANE_HISTOGRAM;
1387
6f31fa931d3f simplified bar interface
nadvornik
parents: 1346
diff changeset
282
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
283 phd->pane.expanded = expanded;
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
284
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
285 phd->histogram = histogram_new();
1319
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
286
1324
e4f9e3567f0a Save bar pane histogram state to rc file.
zas_
parents: 1323
diff changeset
287 histogram_set_channel(phd->histogram, histogram_channel);
1329
1fc356f629fe Clean up histogram stuff: options saving/restoring, osd histogram separation, tidy up.
zas_
parents: 1324
diff changeset
288 histogram_set_mode(phd->histogram, histogram_mode);
1319
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
289
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
290 phd->widget = gtk_vbox_new(FALSE, PREF_PAD_GAP);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
291
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
292 g_object_set_data(G_OBJECT(phd->widget), "pane_data", phd);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
293 g_signal_connect(G_OBJECT(phd->widget), "destroy",
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
294 G_CALLBACK(bar_pane_histogram_destroy), phd);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
295
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
296
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
297 gtk_widget_set_size_request(GTK_WIDGET(phd->widget), -1, height);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
299 phd->drawing_area = gtk_drawing_area_new();
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
300 g_signal_connect_after(G_OBJECT(phd->drawing_area), "size_allocate",
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
301 G_CALLBACK(bar_pane_histogram_size_cb), phd);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
302
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
303 g_signal_connect(G_OBJECT(phd->drawing_area), "expose_event",
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
304 G_CALLBACK(bar_pane_histogram_expose_event_cb), phd);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
305
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
306 gtk_box_pack_start(GTK_BOX(phd->widget), phd->drawing_area, TRUE, TRUE, 0);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
307 gtk_widget_show(phd->drawing_area);
1319
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
308 gtk_widget_add_events(phd->drawing_area, GDK_BUTTON_PRESS_MASK);
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
309
1319
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
310 g_signal_connect(G_OBJECT(phd->drawing_area), "button_press_event", G_CALLBACK(bar_pane_histogram_press_cb), phd);
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
311
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
312 gtk_widget_show(phd->widget);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
313
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
314 file_data_register_notify_func(bar_pane_histogram_notify_cb, phd, NOTIFY_PRIORITY_LOW);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
315
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
316 return phd->widget;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
317 }
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
318
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
319 GtkWidget *bar_pane_histogram_new_from_config(const gchar **attribute_names, const gchar **attribute_values)
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
320 {
1471
65a5c27823c2 update translated pane titles
nadvornik
parents: 1469
diff changeset
321 gchar *title = NULL;
1469
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
322 gchar *id = g_strdup("histogram");
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
323 gboolean expanded = TRUE;
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
324 gint height = 80;
1324
e4f9e3567f0a Save bar pane histogram state to rc file.
zas_
parents: 1323
diff changeset
325 gint histogram_channel = HCHAN_RGB;
1329
1fc356f629fe Clean up histogram stuff: options saving/restoring, osd histogram separation, tidy up.
zas_
parents: 1324
diff changeset
326 gint histogram_mode = 0;
1469
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
327 GtkWidget *ret;
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
328
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
329 while (*attribute_names)
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
330 {
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
331 const gchar *option = *attribute_names++;
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
332 const gchar *value = *attribute_values++;
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
333
1469
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
334 if (READ_CHAR_FULL("id", id)) continue;
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
335 if (READ_CHAR_FULL("title", title)) continue;
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
336 if (READ_BOOL_FULL("expanded", expanded)) continue;
1324
e4f9e3567f0a Save bar pane histogram state to rc file.
zas_
parents: 1323
diff changeset
337 if (READ_INT_FULL("histogram_channel", histogram_channel)) continue;
1329
1fc356f629fe Clean up histogram stuff: options saving/restoring, osd histogram separation, tidy up.
zas_
parents: 1324
diff changeset
338 if (READ_INT_FULL("histogram_mode", histogram_mode)) continue;
1324
e4f9e3567f0a Save bar pane histogram state to rc file.
zas_
parents: 1323
diff changeset
339
1464
1b3751ac4743 be more verbose on parse errors
nadvornik
parents: 1461
diff changeset
340 log_printf("unknown attribute %s = %s\n", option, value);
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
341 }
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
342
1471
65a5c27823c2 update translated pane titles
nadvornik
parents: 1469
diff changeset
343 bar_pane_translate_title(PANE_HISTOGRAM, id, &title);
1469
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
344 ret = bar_pane_histogram_new(id, title, height, expanded, histogram_channel, histogram_mode);
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
345 g_free(title);
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
346 g_free(id);
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
347 return ret;
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
348 }
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
349
1469
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
350 void bar_pane_histogram_update_from_config(GtkWidget *pane, const gchar **attribute_names, const gchar **attribute_values)
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
351 {
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
352 PaneHistogramData *phd;
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
353
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
354 phd = g_object_get_data(G_OBJECT(pane), "pane_data");
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
355 if (!phd) return;
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
356
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
357 gint histogram_channel = phd->histogram->histogram_channel;
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
358 gint histogram_mode = phd->histogram->histogram_mode;
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
359
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
360 while (*attribute_names)
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
361 {
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
362 const gchar *option = *attribute_names++;
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
363 const gchar *value = *attribute_values++;
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
364
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
365 if (READ_CHAR_FULL("id", phd->pane.id)) continue;
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
366 // if (READ_CHAR_FULL("pane.title", title)) continue;
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
367 if (READ_BOOL_FULL("expanded", phd->pane.expanded)) continue;
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
368 if (READ_INT_FULL("histogram_channel", histogram_channel)) continue;
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
369 if (READ_INT_FULL("histogram_mode", histogram_mode)) continue;
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
370
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
371
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
372 log_printf("unknown attribute %s = %s\n", option, value);
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
373 }
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
374
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
375 histogram_set_channel(phd->histogram, histogram_channel);
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
376 histogram_set_mode(phd->histogram, histogram_mode);
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
377
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
378 bar_update_expander(pane);
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
379 bar_pane_histogram_update(phd);
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
380 }
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
381
607c60506863 added a possibility to update existing bars from config
nadvornik
parents: 1464
diff changeset
382
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
383 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */