annotate src/bar_histogram.c @ 1330:8b6e2a47adc7

Add a tooltip showing current histogram state on bar histogram.
author zas_
date Thu, 26 Feb 2009 21:46:27 +0000
parents 1fc356f629fe
children a5c15bf32cdb
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"
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
15 #include "bar_comment.h"
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;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
45 };
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
46
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
47
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
48 static void bar_pane_histogram_update(PaneHistogramData *phd)
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
49 {
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
50 const HistMap *histmap;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
51 if (phd->pixbuf) g_object_unref(phd->pixbuf);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
52 phd->pixbuf = NULL;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
53
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
54 if (!phd->histogram_width || !phd->histogram_height || !phd->fd) return;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
55
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
56 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
57
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
58 histmap = histmap_get(phd->fd);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
59
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
60 if (!histmap) return;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
61
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
62 phd->pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, phd->histogram_width, phd->histogram_height);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
63 gdk_pixbuf_fill(phd->pixbuf, 0xffffffff);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
64 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
65
8b6e2a47adc7 Add a tooltip showing current histogram state on bar histogram.
zas_
parents: 1329
diff changeset
66 #if GTK_CHECK_VERSION(2,12,0)
8b6e2a47adc7 Add a tooltip showing current histogram state on bar histogram.
zas_
parents: 1329
diff changeset
67 gtk_widget_set_tooltip_text(phd->drawing_area, histogram_label(phd->histogram));
8b6e2a47adc7 Add a tooltip showing current histogram state on bar histogram.
zas_
parents: 1329
diff changeset
68 #endif
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
69 }
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
70
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
71
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
72 static void bar_pane_histogram_set_fd(GtkWidget *pane, FileData *fd)
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
73 {
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
74 PaneHistogramData *phd;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
75
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
76 phd = g_object_get_data(G_OBJECT(pane), "pane_data");
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
77 if (!phd) return;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
78
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
79 file_data_unref(phd->fd);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
80 phd->fd = file_data_ref(fd);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
81
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
82 bar_pane_histogram_update(phd);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
83 }
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
84
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
85 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
86 {
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
87 PaneHistogramData *phd;
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
88
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
89 phd = g_object_get_data(G_OBJECT(pane), "pane_data");
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
90 if (!phd) return;
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
91
1314
8cca18bce950 simplified config writing
nadvornik
parents: 1309
diff changeset
92 WRITE_STRING("<pane_histogram\n");
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
93 indent++;
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
94 WRITE_CHAR(*phd, pane.title);
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
95 WRITE_BOOL(*phd, pane.expanded);
1329
1fc356f629fe Clean up histogram stuff: options saving/restoring, osd histogram separation, tidy up.
zas_
parents: 1324
diff changeset
96 WRITE_INT(*phd->histogram, histogram_channel);
1fc356f629fe Clean up histogram stuff: options saving/restoring, osd histogram separation, tidy up.
zas_
parents: 1324
diff changeset
97 WRITE_INT(*phd->histogram, histogram_mode);
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
98 indent--;
1314
8cca18bce950 simplified config writing
nadvornik
parents: 1309
diff changeset
99 WRITE_STRING("/>\n");
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
100 }
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
101
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
102
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
103 static void bar_pane_histogram_notify_cb(FileData *fd, NotifyType type, gpointer data)
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
104 {
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
105 PaneHistogramData *phd = data;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
106 if (fd == phd->fd) bar_pane_histogram_update(phd);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
107 }
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
108
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
109 static gboolean bar_pane_histogram_expose_event_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
110 {
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
111 PaneHistogramData *phd = data;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
112 if (!phd || !phd->pixbuf) return TRUE;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
113
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
114 gdk_draw_pixbuf(widget->window,
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
115 widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
116 phd->pixbuf,
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
117 0, 0,
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
118 0, 0,
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
119 -1, -1,
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
120 GDK_RGB_DITHER_NORMAL, 0, 0);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
121 return TRUE;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
122 }
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
123
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
124 static void bar_pane_histogram_size_cb(GtkWidget *widget, GtkAllocation *allocation, gpointer data)
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
125 {
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
126 PaneHistogramData *phd = data;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
127
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
128 phd->histogram_width = allocation->width;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
129 phd->histogram_height = allocation->height;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
130 bar_pane_histogram_update(phd);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
131 }
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
132
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
133 static void bar_pane_histogram_close(GtkWidget *pane)
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
134 {
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
135 PaneHistogramData *phd;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
136
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
137 phd = g_object_get_data(G_OBJECT(pane), "pane_data");
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
138 if (!phd) return;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
139
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
140 gtk_widget_destroy(phd->widget);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
141 }
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
142
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
143 static void bar_pane_histogram_destroy(GtkWidget *widget, gpointer data)
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
144 {
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
145 PaneHistogramData *phd = data;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
146
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
147 file_data_unregister_notify_func(bar_pane_histogram_notify_cb, phd);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
148
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
149 file_data_unref(phd->fd);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
150 g_free(phd->pane.title);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
151 histogram_free(phd->histogram);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
152 if (phd->pixbuf) g_object_unref(phd->pixbuf);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
153
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
154 g_free(phd);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
155 }
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
156
1319
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
157 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
158 {
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
159 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
160 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
161
1323
50ab4016ae0b Fix up bar pane histogram contextual menu: show current state for channel and log mode.
zas_
parents: 1319
diff changeset
162 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
163
1319
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
164 phd = submenu_item_get_data(widget);
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
165
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
166 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
167
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
168 channel = GPOINTER_TO_INT(data);
1323
50ab4016ae0b Fix up bar pane histogram contextual menu: show current state for channel and log mode.
zas_
parents: 1319
diff changeset
169 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
170
1319
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
171 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
172 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
173 }
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
174
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
175 static void bar_pane_histogram_popup_logmode_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
176 {
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
177 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
178 gint logmode;
1323
50ab4016ae0b Fix up bar pane histogram contextual menu: show current state for channel and log mode.
zas_
parents: 1319
diff changeset
179
50ab4016ae0b Fix up bar pane histogram contextual menu: show current state for channel and log mode.
zas_
parents: 1319
diff changeset
180 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
181
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
182 phd = submenu_item_get_data(widget);
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
183
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
184 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
185
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
186 logmode = GPOINTER_TO_INT(data);
1323
50ab4016ae0b Fix up bar pane histogram contextual menu: show current state for channel and log mode.
zas_
parents: 1319
diff changeset
187 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
188
1319
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
189 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
190 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
191 }
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
192
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
193 static GtkWidget *bar_pane_histogram_add_radio(GtkWidget *menu, GtkWidget *parent,
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
194 const gchar *label,
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
195 GCallback func, gint value,
1323
50ab4016ae0b Fix up bar pane histogram contextual menu: show current state for channel and log mode.
zas_
parents: 1319
diff changeset
196 gboolean show_current, gint current_value)
1319
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
197 {
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
198 GtkWidget *item;
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
199
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
200 if (show_current)
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
201 {
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
202 item = menu_item_add_radio(menu, parent,
1323
50ab4016ae0b Fix up bar pane histogram contextual menu: show current state for channel and log mode.
zas_
parents: 1319
diff changeset
203 label, (value == current_value),
1319
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
204 func, GINT_TO_POINTER((gint)value));
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
205 }
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
206 else
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
207 {
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
208 item = menu_item_add(menu, label,
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
209 func, GINT_TO_POINTER((gint)value));
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
210 }
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
211
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
212 return item;
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
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
215 GtkWidget *bar_pane_histogram_add_channels(GtkWidget *menu, GCallback func, gpointer data,
1323
50ab4016ae0b Fix up bar pane histogram contextual menu: show current state for channel and log mode.
zas_
parents: 1319
diff changeset
216 gboolean show_current, gint current_value)
1319
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
217 {
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
218 GtkWidget *submenu;
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
219 GtkWidget *parent;
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
220
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
221 submenu = gtk_menu_new();
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
222 g_object_set_data(G_OBJECT(submenu), "submenu_data", data);
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
223
1323
50ab4016ae0b Fix up bar pane histogram contextual menu: show current state for channel and log mode.
zas_
parents: 1319
diff changeset
224 parent = bar_pane_histogram_add_radio(submenu, NULL, _("_Red"), func, HCHAN_R, show_current, current_value);
50ab4016ae0b Fix up bar pane histogram contextual menu: show current state for channel and log mode.
zas_
parents: 1319
diff changeset
225 bar_pane_histogram_add_radio(submenu, parent, _("_Green"), func, HCHAN_G, show_current, current_value);
50ab4016ae0b Fix up bar pane histogram contextual menu: show current state for channel and log mode.
zas_
parents: 1319
diff changeset
226 bar_pane_histogram_add_radio(submenu, parent, _("_Blue"),func, HCHAN_B, show_current, current_value);
50ab4016ae0b Fix up bar pane histogram contextual menu: show current state for channel and log mode.
zas_
parents: 1319
diff changeset
227 bar_pane_histogram_add_radio(submenu, parent, _("_RGB"),func, HCHAN_RGB, show_current, current_value);
50ab4016ae0b Fix up bar pane histogram contextual menu: show current state for channel and log mode.
zas_
parents: 1319
diff changeset
228 bar_pane_histogram_add_radio(submenu, parent, _("_Value"),func, HCHAN_MAX, show_current, current_value);
1319
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 if (menu)
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
231 {
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
232 GtkWidget *item;
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
233
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
234 item = menu_item_add(menu, _("Channels"), NULL, NULL);
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
235 gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
236 return item;
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
237 }
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
238
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
239 return submenu;
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
240 }
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
241 GtkWidget *bar_pane_histogram_add_logmode(GtkWidget *menu, GCallback func, gpointer data,
1323
50ab4016ae0b Fix up bar pane histogram contextual menu: show current state for channel and log mode.
zas_
parents: 1319
diff changeset
242 gboolean show_current, gint current_value)
1319
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
243 {
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
244 GtkWidget *submenu;
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
245 GtkWidget *parent;
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
246
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
247 submenu = gtk_menu_new();
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
248 g_object_set_data(G_OBJECT(submenu), "submenu_data", data);
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
249
1323
50ab4016ae0b Fix up bar pane histogram contextual menu: show current state for channel and log mode.
zas_
parents: 1319
diff changeset
250 parent = bar_pane_histogram_add_radio(submenu, NULL, _("_Linear"), func, 0, show_current, current_value);
50ab4016ae0b Fix up bar pane histogram contextual menu: show current state for channel and log mode.
zas_
parents: 1319
diff changeset
251 bar_pane_histogram_add_radio(submenu, parent, _("Lo_garithmical"), func, 1, show_current, current_value);
1319
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 if (menu)
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
254 {
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
255 GtkWidget *item;
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
256
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
257 item = menu_item_add(menu, _("Mode"), NULL, NULL);
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
258 gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
259 return item;
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
260 }
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 return submenu;
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
263 }
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
264
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 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
267 {
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
268 GtkWidget *menu;
1323
50ab4016ae0b Fix up bar pane histogram contextual menu: show current state for channel and log mode.
zas_
parents: 1319
diff changeset
269 static gboolean show_current = TRUE;
1319
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
270
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
271 menu = popup_menu_short_lived();
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
272 bar_pane_histogram_add_channels(menu, G_CALLBACK(bar_pane_histogram_popup_channels_cb), phd,
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
273 show_current, histogram_get_channel(phd->histogram));
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
274 bar_pane_histogram_add_logmode(menu, G_CALLBACK(bar_pane_histogram_popup_logmode_cb), phd,
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
275 show_current, histogram_get_mode(phd->histogram));
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
276
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
277 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
278 }
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
279
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
280 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
281 {
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
282 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
283
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
284 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
285 {
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
286 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
287
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
288 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
289 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
290 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
291 }
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
292
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
293 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
294 }
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
295
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
296
1329
1fc356f629fe Clean up histogram stuff: options saving/restoring, osd histogram separation, tidy up.
zas_
parents: 1324
diff changeset
297 GtkWidget *bar_pane_histogram_new(const gchar *title, gint height, gint expanded, gint histogram_channel, gint histogram_mode)
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
298 {
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
299 PaneHistogramData *phd;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
300
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
301 phd = g_new0(PaneHistogramData, 1);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
302
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
303 phd->pane.pane_set_fd = bar_pane_histogram_set_fd;
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
304 phd->pane.pane_write_config = bar_pane_histogram_write_config;
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
305 phd->pane.title = g_strdup(title);
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
306 phd->pane.expanded = expanded;
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
307
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
308 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
309
1324
e4f9e3567f0a Save bar pane histogram state to rc file.
zas_
parents: 1323
diff changeset
310 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
311 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
312
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
313 phd->widget = gtk_vbox_new(FALSE, PREF_PAD_GAP);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
314
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
315 g_object_set_data(G_OBJECT(phd->widget), "pane_data", phd);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
316 g_signal_connect(G_OBJECT(phd->widget), "destroy",
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
317 G_CALLBACK(bar_pane_histogram_destroy), phd);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
318
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
319
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
320 gtk_widget_set_size_request(GTK_WIDGET(phd->widget), -1, height);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
321
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
322 phd->drawing_area = gtk_drawing_area_new();
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
323 g_signal_connect_after(G_OBJECT(phd->drawing_area), "size_allocate",
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
324 G_CALLBACK(bar_pane_histogram_size_cb), phd);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
325
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
326 g_signal_connect(G_OBJECT(phd->drawing_area), "expose_event",
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
327 G_CALLBACK(bar_pane_histogram_expose_event_cb), phd);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
328
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
329 gtk_box_pack_start(GTK_BOX(phd->widget), phd->drawing_area, TRUE, TRUE, 0);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
330 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
331 gtk_widget_add_events(phd->drawing_area, GDK_BUTTON_PRESS_MASK);
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
332
1319
358685fb9dc9 Add a contextual menu on bar pane histogram allowing to change channels and mode. More work needed.
zas_
parents: 1315
diff changeset
333 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
334
1330
8b6e2a47adc7 Add a tooltip showing current histogram state on bar histogram.
zas_
parents: 1329
diff changeset
335 #if GTK_CHECK_VERSION(2,12,0)
8b6e2a47adc7 Add a tooltip showing current histogram state on bar histogram.
zas_
parents: 1329
diff changeset
336 gtk_widget_set_tooltip_text(phd->drawing_area, histogram_label(phd->histogram));
8b6e2a47adc7 Add a tooltip showing current histogram state on bar histogram.
zas_
parents: 1329
diff changeset
337 #endif
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
338 gtk_widget_show(phd->widget);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
339
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
340 file_data_register_notify_func(bar_pane_histogram_notify_cb, phd, NOTIFY_PRIORITY_LOW);
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
341
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
342 return phd->widget;
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
343 }
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
344
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
345 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
346 {
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
347 gchar *title = g_strdup(_("NoName"));
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
348 gboolean expanded = TRUE;
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
349 gint height = 80;
1324
e4f9e3567f0a Save bar pane histogram state to rc file.
zas_
parents: 1323
diff changeset
350 gint histogram_channel = HCHAN_RGB;
1329
1fc356f629fe Clean up histogram stuff: options saving/restoring, osd histogram separation, tidy up.
zas_
parents: 1324
diff changeset
351 gint histogram_mode = 0;
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
352
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
353 while (*attribute_names)
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
354 {
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
355 const gchar *option = *attribute_names++;
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
356 const gchar *value = *attribute_values++;
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
357
1315
c1d108ab3388 Since READ_*() macros are now exported, do not hide
zas_
parents: 1314
diff changeset
358 if (READ_CHAR_FULL("pane.title", title)) continue;
c1d108ab3388 Since READ_*() macros are now exported, do not hide
zas_
parents: 1314
diff changeset
359 if (READ_BOOL_FULL("pane.expanded", expanded)) continue;
1324
e4f9e3567f0a Save bar pane histogram state to rc file.
zas_
parents: 1323
diff changeset
360 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
361 if (READ_INT_FULL("histogram_mode", histogram_mode)) continue;
1324
e4f9e3567f0a Save bar pane histogram state to rc file.
zas_
parents: 1323
diff changeset
362
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
363
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
364 DEBUG_1("unknown attribute %s = %s", option, value);
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
365 }
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
366
1329
1fc356f629fe Clean up histogram stuff: options saving/restoring, osd histogram separation, tidy up.
zas_
parents: 1324
diff changeset
367 return bar_pane_histogram_new(title, height, expanded, histogram_channel, histogram_mode);
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
368 }
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
369
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
370
1298
c37f36b97173 added histogram pane
nadvornik
parents:
diff changeset
371 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */