Mercurial > audlegacy
annotate audacious/playlist_list.c @ 1158:c01fe6970660 trunk
[svn] - remove an old hack that is no longer necessary (can cause a crash (!))
author | nenolod |
---|---|
date | Thu, 08 Jun 2006 12:11:06 -0700 |
parents | 968a9449f270 |
children | 5767c05ce900 |
rev | line source |
---|---|
1048
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
1 /* Audacious - Cross-platform multimedia player |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
2 * Copyright (C) 2005-2006 Audacious development team. |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
3 * |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
4 * BMP - Cross-platform multimedia player |
0 | 5 * Copyright (C) 2003-2004 BMP development team. |
6 * | |
7 * Based on XMMS: | |
8 * Copyright (C) 1998-2003 XMMS development team. | |
9 * | |
10 * This program is free software; you can redistribute it and/or modify | |
11 * it under the terms of the GNU General Public License as published by | |
12 * the Free Software Foundation; either version 2 of the License, or | |
13 * (at your option) any later version. | |
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
23 */ | |
24 | |
25 /* | |
26 * A note about Pango and some funky spacey fonts: Weirdly baselined | |
27 * fonts, or fonts with weird ascents or descents _will_ display a | |
28 * little bit weird in the playlist widget, but the display engine | |
29 * won't make it look too bad, just a little deranged. I honestly | |
30 * don't think it's worth fixing (around...), it doesn't have to be | |
31 * perfectly fitting, just the general look has to be ok, which it | |
32 * IMHO is. | |
33 * | |
34 * A second note: The numbers aren't perfectly aligned, but in the | |
35 * end it looks better when using a single Pango layout for each | |
36 * number. | |
37 */ | |
38 | |
39 #include "playlist_list.h" | |
40 | |
41 #include <stdlib.h> | |
42 #include <string.h> | |
43 | |
44 #include "main.h" | |
45 #include "input.h" | |
538
e4e897d20791
[svn] remove libaudcore, we never did anything with it
nenolod
parents:
512
diff
changeset
|
46 #include "playback.h" |
0 | 47 #include "playlist.h" |
383 | 48 #include "ui_playlist.h" |
0 | 49 #include "util.h" |
50 | |
51 #include "debug.h" | |
52 | |
53 static PangoFontDescription *playlist_list_font = NULL; | |
54 static gint ascent, descent, width_delta_digit_one; | |
55 static gboolean has_slant; | |
56 static guint padding; | |
57 | |
58 /* FIXME: the following globals should not be needed. */ | |
59 static gint width_approx_letters; | |
60 static gint width_colon, width_colon_third; | |
61 static gint width_approx_digits, width_approx_digits_half; | |
62 | |
1048
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
63 GdkPixmap *rootpix; |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
64 |
1079
d94ba9133f94
[svn] - update transparency pixmap if root window pixmap changes
nenolod
parents:
1078
diff
changeset
|
65 void playlist_list_draw(Widget * w); |
d94ba9133f94
[svn] - update transparency pixmap if root window pixmap changes
nenolod
parents:
1078
diff
changeset
|
66 |
1048
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
67 /* Sort of stolen from XChat, but not really, as theres uses Xlib */ |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
68 static void |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
69 shade_gdkimage_generic (GdkVisual *visual, GdkImage *ximg, int bpl, int w, int h, int rm, int gm, int bm, int bg) |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
70 { |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
71 int x, y; |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
72 int bgr = (256 - rm) * (bg & visual->red_mask); |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
73 int bgg = (256 - gm) * (bg & visual->green_mask); |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
74 int bgb = (256 - bm) * (bg & visual->blue_mask); |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
75 |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
76 for (x = 0; x < w; x++) |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
77 { |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
78 for (y = 0; y < h; y++) |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
79 { |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
80 unsigned long pixel = gdk_image_get_pixel (ximg, x, y); |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
81 int r, g, b; |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
82 |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
83 r = rm * (pixel & visual->red_mask) + bgr; |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
84 g = gm * (pixel & visual->green_mask) + bgg; |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
85 b = bm * (pixel & visual->blue_mask) + bgb; |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
86 |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
87 gdk_image_put_pixel (ximg, x, y, |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
88 ((r >> 8) & visual->red_mask) | |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
89 ((g >> 8) & visual->green_mask) | |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
90 ((b >> 8) & visual->blue_mask)); |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
91 } |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
92 } |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
93 } |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
94 |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
95 /* and this is definately mine... -nenolod */ |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
96 GdkPixmap * |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
97 shade_pixmap(GdkPixmap *in, gint x, gint y, gint x_offset, gint y_offset, gint w, gint h, GdkColor *shade_color) |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
98 { |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
99 GdkImage *ximg; |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
100 GdkPixmap *p = gdk_pixmap_new(in, w, h, -1); |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
101 GdkGC *gc = gdk_gc_new(p); |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
102 |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
103 gdk_draw_pixmap(p, gc, in, x, y, 0, 0, w, h); |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
104 |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
105 ximg = gdk_drawable_copy_to_image(in, NULL, x, y, 0, 0, w, h); /* copy */ |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
106 |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
107 shade_gdkimage_generic(gdk_drawable_get_visual(GDK_WINDOW(playlistwin->window)), |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
108 ximg, ximg->bpl, w, h, 60, 60, 60, shade_color->pixel); |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
109 |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
110 gdk_draw_image(p, gc, ximg, 0, 0, x, y, w, h); |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
111 |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
112 g_object_unref(gc); |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
113 |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
114 return p; |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
115 } |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
116 |
1047
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
117 #ifdef GDK_WINDOWING_X11 |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
118 |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
119 #include <gdk/gdkx.h> |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
120 #include <X11/Xlib.h> |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
121 #include <X11/Xatom.h> |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
122 |
1050 | 123 GdkPixmap *get_transparency_pixmap(void) |
1047
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
124 { |
1078 | 125 Atom type; |
126 static Atom prop = None; | |
1047
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
127 int format; |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
128 unsigned long length, after; |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
129 unsigned char *data; |
1078 | 130 GdkPixmap *retval = NULL; |
1047
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
131 |
1078 | 132 if(prop == None) |
133 prop = XInternAtom(GDK_DISPLAY(), "_XROOTPMAP_ID", True); | |
1047
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
134 if(prop == None) |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
135 return NULL; |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
136 |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
137 XGetWindowProperty(GDK_DISPLAY(), GDK_ROOT_WINDOW(), prop, 0L, 1L, False, AnyPropertyType, &type, &format, &length, &after, &data); |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
138 |
1078 | 139 if (data) |
140 { | |
141 if(type == XA_PIXMAP) | |
142 retval = gdk_pixmap_foreign_new(*((Pixmap *)data)); | |
143 | |
144 XFree(data); | |
145 } | |
1047
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
146 |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
147 return retval; |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
148 } |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
149 |
1079
d94ba9133f94
[svn] - update transparency pixmap if root window pixmap changes
nenolod
parents:
1078
diff
changeset
|
150 static GdkFilterReturn |
d94ba9133f94
[svn] - update transparency pixmap if root window pixmap changes
nenolod
parents:
1078
diff
changeset
|
151 root_event_cb (GdkXEvent *xev, GdkEventProperty *event, gpointer data) |
d94ba9133f94
[svn] - update transparency pixmap if root window pixmap changes
nenolod
parents:
1078
diff
changeset
|
152 { |
d94ba9133f94
[svn] - update transparency pixmap if root window pixmap changes
nenolod
parents:
1078
diff
changeset
|
153 static Atom at = None; |
d94ba9133f94
[svn] - update transparency pixmap if root window pixmap changes
nenolod
parents:
1078
diff
changeset
|
154 XEvent *xevent = (XEvent *)xev; |
d94ba9133f94
[svn] - update transparency pixmap if root window pixmap changes
nenolod
parents:
1078
diff
changeset
|
155 |
d94ba9133f94
[svn] - update transparency pixmap if root window pixmap changes
nenolod
parents:
1078
diff
changeset
|
156 if (xevent->type == PropertyNotify) |
d94ba9133f94
[svn] - update transparency pixmap if root window pixmap changes
nenolod
parents:
1078
diff
changeset
|
157 { |
d94ba9133f94
[svn] - update transparency pixmap if root window pixmap changes
nenolod
parents:
1078
diff
changeset
|
158 if (at == None) |
d94ba9133f94
[svn] - update transparency pixmap if root window pixmap changes
nenolod
parents:
1078
diff
changeset
|
159 at = XInternAtom (xevent->xproperty.display, "_XROOTPMAP_ID", True); |
d94ba9133f94
[svn] - update transparency pixmap if root window pixmap changes
nenolod
parents:
1078
diff
changeset
|
160 |
d94ba9133f94
[svn] - update transparency pixmap if root window pixmap changes
nenolod
parents:
1078
diff
changeset
|
161 if (at == xevent->xproperty.atom) |
d94ba9133f94
[svn] - update transparency pixmap if root window pixmap changes
nenolod
parents:
1078
diff
changeset
|
162 { |
d94ba9133f94
[svn] - update transparency pixmap if root window pixmap changes
nenolod
parents:
1078
diff
changeset
|
163 rootpix = shade_pixmap(get_transparency_pixmap(), 0, 0, 0, 0, gdk_screen_width(), gdk_screen_height(), |
d94ba9133f94
[svn] - update transparency pixmap if root window pixmap changes
nenolod
parents:
1078
diff
changeset
|
164 skin_get_color(bmp_active_skin, SKIN_PLEDIT_NORMALBG)); |
d94ba9133f94
[svn] - update transparency pixmap if root window pixmap changes
nenolod
parents:
1078
diff
changeset
|
165 |
d94ba9133f94
[svn] - update transparency pixmap if root window pixmap changes
nenolod
parents:
1078
diff
changeset
|
166 if (cfg.playlist_transparent) |
1082 | 167 { |
168 playlistwin_update_list(); | |
169 draw_playlist_window(TRUE); | |
170 } | |
1079
d94ba9133f94
[svn] - update transparency pixmap if root window pixmap changes
nenolod
parents:
1078
diff
changeset
|
171 } |
d94ba9133f94
[svn] - update transparency pixmap if root window pixmap changes
nenolod
parents:
1078
diff
changeset
|
172 } |
d94ba9133f94
[svn] - update transparency pixmap if root window pixmap changes
nenolod
parents:
1078
diff
changeset
|
173 |
d94ba9133f94
[svn] - update transparency pixmap if root window pixmap changes
nenolod
parents:
1078
diff
changeset
|
174 return GDK_FILTER_CONTINUE; |
d94ba9133f94
[svn] - update transparency pixmap if root window pixmap changes
nenolod
parents:
1078
diff
changeset
|
175 } |
d94ba9133f94
[svn] - update transparency pixmap if root window pixmap changes
nenolod
parents:
1078
diff
changeset
|
176 |
1047
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
177 #else |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
178 |
1050 | 179 GdkPixmap *get_transparency_pixmap(void) |
1047
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
180 { |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
181 return NULL; |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
182 } |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
183 |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
184 #endif |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
185 |
0 | 186 static gboolean |
187 playlist_list_auto_drag_down_func(gpointer data) | |
188 { | |
189 PlayList_List *pl = data; | |
190 | |
191 if (pl->pl_auto_drag_down) { | |
192 playlist_list_move_down(pl); | |
193 pl->pl_first++; | |
194 playlistwin_update_list(); | |
195 return TRUE; | |
196 } | |
197 return FALSE; | |
198 } | |
199 | |
200 static gboolean | |
201 playlist_list_auto_drag_up_func(gpointer data) | |
202 { | |
203 PlayList_List *pl = data; | |
204 | |
205 if (pl->pl_auto_drag_up) { | |
206 playlist_list_move_up(pl); | |
207 pl->pl_first--; | |
208 playlistwin_update_list(); | |
209 return TRUE; | |
210 | |
211 } | |
212 return FALSE; | |
213 } | |
214 | |
215 void | |
216 playlist_list_move_up(PlayList_List * pl) | |
217 { | |
218 GList *list; | |
219 | |
220 PLAYLIST_LOCK(); | |
221 if ((list = playlist_get()) == NULL) { | |
222 PLAYLIST_UNLOCK(); | |
223 return; | |
224 } | |
225 if (PLAYLIST_ENTRY(list->data)->selected) { | |
226 /* We are at the top */ | |
227 PLAYLIST_UNLOCK(); | |
228 return; | |
229 } | |
230 while (list) { | |
231 if (PLAYLIST_ENTRY(list->data)->selected) | |
232 glist_moveup(list); | |
233 list = g_list_next(list); | |
234 } | |
235 PLAYLIST_UNLOCK(); | |
236 if (pl->pl_prev_selected != -1) | |
237 pl->pl_prev_selected--; | |
238 if (pl->pl_prev_min != -1) | |
239 pl->pl_prev_min--; | |
240 if (pl->pl_prev_max != -1) | |
241 pl->pl_prev_max--; | |
242 } | |
243 | |
244 void | |
245 playlist_list_move_down(PlayList_List * pl) | |
246 { | |
247 GList *list; | |
248 | |
249 PLAYLIST_LOCK(); | |
250 | |
251 if (!(list = g_list_last(playlist_get()))) { | |
252 PLAYLIST_UNLOCK(); | |
253 return; | |
254 } | |
255 | |
256 if (PLAYLIST_ENTRY(list->data)->selected) { | |
257 /* We are at the bottom */ | |
258 PLAYLIST_UNLOCK(); | |
259 return; | |
260 } | |
261 | |
262 while (list) { | |
263 if (PLAYLIST_ENTRY(list->data)->selected) | |
264 glist_movedown(list); | |
265 list = g_list_previous(list); | |
266 } | |
267 | |
268 PLAYLIST_UNLOCK(); | |
269 | |
270 if (pl->pl_prev_selected != -1) | |
271 pl->pl_prev_selected++; | |
272 if (pl->pl_prev_min != -1) | |
273 pl->pl_prev_min++; | |
274 if (pl->pl_prev_max != -1) | |
275 pl->pl_prev_max++; | |
276 } | |
277 | |
278 static void | |
279 playlist_list_button_press_cb(GtkWidget * widget, | |
280 GdkEventButton * event, | |
281 PlayList_List * pl) | |
282 { | |
283 gint nr, y; | |
284 | |
285 if (event->button == 1 && pl->pl_fheight && | |
286 widget_contains(&pl->pl_widget, event->x, event->y)) { | |
287 | |
288 y = event->y - pl->pl_widget.y; | |
289 nr = (y / pl->pl_fheight) + pl->pl_first; | |
290 | |
291 if (nr >= playlist_get_length()) | |
292 nr = playlist_get_length() - 1; | |
293 | |
294 if (!(event->state & GDK_CONTROL_MASK)) | |
295 playlist_select_all(FALSE); | |
296 | |
297 if (event->state & GDK_SHIFT_MASK && pl->pl_prev_selected != -1) { | |
298 playlist_select_range(pl->pl_prev_selected, nr, TRUE); | |
299 pl->pl_prev_min = pl->pl_prev_selected; | |
300 pl->pl_prev_max = nr; | |
301 pl->pl_drag_pos = nr - pl->pl_first; | |
302 } | |
303 else { | |
304 if (playlist_select_invert(nr)) { | |
305 if (event->state & GDK_CONTROL_MASK) { | |
306 if (pl->pl_prev_min == -1) { | |
307 pl->pl_prev_min = pl->pl_prev_selected; | |
308 pl->pl_prev_max = pl->pl_prev_selected; | |
309 } | |
310 if (nr < pl->pl_prev_min) | |
311 pl->pl_prev_min = nr; | |
312 else if (nr > pl->pl_prev_max) | |
313 pl->pl_prev_max = nr; | |
314 } | |
315 else | |
316 pl->pl_prev_min = -1; | |
317 pl->pl_prev_selected = nr; | |
318 pl->pl_drag_pos = nr - pl->pl_first; | |
319 } | |
320 } | |
321 if (event->type == GDK_2BUTTON_PRESS) { | |
322 /* | |
323 * Ungrab the pointer to prevent us from | |
324 * hanging on to it during the sometimes slow | |
325 * bmp_playback_initiate(). | |
326 */ | |
327 gdk_pointer_ungrab(GDK_CURRENT_TIME); | |
328 gdk_flush(); | |
329 playlist_set_position(nr); | |
330 if (!bmp_playback_get_playing()) | |
331 bmp_playback_initiate(); | |
332 } | |
333 | |
334 pl->pl_dragging = TRUE; | |
335 playlistwin_update_list(); | |
336 } | |
337 } | |
338 | |
339 gint | |
340 playlist_list_get_playlist_position(PlayList_List * pl, | |
341 gint x, | |
342 gint y) | |
343 { | |
344 gint iy, length; | |
345 | |
346 if (!widget_contains(WIDGET(pl), x, y) || !pl->pl_fheight) | |
347 return -1; | |
348 | |
349 if ((length = playlist_get_length()) == 0) | |
350 return -1; | |
351 iy = y - pl->pl_widget.y; | |
352 | |
353 return (MIN((iy / pl->pl_fheight) + pl->pl_first, length - 1)); | |
354 } | |
355 | |
356 static void | |
357 playlist_list_motion_cb(GtkWidget * widget, | |
358 GdkEventMotion * event, | |
359 PlayList_List * pl) | |
360 { | |
361 gint nr, y, off, i; | |
362 | |
363 if (pl->pl_dragging) { | |
364 y = event->y - pl->pl_widget.y; | |
365 nr = (y / pl->pl_fheight); | |
366 if (nr < 0) { | |
367 nr = 0; | |
368 if (!pl->pl_auto_drag_up) { | |
369 pl->pl_auto_drag_up = TRUE; | |
370 pl->pl_auto_drag_up_tag = | |
371 gtk_timeout_add(100, playlist_list_auto_drag_up_func, pl); | |
372 } | |
373 } | |
374 else if (pl->pl_auto_drag_up) | |
375 pl->pl_auto_drag_up = FALSE; | |
376 | |
377 if (nr >= pl->pl_num_visible) { | |
378 nr = pl->pl_num_visible - 1; | |
379 if (!pl->pl_auto_drag_down) { | |
380 pl->pl_auto_drag_down = TRUE; | |
381 pl->pl_auto_drag_down_tag = | |
382 gtk_timeout_add(100, playlist_list_auto_drag_down_func, | |
383 pl); | |
384 } | |
385 } | |
386 else if (pl->pl_auto_drag_down) | |
387 pl->pl_auto_drag_down = FALSE; | |
388 | |
389 off = nr - pl->pl_drag_pos; | |
390 if (off) { | |
391 for (i = 0; i < abs(off); i++) { | |
392 if (off < 0) | |
393 playlist_list_move_up(pl); | |
394 else | |
395 playlist_list_move_down(pl); | |
396 | |
397 } | |
398 playlistwin_update_list(); | |
399 } | |
400 pl->pl_drag_pos = nr; | |
401 } | |
402 } | |
403 | |
404 static void | |
405 playlist_list_button_release_cb(GtkWidget * widget, | |
406 GdkEventButton * event, | |
407 PlayList_List * pl) | |
408 { | |
409 pl->pl_dragging = FALSE; | |
410 pl->pl_auto_drag_down = FALSE; | |
411 pl->pl_auto_drag_up = FALSE; | |
412 } | |
413 | |
414 static void | |
415 playlist_list_draw_string(PlayList_List * pl, | |
416 PangoFontDescription * font, | |
417 gint line, | |
418 gint width, | |
419 const gchar * text, | |
420 guint ppos) | |
421 { | |
324
fbafca56b6a8
[svn] playlist window truncation fixes provided by external contributor: Tim Yamin <plasmaroo -at- gentoo.org>.
nenolod
parents:
284
diff
changeset
|
422 guint plist_length_int; |
0 | 423 |
424 PangoLayout *layout; | |
425 | |
426 REQUIRE_STATIC_LOCK(playlist); | |
427 | |
428 if (cfg.show_numbers_in_pl) { | |
1077
e3fbf8df3773
[svn] - if cfg.show_separator_in_pl is not true, then make it look nicer (and
nenolod
parents:
1056
diff
changeset
|
429 gchar *pos_string = g_strdup_printf(cfg.show_separator_in_pl == TRUE ? "%d" : "%d.", ppos); |
0 | 430 plist_length_int = |
1077
e3fbf8df3773
[svn] - if cfg.show_separator_in_pl is not true, then make it look nicer (and
nenolod
parents:
1056
diff
changeset
|
431 gint_count_digits(playlist_get_length_nolock()) + !cfg.show_separator_in_pl + 1; /* cf.show_separator_in_pl will be 0 if false */ |
0 | 432 |
433 padding = plist_length_int; | |
434 padding = ((padding + 1) * width_approx_digits); | |
435 | |
436 layout = gtk_widget_create_pango_layout(playlistwin, pos_string); | |
437 pango_layout_set_font_description(layout, playlist_list_font); | |
438 pango_layout_set_width(layout, plist_length_int * 100); | |
439 | |
440 pango_layout_set_alignment(layout, PANGO_ALIGN_LEFT); | |
441 gdk_draw_layout(pl->pl_widget.parent, pl->pl_widget.gc, | |
442 pl->pl_widget.x + | |
443 (width_approx_digits * | |
444 (-1 + plist_length_int - strlen(pos_string))) + | |
445 (width_approx_digits / 4), | |
446 pl->pl_widget.y + (line - 1) * pl->pl_fheight + | |
447 ascent + abs(descent), layout); | |
448 g_free(pos_string); | |
449 g_object_unref(layout); | |
1077
e3fbf8df3773
[svn] - if cfg.show_separator_in_pl is not true, then make it look nicer (and
nenolod
parents:
1056
diff
changeset
|
450 |
e3fbf8df3773
[svn] - if cfg.show_separator_in_pl is not true, then make it look nicer (and
nenolod
parents:
1056
diff
changeset
|
451 if (!cfg.show_separator_in_pl) |
e3fbf8df3773
[svn] - if cfg.show_separator_in_pl is not true, then make it look nicer (and
nenolod
parents:
1056
diff
changeset
|
452 padding -= (width_approx_digits * 1.5); |
0 | 453 } |
454 else { | |
455 padding = 3; | |
456 } | |
457 | |
324
fbafca56b6a8
[svn] playlist window truncation fixes provided by external contributor: Tim Yamin <plasmaroo -at- gentoo.org>.
nenolod
parents:
284
diff
changeset
|
458 width -= padding; |
fbafca56b6a8
[svn] playlist window truncation fixes provided by external contributor: Tim Yamin <plasmaroo -at- gentoo.org>.
nenolod
parents:
284
diff
changeset
|
459 |
326 | 460 layout = gtk_widget_create_pango_layout(playlistwin, text); |
0 | 461 |
462 pango_layout_set_font_description(layout, playlist_list_font); | |
326 | 463 pango_layout_set_width(layout, width * PANGO_SCALE); |
464 pango_layout_set_single_paragraph_mode(layout, TRUE); | |
465 pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_END); | |
0 | 466 gdk_draw_layout(pl->pl_widget.parent, pl->pl_widget.gc, |
467 pl->pl_widget.x + padding + (width_approx_letters / 4), | |
468 pl->pl_widget.y + (line - 1) * pl->pl_fheight + | |
469 ascent + abs(descent), layout); | |
470 | |
471 g_object_unref(layout); | |
472 } | |
473 | |
474 void | |
475 playlist_list_draw(Widget * w) | |
476 { | |
477 PlayList_List *pl = PLAYLIST_LIST(w); | |
478 GList *list; | |
479 GdkGC *gc; | |
480 GdkPixmap *obj; | |
481 PangoLayout *layout; | |
482 gchar *title; | |
483 gint width, height; | |
484 gint i, max_first; | |
485 guint padding, padding_dwidth, padding_plength; | |
486 guint max_time_len = 0; | |
958 | 487 gfloat queue_tailpadding = 0; |
701
d539e5c5f730
[svn] Fixes of the remaining GCC 4.1 warnings from external contributor Diego "Flameeyes" Petteno (Gentoo).
chainsaw
parents:
625
diff
changeset
|
488 gint tpadding; |
d539e5c5f730
[svn] Fixes of the remaining GCC 4.1 warnings from external contributor Diego "Flameeyes" Petteno (Gentoo).
chainsaw
parents:
625
diff
changeset
|
489 gsize tpadding_dwidth = 0; |
828
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
490 gint x, y; |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
491 guint tail_width; |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
492 guint tail_len; |
0 | 493 |
494 gchar tail[100]; | |
782
4c7ee8f64d9b
[svn] untag a critical fixme as it was actually deadchip smoking some craq
nenolod
parents:
736
diff
changeset
|
495 gchar queuepos[255]; |
0 | 496 gchar length[40]; |
497 | |
498 gchar **frags; | |
499 gchar *frag0; | |
500 | |
501 gint plw_w, plw_h; | |
502 | |
503 GdkRectangle *playlist_rect; | |
504 | |
505 gc = pl->pl_widget.gc; | |
506 | |
507 width = pl->pl_widget.width; | |
508 height = pl->pl_widget.height; | |
509 | |
510 obj = pl->pl_widget.parent; | |
511 | |
512 gtk_window_get_size(GTK_WINDOW(playlistwin), &plw_w, &plw_h); | |
513 | |
514 playlist_rect = g_new0(GdkRectangle, 1); | |
515 | |
516 playlist_rect->x = 0; | |
517 playlist_rect->y = 0; | |
518 playlist_rect->width = plw_w - 17; | |
519 playlist_rect->height = plw_h - 36; | |
520 | |
521 gdk_gc_set_clip_origin(gc, 31, 58); | |
522 gdk_gc_set_clip_rectangle(gc, playlist_rect); | |
1047
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
523 |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
524 if (cfg.playlist_transparent == FALSE) |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
525 { |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
526 gdk_gc_set_foreground(gc, |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
527 skin_get_color(bmp_active_skin, |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
528 SKIN_PLEDIT_NORMALBG)); |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
529 gdk_draw_rectangle(obj, gc, TRUE, pl->pl_widget.x, pl->pl_widget.y, |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
530 width, height); |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
531 } |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
532 else |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
533 { |
1048
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
534 if (!rootpix) |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
535 rootpix = shade_pixmap(get_transparency_pixmap(), 0, 0, 0, 0, gdk_screen_width(), gdk_screen_height(), |
b10e09537428
[svn] - self-caching transparency generator (right now we have a blend constant of 60%)
nenolod
parents:
1047
diff
changeset
|
536 skin_get_color(bmp_active_skin, SKIN_PLEDIT_NORMALBG)); |
1047
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
537 gdk_draw_pixmap(obj, gc, rootpix, cfg.playlist_x + pl->pl_widget.x, |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
538 cfg.playlist_y + pl->pl_widget.y, pl->pl_widget.x, pl->pl_widget.y, |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
539 width, height); |
91f6db060a8b
[svn] - initial playlist_transparent patch. (you will need to edit your audacious config manually, either by gconf or texteditor to enable)
nenolod
parents:
958
diff
changeset
|
540 } |
0 | 541 |
542 if (!playlist_list_font) { | |
543 g_critical("Couldn't open playlist font"); | |
544 return; | |
545 } | |
546 | |
547 pl->pl_fheight = (ascent + abs(descent)); | |
548 pl->pl_num_visible = height / pl->pl_fheight; | |
549 | |
550 max_first = playlist_get_length() - pl->pl_num_visible; | |
551 max_first = MAX(max_first, 0); | |
552 | |
553 pl->pl_first = CLAMP(pl->pl_first, 0, max_first); | |
554 | |
555 PLAYLIST_LOCK(); | |
556 list = playlist_get(); | |
610
d056380ea0b3
[svn] playlist_list widget improvements via plasmaroo
nenolod
parents:
538
diff
changeset
|
557 list = g_list_nth(list, pl->pl_first); |
0 | 558 |
610
d056380ea0b3
[svn] playlist_list widget improvements via plasmaroo
nenolod
parents:
538
diff
changeset
|
559 /* It sucks having to run the iteration twice but this is the only |
d056380ea0b3
[svn] playlist_list widget improvements via plasmaroo
nenolod
parents:
538
diff
changeset
|
560 way you can reliably get the maximum width so we can get our |
d056380ea0b3
[svn] playlist_list widget improvements via plasmaroo
nenolod
parents:
538
diff
changeset
|
561 playlist nice and aligned... -- plasmaroo */ |
d056380ea0b3
[svn] playlist_list widget improvements via plasmaroo
nenolod
parents:
538
diff
changeset
|
562 |
d056380ea0b3
[svn] playlist_list widget improvements via plasmaroo
nenolod
parents:
538
diff
changeset
|
563 for (i = pl->pl_first; |
d056380ea0b3
[svn] playlist_list widget improvements via plasmaroo
nenolod
parents:
538
diff
changeset
|
564 list && i < pl->pl_first + pl->pl_num_visible; |
d056380ea0b3
[svn] playlist_list widget improvements via plasmaroo
nenolod
parents:
538
diff
changeset
|
565 list = g_list_next(list), i++) { |
d056380ea0b3
[svn] playlist_list widget improvements via plasmaroo
nenolod
parents:
538
diff
changeset
|
566 PlaylistEntry *entry = list->data; |
d056380ea0b3
[svn] playlist_list widget improvements via plasmaroo
nenolod
parents:
538
diff
changeset
|
567 |
d056380ea0b3
[svn] playlist_list widget improvements via plasmaroo
nenolod
parents:
538
diff
changeset
|
568 if (entry->length != -1) |
d056380ea0b3
[svn] playlist_list widget improvements via plasmaroo
nenolod
parents:
538
diff
changeset
|
569 { |
d056380ea0b3
[svn] playlist_list widget improvements via plasmaroo
nenolod
parents:
538
diff
changeset
|
570 g_snprintf(length, sizeof(length), "%d:%-2.2d", |
d056380ea0b3
[svn] playlist_list widget improvements via plasmaroo
nenolod
parents:
538
diff
changeset
|
571 entry->length / 60000, (entry->length / 1000) % 60); |
d056380ea0b3
[svn] playlist_list widget improvements via plasmaroo
nenolod
parents:
538
diff
changeset
|
572 tpadding_dwidth = MAX(tpadding_dwidth, strlen(length)); |
d056380ea0b3
[svn] playlist_list widget improvements via plasmaroo
nenolod
parents:
538
diff
changeset
|
573 } |
d056380ea0b3
[svn] playlist_list widget improvements via plasmaroo
nenolod
parents:
538
diff
changeset
|
574 } |
d056380ea0b3
[svn] playlist_list widget improvements via plasmaroo
nenolod
parents:
538
diff
changeset
|
575 |
d056380ea0b3
[svn] playlist_list widget improvements via plasmaroo
nenolod
parents:
538
diff
changeset
|
576 /* Reset */ |
d056380ea0b3
[svn] playlist_list widget improvements via plasmaroo
nenolod
parents:
538
diff
changeset
|
577 list = playlist_get(); |
d056380ea0b3
[svn] playlist_list widget improvements via plasmaroo
nenolod
parents:
538
diff
changeset
|
578 list = g_list_nth(list, pl->pl_first); |
0 | 579 |
580 for (i = pl->pl_first; | |
581 list && i < pl->pl_first + pl->pl_num_visible; | |
582 list = g_list_next(list), i++) { | |
583 gint pos; | |
584 PlaylistEntry *entry = list->data; | |
585 | |
586 if (entry->selected) { | |
587 gdk_gc_set_foreground(gc, | |
588 skin_get_color(bmp_active_skin, | |
589 SKIN_PLEDIT_SELECTEDBG)); | |
590 gdk_draw_rectangle(obj, gc, TRUE, pl->pl_widget.x, | |
591 pl->pl_widget.y + | |
592 ((i - pl->pl_first) * pl->pl_fheight), | |
593 width, pl->pl_fheight); | |
594 } | |
595 | |
596 /* FIXME: entry->title should NEVER be NULL, and there should | |
597 NEVER be a need to do a UTF-8 conversion. Playlist title | |
598 strings should be kept properly. */ | |
599 | |
600 if (!entry->title) { | |
601 gchar *basename = g_path_get_basename(entry->filename); | |
602 title = filename_to_utf8(basename); | |
603 g_free(basename); | |
604 } | |
605 else | |
606 title = str_to_utf8(entry->title); | |
607 | |
608 pos = playlist_get_queue_position(entry); | |
609 | |
610 tail[0] = 0; | |
611 queuepos[0] = 0; | |
612 length[0] = 0; | |
613 | |
614 if (pos != -1) | |
615 g_snprintf(queuepos, sizeof(queuepos), "%d", pos + 1); | |
616 | |
617 if (entry->length != -1) | |
506
4d3b74821345
[svn] Add a line between the time and the track name.
nenolod
parents:
460
diff
changeset
|
618 { |
0 | 619 g_snprintf(length, sizeof(length), "%d:%-2.2d", |
620 entry->length / 60000, (entry->length / 1000) % 60); | |
506
4d3b74821345
[svn] Add a line between the time and the track name.
nenolod
parents:
460
diff
changeset
|
621 } |
0 | 622 |
828
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
623 strncat(tail, length, sizeof(tail)); |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
624 tail_len = strlen(tail); |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
625 |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
626 max_time_len = MAX(max_time_len, tail_len); |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
627 |
958 | 628 if (pos != -1 && tpadding_dwidth <= 0) |
629 tail_width = width - (width_approx_digits * (strlen(queuepos) + 2.25)); | |
630 else if (pos != -1) | |
828
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
631 tail_width = width - (width_approx_digits * (tpadding_dwidth + strlen(queuepos) + 4)); |
958 | 632 else if (tpadding_dwidth > 0) |
633 tail_width = width - (width_approx_digits * (tpadding_dwidth + 2.5)); | |
828
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
634 else |
958 | 635 tail_width = width; |
0 | 636 |
828
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
637 if (i == playlist_get_position_nolock()) |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
638 gdk_gc_set_foreground(gc, |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
639 skin_get_color(bmp_active_skin, |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
640 SKIN_PLEDIT_CURRENT)); |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
641 else |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
642 gdk_gc_set_foreground(gc, |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
643 skin_get_color(bmp_active_skin, |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
644 SKIN_PLEDIT_NORMAL)); |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
645 playlist_list_draw_string(pl, playlist_list_font, |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
646 i - pl->pl_first, tail_width, title, |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
647 i + 1); |
0 | 648 |
828
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
649 x = pl->pl_widget.x + width - width_approx_digits * 2; |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
650 y = pl->pl_widget.y + ((i - pl->pl_first) - |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
651 1) * pl->pl_fheight + ascent; |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
652 |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
653 frags = NULL; |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
654 frag0 = NULL; |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
655 |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
656 if ((strlen(tail) > 0) && (tail != NULL)) { |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
657 frags = g_strsplit(tail, ":", 0); |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
658 frag0 = g_strconcat(frags[0], ":", NULL); |
0 | 659 |
828
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
660 layout = gtk_widget_create_pango_layout(playlistwin, frags[1]); |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
661 pango_layout_set_font_description(layout, playlist_list_font); |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
662 pango_layout_set_width(layout, tail_len * 100); |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
663 pango_layout_set_alignment(layout, PANGO_ALIGN_LEFT); |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
664 gdk_draw_layout(obj, gc, x - (0.5 * width_approx_digits), |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
665 y + abs(descent), layout); |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
666 g_object_unref(layout); |
0 | 667 |
828
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
668 layout = gtk_widget_create_pango_layout(playlistwin, frag0); |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
669 pango_layout_set_font_description(layout, playlist_list_font); |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
670 pango_layout_set_width(layout, tail_len * 100); |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
671 pango_layout_set_alignment(layout, PANGO_ALIGN_RIGHT); |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
672 gdk_draw_layout(obj, gc, x - (0.75 * width_approx_digits), |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
673 y + abs(descent), layout); |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
674 g_object_unref(layout); |
0 | 675 |
828
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
676 g_free(frag0); |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
677 g_strfreev(frags); |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
678 } |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
679 |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
680 if (pos != -1) { |
0 | 681 |
828
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
682 /* DON'T remove the commented code yet please -- Milosz */ |
0 | 683 |
958 | 684 if (tpadding_dwidth > 0) |
685 queue_tailpadding = tpadding_dwidth + 1; | |
686 else | |
687 queue_tailpadding = -0.75; | |
0 | 688 |
828
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
689 gdk_draw_rectangle(obj, gc, FALSE, |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
690 x - |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
691 (((queue_tailpadding + |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
692 strlen(queuepos)) * |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
693 width_approx_digits) + |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
694 (width_approx_digits / 4)), |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
695 y + abs(descent), |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
696 (strlen(queuepos)) * |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
697 width_approx_digits + |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
698 (width_approx_digits / 2), |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
699 pl->pl_fheight - 2); |
0 | 700 |
828
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
701 layout = |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
702 gtk_widget_create_pango_layout(playlistwin, queuepos); |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
703 pango_layout_set_font_description(layout, playlist_list_font); |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
704 pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER); |
0 | 705 |
828
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
706 gdk_draw_layout(obj, gc, |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
707 x - |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
708 ((queue_tailpadding + |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
709 strlen(queuepos)) * width_approx_digits) + |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
710 (width_approx_digits / 4), |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
711 y + abs(descent), layout); |
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
712 g_object_unref(layout); |
0 | 713 } |
714 | |
715 g_free(title); | |
716 } | |
717 | |
718 | |
719 /* | |
720 * Drop target hovering over the playlist, so draw some hint where the | |
721 * drop will occur. | |
722 * | |
723 * This is (currently? unfixably?) broken when dragging files from Qt/KDE apps, | |
724 * probably due to DnD signaling problems (actually i have no clue). | |
725 * | |
726 */ | |
727 | |
728 if (pl->pl_drag_motion) { | |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
610
diff
changeset
|
729 guint pos, plength, lpadding; |
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
610
diff
changeset
|
730 gint x, y, plx, ply; |
0 | 731 |
732 if (cfg.show_numbers_in_pl) { | |
733 lpadding = gint_count_digits(playlist_get_length_nolock()) + 1; | |
734 lpadding = ((lpadding + 1) * width_approx_digits); | |
735 } | |
736 else { | |
737 lpadding = 3; | |
738 }; | |
739 | |
740 /* We already hold the mutex and have the playlist locked, so call | |
741 the non-locking function. */ | |
742 plength = playlist_get_length_nolock(); | |
743 | |
744 x = pl->drag_motion_x; | |
745 y = pl->drag_motion_y; | |
746 | |
747 plx = pl->pl_widget.x; | |
748 ply = pl->pl_widget.y; | |
749 | |
750 if ((x > pl->pl_widget.x) && !(x > pl->pl_widget.width)) { | |
751 | |
752 if ((y > pl->pl_widget.y) | |
753 && !(y > (pl->pl_widget.height + ply))) { | |
754 | |
755 pos = ((y - ((Widget *) pl)->y) / pl->pl_fheight) + | |
756 pl->pl_first; | |
757 | |
758 if (pos > (plength)) { | |
759 pos = plength; | |
760 } | |
761 | |
762 gdk_gc_set_foreground(gc, | |
763 skin_get_color(bmp_active_skin, | |
764 SKIN_PLEDIT_CURRENT)); | |
765 | |
766 gdk_draw_line(obj, gc, pl->pl_widget.x, | |
735 | 767 pl->pl_widget.y + ((pos - pl->pl_first) * pl->pl_fheight), |
0 | 768 pl->pl_widget.width + pl->pl_widget.x - 1, |
769 pl->pl_widget.y + | |
770 ((pos - pl->pl_first) * pl->pl_fheight)); | |
771 } | |
772 | |
773 } | |
774 | |
775 /* When dropping on the borders of the playlist, outside the text area, | |
776 * files get appended at the end of the list. Show that too. | |
777 */ | |
778 | |
779 if ((y < ply) || (y > pl->pl_widget.height + ply)) { | |
780 if ((y >= 0) || (y <= (pl->pl_widget.height + ply))) { | |
781 pos = plength; | |
782 gdk_gc_set_foreground(gc, | |
783 skin_get_color(bmp_active_skin, | |
784 SKIN_PLEDIT_CURRENT)); | |
785 | |
786 gdk_draw_line(obj, gc, pl->pl_widget.x, | |
736 | 787 pl->pl_widget.y + |
788 ((pos - pl->pl_first) * pl->pl_fheight), | |
0 | 789 pl->pl_widget.width + pl->pl_widget.x - 1, |
790 pl->pl_widget.y + | |
791 ((pos - pl->pl_first) * pl->pl_fheight)); | |
792 | |
793 } | |
794 } | |
795 } | |
796 | |
797 gdk_gc_set_foreground(gc, | |
798 skin_get_color(bmp_active_skin, | |
799 SKIN_PLEDIT_NORMAL)); | |
800 | |
801 if (cfg.show_numbers_in_pl) { | |
802 | |
803 padding_plength = playlist_get_length_nolock(); | |
804 | |
805 if (padding_plength == 0) { | |
806 padding_dwidth = 0; | |
807 } | |
808 else { | |
809 padding_dwidth = gint_count_digits(playlist_get_length_nolock()); | |
810 } | |
811 | |
812 padding = | |
813 (padding_dwidth * | |
814 width_approx_digits) + width_approx_digits; | |
815 | |
816 | |
817 /* For italic or oblique fonts we add another half of the | |
818 * approximate width */ | |
819 if (has_slant) | |
820 padding += width_approx_digits_half; | |
821 | |
1056
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
1050
diff
changeset
|
822 if (cfg.show_separator_in_pl) { |
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
1050
diff
changeset
|
823 gdk_draw_line(obj, gc, |
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
1050
diff
changeset
|
824 pl->pl_widget.x + padding, |
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
1050
diff
changeset
|
825 pl->pl_widget.y, |
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
1050
diff
changeset
|
826 pl->pl_widget.x + padding, |
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
1050
diff
changeset
|
827 pl->pl_widget.y + pl->pl_widget.height - 1); |
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
1050
diff
changeset
|
828 } |
0 | 829 } |
830 | |
506
4d3b74821345
[svn] Add a line between the time and the track name.
nenolod
parents:
460
diff
changeset
|
831 if (tpadding_dwidth != 0) |
4d3b74821345
[svn] Add a line between the time and the track name.
nenolod
parents:
460
diff
changeset
|
832 { |
828
45ec63505a4e
[svn] - improvements to the playlist list control, via nhjm
nenolod
parents:
813
diff
changeset
|
833 tpadding = (tpadding_dwidth * width_approx_digits) + (width_approx_digits * 1.5); |
506
4d3b74821345
[svn] Add a line between the time and the track name.
nenolod
parents:
460
diff
changeset
|
834 |
4d3b74821345
[svn] Add a line between the time and the track name.
nenolod
parents:
460
diff
changeset
|
835 if (has_slant) |
4d3b74821345
[svn] Add a line between the time and the track name.
nenolod
parents:
460
diff
changeset
|
836 tpadding += width_approx_digits_half; |
4d3b74821345
[svn] Add a line between the time and the track name.
nenolod
parents:
460
diff
changeset
|
837 |
1056
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
1050
diff
changeset
|
838 if (cfg.show_separator_in_pl) { |
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
1050
diff
changeset
|
839 gdk_draw_line(obj, gc, |
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
1050
diff
changeset
|
840 pl->pl_widget.x + pl->pl_widget.width - tpadding, |
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
1050
diff
changeset
|
841 pl->pl_widget.y, |
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
1050
diff
changeset
|
842 pl->pl_widget.x + pl->pl_widget.width - tpadding, |
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
1050
diff
changeset
|
843 pl->pl_widget.y + pl->pl_widget.height - 1); |
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
1050
diff
changeset
|
844 } |
506
4d3b74821345
[svn] Add a line between the time and the track name.
nenolod
parents:
460
diff
changeset
|
845 } |
4d3b74821345
[svn] Add a line between the time and the track name.
nenolod
parents:
460
diff
changeset
|
846 |
0 | 847 gdk_gc_set_clip_origin(gc, 0, 0); |
848 gdk_gc_set_clip_rectangle(gc, NULL); | |
849 | |
850 PLAYLIST_UNLOCK(); | |
958 | 851 |
1081 | 852 gdk_flush(); |
853 | |
813
c8cf439179b8
[svn] - Fix a ton and a half of memory leaks, via the wonderful Leonardo Boshell <leonardop -at- gentoo.org>.
nenolod
parents:
797
diff
changeset
|
854 g_free(playlist_rect); |
0 | 855 } |
856 | |
857 | |
858 PlayList_List * | |
859 create_playlist_list(GList ** wlist, | |
860 GdkPixmap * parent, | |
861 GdkGC * gc, | |
862 gint x, gint y, | |
863 gint w, gint h) | |
864 { | |
865 PlayList_List *pl; | |
866 | |
867 pl = g_new0(PlayList_List, 1); | |
868 widget_init(&pl->pl_widget, parent, gc, x, y, w, h, TRUE); | |
869 | |
870 pl->pl_widget.button_press_cb = | |
871 (WidgetButtonPressFunc) playlist_list_button_press_cb; | |
872 pl->pl_widget.button_release_cb = | |
873 (WidgetButtonReleaseFunc) playlist_list_button_release_cb; | |
874 pl->pl_widget.motion_cb = (WidgetMotionFunc) playlist_list_motion_cb; | |
875 pl->pl_widget.draw = playlist_list_draw; | |
876 | |
877 pl->pl_prev_selected = -1; | |
878 pl->pl_prev_min = -1; | |
879 pl->pl_prev_max = -1; | |
880 | |
881 widget_list_add(wlist, WIDGET(pl)); | |
882 | |
1079
d94ba9133f94
[svn] - update transparency pixmap if root window pixmap changes
nenolod
parents:
1078
diff
changeset
|
883 #ifdef GDK_WINDOWING_X11 |
d94ba9133f94
[svn] - update transparency pixmap if root window pixmap changes
nenolod
parents:
1078
diff
changeset
|
884 gdk_window_set_events (gdk_get_default_root_window(), GDK_PROPERTY_CHANGE_MASK); |
d94ba9133f94
[svn] - update transparency pixmap if root window pixmap changes
nenolod
parents:
1078
diff
changeset
|
885 gdk_window_add_filter (gdk_get_default_root_window(), (GdkFilterFunc)root_event_cb, pl); |
d94ba9133f94
[svn] - update transparency pixmap if root window pixmap changes
nenolod
parents:
1078
diff
changeset
|
886 #endif |
d94ba9133f94
[svn] - update transparency pixmap if root window pixmap changes
nenolod
parents:
1078
diff
changeset
|
887 |
0 | 888 return pl; |
889 } | |
890 | |
891 void | |
892 playlist_list_set_font(const gchar * font) | |
893 { | |
894 | |
895 /* Welcome to bad hack central 2k3 */ | |
896 | |
897 gchar *font_lower; | |
898 gint width_temp; | |
899 gint width_temp_0; | |
900 | |
901 playlist_list_font = pango_font_description_from_string(font); | |
902 | |
903 text_get_extents(font, | |
904 "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz ", | |
905 &width_approx_letters, NULL, &ascent, &descent); | |
906 | |
907 width_approx_letters = (width_approx_letters / 53); | |
908 | |
909 /* Experimental: We don't weigh the 1 into total because it's width is almost always | |
910 * very different from the rest | |
911 */ | |
912 text_get_extents(font, "023456789", &width_approx_digits, NULL, NULL, | |
913 NULL); | |
914 width_approx_digits = (width_approx_digits / 9); | |
915 | |
916 /* Precache some often used calculations */ | |
917 width_approx_digits_half = width_approx_digits / 2; | |
918 | |
919 /* FIXME: We assume that any other number is broader than the "1" */ | |
920 text_get_extents(font, "1", &width_temp, NULL, NULL, NULL); | |
921 text_get_extents(font, "2", &width_temp_0, NULL, NULL, NULL); | |
922 | |
923 if (abs(width_temp_0 - width_temp) < 2) { | |
924 width_delta_digit_one = 0; | |
925 } | |
926 else { | |
927 width_delta_digit_one = ((width_temp_0 - width_temp) / 2) + 2; | |
928 } | |
929 | |
930 text_get_extents(font, ":", &width_colon, NULL, NULL, NULL); | |
931 width_colon_third = width_colon / 4; | |
932 | |
933 font_lower = g_utf8_strdown(font, strlen(font)); | |
934 /* This doesn't take any i18n into account, but i think there is none with TTF fonts | |
935 * FIXME: This can probably be retrieved trough Pango too | |
936 */ | |
937 has_slant = g_strstr_len(font_lower, strlen(font_lower), "oblique") | |
938 || g_strstr_len(font_lower, strlen(font_lower), "italic"); | |
939 | |
940 g_free(font_lower); | |
941 } |