Mercurial > audlegacy
annotate src/audacious/ui_skinned_textbox.c @ 2983:048fa5c2b1db trunk
paint on obj instead on textbox->img while in oneway scroll mode
author | Tomasz Mon <desowin@gmail.com> |
---|---|
date | Wed, 04 Jul 2007 21:24:04 +0200 |
parents | b5efea796fe8 |
children | f7604f7d8e41 |
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 | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
36 static GMutex *mutex = NULL; |
2911 | 37 |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
38 #define TEXTBOX_SCROLL_SMOOTH_TIMEOUT 30 |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
39 #define TEXTBOX_SCROLL_WAIT 80 |
2965
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2962
diff
changeset
|
40 |
2911 | 41 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
|
42 CLICKED, |
2911 | 43 DOUBLE_CLICKED, |
44 RIGHT_CLICKED, | |
45 DOUBLED, | |
46 REDRAW, | |
47 LAST_SIGNAL | |
48 }; | |
49 | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
50 static void ui_skinned_textbox_class_init (UiSkinnedTextboxClass *klass); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
51 static void ui_skinned_textbox_init (UiSkinnedTextbox *textbox); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
52 static void ui_skinned_textbox_destroy (GtkObject *object); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
53 static void ui_skinned_textbox_realize (GtkWidget *widget); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
54 static void ui_skinned_textbox_size_request (GtkWidget *widget, GtkRequisition *requisition); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
55 static void ui_skinned_textbox_size_allocate (GtkWidget *widget, GtkAllocation *allocation); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
56 static gboolean ui_skinned_textbox_expose (GtkWidget *widget, GdkEventExpose *event); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
57 static gboolean ui_skinned_textbox_button_press (GtkWidget *widget, GdkEventButton *event); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
58 static gboolean ui_skinned_textbox_button_release (GtkWidget *widget, GdkEventButton *event); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
59 static gboolean ui_skinned_textbox_motion_notify (GtkWidget *widget, GdkEventMotion *event); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
60 static void ui_skinned_textbox_toggle_doublesize (UiSkinnedTextbox *textbox); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
61 static void ui_skinned_textbox_redraw (UiSkinnedTextbox *textbox); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
62 static gboolean ui_skinned_textbox_should_scroll (UiSkinnedTextbox *textbox); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
63 static void textbox_generate_xfont_pixmap (UiSkinnedTextbox *textbox, const gchar *pixmaptext); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
64 static gboolean textbox_scroll (gpointer data); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
65 static void textbox_generate_pixmap (UiSkinnedTextbox *textbox); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
66 static void textbox_handle_special_char (gchar c, gint * x, gint * y); |
2911 | 67 |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
68 static GtkWidgetClass *parent_class = NULL; |
2911 | 69 static guint textbox_signals[LAST_SIGNAL] = { 0 }; |
70 | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
71 GType ui_skinned_textbox_get_type() { |
2911 | 72 static GType textbox_type = 0; |
73 if (!textbox_type) { | |
74 static const GTypeInfo textbox_info = { | |
75 sizeof (UiSkinnedTextboxClass), | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
76 NULL, |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
77 NULL, |
2911 | 78 (GClassInitFunc) ui_skinned_textbox_class_init, |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
79 NULL, |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
80 NULL, |
2911 | 81 sizeof (UiSkinnedTextbox), |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
82 0, |
2911 | 83 (GInstanceInitFunc) ui_skinned_textbox_init, |
84 }; | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
85 textbox_type = g_type_register_static (GTK_TYPE_WIDGET, "UiSkinnedTextbox", &textbox_info, 0); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
86 } |
2911 | 87 |
88 return textbox_type; | |
89 } | |
90 | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
91 static void ui_skinned_textbox_class_init(UiSkinnedTextboxClass *klass) { |
2911 | 92 GtkObjectClass *object_class; |
93 GtkWidgetClass *widget_class; | |
94 | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
95 object_class = (GtkObjectClass*) klass; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
96 widget_class = (GtkWidgetClass*) klass; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
97 parent_class = gtk_type_class (gtk_widget_get_type ()); |
2911 | 98 |
99 object_class->destroy = ui_skinned_textbox_destroy; | |
100 | |
101 widget_class->realize = ui_skinned_textbox_realize; | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
102 widget_class->expose_event = ui_skinned_textbox_expose; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
103 widget_class->size_request = ui_skinned_textbox_size_request; |
2911 | 104 widget_class->size_allocate = ui_skinned_textbox_size_allocate; |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
105 widget_class->button_press_event = ui_skinned_textbox_button_press; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
106 widget_class->button_release_event = ui_skinned_textbox_button_release; |
2911 | 107 widget_class->motion_notify_event = ui_skinned_textbox_motion_notify; |
108 | |
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
|
109 klass->clicked = NULL; |
2911 | 110 klass->double_clicked = NULL; |
111 klass->right_clicked = NULL; | |
112 klass->doubled = ui_skinned_textbox_toggle_doublesize; | |
113 klass->redraw = ui_skinned_textbox_redraw; | |
114 | |
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
|
115 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
|
116 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
|
117 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
|
118 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
|
119 |
2911 | 120 textbox_signals[DOUBLE_CLICKED] = |
121 g_signal_new ("double-clicked", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, | |
122 G_STRUCT_OFFSET (UiSkinnedTextboxClass, double_clicked), NULL, NULL, | |
123 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); | |
124 | |
125 textbox_signals[RIGHT_CLICKED] = | |
126 g_signal_new ("right-clicked", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, | |
127 G_STRUCT_OFFSET (UiSkinnedTextboxClass, right_clicked), NULL, NULL, | |
128 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); | |
129 | |
130 textbox_signals[DOUBLED] = | |
131 g_signal_new ("toggle-double-size", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, | |
132 G_STRUCT_OFFSET (UiSkinnedTextboxClass, doubled), NULL, NULL, | |
133 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); | |
134 | |
135 textbox_signals[REDRAW] = | |
136 g_signal_new ("redraw", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, | |
137 G_STRUCT_OFFSET (UiSkinnedTextboxClass, redraw), NULL, NULL, | |
138 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); | |
139 } | |
140 | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
141 static void ui_skinned_textbox_init(UiSkinnedTextbox *textbox) { |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
142 mutex = g_mutex_new(); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
143 textbox->resize_width = 0; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
144 textbox->resize_height = 0; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
145 textbox->move_x = 0; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
146 textbox->move_y = 0; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
147 textbox->img = NULL; |
2911 | 148 } |
149 | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
150 GtkWidget* ui_skinned_textbox_new(GtkWidget *fixed, GdkPixmap * parent, GdkGC * gc, gint x, gint y, gint w, gboolean allow_scroll, SkinPixmapId si) { |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
151 UiSkinnedTextbox *textbox = g_object_new (ui_skinned_textbox_get_type (), NULL); |
2911 | 152 |
153 textbox->height = bmp_active_skin->properties.textbox_bitmap_font_height; | |
154 textbox->x = x; | |
155 textbox->y = y; | |
2957
c859aa1a1a4e
don't update text if it haven't changed
Tomasz Mon <desowin@gmail.com>
parents:
2956
diff
changeset
|
156 textbox->text = g_strdup(""); |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
157 textbox->gc = gc; |
2947 | 158 textbox->width = w; |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
159 textbox->scroll_allowed = allow_scroll; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
160 textbox->scroll_enabled = TRUE; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
161 textbox->skin_index = si; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
162 textbox->nominal_y = y; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
163 textbox->nominal_height = textbox->height; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
164 textbox->scroll_timeout = 0; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
165 textbox->scroll_dummy = 0; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
166 |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
167 textbox->fixed = fixed; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
168 textbox->double_size = FALSE; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
169 |
2982 | 170 gtk_fixed_put(GTK_FIXED(textbox->fixed), GTK_WIDGET(textbox), textbox->x, textbox->y); |
171 | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
172 return GTK_WIDGET(textbox); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
173 } |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
174 |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
175 static void ui_skinned_textbox_destroy(GtkObject *object) { |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
176 UiSkinnedTextbox *textbox; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
177 |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
178 g_return_if_fail (object != NULL); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
179 g_return_if_fail (UI_SKINNED_IS_TEXTBOX (object)); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
180 |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
181 textbox = UI_SKINNED_TEXTBOX (object); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
182 |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
183 if (GTK_OBJECT_CLASS (parent_class)->destroy) |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
184 (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
185 } |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
186 |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
187 static void ui_skinned_textbox_realize(GtkWidget *widget) { |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
188 UiSkinnedTextbox *textbox; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
189 GdkWindowAttr attributes; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
190 gint attributes_mask; |
2911 | 191 |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
192 g_return_if_fail (widget != NULL); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
193 g_return_if_fail (UI_SKINNED_IS_TEXTBOX(widget)); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
194 |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
195 GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
196 textbox = UI_SKINNED_TEXTBOX(widget); |
2911 | 197 |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
198 attributes.x = widget->allocation.x; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
199 attributes.y = widget->allocation.y; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
200 attributes.width = widget->allocation.width; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
201 attributes.height = widget->allocation.height; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
202 attributes.wclass = GDK_INPUT_OUTPUT; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
203 attributes.window_type = GDK_WINDOW_CHILD; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
204 attributes.event_mask = gtk_widget_get_events(widget); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
205 attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
206 GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
207 GDK_POINTER_MOTION_HINT_MASK; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
208 attributes.visual = gtk_widget_get_visual(widget); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
209 attributes.colormap = gtk_widget_get_colormap(widget); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
210 |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
211 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
212 widget->window = gdk_window_new(widget->parent->window, &attributes, attributes_mask); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
213 |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
214 widget->style = gtk_style_attach(widget->style, widget->window); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
215 |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
216 gdk_window_set_user_data(widget->window, widget); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
217 } |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
218 |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
219 static void ui_skinned_textbox_size_request(GtkWidget *widget, GtkRequisition *requisition) { |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
220 UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX(widget); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
221 requisition->width = UI_SKINNED_TEXTBOX(widget)->width*(1+textbox->double_size); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
222 requisition->height = UI_SKINNED_TEXTBOX(widget)->height*(1+textbox->double_size); |
2911 | 223 } |
224 | |
225 static void ui_skinned_textbox_size_allocate(GtkWidget *widget, GtkAllocation *allocation) { | |
2965
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2962
diff
changeset
|
226 g_mutex_lock(mutex); |
2911 | 227 UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX (widget); |
228 widget->allocation = *allocation; | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
229 if (GTK_WIDGET_REALIZED (widget)) |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
230 gdk_window_move_resize(widget->window, allocation->x, allocation->y, allocation->width, allocation->height); |
2911 | 231 |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
232 textbox->x = widget->allocation.x/(textbox->double_size ? 2 : 1); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
233 textbox->y = widget->allocation.y/(textbox->double_size ? 2 : 1); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
234 textbox->move_x = 0; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
235 textbox->move_y = 0; |
2919 | 236 |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
237 if (textbox->width != widget->allocation.width/(textbox->double_size ? 2 : 1)) { |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
238 textbox->width = widget->allocation.width/(textbox->double_size ? 2 : 1); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
239 textbox->resize_width = 0; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
240 textbox->resize_height = 0; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
241 if (textbox->pixmap_text) g_free(textbox->pixmap_text); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
242 textbox->pixmap_text = NULL; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
243 textbox->offset = 0; |
2965
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2962
diff
changeset
|
244 gtk_widget_queue_draw(GTK_WIDGET(textbox)); |
2919 | 245 } |
2965
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2962
diff
changeset
|
246 g_mutex_unlock(mutex); |
2911 | 247 } |
248 | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
249 static gboolean ui_skinned_textbox_expose(GtkWidget *widget, GdkEventExpose *event) { |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
250 g_return_val_if_fail (widget != NULL, FALSE); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
251 g_return_val_if_fail (UI_SKINNED_IS_TEXTBOX (widget), FALSE); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
252 g_return_val_if_fail (event != NULL, FALSE); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
253 |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
254 UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX (widget); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
255 if(textbox->redraw) { |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
256 textbox->redraw = FALSE; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
257 GdkPixmap *obj = NULL; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
258 gint cw; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
259 |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
260 if (textbox->text && (!textbox->pixmap_text || strcmp(textbox->text, textbox->pixmap_text))) |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
261 textbox_generate_pixmap(textbox); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
262 |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
263 if (textbox->pixmap) { |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
264 if (skin_get_id() != textbox->skin_id) { |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
265 textbox->skin_id = skin_get_id(); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
266 textbox_generate_pixmap(textbox); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
267 } |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
268 obj = gdk_pixmap_new(NULL, textbox->width, textbox->height, gdk_rgb_get_visual()->depth); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
269 |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
270 if(cfg.twoway_scroll) { // twoway scroll |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
271 cw = textbox->pixmap_width - textbox->offset; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
272 if (cw > textbox->width) |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
273 cw = textbox->width; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
274 gdk_draw_drawable(obj, textbox->gc, textbox->pixmap, textbox->offset, 0, 0, 0, cw, textbox->height); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
275 if (cw < textbox->width) |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
276 gdk_draw_drawable(obj, textbox->gc, textbox->pixmap, 0, 0, |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
277 textbox->x + cw, textbox->y, |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
278 textbox->width - cw, textbox->height); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
279 } |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
280 else { // oneway scroll |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
281 int cw1, cw2; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
282 |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
283 if(textbox->offset >= textbox->pixmap_width) |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
284 textbox->offset = 0; |
2911 | 285 |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
286 if(textbox->pixmap_width - textbox->offset > textbox->width){ // case1 |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
287 cw1 = textbox->width; |
2983
048fa5c2b1db
paint on obj instead on textbox->img while in oneway scroll mode
Tomasz Mon <desowin@gmail.com>
parents:
2982
diff
changeset
|
288 gdk_draw_drawable(obj, textbox->gc, textbox->pixmap, textbox->offset, 0, |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
289 0, 0, cw1, textbox->height); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
290 } |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
291 else { // case 2 |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
292 cw1 = textbox->pixmap_width - textbox->offset; |
2983
048fa5c2b1db
paint on obj instead on textbox->img while in oneway scroll mode
Tomasz Mon <desowin@gmail.com>
parents:
2982
diff
changeset
|
293 gdk_draw_drawable(obj, textbox->gc, textbox->pixmap, textbox->offset, 0, |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
294 0, 0, cw1, textbox->height); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
295 cw2 = textbox->width - cw1; |
2983
048fa5c2b1db
paint on obj instead on textbox->img while in oneway scroll mode
Tomasz Mon <desowin@gmail.com>
parents:
2982
diff
changeset
|
296 gdk_draw_drawable(obj, textbox->gc, textbox->pixmap, 0, 0, cw1, 0, cw2, textbox->height); |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
297 } |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
298 |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
299 } |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
300 if (textbox->img) |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
301 g_object_unref(textbox->img); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
302 textbox->img = gdk_pixmap_new(NULL, textbox->width*(1+textbox->double_size), |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
303 textbox->height*(1+textbox->double_size), |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
304 gdk_rgb_get_visual()->depth); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
305 |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
306 if (textbox->double_size) { |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
307 GdkImage *img, *img2x; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
308 img = gdk_drawable_get_image(obj, 0, 0, textbox->width, textbox->height); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
309 img2x = create_dblsize_image(img); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
310 gdk_draw_image (textbox->img, textbox->gc, img2x, 0, 0, 0, 0, textbox->width*2, textbox->height*2); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
311 g_object_unref(img2x); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
312 g_object_unref(img); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
313 } else |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
314 gdk_draw_drawable (textbox->img, textbox->gc, obj, 0, 0, 0, 0, textbox->width, textbox->height); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
315 g_object_unref(obj); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
316 gtk_widget_queue_resize(widget); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
317 } |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
318 } |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
319 |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
320 gdk_draw_drawable (widget->window, textbox->gc, textbox->img, 0, 0, 0, 0, |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
321 textbox->width*(1+textbox->double_size), textbox->height*(1+textbox->double_size)); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
322 return FALSE; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
323 } |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
324 |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
325 static gboolean ui_skinned_textbox_button_press(GtkWidget *widget, GdkEventButton *event) { |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
326 g_return_val_if_fail (widget != NULL, FALSE); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
327 g_return_val_if_fail (UI_SKINNED_IS_TEXTBOX (widget), FALSE); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
328 g_return_val_if_fail (event != NULL, FALSE); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
329 |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
330 UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX (widget); |
2911 | 331 if (event->type == GDK_BUTTON_PRESS) { |
332 textbox = UI_SKINNED_TEXTBOX(widget); | |
333 if (event->button == 1) { | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
334 if (textbox->scroll_allowed) { |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
335 if ((textbox->pixmap_width > textbox->width) && textbox->is_scrollable) { |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
336 textbox->is_dragging = TRUE; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
337 textbox->drag_off = textbox->offset; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
338 textbox->drag_x = event->x; |
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
|
339 } |
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
|
340 } 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
|
341 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
|
342 |
2911 | 343 } else if (event->button == 3) { |
344 g_signal_emit(widget, textbox_signals[RIGHT_CLICKED], 0); | |
345 } | |
346 } else if (event->type == GDK_2BUTTON_PRESS) { | |
347 if (event->button == 1) { | |
348 g_signal_emit(widget, textbox_signals[DOUBLE_CLICKED], 0); | |
349 } | |
350 } | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
351 |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
352 return FALSE; |
2911 | 353 } |
354 | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
355 static gboolean ui_skinned_textbox_button_release(GtkWidget *widget, GdkEventButton *event) { |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
356 UiSkinnedTextbox *textbox; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
357 |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
358 textbox = UI_SKINNED_TEXTBOX (widget); |
2911 | 359 if (event->button == 1) { |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
360 textbox->is_dragging = FALSE; |
2911 | 361 } |
362 | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
363 return FALSE; |
2911 | 364 } |
365 | |
366 static gboolean ui_skinned_textbox_motion_notify(GtkWidget *widget, GdkEventMotion *event) { | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
367 g_return_val_if_fail (widget != NULL, FALSE); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
368 g_return_val_if_fail (UI_SKINNED_IS_TEXTBOX (widget), FALSE); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
369 g_return_val_if_fail (event != NULL, FALSE); |
2911 | 370 |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
371 UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX (widget); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
372 if (textbox->is_dragging) { |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
373 if (textbox->scroll_allowed && |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
374 textbox->pixmap_width > textbox->width) { |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
375 textbox->offset = textbox->drag_off - (event->x - textbox->drag_x); |
2911 | 376 |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
377 while (textbox->offset < 0) |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
378 textbox->offset = 0; |
2911 | 379 |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
380 while (textbox->offset > (textbox->pixmap_width - textbox->width)) |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
381 textbox->offset = (textbox->pixmap_width - textbox->width); |
2911 | 382 |
2965
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2962
diff
changeset
|
383 textbox->redraw = TRUE; |
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2962
diff
changeset
|
384 gtk_widget_queue_draw(widget); |
2911 | 385 } |
386 } | |
387 | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
388 return FALSE; |
2911 | 389 } |
390 | |
391 static void ui_skinned_textbox_toggle_doublesize(UiSkinnedTextbox *textbox) { | |
392 GtkWidget *widget = GTK_WIDGET (textbox); | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
393 textbox->double_size = !textbox->double_size; |
2911 | 394 |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
395 gtk_widget_set_size_request(widget, textbox->width*(1+textbox->double_size), textbox->height*(1+textbox->double_size)); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
396 gtk_widget_set_uposition(widget, textbox->x*(1+textbox->double_size), textbox->y*(1+textbox->double_size)); |
2911 | 397 |
398 textbox->redraw = TRUE; | |
2962
ba45ef731cf1
don't call ui_skinned_textbox_paint() directly, use gtk_widget_queue_draw() instead; fix ui_skinned_textbox_expose()
Tomasz Mon <desowin@gmail.com>
parents:
2961
diff
changeset
|
399 gtk_widget_queue_draw(GTK_WIDGET(textbox)); |
2911 | 400 } |
401 | |
402 static void ui_skinned_textbox_redraw(UiSkinnedTextbox *textbox) { | |
2965
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2962
diff
changeset
|
403 g_mutex_lock(mutex); |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
404 if (textbox->resize_width || textbox->resize_height) |
2965
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2962
diff
changeset
|
405 gtk_widget_set_size_request(GTK_WIDGET(textbox), |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
406 (textbox->width+textbox->resize_width)*(1+textbox->double_size), |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
407 (textbox->height+textbox->resize_height)*(1+textbox->double_size)); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
408 if (textbox->move_x || textbox->move_y) |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
409 gtk_fixed_move(GTK_FIXED(textbox->fixed), GTK_WIDGET(textbox), textbox->x+textbox->move_x, textbox->y+textbox->move_y); |
2965
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2962
diff
changeset
|
410 |
2911 | 411 textbox->redraw = TRUE; |
2962
ba45ef731cf1
don't call ui_skinned_textbox_paint() directly, use gtk_widget_queue_draw() instead; fix ui_skinned_textbox_expose()
Tomasz Mon <desowin@gmail.com>
parents:
2961
diff
changeset
|
412 gtk_widget_queue_draw(GTK_WIDGET(textbox)); |
2965
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2962
diff
changeset
|
413 g_mutex_unlock(mutex); |
2911 | 414 } |
415 | |
416 static gboolean ui_skinned_textbox_should_scroll(UiSkinnedTextbox *textbox) { | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
417 if (!textbox->scroll_allowed) |
2911 | 418 return FALSE; |
419 | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
420 if (textbox->font) { |
2911 | 421 gint width; |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
422 text_get_extents(textbox->fontname, textbox->text, &width, NULL, NULL, NULL); |
2911 | 423 |
2947 | 424 if (width <= textbox->width) |
2911 | 425 return FALSE; |
426 else | |
427 return TRUE; | |
428 } | |
429 | |
2947 | 430 if (g_utf8_strlen(textbox->text, -1) * bmp_active_skin->properties.textbox_bitmap_font_width > textbox->width) |
2911 | 431 return TRUE; |
432 | |
433 return FALSE; | |
434 } | |
435 | |
436 void ui_skinned_textbox_set_xfont(GtkWidget *widget, gboolean use_xfont, const gchar * fontname) { | |
437 UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX (widget); | |
438 gint ascent, descent; | |
439 | |
440 g_return_if_fail(textbox != NULL); | |
441 | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
442 if (textbox->font) { |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
443 pango_font_description_free(textbox->font); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
444 textbox->font = NULL; |
2911 | 445 } |
446 | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
447 textbox->y = textbox->nominal_y; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
448 textbox->height = textbox->nominal_height; |
2911 | 449 |
450 /* Make sure the pixmap is regenerated */ | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
451 if (textbox->pixmap_text) { |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
452 g_free(textbox->pixmap_text); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
453 textbox->pixmap_text = NULL; |
2911 | 454 } |
455 | |
456 if (!use_xfont || strlen(fontname) == 0) | |
457 return; | |
458 | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
459 textbox->font = pango_font_description_from_string(fontname); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
460 textbox->fontname = g_strdup(fontname); |
2911 | 461 |
462 text_get_extents(fontname, | |
463 "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz ", | |
464 NULL, NULL, &ascent, &descent); | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
465 textbox->font_ascent = ascent; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
466 textbox->font_descent = descent; |
2911 | 467 |
468 | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
469 if (textbox->font == NULL) |
2911 | 470 return; |
471 | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
472 textbox->height = textbox->font_ascent; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
473 if (textbox->height > textbox->nominal_height) |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
474 textbox->y -= (textbox->height - textbox->nominal_height) / 2; |
2911 | 475 else |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
476 textbox->height = textbox->nominal_height; |
2911 | 477 } |
478 | |
479 void ui_skinned_textbox_set_text(GtkWidget *widget, const gchar *text) { | |
480 g_return_if_fail(text != NULL); | |
481 UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX (widget); | |
482 | |
2957
c859aa1a1a4e
don't update text if it haven't changed
Tomasz Mon <desowin@gmail.com>
parents:
2956
diff
changeset
|
483 if (!strcmp(textbox->text, text)) |
c859aa1a1a4e
don't update text if it haven't changed
Tomasz Mon <desowin@gmail.com>
parents:
2956
diff
changeset
|
484 return; |
2951
4586c0951eab
Handle multibyte sequences properly when encountered.
William Pitcock <nenolod@atheme-project.org>
parents:
2949
diff
changeset
|
485 if (textbox->text) |
2911 | 486 g_free(textbox->text); |
487 | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
488 textbox->redraw = TRUE; |
2952
cb15e12b6352
Preserve capitalization for xfont users.
William Pitcock <nenolod@atheme-project.org>
parents:
2951
diff
changeset
|
489 textbox->text = str_to_utf8(text); |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
490 textbox->scroll_back = FALSE; |
2981
3bd337a93c9d
oops, those shouldn't be commented
Tomasz Mon <desowin@gmail.com>
parents:
2980
diff
changeset
|
491 gtk_widget_queue_draw(GTK_WIDGET(textbox)); |
2911 | 492 } |
493 | |
494 static void textbox_generate_xfont_pixmap(UiSkinnedTextbox *textbox, const gchar *pixmaptext) { | |
495 gint length, i; | |
496 GdkGC *gc, *maskgc; | |
497 GdkColor *c, pattern; | |
498 GdkBitmap *mask; | |
499 PangoLayout *layout; | |
500 gint width; | |
501 | |
502 g_return_if_fail(textbox != NULL); | |
503 g_return_if_fail(pixmaptext != NULL); | |
504 | |
505 length = g_utf8_strlen(pixmaptext, -1); | |
506 | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
507 text_get_extents(textbox->fontname, pixmaptext, &width, NULL, NULL, NULL); |
2911 | 508 |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
509 textbox->pixmap_width = MAX(width, textbox->width); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
510 textbox->pixmap = gdk_pixmap_new(mainwin->window, textbox->pixmap_width, |
2911 | 511 textbox->height, |
512 gdk_rgb_get_visual()->depth); | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
513 gc = textbox->gc; |
2911 | 514 c = skin_get_color(bmp_active_skin, SKIN_TEXTBG); |
515 for (i = 0; i < textbox->height; i++) { | |
516 gdk_gc_set_foreground(gc, &c[6 * i / textbox->height]); | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
517 gdk_draw_line(textbox->pixmap, gc, 0, i, textbox->pixmap_width, i); |
2911 | 518 } |
519 | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
520 mask = gdk_pixmap_new(mainwin->window, textbox->pixmap_width, textbox->height, 1); |
2911 | 521 maskgc = gdk_gc_new(mask); |
522 pattern.pixel = 0; | |
523 gdk_gc_set_foreground(maskgc, &pattern); | |
524 | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
525 gdk_draw_rectangle(mask, maskgc, TRUE, 0, 0, textbox->pixmap_width, textbox->height); |
2911 | 526 pattern.pixel = 1; |
527 gdk_gc_set_foreground(maskgc, &pattern); | |
528 | |
529 gdk_gc_set_foreground(gc, skin_get_color(bmp_active_skin, SKIN_TEXTFG)); | |
530 | |
531 layout = gtk_widget_create_pango_layout(mainwin, pixmaptext); | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
532 pango_layout_set_font_description(layout, textbox->font); |
2911 | 533 |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
534 gdk_draw_layout(textbox->pixmap, gc, 0, (textbox->font_descent / 2), layout); |
2911 | 535 g_object_unref(layout); |
536 | |
537 g_object_unref(maskgc); | |
538 | |
539 gdk_gc_set_clip_mask(gc, mask); | |
540 c = skin_get_color(bmp_active_skin, SKIN_TEXTFG); | |
541 for (i = 0; i < textbox->height; i++) { | |
542 gdk_gc_set_foreground(gc, &c[6 * i / textbox->height]); | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
543 gdk_draw_line(textbox->pixmap, gc, 0, i, textbox->pixmap_width, i); |
2911 | 544 } |
545 g_object_unref(mask); | |
546 gdk_gc_set_clip_mask(gc, NULL); | |
547 } | |
548 | |
549 static gboolean textbox_scroll(gpointer data) { | |
550 UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX(data); | |
551 | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
552 if (!textbox->is_dragging) { |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
553 if (textbox->scroll_dummy < TEXTBOX_SCROLL_WAIT) |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
554 textbox->scroll_dummy++; |
2948
830fdbec31be
introduce scroll_dummy to stop scrolling when it reaches end
Tomasz Mon <desowin@gmail.com>
parents:
2947
diff
changeset
|
555 else { |
2968
83f03505f819
add support for one-way text scroll.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2967
diff
changeset
|
556 if(cfg.twoway_scroll) { |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
557 if (textbox->scroll_back) |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
558 textbox->offset -= 1; |
2968
83f03505f819
add support for one-way text scroll.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2967
diff
changeset
|
559 else |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
560 textbox->offset += 1; |
2911 | 561 |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
562 if (textbox->offset >= (textbox->pixmap_width - textbox->width)) { |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
563 textbox->scroll_back = TRUE; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
564 textbox->scroll_dummy = 0; |
2968
83f03505f819
add support for one-way text scroll.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2967
diff
changeset
|
565 } |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
566 if (textbox->offset <= 0) { |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
567 textbox->scroll_back = FALSE; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
568 textbox->scroll_dummy = 0; |
2968
83f03505f819
add support for one-way text scroll.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2967
diff
changeset
|
569 } |
2948
830fdbec31be
introduce scroll_dummy to stop scrolling when it reaches end
Tomasz Mon <desowin@gmail.com>
parents:
2947
diff
changeset
|
570 } |
2968
83f03505f819
add support for one-way text scroll.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2967
diff
changeset
|
571 else { // oneway scroll |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
572 textbox->scroll_back = FALSE; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
573 textbox->offset += 1; |
2948
830fdbec31be
introduce scroll_dummy to stop scrolling when it reaches end
Tomasz Mon <desowin@gmail.com>
parents:
2947
diff
changeset
|
574 } |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
575 textbox->redraw=TRUE; |
2965
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2962
diff
changeset
|
576 gtk_widget_queue_draw(GTK_WIDGET(textbox)); |
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
|
577 } |
2911 | 578 } |
579 return TRUE; | |
580 } | |
581 | |
582 static void textbox_generate_pixmap(UiSkinnedTextbox *textbox) { | |
583 gint length, i, x, y, wl; | |
584 gchar *pixmaptext; | |
2953
80b6fc3f4d29
Fix invalid free.
William Pitcock <nenolod@atheme-project.org>
parents:
2952
diff
changeset
|
585 gchar *tmp, *stxt; |
2911 | 586 GdkGC *gc; |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
587 |
2911 | 588 g_return_if_fail(textbox != NULL); |
589 | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
590 if (textbox->pixmap) { |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
591 g_object_unref(textbox->pixmap); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
592 textbox->pixmap = NULL; |
2911 | 593 } |
594 | |
595 /* | |
596 * Don't reset the offset if only text after the last '(' has | |
597 * changed. This is a hack to avoid visual noice on vbr files | |
598 * where we guess the length. | |
599 */ | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
600 if (!(textbox->pixmap_text && strrchr(textbox->text, '(') && |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
601 !strncmp(textbox->pixmap_text, textbox->text, |
2911 | 602 strrchr(textbox->text, '(') - textbox->text))) |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
603 textbox->offset = 0; |
2911 | 604 |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
605 g_free(textbox->pixmap_text); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
606 textbox->pixmap_text = g_strdup(textbox->text); |
2911 | 607 |
608 /* | |
609 * wl is the number of (partial) letters visible. Only makes | |
610 * sense when using skinned font. | |
611 */ | |
2947 | 612 wl = textbox->width / 5; |
613 if (wl * 5 != textbox->width) | |
2911 | 614 wl++; |
615 | |
616 length = g_utf8_strlen(textbox->text, -1); | |
617 | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
618 textbox->is_scrollable = FALSE; |
2911 | 619 |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
620 textbox->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
|
621 |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
622 if (textbox->is_scrollable) { |
2971 | 623 if(!cfg.twoway_scroll) { |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
624 pixmaptext = g_strdup_printf("%s *** ", textbox->pixmap_text); |
2971 | 625 length += 5; |
626 } else | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
627 pixmaptext = g_strdup(textbox->pixmap_text); |
2971 | 628 } else |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
629 if (!textbox->font && length <= wl) { |
2916
3ef909ed3056
fix clearing textbox when short text is displayed
Tomasz Mon <desowin@gmail.com>
parents:
2913
diff
changeset
|
630 gint pad = wl - length; |
3ef909ed3056
fix clearing textbox when short text is displayed
Tomasz Mon <desowin@gmail.com>
parents:
2913
diff
changeset
|
631 gchar *padchars = g_strnfill(pad, ' '); |
3ef909ed3056
fix clearing textbox when short text is displayed
Tomasz Mon <desowin@gmail.com>
parents:
2913
diff
changeset
|
632 |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
633 pixmaptext = g_strconcat(textbox->pixmap_text, padchars, NULL); |
2916
3ef909ed3056
fix clearing textbox when short text is displayed
Tomasz Mon <desowin@gmail.com>
parents:
2913
diff
changeset
|
634 g_free(padchars); |
3ef909ed3056
fix clearing textbox when short text is displayed
Tomasz Mon <desowin@gmail.com>
parents:
2913
diff
changeset
|
635 length += pad; |
2971 | 636 } else |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
637 pixmaptext = g_strdup(textbox->pixmap_text); |
2911 | 638 |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
639 if (textbox->is_scrollable) { |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
640 if (textbox->scroll_enabled && !textbox->scroll_timeout) { |
2911 | 641 gint tag; |
642 tag = TEXTBOX_SCROLL_SMOOTH_TIMEOUT; | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
643 textbox->scroll_timeout = g_timeout_add(tag, textbox_scroll, textbox); |
2911 | 644 } |
645 } else { | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
646 if (textbox->scroll_timeout) { |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
647 g_source_remove(textbox->scroll_timeout); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
648 textbox->scroll_timeout = 0; |
2911 | 649 } |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
650 textbox->offset = 0; |
2911 | 651 } |
652 | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
653 if (textbox->font) { |
2911 | 654 textbox_generate_xfont_pixmap(textbox, pixmaptext); |
655 g_free(pixmaptext); | |
656 return; | |
657 } | |
658 | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
659 textbox->pixmap_width = length * bmp_active_skin->properties.textbox_bitmap_font_width; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
660 textbox->pixmap = gdk_pixmap_new(NULL, |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
661 textbox->pixmap_width, bmp_active_skin->properties.textbox_bitmap_font_height, |
2911 | 662 gdk_rgb_get_visual()->depth); |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
663 gc = textbox->gc; |
2911 | 664 |
2953
80b6fc3f4d29
Fix invalid free.
William Pitcock <nenolod@atheme-project.org>
parents:
2952
diff
changeset
|
665 for (tmp = stxt = g_utf8_strup(pixmaptext, -1), i = 0; |
2952
cb15e12b6352
Preserve capitalization for xfont users.
William Pitcock <nenolod@atheme-project.org>
parents:
2951
diff
changeset
|
666 tmp != NULL && i < length; i++, tmp = g_utf8_next_char(tmp)) { |
2951
4586c0951eab
Handle multibyte sequences properly when encountered.
William Pitcock <nenolod@atheme-project.org>
parents:
2949
diff
changeset
|
667 gchar c = *tmp; |
2911 | 668 x = y = -1; |
669 if (c >= 'A' && c <= 'Z') { | |
670 x = bmp_active_skin->properties.textbox_bitmap_font_width * (c - 'A'); | |
671 y = 0; | |
672 } | |
673 else if (c >= '0' && c <= '9') { | |
674 x = bmp_active_skin->properties.textbox_bitmap_font_width * (c - '0'); | |
675 y = bmp_active_skin->properties.textbox_bitmap_font_height; | |
676 } | |
677 else | |
678 textbox_handle_special_char(c, &x, &y); | |
679 | |
680 skin_draw_pixmap(bmp_active_skin, | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
681 textbox->pixmap, gc, textbox->skin_index, |
2911 | 682 x, y, i * bmp_active_skin->properties.textbox_bitmap_font_width, 0, |
683 bmp_active_skin->properties.textbox_bitmap_font_width, | |
684 bmp_active_skin->properties.textbox_bitmap_font_height); | |
685 } | |
2953
80b6fc3f4d29
Fix invalid free.
William Pitcock <nenolod@atheme-project.org>
parents:
2952
diff
changeset
|
686 g_free(stxt); |
2911 | 687 g_free(pixmaptext); |
688 } | |
689 | |
690 void ui_skinned_textbox_set_scroll(GtkWidget *widget, gboolean scroll) { | |
691 g_return_if_fail(widget != NULL); | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
692 UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX(widget); |
2911 | 693 |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
694 textbox->scroll_enabled = scroll; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
695 if (textbox->scroll_enabled && textbox->is_scrollable && textbox->scroll_allowed) { |
2911 | 696 gint tag; |
697 tag = TEXTBOX_SCROLL_SMOOTH_TIMEOUT; | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
698 if (textbox->scroll_timeout) { |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
699 g_source_remove(textbox->scroll_timeout); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
700 textbox->scroll_timeout = 0; |
2911 | 701 } |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
702 textbox->scroll_timeout = g_timeout_add(tag, textbox_scroll, textbox); |
2911 | 703 |
704 } else { | |
705 | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
706 if (textbox->scroll_timeout) { |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
707 g_source_remove(textbox->scroll_timeout); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
708 textbox->scroll_timeout = 0; |
2911 | 709 } |
710 | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
711 textbox->offset = 0; |
2981
3bd337a93c9d
oops, those shouldn't be commented
Tomasz Mon <desowin@gmail.com>
parents:
2980
diff
changeset
|
712 gtk_widget_queue_draw(GTK_WIDGET(textbox)); |
2911 | 713 } |
714 } | |
715 | |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
716 static void textbox_handle_special_char(gchar c, gint * x, gint * y) { |
2911 | 717 gint tx, ty; |
718 | |
719 switch (c) { | |
720 case '"': | |
721 tx = 26; | |
722 ty = 0; | |
723 break; | |
724 case '\r': | |
725 tx = 10; | |
726 ty = 1; | |
727 break; | |
728 case ':': | |
729 case ';': | |
730 tx = 12; | |
731 ty = 1; | |
732 break; | |
733 case '(': | |
734 tx = 13; | |
735 ty = 1; | |
736 break; | |
737 case ')': | |
738 tx = 14; | |
739 ty = 1; | |
740 break; | |
741 case '-': | |
742 tx = 15; | |
743 ty = 1; | |
744 break; | |
745 case '`': | |
746 case '\'': | |
747 tx = 16; | |
748 ty = 1; | |
749 break; | |
750 case '!': | |
751 tx = 17; | |
752 ty = 1; | |
753 break; | |
754 case '_': | |
755 tx = 18; | |
756 ty = 1; | |
757 break; | |
758 case '+': | |
759 tx = 19; | |
760 ty = 1; | |
761 break; | |
762 case '\\': | |
763 tx = 20; | |
764 ty = 1; | |
765 break; | |
766 case '/': | |
767 tx = 21; | |
768 ty = 1; | |
769 break; | |
770 case '[': | |
771 tx = 22; | |
772 ty = 1; | |
773 break; | |
774 case ']': | |
775 tx = 23; | |
776 ty = 1; | |
777 break; | |
778 case '^': | |
779 tx = 24; | |
780 ty = 1; | |
781 break; | |
782 case '&': | |
783 tx = 25; | |
784 ty = 1; | |
785 break; | |
786 case '%': | |
787 tx = 26; | |
788 ty = 1; | |
789 break; | |
790 case '.': | |
791 case ',': | |
792 tx = 27; | |
793 ty = 1; | |
794 break; | |
795 case '=': | |
796 tx = 28; | |
797 ty = 1; | |
798 break; | |
799 case '$': | |
800 tx = 29; | |
801 ty = 1; | |
802 break; | |
803 case '#': | |
804 tx = 30; | |
805 ty = 1; | |
806 break; | |
807 case '?': | |
808 tx = 3; | |
809 ty = 2; | |
810 break; | |
811 case '*': | |
812 tx = 4; | |
813 ty = 2; | |
814 break; | |
815 default: | |
816 tx = 29; | |
817 ty = 0; | |
818 break; | |
819 } | |
820 | |
821 *x = tx * bmp_active_skin->properties.textbox_bitmap_font_width; | |
822 *y = ty * bmp_active_skin->properties.textbox_bitmap_font_height; | |
823 } | |
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
|
824 |
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
|
825 void ui_skinned_textbox_move_relative(GtkWidget *widget, gint x, gint y) { |
2965
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2962
diff
changeset
|
826 g_mutex_lock(mutex); |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
827 UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX(widget); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
828 textbox->move_x += x; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
829 textbox->move_y += y; |
2965
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2962
diff
changeset
|
830 g_mutex_unlock(mutex); |
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
|
831 } |
2945
09c216d437b2
Backed out changeset 3c66c8d03c534692d1606ed3ed79634e227f7bd2
William Pitcock <nenolod@atheme.org>
parents:
2944
diff
changeset
|
832 |
09c216d437b2
Backed out changeset 3c66c8d03c534692d1606ed3ed79634e227f7bd2
William Pitcock <nenolod@atheme.org>
parents:
2944
diff
changeset
|
833 void ui_skinned_textbox_resize_relative(GtkWidget *widget, gint w, gint h) { |
2965
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2962
diff
changeset
|
834 g_mutex_lock(mutex); |
2980
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
835 UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX(widget); |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
836 textbox->resize_width += w; |
d58560be5a4c
draw directly instead using embeded GtkImage
Tomasz Mon <desowin@gmail.com>
parents:
2971
diff
changeset
|
837 textbox->resize_height += h; |
2965
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2962
diff
changeset
|
838 g_mutex_unlock(mutex); |
2945
09c216d437b2
Backed out changeset 3c66c8d03c534692d1606ed3ed79634e227f7bd2
William Pitcock <nenolod@atheme.org>
parents:
2944
diff
changeset
|
839 } |