Mercurial > audlegacy
annotate src/audacious/ui_skinned_textbox.c @ 2947:13591e28d89e trunk
cleanup
author | Tomasz Mon <desowin@gmail.com> |
---|---|
date | Sun, 01 Jul 2007 12:52:58 +0200 |
parents | 09c216d437b2 |
children | 830fdbec31be |
rev | line source |
---|---|
2911 | 1 /* |
2 * Audacious - a cross-platform multimedia player | |
3 * Copyright (c) 2007 Audacious development team. | |
4 * | |
5 * Based on: | |
6 * BMP - Cross-platform multimedia player | |
7 * Copyright (C) 2003-2004 BMP development team. | |
8 * XMMS: | |
9 * Copyright (C) 1998-2003 XMMS development team. | |
10 * | |
11 * This program is free software; you can redistribute it and/or modify | |
12 * it under the terms of the GNU General Public License as published by | |
2918
4e71092ab29b
remove evil GPL3 upgrade phrase
Tomasz Mon <desowin@gmail.com>
parents:
2917
diff
changeset
|
13 * the Free Software Foundation; under version 2 of the License. |
2911 | 14 * |
15 * This program is distributed in the hope that it will be useful, | |
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 * GNU General Public License for more details. | |
19 * | |
20 * You should have received a copy of the GNU General Public License | |
21 * along with this program; if not, write to the Free Software | |
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
23 */ | |
24 | |
25 #include "widgets/widgetcore.h" | |
26 #include "ui_skinned_textbox.h" | |
27 #include "main.h" | |
28 #include "util.h" | |
29 #include "strings.h" | |
30 #include <string.h> | |
31 #include <ctype.h> | |
32 #include <gtk/gtkmain.h> | |
33 #include <gtk/gtkmarshal.h> | |
34 #include <gtk/gtkimage.h> | |
35 | |
36 #define UI_SKINNED_TEXTBOX_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UI_TYPE_SKINNED_TEXTBOX, UiSkinnedTextboxPrivate)) | |
37 typedef struct _UiSkinnedTextboxPrivate UiSkinnedTextboxPrivate; | |
38 | |
39 enum { | |
2942
1a59a0ced6a8
make scrolling stop for second when it reaches end, replace remaining mainwin TextBox with UiSkinnedTextbox
Tomasz Mon <desowin@gmail.com>
parents:
2920
diff
changeset
|
40 CLICKED, |
2911 | 41 DOUBLE_CLICKED, |
42 RIGHT_CLICKED, | |
43 DOUBLED, | |
44 REDRAW, | |
45 LAST_SIGNAL | |
46 }; | |
47 | |
48 struct _UiSkinnedTextboxPrivate { | |
49 GtkWidget *image; | |
50 GdkGC *gc; | |
51 SkinPixmapId skin_index; | |
52 GtkWidget *fixed; | |
53 gboolean double_size; | |
54 gboolean scroll_back; | |
55 gint nominal_y, nominal_height; | |
56 gint scroll_timeout; | |
57 gint font_ascent, font_descent; | |
58 PangoFontDescription *font; | |
59 gchar *fontname; | |
60 gchar *pixmap_text; | |
61 gint skin_id; | |
62 gint drag_x, drag_off, offset; | |
63 gboolean is_scrollable, is_dragging; | |
64 gint pixmap_width; | |
65 GdkPixmap *pixmap; | |
66 gboolean scroll_allowed, scroll_enabled; | |
67 }; | |
68 | |
69 | |
70 static GtkBinClass *parent_class = NULL; | |
71 static void ui_skinned_textbox_class_init(UiSkinnedTextboxClass *klass); | |
72 static void ui_skinned_textbox_init(UiSkinnedTextbox *textbox); | |
73 static GObject* ui_skinned_textbox_constructor(GType type, guint n_construct_properties, GObjectConstructParam *construct_params); | |
74 static void ui_skinned_textbox_destroy(GtkObject *object); | |
75 static void ui_skinned_textbox_realize(GtkWidget *widget); | |
76 static void ui_skinned_textbox_unrealize(GtkWidget *widget); | |
77 static void ui_skinned_textbox_map(GtkWidget *widget); | |
78 static void ui_skinned_textbox_unmap(GtkWidget *widget); | |
79 static gint ui_skinned_textbox_expose(GtkWidget *widget,GdkEventExpose *event); | |
80 | |
81 static void ui_skinned_textbox_size_allocate(GtkWidget *widget, GtkAllocation *allocation); | |
82 | |
83 static guint textbox_signals[LAST_SIGNAL] = { 0 }; | |
84 static gint ui_skinned_textbox_textbox_press(GtkWidget *widget, GdkEventButton *event); | |
85 static gint ui_skinned_textbox_textbox_release(GtkWidget *widget, GdkEventButton *event); | |
86 | |
87 static void ui_skinned_textbox_add(GtkContainer *container, GtkWidget *widget); | |
88 static void ui_skinned_textbox_toggle_doublesize(UiSkinnedTextbox *textbox); | |
89 | |
90 static gint ui_skinned_textbox_motion_notify(GtkWidget *widget, GdkEventMotion *event); | |
91 static void ui_skinned_textbox_paint(UiSkinnedTextbox *textbox); | |
92 static void ui_skinned_textbox_redraw(UiSkinnedTextbox *textbox); | |
93 static gboolean ui_skinned_textbox_should_scroll(UiSkinnedTextbox *textbox); | |
94 static void textbox_generate_xfont_pixmap(UiSkinnedTextbox *textbox, const gchar *pixmaptext); | |
95 static void textbox_generate_pixmap(UiSkinnedTextbox *textbox); | |
96 static void textbox_handle_special_char(gchar c, gint * x, gint * y); | |
97 | |
98 GType ui_skinned_textbox_get_type (void) { | |
99 static GType textbox_type = 0; | |
100 | |
101 if (!textbox_type) { | |
102 static const GTypeInfo textbox_info = { | |
103 sizeof (UiSkinnedTextboxClass), | |
104 NULL, /* base_init */ | |
105 NULL, /* base_finalize */ | |
106 (GClassInitFunc) ui_skinned_textbox_class_init, | |
107 NULL, /* class_finalize */ | |
108 NULL, /* class_data */ | |
109 sizeof (UiSkinnedTextbox), | |
110 16, /* n_preallocs */ | |
111 (GInstanceInitFunc) ui_skinned_textbox_init, | |
112 }; | |
113 | |
114 textbox_type = g_type_register_static (GTK_TYPE_BIN, "UiSkinnedTextbox", &textbox_info, 0); | |
115 } | |
116 return textbox_type; | |
117 } | |
118 | |
119 static void ui_skinned_textbox_class_init (UiSkinnedTextboxClass *klass) { | |
120 GObjectClass *gobject_class; | |
121 GtkObjectClass *object_class; | |
122 GtkWidgetClass *widget_class; | |
123 GtkContainerClass *container_class; | |
124 | |
125 gobject_class = G_OBJECT_CLASS(klass); | |
126 object_class = (GtkObjectClass*)klass; | |
127 widget_class = (GtkWidgetClass*)klass; | |
128 container_class = (GtkContainerClass*)klass; | |
129 | |
130 parent_class = g_type_class_peek_parent(klass); | |
131 gobject_class->constructor = ui_skinned_textbox_constructor; | |
132 object_class->destroy = ui_skinned_textbox_destroy; | |
133 | |
134 widget_class->realize = ui_skinned_textbox_realize; | |
135 widget_class->unrealize = ui_skinned_textbox_unrealize; | |
136 widget_class->map = ui_skinned_textbox_map; | |
137 widget_class->unmap = ui_skinned_textbox_unmap; | |
138 widget_class->size_allocate = ui_skinned_textbox_size_allocate; | |
139 widget_class->expose_event = ui_skinned_textbox_expose; | |
140 widget_class->button_press_event = ui_skinned_textbox_textbox_press; | |
141 widget_class->button_release_event = ui_skinned_textbox_textbox_release; | |
142 widget_class->motion_notify_event = ui_skinned_textbox_motion_notify; | |
143 | |
144 container_class->add = ui_skinned_textbox_add; | |
145 | |
2942
1a59a0ced6a8
make scrolling stop for second when it reaches end, replace remaining mainwin TextBox with UiSkinnedTextbox
Tomasz Mon <desowin@gmail.com>
parents:
2920
diff
changeset
|
146 klass->clicked = NULL; |
2911 | 147 klass->double_clicked = NULL; |
148 klass->right_clicked = NULL; | |
149 klass->doubled = ui_skinned_textbox_toggle_doublesize; | |
150 klass->redraw = ui_skinned_textbox_redraw; | |
151 | |
2942
1a59a0ced6a8
make scrolling stop for second when it reaches end, replace remaining mainwin TextBox with UiSkinnedTextbox
Tomasz Mon <desowin@gmail.com>
parents:
2920
diff
changeset
|
152 textbox_signals[CLICKED] = |
1a59a0ced6a8
make scrolling stop for second when it reaches end, replace remaining mainwin TextBox with UiSkinnedTextbox
Tomasz Mon <desowin@gmail.com>
parents:
2920
diff
changeset
|
153 g_signal_new ("clicked", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, |
1a59a0ced6a8
make scrolling stop for second when it reaches end, replace remaining mainwin TextBox with UiSkinnedTextbox
Tomasz Mon <desowin@gmail.com>
parents:
2920
diff
changeset
|
154 G_STRUCT_OFFSET (UiSkinnedTextboxClass, clicked), NULL, NULL, |
1a59a0ced6a8
make scrolling stop for second when it reaches end, replace remaining mainwin TextBox with UiSkinnedTextbox
Tomasz Mon <desowin@gmail.com>
parents:
2920
diff
changeset
|
155 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); |
1a59a0ced6a8
make scrolling stop for second when it reaches end, replace remaining mainwin TextBox with UiSkinnedTextbox
Tomasz Mon <desowin@gmail.com>
parents:
2920
diff
changeset
|
156 |
2911 | 157 textbox_signals[DOUBLE_CLICKED] = |
158 g_signal_new ("double-clicked", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, | |
159 G_STRUCT_OFFSET (UiSkinnedTextboxClass, double_clicked), NULL, NULL, | |
160 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); | |
161 | |
162 textbox_signals[RIGHT_CLICKED] = | |
163 g_signal_new ("right-clicked", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, | |
164 G_STRUCT_OFFSET (UiSkinnedTextboxClass, right_clicked), NULL, NULL, | |
165 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); | |
166 | |
167 textbox_signals[DOUBLED] = | |
168 g_signal_new ("toggle-double-size", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, | |
169 G_STRUCT_OFFSET (UiSkinnedTextboxClass, doubled), NULL, NULL, | |
170 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); | |
171 | |
172 textbox_signals[REDRAW] = | |
173 g_signal_new ("redraw", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, | |
174 G_STRUCT_OFFSET (UiSkinnedTextboxClass, redraw), NULL, NULL, | |
175 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); | |
176 | |
177 g_type_class_add_private (gobject_class, sizeof (UiSkinnedTextboxPrivate)); | |
178 } | |
179 | |
180 static void ui_skinned_textbox_init (UiSkinnedTextbox *textbox) { | |
181 UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE (textbox); | |
182 priv->image = gtk_image_new(); | |
183 textbox->redraw = TRUE; | |
184 | |
185 g_object_set (priv->image, "visible", TRUE, NULL); | |
186 gtk_container_add(GTK_CONTAINER(GTK_WIDGET(textbox)), priv->image); | |
187 | |
188 GTK_WIDGET_SET_FLAGS (textbox, GTK_NO_WINDOW); | |
189 } | |
190 | |
191 static void ui_skinned_textbox_destroy (GtkObject *object) { | |
192 (*GTK_OBJECT_CLASS (parent_class)->destroy) (object); | |
193 } | |
194 | |
195 static GObject* ui_skinned_textbox_constructor(GType type, guint n_construct_properties, GObjectConstructParam *construct_params) { | |
196 GObject *object = (*G_OBJECT_CLASS (parent_class)->constructor)(type, n_construct_properties, construct_params); | |
197 | |
198 return object; | |
199 } | |
200 | |
201 static void ui_skinned_textbox_realize (GtkWidget *widget) { | |
202 UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX (widget); | |
203 GdkWindowAttr attrib; | |
204 | |
205 GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); | |
206 | |
207 attrib.window_type = GDK_WINDOW_CHILD; | |
208 attrib.x = widget->allocation.x; | |
209 attrib.y = widget->allocation.y; | |
210 attrib.width = widget->allocation.width; | |
211 attrib.height = widget->allocation.height; | |
212 attrib.wclass = GDK_INPUT_ONLY; | |
213 attrib.event_mask = gtk_widget_get_events (widget); | |
214 attrib.event_mask |= (GDK_BUTTON_PRESS_MASK | GDK_BUTTON_MOTION_MASK | GDK_BUTTON_RELEASE_MASK); | |
215 | |
216 widget->window = gtk_widget_get_parent_window(widget); | |
217 g_object_ref(widget->window); | |
218 | |
219 textbox->event_window = gdk_window_new(gtk_widget_get_parent_window(widget), &attrib, GDK_WA_X | GDK_WA_Y); | |
220 gdk_window_set_user_data (textbox->event_window, textbox); | |
221 } | |
222 | |
223 static void ui_skinned_textbox_unrealize(GtkWidget *widget) { | |
224 UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX (widget); | |
225 | |
226 if (textbox->event_window) { | |
227 gdk_window_set_user_data (textbox->event_window, NULL); | |
228 gdk_window_destroy (textbox->event_window); | |
229 textbox->event_window = NULL; | |
230 } | |
231 | |
232 GTK_WIDGET_CLASS (parent_class)->unrealize (widget); | |
233 } | |
234 | |
235 static void ui_skinned_textbox_map(GtkWidget *widget) { | |
236 UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX (widget); | |
237 g_return_if_fail (UI_IS_SKINNED_TEXTBOX (widget)); | |
238 GTK_WIDGET_CLASS (parent_class)->map(widget); | |
239 gdk_window_show (textbox->event_window); | |
240 } | |
241 | |
242 static void ui_skinned_textbox_unmap (GtkWidget *widget) { | |
243 UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX (widget); | |
244 g_return_if_fail (UI_IS_SKINNED_TEXTBOX(widget)); | |
245 | |
246 if (textbox->event_window) | |
247 gdk_window_hide (textbox->event_window); | |
248 | |
249 GTK_WIDGET_CLASS (parent_class)->unmap (widget); | |
250 } | |
251 | |
252 static gboolean ui_skinned_textbox_expose(GtkWidget *widget, GdkEventExpose *event) { | |
253 if (GTK_WIDGET_DRAWABLE (widget)) | |
254 (*GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event); | |
255 | |
256 return FALSE; | |
257 } | |
258 | |
259 GtkWidget* ui_skinned_textbox_new () { | |
260 return g_object_new (UI_TYPE_SKINNED_TEXTBOX, NULL); | |
261 } | |
262 | |
263 void ui_skinned_textbox_setup(GtkWidget *widget, GtkWidget *fixed,GdkPixmap * parent, GdkGC * gc, gint x, gint y, gint w, gboolean allow_scroll, SkinPixmapId si) { | |
264 | |
265 UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX(widget); | |
266 UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(textbox); | |
267 textbox->height = bmp_active_skin->properties.textbox_bitmap_font_height; | |
268 textbox->x = x; | |
269 textbox->y = y; | |
270 priv->gc = gc; | |
2947 | 271 textbox->width = w; |
2911 | 272 priv->scroll_allowed = allow_scroll; |
273 priv->scroll_enabled = TRUE; | |
274 priv->skin_index = si; | |
275 priv->nominal_y = y; | |
276 priv->nominal_height = textbox->height; | |
277 priv->scroll_timeout = 0; | |
278 | |
279 priv->fixed = fixed; | |
280 priv->double_size = FALSE; | |
281 | |
2947 | 282 gtk_widget_set_size_request(widget, textbox->width, textbox->height); |
2911 | 283 gtk_fixed_put(GTK_FIXED(priv->fixed), widget, textbox->x, textbox->y); |
284 } | |
285 | |
286 static void ui_skinned_textbox_size_allocate(GtkWidget *widget, GtkAllocation *allocation) { | |
287 UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX (widget); | |
288 UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE (textbox); | |
289 GtkAllocation child_alloc; | |
290 | |
291 widget->allocation = *allocation; | |
292 if (GTK_BIN (textbox)->child) { //image should fill whole widget | |
293 child_alloc.x = widget->allocation.x; | |
294 child_alloc.y = widget->allocation.y; | |
295 child_alloc.width = MAX (1, widget->allocation.width); | |
296 child_alloc.height = MAX (1, widget->allocation.height); | |
297 | |
298 gtk_widget_size_allocate (GTK_BIN (textbox)->child, &child_alloc); | |
299 } | |
300 | |
301 if (GDK_IS_WINDOW(textbox->event_window)) | |
302 gdk_window_move_resize (textbox->event_window, widget->allocation.x, widget->allocation.y, | |
303 widget->allocation.width, widget->allocation.height); | |
304 | |
305 textbox->x = widget->allocation.x/(priv->double_size ? 2 : 1); | |
306 textbox->y = widget->allocation.y/(priv->double_size ? 2 : 1); | |
2919 | 307 |
2947 | 308 if (textbox->width != widget->allocation.width) { |
309 textbox->width = widget->allocation.width; | |
2919 | 310 if (priv->pixmap_text) g_free(priv->pixmap_text); |
311 priv->pixmap_text = NULL; | |
312 priv->offset = 0; | |
2945
09c216d437b2
Backed out changeset 3c66c8d03c534692d1606ed3ed79634e227f7bd2
William Pitcock <nenolod@atheme.org>
parents:
2944
diff
changeset
|
313 ui_skinned_textbox_redraw(textbox); |
2919 | 314 } |
2911 | 315 } |
316 | |
317 static gboolean ui_skinned_textbox_textbox_press(GtkWidget *widget, GdkEventButton *event) { | |
318 UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX(widget); | |
319 UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE (textbox); | |
320 | |
321 if (event->type == GDK_BUTTON_PRESS) { | |
322 textbox = UI_SKINNED_TEXTBOX(widget); | |
323 | |
324 if (event->button == 1) { | |
2942
1a59a0ced6a8
make scrolling stop for second when it reaches end, replace remaining mainwin TextBox with UiSkinnedTextbox
Tomasz Mon <desowin@gmail.com>
parents:
2920
diff
changeset
|
325 if (priv->scroll_allowed) { |
2947 | 326 if ((priv->pixmap_width > textbox->width) && priv->is_scrollable) { |
2942
1a59a0ced6a8
make scrolling stop for second when it reaches end, replace remaining mainwin TextBox with UiSkinnedTextbox
Tomasz Mon <desowin@gmail.com>
parents:
2920
diff
changeset
|
327 priv->is_dragging = TRUE; |
1a59a0ced6a8
make scrolling stop for second when it reaches end, replace remaining mainwin TextBox with UiSkinnedTextbox
Tomasz Mon <desowin@gmail.com>
parents:
2920
diff
changeset
|
328 textbox->redraw = TRUE; |
1a59a0ced6a8
make scrolling stop for second when it reaches end, replace remaining mainwin TextBox with UiSkinnedTextbox
Tomasz Mon <desowin@gmail.com>
parents:
2920
diff
changeset
|
329 priv->drag_off = priv->offset; |
1a59a0ced6a8
make scrolling stop for second when it reaches end, replace remaining mainwin TextBox with UiSkinnedTextbox
Tomasz Mon <desowin@gmail.com>
parents:
2920
diff
changeset
|
330 priv->drag_x = event->x; |
1a59a0ced6a8
make scrolling stop for second when it reaches end, replace remaining mainwin TextBox with UiSkinnedTextbox
Tomasz Mon <desowin@gmail.com>
parents:
2920
diff
changeset
|
331 } |
1a59a0ced6a8
make scrolling stop for second when it reaches end, replace remaining mainwin TextBox with UiSkinnedTextbox
Tomasz Mon <desowin@gmail.com>
parents:
2920
diff
changeset
|
332 } else |
1a59a0ced6a8
make scrolling stop for second when it reaches end, replace remaining mainwin TextBox with UiSkinnedTextbox
Tomasz Mon <desowin@gmail.com>
parents:
2920
diff
changeset
|
333 g_signal_emit(widget, textbox_signals[CLICKED], 0); |
1a59a0ced6a8
make scrolling stop for second when it reaches end, replace remaining mainwin TextBox with UiSkinnedTextbox
Tomasz Mon <desowin@gmail.com>
parents:
2920
diff
changeset
|
334 |
2911 | 335 } else if (event->button == 3) { |
336 g_signal_emit(widget, textbox_signals[RIGHT_CLICKED], 0); | |
337 } | |
338 } else if (event->type == GDK_2BUTTON_PRESS) { | |
339 if (event->button == 1) { | |
340 g_signal_emit(widget, textbox_signals[DOUBLE_CLICKED], 0); | |
341 } | |
342 } | |
343 return TRUE; | |
344 } | |
345 | |
346 static gboolean ui_skinned_textbox_textbox_release(GtkWidget *widget, GdkEventButton *event) { | |
347 UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX(widget); | |
348 UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE (textbox); | |
349 if (event->button == 1) { | |
350 priv->is_dragging = FALSE; | |
351 textbox->redraw = TRUE; | |
352 } | |
353 | |
354 return TRUE; | |
355 } | |
356 | |
357 static gboolean ui_skinned_textbox_motion_notify(GtkWidget *widget, GdkEventMotion *event) { | |
358 UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX(widget); | |
359 UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE (textbox); | |
360 | |
361 if (priv->is_dragging) { | |
362 if (priv->scroll_allowed && | |
2947 | 363 priv->pixmap_width > textbox->width) { |
2911 | 364 priv->offset = priv->drag_off - (event->x - priv->drag_x); |
365 | |
366 while (priv->offset < 0) | |
2917 | 367 priv->offset = 0; |
2911 | 368 |
2947 | 369 while (priv->offset > (priv->pixmap_width - textbox->width)) |
370 priv->offset = (priv->pixmap_width - textbox->width); | |
2911 | 371 |
2945
09c216d437b2
Backed out changeset 3c66c8d03c534692d1606ed3ed79634e227f7bd2
William Pitcock <nenolod@atheme.org>
parents:
2944
diff
changeset
|
372 ui_skinned_textbox_redraw(textbox); |
2911 | 373 } |
374 } | |
375 | |
376 return FALSE; | |
377 } | |
378 | |
379 static void ui_skinned_textbox_add(GtkContainer *container, GtkWidget *widget) { | |
380 GTK_CONTAINER_CLASS (parent_class)->add(container, widget); | |
381 } | |
382 | |
383 static void ui_skinned_textbox_toggle_doublesize(UiSkinnedTextbox *textbox) { | |
384 GtkWidget *widget = GTK_WIDGET (textbox); | |
385 UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE (textbox); | |
386 priv->double_size = !priv->double_size; | |
387 | |
2947 | 388 gtk_widget_set_size_request(widget, textbox->width*(1+priv->double_size), textbox->height*(1+priv->double_size)); |
2911 | 389 gtk_widget_set_uposition(widget, textbox->x*(1+priv->double_size), textbox->y*(1+priv->double_size)); |
390 | |
391 textbox->redraw = TRUE; | |
392 } | |
393 | |
394 static void ui_skinned_textbox_paint(UiSkinnedTextbox *textbox) { | |
395 GtkWidget *widget = GTK_WIDGET (textbox); | |
396 UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE (textbox); | |
397 | |
398 if (textbox->redraw == TRUE) { | |
399 textbox->redraw = FALSE; | |
400 gint cw; | |
401 GdkPixmap *obj; | |
402 GdkPixmap *src; | |
403 | |
404 if (textbox->text && (!priv->pixmap_text || strcmp(textbox->text, priv->pixmap_text))) | |
405 textbox_generate_pixmap(textbox); | |
406 | |
407 if (priv->pixmap) { | |
408 if (skin_get_id() != priv->skin_id) { | |
409 priv->skin_id = skin_get_id(); | |
410 textbox_generate_pixmap(textbox); | |
411 } | |
2947 | 412 obj = gdk_pixmap_new(NULL, textbox->width, textbox->height, gdk_rgb_get_visual()->depth); |
2911 | 413 src = priv->pixmap; |
414 | |
415 cw = priv->pixmap_width - priv->offset; | |
2947 | 416 if (cw > textbox->width) |
417 cw = textbox->width; | |
2911 | 418 gdk_draw_drawable(obj, priv->gc, src, priv->offset, 0, 0, 0, cw, textbox->height); |
2947 | 419 if (cw < textbox->width) |
2911 | 420 gdk_draw_drawable(obj, priv->gc, src, 0, 0, |
421 textbox->x + cw, textbox->y, | |
2947 | 422 textbox->width - cw, textbox->height); |
2911 | 423 |
424 if (priv->double_size) { | |
425 GdkImage *img, *img2x; | |
2947 | 426 img = gdk_drawable_get_image(obj, 0, 0, textbox->width, textbox->height); |
2911 | 427 img2x = create_dblsize_image(img); |
428 gtk_image_set(GTK_IMAGE(priv->image), img2x, NULL); | |
429 g_object_unref(img2x); | |
430 g_object_unref(img); | |
431 } else | |
432 gtk_image_set_from_pixmap(GTK_IMAGE(priv->image), obj, NULL); | |
433 | |
434 g_object_unref(obj); | |
435 gtk_widget_queue_resize(widget); | |
436 } | |
437 } | |
438 } | |
439 | |
440 static void ui_skinned_textbox_redraw(UiSkinnedTextbox *textbox) { | |
441 textbox->redraw = TRUE; | |
442 ui_skinned_textbox_paint(textbox); | |
443 } | |
444 | |
445 static gboolean ui_skinned_textbox_should_scroll(UiSkinnedTextbox *textbox) { | |
446 UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE (textbox); | |
447 if (!priv->scroll_allowed) | |
448 return FALSE; | |
449 | |
450 if (priv->font) { | |
451 gint width; | |
452 text_get_extents(priv->fontname, textbox->text, &width, NULL, NULL, NULL); | |
453 | |
2947 | 454 if (width <= textbox->width) |
2911 | 455 return FALSE; |
456 else | |
457 return TRUE; | |
458 } | |
459 | |
2947 | 460 if (g_utf8_strlen(textbox->text, -1) * bmp_active_skin->properties.textbox_bitmap_font_width > textbox->width) |
2911 | 461 return TRUE; |
462 | |
463 return FALSE; | |
464 } | |
465 | |
466 void ui_skinned_textbox_set_xfont(GtkWidget *widget, gboolean use_xfont, const gchar * fontname) { | |
467 UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX (widget); | |
468 UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE (textbox); | |
469 gint ascent, descent; | |
470 | |
471 g_return_if_fail(textbox != NULL); | |
472 | |
473 if (priv->font) { | |
474 pango_font_description_free(priv->font); | |
475 priv->font = NULL; | |
476 } | |
477 | |
478 textbox->y = priv->nominal_y; | |
479 textbox->height = priv->nominal_height; | |
480 | |
481 /* Make sure the pixmap is regenerated */ | |
482 if (priv->pixmap_text) { | |
483 g_free(priv->pixmap_text); | |
484 priv->pixmap_text = NULL; | |
485 } | |
486 | |
487 if (!use_xfont || strlen(fontname) == 0) | |
488 return; | |
489 | |
490 priv->font = pango_font_description_from_string(fontname); | |
491 priv->fontname = g_strdup(fontname); | |
492 | |
493 text_get_extents(fontname, | |
494 "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz ", | |
495 NULL, NULL, &ascent, &descent); | |
496 priv->font_ascent = ascent; | |
497 priv->font_descent = descent; | |
498 | |
499 | |
500 if (priv->font == NULL) | |
501 return; | |
502 | |
503 textbox->height = priv->font_ascent; | |
504 if (textbox->height > priv->nominal_height) | |
505 textbox->y -= (textbox->height - priv->nominal_height) / 2; | |
506 else | |
507 textbox->height = priv->nominal_height; | |
508 } | |
509 | |
510 void ui_skinned_textbox_set_text(GtkWidget *widget, const gchar *text) { | |
511 g_return_if_fail(text != NULL); | |
512 UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX (widget); | |
513 UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE (textbox); | |
514 | |
515 if (textbox->text) { | |
516 if (!strcmp(text, textbox->text)) | |
517 return; | |
518 g_free(textbox->text); | |
519 } | |
520 | |
521 textbox->text = str_to_utf8(text); | |
522 priv->scroll_back = FALSE; | |
523 ui_skinned_textbox_redraw(textbox); | |
524 } | |
525 | |
526 static void textbox_generate_xfont_pixmap(UiSkinnedTextbox *textbox, const gchar *pixmaptext) { | |
527 gint length, i; | |
528 GdkGC *gc, *maskgc; | |
529 GdkColor *c, pattern; | |
530 GdkBitmap *mask; | |
531 PangoLayout *layout; | |
532 gint width; | |
533 UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE (textbox); | |
534 | |
535 g_return_if_fail(textbox != NULL); | |
536 g_return_if_fail(pixmaptext != NULL); | |
537 | |
538 length = g_utf8_strlen(pixmaptext, -1); | |
539 | |
540 text_get_extents(priv->fontname, pixmaptext, &width, NULL, NULL, NULL); | |
541 | |
2947 | 542 priv->pixmap_width = MAX(width, textbox->width); |
2911 | 543 priv->pixmap = gdk_pixmap_new(mainwin->window, priv->pixmap_width, |
544 textbox->height, | |
545 gdk_rgb_get_visual()->depth); | |
546 gc = priv->gc; | |
547 c = skin_get_color(bmp_active_skin, SKIN_TEXTBG); | |
548 for (i = 0; i < textbox->height; i++) { | |
549 gdk_gc_set_foreground(gc, &c[6 * i / textbox->height]); | |
2920
5a94507f507e
fix textbox_generate_xfont_pixmap
Tomasz Mon <desowin@gmail.com>
parents:
2919
diff
changeset
|
550 gdk_draw_line(priv->pixmap, gc, 0, i, priv->pixmap_width, i); |
2911 | 551 } |
552 | |
553 mask = gdk_pixmap_new(mainwin->window, priv->pixmap_width, textbox->height, 1); | |
554 maskgc = gdk_gc_new(mask); | |
555 pattern.pixel = 0; | |
556 gdk_gc_set_foreground(maskgc, &pattern); | |
557 | |
558 gdk_draw_rectangle(mask, maskgc, TRUE, 0, 0, priv->pixmap_width, textbox->height); | |
559 pattern.pixel = 1; | |
560 gdk_gc_set_foreground(maskgc, &pattern); | |
561 | |
562 gdk_gc_set_foreground(gc, skin_get_color(bmp_active_skin, SKIN_TEXTFG)); | |
563 | |
564 layout = gtk_widget_create_pango_layout(mainwin, pixmaptext); | |
565 pango_layout_set_font_description(layout, priv->font); | |
566 | |
567 gdk_draw_layout(priv->pixmap, gc, 0, (priv->font_descent / 2), layout); | |
568 g_object_unref(layout); | |
569 | |
570 g_object_unref(maskgc); | |
571 | |
572 gdk_gc_set_clip_mask(gc, mask); | |
573 c = skin_get_color(bmp_active_skin, SKIN_TEXTFG); | |
574 for (i = 0; i < textbox->height; i++) { | |
575 gdk_gc_set_foreground(gc, &c[6 * i / textbox->height]); | |
576 gdk_draw_line(priv->pixmap, gc, 0, i, priv->pixmap_width, i); | |
577 } | |
578 g_object_unref(mask); | |
579 gdk_gc_set_clip_mask(gc, NULL); | |
580 } | |
581 | |
582 static gboolean textbox_scroll(gpointer data) { | |
583 UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX(data); | |
584 UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE (data); | |
585 | |
586 if (!priv->is_dragging) { | |
587 if (priv->scroll_back) priv->offset -= 1; | |
588 else priv->offset += 1; | |
589 | |
2947 | 590 if (priv->offset >= (priv->pixmap_width - textbox->width)) { |
2942
1a59a0ced6a8
make scrolling stop for second when it reaches end, replace remaining mainwin TextBox with UiSkinnedTextbox
Tomasz Mon <desowin@gmail.com>
parents:
2920
diff
changeset
|
591 priv->scroll_back = TRUE; |
1a59a0ced6a8
make scrolling stop for second when it reaches end, replace remaining mainwin TextBox with UiSkinnedTextbox
Tomasz Mon <desowin@gmail.com>
parents:
2920
diff
changeset
|
592 /* There are 1 million microseconds per second */ |
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2942
diff
changeset
|
593 //g_usleep(1000000); |
2942
1a59a0ced6a8
make scrolling stop for second when it reaches end, replace remaining mainwin TextBox with UiSkinnedTextbox
Tomasz Mon <desowin@gmail.com>
parents:
2920
diff
changeset
|
594 } |
1a59a0ced6a8
make scrolling stop for second when it reaches end, replace remaining mainwin TextBox with UiSkinnedTextbox
Tomasz Mon <desowin@gmail.com>
parents:
2920
diff
changeset
|
595 if (priv->offset <= 0) { |
1a59a0ced6a8
make scrolling stop for second when it reaches end, replace remaining mainwin TextBox with UiSkinnedTextbox
Tomasz Mon <desowin@gmail.com>
parents:
2920
diff
changeset
|
596 priv->scroll_back = FALSE; |
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2942
diff
changeset
|
597 //g_usleep(1000000); |
2942
1a59a0ced6a8
make scrolling stop for second when it reaches end, replace remaining mainwin TextBox with UiSkinnedTextbox
Tomasz Mon <desowin@gmail.com>
parents:
2920
diff
changeset
|
598 } |
2911 | 599 ui_skinned_textbox_redraw(textbox); |
600 } | |
601 | |
602 return TRUE; | |
603 } | |
604 | |
605 static void textbox_generate_pixmap(UiSkinnedTextbox *textbox) { | |
606 gint length, i, x, y, wl; | |
607 gchar *pixmaptext; | |
608 GdkGC *gc; | |
609 UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE (textbox); | |
610 g_return_if_fail(textbox != NULL); | |
611 | |
612 if (priv->pixmap) { | |
613 g_object_unref(priv->pixmap); | |
614 priv->pixmap = NULL; | |
615 } | |
616 | |
617 /* | |
618 * Don't reset the offset if only text after the last '(' has | |
619 * changed. This is a hack to avoid visual noice on vbr files | |
620 * where we guess the length. | |
621 */ | |
622 if (!(priv->pixmap_text && strrchr(textbox->text, '(') && | |
623 !strncmp(priv->pixmap_text, textbox->text, | |
624 strrchr(textbox->text, '(') - textbox->text))) | |
625 priv->offset = 0; | |
626 | |
627 g_free(priv->pixmap_text); | |
628 priv->pixmap_text = g_strdup(textbox->text); | |
629 | |
630 /* | |
631 * wl is the number of (partial) letters visible. Only makes | |
632 * sense when using skinned font. | |
633 */ | |
2947 | 634 wl = textbox->width / 5; |
635 if (wl * 5 != textbox->width) | |
2911 | 636 wl++; |
637 | |
638 length = g_utf8_strlen(textbox->text, -1); | |
639 | |
640 priv->is_scrollable = FALSE; | |
641 | |
642 priv->is_scrollable = ui_skinned_textbox_should_scroll(textbox); | |
2916
3ef909ed3056
fix clearing textbox when short text is displayed
Tomasz Mon <desowin@gmail.com>
parents:
2913
diff
changeset
|
643 |
3ef909ed3056
fix clearing textbox when short text is displayed
Tomasz Mon <desowin@gmail.com>
parents:
2913
diff
changeset
|
644 if (!priv->is_scrollable && !priv->font && length <= wl) { |
3ef909ed3056
fix clearing textbox when short text is displayed
Tomasz Mon <desowin@gmail.com>
parents:
2913
diff
changeset
|
645 gint pad = wl - length; |
3ef909ed3056
fix clearing textbox when short text is displayed
Tomasz Mon <desowin@gmail.com>
parents:
2913
diff
changeset
|
646 gchar *padchars = g_strnfill(pad, ' '); |
3ef909ed3056
fix clearing textbox when short text is displayed
Tomasz Mon <desowin@gmail.com>
parents:
2913
diff
changeset
|
647 |
3ef909ed3056
fix clearing textbox when short text is displayed
Tomasz Mon <desowin@gmail.com>
parents:
2913
diff
changeset
|
648 pixmaptext = g_strconcat(priv->pixmap_text, padchars, NULL); |
3ef909ed3056
fix clearing textbox when short text is displayed
Tomasz Mon <desowin@gmail.com>
parents:
2913
diff
changeset
|
649 g_free(padchars); |
3ef909ed3056
fix clearing textbox when short text is displayed
Tomasz Mon <desowin@gmail.com>
parents:
2913
diff
changeset
|
650 length += pad; |
3ef909ed3056
fix clearing textbox when short text is displayed
Tomasz Mon <desowin@gmail.com>
parents:
2913
diff
changeset
|
651 } else |
3ef909ed3056
fix clearing textbox when short text is displayed
Tomasz Mon <desowin@gmail.com>
parents:
2913
diff
changeset
|
652 pixmaptext = g_strdup(priv->pixmap_text); |
2911 | 653 |
654 if (priv->is_scrollable) { | |
655 if (priv->scroll_enabled && !priv->scroll_timeout) { | |
656 gint tag; | |
657 tag = TEXTBOX_SCROLL_SMOOTH_TIMEOUT; | |
658 priv->scroll_timeout = g_timeout_add(tag, textbox_scroll, textbox); | |
659 } | |
660 } else { | |
661 if (priv->scroll_timeout) { | |
662 g_source_remove(priv->scroll_timeout); | |
663 priv->scroll_timeout = 0; | |
664 } | |
665 priv->offset = 0; | |
666 } | |
667 | |
668 if (priv->font) { | |
669 textbox_generate_xfont_pixmap(textbox, pixmaptext); | |
670 g_free(pixmaptext); | |
671 return; | |
672 } | |
673 | |
674 priv->pixmap_width = length * bmp_active_skin->properties.textbox_bitmap_font_width; | |
675 priv->pixmap = gdk_pixmap_new(mainwin->window, | |
676 priv->pixmap_width, bmp_active_skin->properties.textbox_bitmap_font_height, | |
677 gdk_rgb_get_visual()->depth); | |
678 gc = priv->gc; | |
679 | |
680 for (i = 0; i < length; i++) { | |
681 gchar c; | |
682 x = y = -1; | |
683 c = toupper((int) pixmaptext[i]); | |
684 if (c >= 'A' && c <= 'Z') { | |
685 x = bmp_active_skin->properties.textbox_bitmap_font_width * (c - 'A'); | |
686 y = 0; | |
687 } | |
688 else if (c >= '0' && c <= '9') { | |
689 x = bmp_active_skin->properties.textbox_bitmap_font_width * (c - '0'); | |
690 y = bmp_active_skin->properties.textbox_bitmap_font_height; | |
691 } | |
692 else | |
693 textbox_handle_special_char(c, &x, &y); | |
694 | |
695 skin_draw_pixmap(bmp_active_skin, | |
696 priv->pixmap, gc, priv->skin_index, | |
697 x, y, i * bmp_active_skin->properties.textbox_bitmap_font_width, 0, | |
698 bmp_active_skin->properties.textbox_bitmap_font_width, | |
699 bmp_active_skin->properties.textbox_bitmap_font_height); | |
700 } | |
701 g_free(pixmaptext); | |
702 } | |
703 | |
704 void ui_skinned_textbox_set_scroll(GtkWidget *widget, gboolean scroll) { | |
705 g_return_if_fail(widget != NULL); | |
706 UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX (widget); | |
707 UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE (textbox); | |
708 | |
709 priv->scroll_enabled = scroll; | |
710 if (priv->scroll_enabled && priv->is_scrollable && priv->scroll_allowed) { | |
711 gint tag; | |
712 tag = TEXTBOX_SCROLL_SMOOTH_TIMEOUT; | |
713 if (priv->scroll_timeout) { | |
714 g_source_remove(priv->scroll_timeout); | |
715 priv->scroll_timeout = 0; | |
716 } | |
717 priv->scroll_timeout = g_timeout_add(tag, textbox_scroll, textbox); | |
718 | |
719 } else { | |
720 | |
721 if (priv->scroll_timeout) { | |
722 g_source_remove(priv->scroll_timeout); | |
723 priv->scroll_timeout = 0; | |
724 } | |
725 | |
726 priv->offset = 0; | |
727 ui_skinned_textbox_redraw(textbox); | |
728 } | |
729 } | |
730 | |
731 static void | |
732 textbox_handle_special_char(gchar c, gint * x, gint * y) | |
733 { | |
734 gint tx, ty; | |
735 | |
736 switch (c) { | |
737 case '"': | |
738 tx = 26; | |
739 ty = 0; | |
740 break; | |
741 case '\r': | |
742 tx = 10; | |
743 ty = 1; | |
744 break; | |
745 case ':': | |
746 case ';': | |
747 tx = 12; | |
748 ty = 1; | |
749 break; | |
750 case '(': | |
751 tx = 13; | |
752 ty = 1; | |
753 break; | |
754 case ')': | |
755 tx = 14; | |
756 ty = 1; | |
757 break; | |
758 case '-': | |
759 tx = 15; | |
760 ty = 1; | |
761 break; | |
762 case '`': | |
763 case '\'': | |
764 tx = 16; | |
765 ty = 1; | |
766 break; | |
767 case '!': | |
768 tx = 17; | |
769 ty = 1; | |
770 break; | |
771 case '_': | |
772 tx = 18; | |
773 ty = 1; | |
774 break; | |
775 case '+': | |
776 tx = 19; | |
777 ty = 1; | |
778 break; | |
779 case '\\': | |
780 tx = 20; | |
781 ty = 1; | |
782 break; | |
783 case '/': | |
784 tx = 21; | |
785 ty = 1; | |
786 break; | |
787 case '[': | |
788 tx = 22; | |
789 ty = 1; | |
790 break; | |
791 case ']': | |
792 tx = 23; | |
793 ty = 1; | |
794 break; | |
795 case '^': | |
796 tx = 24; | |
797 ty = 1; | |
798 break; | |
799 case '&': | |
800 tx = 25; | |
801 ty = 1; | |
802 break; | |
803 case '%': | |
804 tx = 26; | |
805 ty = 1; | |
806 break; | |
807 case '.': | |
808 case ',': | |
809 tx = 27; | |
810 ty = 1; | |
811 break; | |
812 case '=': | |
813 tx = 28; | |
814 ty = 1; | |
815 break; | |
816 case '$': | |
817 tx = 29; | |
818 ty = 1; | |
819 break; | |
820 case '#': | |
821 tx = 30; | |
822 ty = 1; | |
823 break; | |
824 case '?': | |
825 tx = 3; | |
826 ty = 2; | |
827 break; | |
828 case '*': | |
829 tx = 4; | |
830 ty = 2; | |
831 break; | |
832 default: | |
833 tx = 29; | |
834 ty = 0; | |
835 break; | |
836 } | |
837 | |
838 *x = tx * bmp_active_skin->properties.textbox_bitmap_font_width; | |
839 *y = ty * bmp_active_skin->properties.textbox_bitmap_font_height; | |
840 } | |
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2942
diff
changeset
|
841 |
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2942
diff
changeset
|
842 void ui_skinned_textbox_move_relative(GtkWidget *widget, gint x, gint y) { |
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2942
diff
changeset
|
843 UiSkinnedTextbox *t = UI_SKINNED_TEXTBOX(widget); |
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2942
diff
changeset
|
844 UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE (widget); |
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2942
diff
changeset
|
845 gtk_fixed_move(GTK_FIXED(priv->fixed), widget, t->x+x, t->y+y); |
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2942
diff
changeset
|
846 } |
2945
09c216d437b2
Backed out changeset 3c66c8d03c534692d1606ed3ed79634e227f7bd2
William Pitcock <nenolod@atheme.org>
parents:
2944
diff
changeset
|
847 |
09c216d437b2
Backed out changeset 3c66c8d03c534692d1606ed3ed79634e227f7bd2
William Pitcock <nenolod@atheme.org>
parents:
2944
diff
changeset
|
848 void ui_skinned_textbox_resize_relative(GtkWidget *widget, gint w, gint h) { |
2947 | 849 UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX(widget); |
850 gtk_widget_set_size_request(widget, textbox->width+w, textbox->height+h); | |
2945
09c216d437b2
Backed out changeset 3c66c8d03c534692d1606ed3ed79634e227f7bd2
William Pitcock <nenolod@atheme.org>
parents:
2944
diff
changeset
|
851 } |