diff options
author | Kevin Lo <kevlo@FreeBSD.org> | 2000-08-24 12:09:34 +0000 |
---|---|---|
committer | Kevin Lo <kevlo@FreeBSD.org> | 2000-08-24 12:09:34 +0000 |
commit | 09e930a48a64934687e38fefe938e6953822ec36 (patch) | |
tree | 5eebc75664e49c1fe63e1a2223ea35fe6ae1a58e /chinese | |
parent | Add gnomeres_applet - a GNOME applet for changing XFree display modes. (diff) |
Initial import of zh-xmms 1.2.2
zh-xmms is an audio player with a Winamp GUI.
PR: 20719
Submitted by: Clive Lin <clive@CirX.ORG>
Notes
Notes:
svn path=/head/; revision=31918
Diffstat (limited to 'chinese')
-rw-r--r-- | chinese/Makefile | 1 | ||||
-rw-r--r-- | chinese/xmms/Makefile | 113 | ||||
-rw-r--r-- | chinese/xmms/files/extra-patch-xmms-1.2.x-xfont | 496 |
3 files changed, 610 insertions, 0 deletions
diff --git a/chinese/Makefile b/chinese/Makefile index b13e001b6b7d..c609272fab41 100644 --- a/chinese/Makefile +++ b/chinese/Makefile @@ -1,5 +1,6 @@ # $FreeBSD$ # + SUBDIR += xmms SUBDIR += CJK SUBDIR += Wnn diff --git a/chinese/xmms/Makefile b/chinese/xmms/Makefile new file mode 100644 index 000000000000..abb6eb11c178 --- /dev/null +++ b/chinese/xmms/Makefile @@ -0,0 +1,113 @@ +# New ports collection makefile for: xmms +# Date created: 3 July 1999 +# Whom: Espen Skoglund <esk@ira.uka.de> +# +# $FreeBSD$ +# + +PORTNAME= xmms +PORTVERSION= 1.2.2 +CATEGORIES= chinese +MASTER_SITES= ftp://ftp.xmms.org/xmms/1.2.x/ \ + ftp://ftp.uk.xmms.org/xmms/1.2.x/ \ + ftp://ftp.us.xmms.org/xmms/1.2.x/ \ + ftp://ftp.ca.us.xmms.org/xmms/1.2.x/ \ + ftp://ftp.md.us.xmms.org/xmms/1.2.x/ \ + ftp://ftp.nl.xmms.org/xmms/1.2.x/ \ + ftp://ftp.de.xmms.org/xmms/1.2.x/ + +PATCH_SITES= ${MASTER_SITE_LOCAL} +PATCH_SITE_SUBDIR= sobomax + +MAINTAINER= clive@CirX.ORG + +LIB_DEPENDS= gtk12.2:${PORTSDIR}/x11-toolkits/gtk12 \ + glib12.3:${PORTSDIR}/devel/glib12 \ + xml.5:${PORTSDIR}/textproc/libxml + +RUN_DEPENDS= ${X11BASE}/lib/X11/fonts/TrueType/bsmi00lp.ttf:${PORTSDIR}/chinese/arphicttf + +USE_X_PREFIX= yes +USE_LIBTOOL= yes +LIBTOOLFILES= configure libxmms/configure +INSTALLS_SHLIB= yes + +.if !defined(WITHOUT_MIKMOD) +LIB_DEPENDS+= mikmod.2:${PORTSDIR}/audio/libmikmod +HAVE_MIKMOD_OVERRIDE= +PLIST_SUB+= MIKMODPLUGIN:="" +.else +HAVE_MIKMOD_OVERRIDE= yes +PLIST_SUB+= MIKMODPLUGIN:="@comment " +.endif + +.if !defined(WITHOUT_ESD) +LIB_DEPENDS+= esd.2:${PORTSDIR}/audio/esound +HAVE_ESD_OVERRIDE= +PLIST_SUB+= ESDPLUGIN:="" +.else +HAVE_ESD_OVERRIDE= yes +PLIST_SUB+= ESDPLUGIN:="@comment " +.endif + +.if defined(WITH_GNOME) +LIB_DEPENDS+= gnome.4:${PORTSDIR}/x11/gnomelibs \ + panel_applet.4:${PORTSDIR}/x11/gnomecore +CONFIGURE_ARGS+= --with-gnome +PLIST_SUB+= GNOME:="" +.else +CONFIGURE_ARGS+= --without-gnome +PLIST_SUB+= GNOME:="@comment " +.endif + +GTK_CONFIG?= ${X11BASE}/bin/gtk12-config +GLIB_CONFIG?= ${LOCALBASE}/bin/glib12-config + +CONFIGURE_ENV+= GTK_CONFIG="${GTK_CONFIG}" \ + GLIB_CONFIG="${GLIB_CONFIG}" \ + CPPFLAGS="-I${LOCALBASE}/include" \ + LDFLAGS="-L${LOCALBASE}/lib" \ + HAVE_ESD_OVERRIDE="${HAVE_ESD_OVERRIDE}" \ + HAVE_MIKMOD_OVERRIDE="${HAVE_MIKMOD_OVERRIDE}" + +.include <bsd.port.pre.mk> + +.if !defined(WITHOUT_3DNOW) && ${OSVERSION} >= 400021 +PATCHFILES= xmms-1.2.1-3dnow-20000620.patch.gz +CONFIGURE_ARGS+= --enable-3dnow +.endif + +pre-patch: + @( cd ${WRKSRC}; \ + ${PATCH} -sp1 < ${PATCHDIR}/xmms-1.2.x-xfont.diff ; ) + +pre-extract: +.if !defined(WITH_GNOME) || !defined(WITHOUT_ESD) || !defined(WITHOUT_MIKMOD) || \ + ( !defined(WITHOUT_3DNOW) && ${OSVERSION} >= 400021 ) + @${ECHO_MSG} +.if !defined(WITH_GNOME) + @${ECHO_MSG} "You can add support for GNOME by defining WITH_GNOME." +.endif +.if !defined(WITHOUT_ESD) + @${ECHO_MSG} "You can disable support for ESD sound daemon by defining WITHOUT_ESD." +.endif +.if !defined(WITHOUT_MIKMOD) + @${ECHO_MSG} "You can disable support for mikmod by defining WITHOUT_MIKMOD." +.endif +.if !defined(WITHOUT_3DNOW) && ${OSVERSION} >= 400021 + @${ECHO_MSG} "You can disable 3DNOW optimized decoding routines by defining WITHOUT_3DNOW." +.endif + @${ECHO_MSG} +.endif + +.if defined(WITHOUT_3DNOW) || ${OSVERSION} < 400021 +post-extract: + (cd ${WRKSRC}/Input/mpg123 && ${MV} decode_i586.s decode_i586.S && \ + ${MV} getbits.s getbits.S && cd ${WRKSRC}/Visualization/blur_scope && \ + ${MV} blur_8.s blur_8.S); + ${PERL} -pi.bak -e 's:\.s :\.S :g' ${WRKSRC}/Input/mpg123/Makefile.in + ${PERL} -pi.bak -e 's:blur_8.s:blur_8.S:g' \ + ${WRKSRC}/Visualization/blur_scope/Makefile.in +.endif + +.include <bsd.port.post.mk> diff --git a/chinese/xmms/files/extra-patch-xmms-1.2.x-xfont b/chinese/xmms/files/extra-patch-xmms-1.2.x-xfont new file mode 100644 index 000000000000..f2f6160a556f --- /dev/null +++ b/chinese/xmms/files/extra-patch-xmms-1.2.x-xfont @@ -0,0 +1,496 @@ +diff -ru xmms-1.2.2/xmms/about.c xmms-1.2.2-xfont/xmms/about.c +--- xmms-1.2.2/xmms/about.c Mon Jun 12 06:27:14 2000 ++++ xmms-1.2.2-xfont/xmms/about.c Wed Jul 12 00:13:27 2000 +@@ -35,6 +35,7 @@ + N_("With Additional Help:"), + N_("Sean Atkinson"), + N_("Anders Carlsson (effect plugins)"), ++ N_("Chun-Chung Chen (xfont patch)"), + N_("Tim Ferguson (joystick plugin)"), + N_("Ben Gertzfield"), + N_("Logan Hanks"), +diff -ru xmms-1.2.2/xmms/main.c xmms-1.2.2-xfont/xmms/main.c +--- xmms-1.2.2/xmms/main.c.orig Wed Jul 12 00:11:14 2000 ++++ xmms-1.2.2/xmms/main.c Sun Aug 20 02:02:52 2000 +@@ -321,8 +321,8 @@ + cfg.always_on_top = FALSE; + cfg.sticky = FALSE; + cfg.always_show_cb = TRUE; +- cfg.convert_underscore = TRUE; +- cfg.convert_twenty = TRUE; ++ cfg.convert_underscore = FALSE; ++ cfg.convert_twenty = FALSE; + cfg.show_numbers_in_pl = TRUE; + cfg.snap_windows = TRUE; + cfg.save_window_position = TRUE; +@@ -335,6 +335,7 @@ + cfg.no_playlist_advance = FALSE; + cfg.smooth_title_scroll = TRUE; + cfg.random_skin_on_play = FALSE; ++ cfg.xfont_for_playinfo = TRUE; + + cfg.playlist_x = 295; + cfg.playlist_y = 20; +@@ -411,7 +412,10 @@ + xmms_cfg_read_boolean(cfgfile, "xmms", "playlist_shaded", &cfg.playlist_shaded); + xmms_cfg_read_boolean(cfgfile, "xmms", "playlist_visible", &cfg.playlist_visible); + if (!xmms_cfg_read_string(cfgfile, "xmms", "playlist_font", &cfg.playlist_font)) +- cfg.playlist_font = g_strdup("-adobe-helvetica-bold-r-*-*-10-*"); ++ cfg.playlist_font = g_strdup("-adobe-helvetica-bold-r-*-*-10-*,*-ming-medium-r-*-*-10-*"); ++ xmms_cfg_read_boolean(cfgfile, "xmms", "xfont_for_playinfo", &cfg.xfont_for_playinfo); ++ if (!xmms_cfg_read_string(cfgfile, "xmms", "playinfo_font", &cfg.playinfo_font)) ++ cfg.playinfo_font = g_strdup("-adobe-helvetica-medium-r-*-*-8-*,*-ming-medium-r-*-*-8-*"); + xmms_cfg_read_int(cfgfile, "xmms", "playlist_position", &cfg.playlist_position); + xmms_cfg_read_int(cfgfile, "xmms", "equalizer_x", &cfg.equalizer_x); + xmms_cfg_read_int(cfgfile, "xmms", "equalizer_y", &cfg.equalizer_y); +@@ -458,7 +462,8 @@ + } + else + { +- cfg.playlist_font = g_strdup("-adobe-helvetica-bold-r-*-*-10-*"); ++ cfg.playlist_font = g_strdup("-adobe-helvetica-bold-r-*-*-10-*,*-ming-medium-r-*-*-10-*"); ++ cfg.playinfo_font = g_strdup("-adobe-helvetica-medium-r-*-*-8-*,*-ming-medium-r-*-*-8-*"); + } + g_free(filename); + } +@@ -537,6 +542,8 @@ + xmms_cfg_write_boolean(cfgfile, "xmms", "playlist_shaded", cfg.playlist_shaded); + xmms_cfg_write_boolean(cfgfile, "xmms", "playlist_visible", cfg.playlist_visible); + xmms_cfg_write_string(cfgfile, "xmms", "playlist_font", cfg.playlist_font); ++ xmms_cfg_write_boolean(cfgfile, "xmms", "xfont_for_playinfo", cfg.xfont_for_playinfo); ++ xmms_cfg_write_string(cfgfile, "xmms", "playinfo_font", cfg.playinfo_font); + xmms_cfg_write_int(cfgfile, "xmms", "playlist_position", get_playlist_position()); + dock_get_widget_pos(equalizerwin, &cfg.equalizer_x, &cfg.equalizer_y); + xmms_cfg_write_int(cfgfile, "xmms", "equalizer_x", cfg.equalizer_x); +@@ -2594,6 +2601,7 @@ + tbutton_set_toggled(mainwin_pl, cfg.playlist_visible); + + mainwin_info = create_textbox(&mainwin_wlist, mainwin_bg, mainwin_gc, 112, 27, 153, 1, SKIN_TEXT); ++ config_textbox(mainwin_info, 27); + textbox_set_scroll(mainwin_info, cfg.autoscroll); + mainwin_rate_text = create_textbox(&mainwin_wlist, mainwin_bg, mainwin_gc, 111, 43, 15, 0, SKIN_TEXT); + mainwin_freq_text = create_textbox(&mainwin_wlist, mainwin_bg, mainwin_gc, 156, 43, 10, 0, SKIN_TEXT); + +diff -ru xmms-1.2.2/xmms/main.h xmms-1.2.2-xfont/xmms/main.h +--- xmms-1.2.2/xmms/main.h Fri Jul 7 09:18:26 2000 ++++ xmms-1.2.2-xfont/xmms/main.h Wed Jul 12 00:13:32 2000 +@@ -45,8 +45,9 @@ + gboolean no_playlist_advance, smooth_title_scroll; + gboolean use_backslash_as_dir_delimiter, enable_dga; + gboolean random_skin_on_play; ++ gboolean xfont_for_playinfo; + gfloat equalizer_preamp, equalizer_bands[10]; +- gchar *skin, *outputplugin, *filesel_path, *playlist_path, *playlist_font; ++ gchar *skin, *outputplugin, *filesel_path, *playlist_path, *playlist_font, *playinfo_font; + gchar *effectplugin; + gchar *disabled_iplugins, *enabled_gplugins, *enabled_vplugins; + GList *url_history; +diff -ru xmms-1.2.2/xmms/playlist_list.c xmms-1.2.2-xfont/xmms/playlist_list.c +--- xmms-1.2.2/xmms/playlist_list.c Fri Jul 7 09:18:26 2000 ++++ xmms-1.2.2-xfont/xmms/playlist_list.c Wed Jul 12 00:13:35 2000 +@@ -232,9 +232,9 @@ + gdk_gc_set_foreground(gc, get_skin_color(SKIN_PLEDIT_NORMALBG)); + gdk_draw_rectangle(obj, gc, TRUE, pl->pl_widget.x, pl->pl_widget.y, width, height); + +-/* if ((font = gdk_fontset_load(cfg.playlist_font)) != NULL) */ ++ if ((font = gdk_fontset_load(cfg.playlist_font)) != NULL) + +- if ((font = gdk_font_load(cfg.playlist_font)) != NULL) ++/* if ((font = gdk_font_load(cfg.playlist_font)) != NULL) */ + { + GList *list = get_playlist(); + pl->pl_fheight = font->ascent + font->descent + 1; +diff -ru xmms-1.2.2/xmms/prefswin.c xmms-1.2.2-xfont/xmms/prefswin.c +--- xmms-1.2.2/xmms/prefswin.c Mon Jun 26 05:27:25 2000 ++++ xmms-1.2.2-xfont/xmms/prefswin.c Wed Jul 12 00:13:37 2000 +@@ -60,6 +60,11 @@ + GtkWidget *prefswin_options_font_frame, *prefswin_options_font_hbox; + GtkWidget *prefswin_options_font_entry, *prefswin_options_font_browse; + GtkWidget *prefswin_options_fontsel; ++GtkWidget *prefswin_mainwin_frame, *prefswin_mainwin_vbox, *prefswin_mainwin_table; ++GtkWidget *prefswin_mainwin_xfont; ++GtkWidget *prefswin_mainwin_font_frame, *prefswin_mainwin_font_hbox; ++GtkWidget *prefswin_mainwin_font_entry, *prefswin_mainwin_font_browse; ++GtkWidget *prefswin_mainwin_fontsel; + GtkWidget *prefswin_vbox, *prefswin_hbox, *prefswin_ok, *prefswin_cancel, + *prefswin_apply; + GtkWidget *prefswin_options_mouse_box, *prefswin_options_mouse_label, +@@ -288,6 +293,7 @@ + void prefswin_apply_changes(void) + { + g_free(cfg.playlist_font); ++ g_free(cfg.playinfo_font); + cfg.allow_multiple_instances = GTK_TOGGLE_BUTTON(prefswin_options_ami)->active; + cfg.always_show_cb = GTK_TOGGLE_BUTTON(prefswin_options_asc)->active; + cfg.convert_underscore = GTK_TOGGLE_BUTTON(prefswin_options_cus)->active; +@@ -298,6 +304,7 @@ + cfg.save_window_position = GTK_TOGGLE_BUTTON(prefswin_options_swp)->active; + cfg.dim_titlebar = GTK_TOGGLE_BUTTON(prefswin_options_dim)->active; + cfg.playlist_font = g_strdup(gtk_entry_get_text(GTK_ENTRY(prefswin_options_font_entry))); ++ cfg.playinfo_font = g_strdup(gtk_entry_get_text(GTK_ENTRY(prefswin_mainwin_font_entry))); + cfg.save_playlist_position = GTK_TOGGLE_BUTTON(prefswin_options_pl_pos)->active; + cfg.open_rev_order = GTK_TOGGLE_BUTTON(prefswin_options_oro)->active; + cfg.get_info_on_load = GTK_TOGGLE_BUTTON(prefswin_options_giol)->active; +@@ -310,7 +317,7 @@ + cfg.pause_between_songs_time = atoi(gtk_entry_get_text(GTK_ENTRY(prefswin_options_pbs_entry))); + cfg.use_backslash_as_dir_delimiter = GTK_TOGGLE_BUTTON(prefswin_options_ubsd)->active; + cfg.enable_dga = GTK_TOGGLE_BUTTON(prefswin_options_edga)->active; +- ++ cfg.xfont_for_playinfo = GTK_TOGGLE_BUTTON(prefswin_mainwin_xfont)->active; + cfg.use_eplugins = GTK_TOGGLE_BUTTON(prefswin_egplugins_euse_cbox)->active; + cfg.mouse_change = (gint) GTK_ADJUSTMENT(prefswin_options_mouse_entry)->value; + +@@ -345,6 +352,10 @@ + textbox_set_scroll(mainwin_info, TRUE); + } + ++ config_textbox(mainwin_info, 27); ++ g_free(mainwin_info->tb_old_skin_path); ++ mainwin_info->tb_old_skin_path = NULL; ++ + draw_main_window(TRUE); + draw_playlist_window(TRUE); + draw_equalizer_window(TRUE); +@@ -388,6 +399,25 @@ + } + } + ++void prefswin_mainwin_font_browse_ok(GtkWidget * w, gpointer data) ++{ ++ gtk_entry_set_text(GTK_ENTRY(prefswin_mainwin_font_entry), gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(prefswin_mainwin_fontsel))); ++ gtk_widget_destroy(prefswin_mainwin_fontsel); ++} ++ ++void prefswin_mainwin_font_browse_cb(GtkWidget * w, gpointer data) ++{ ++ if (!prefswin_mainwin_fontsel) ++ { ++ prefswin_mainwin_fontsel = gtk_font_selection_dialog_new(_("Select playinfo font:")); ++ gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(prefswin_mainwin_fontsel), cfg.playinfo_font); ++ gtk_signal_connect(GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(prefswin_mainwin_fontsel)->ok_button), "clicked", GTK_SIGNAL_FUNC(prefswin_mainwin_font_browse_ok), NULL); ++ gtk_signal_connect_object(GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(prefswin_mainwin_fontsel)->cancel_button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(prefswin_mainwin_fontsel)); ++ gtk_signal_connect(GTK_OBJECT(prefswin_mainwin_fontsel), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &prefswin_mainwin_fontsel); ++ gtk_widget_show(prefswin_mainwin_fontsel); ++ } ++} ++ + void prefswin_egplugins_euse_cb(GtkWidget * w, gpointer data) + { + cfg.use_eplugins = GTK_TOGGLE_BUTTON(w)->active; +@@ -709,6 +739,37 @@ + gtk_box_pack_start(GTK_BOX(prefswin_vplugins_hbox), prefswin_vplugins_use_cbox, TRUE, TRUE, 0); + + gtk_notebook_append_page(GTK_NOTEBOOK(prefswin_notebook), prefswin_vplugins_box, gtk_label_new(_("Visualization Plugins"))); ++ ++ /* ++ * Mainwin page ++ */ ++ ++ prefswin_mainwin_vbox = gtk_vbox_new(FALSE, 0); ++ prefswin_mainwin_frame = gtk_frame_new(_("Main Window")); ++ gtk_box_pack_start(GTK_BOX(prefswin_mainwin_vbox), prefswin_mainwin_frame, FALSE, FALSE, 0); ++ gtk_container_border_width(GTK_CONTAINER(prefswin_mainwin_frame), 5); ++ prefswin_mainwin_table = gtk_table_new(2, 10, FALSE); ++ gtk_container_add(GTK_CONTAINER(prefswin_mainwin_frame), prefswin_mainwin_table); ++ gtk_container_border_width(GTK_CONTAINER(prefswin_mainwin_table), 5); ++ ++ prefswin_mainwin_xfont = gtk_check_button_new_with_label(_("Enable X font display on main window")); ++ gtk_table_attach_defaults(GTK_TABLE(prefswin_mainwin_table), prefswin_mainwin_xfont, 0, 1, 0, 1); ++ ++ prefswin_mainwin_font_frame = gtk_frame_new(_("Playinfo font")); ++ gtk_container_set_border_width(GTK_CONTAINER(prefswin_mainwin_font_frame), 5); ++ gtk_box_pack_start(GTK_BOX(prefswin_mainwin_vbox), prefswin_mainwin_font_frame, FALSE, FALSE, 0); ++ prefswin_mainwin_font_hbox = gtk_hbox_new(FALSE, 5); ++ gtk_container_border_width(GTK_CONTAINER(prefswin_mainwin_font_hbox), 5); ++ gtk_container_add(GTK_CONTAINER(prefswin_mainwin_font_frame), prefswin_mainwin_font_hbox); ++ prefswin_mainwin_font_entry = gtk_entry_new(); ++ gtk_box_pack_start(GTK_BOX(prefswin_mainwin_font_hbox), prefswin_mainwin_font_entry, TRUE, TRUE, 0); ++ prefswin_mainwin_font_browse = gtk_button_new_with_label(_("Browse")); ++ gtk_signal_connect(GTK_OBJECT(prefswin_mainwin_font_browse), "clicked", GTK_SIGNAL_FUNC(prefswin_mainwin_font_browse_cb), NULL); ++ gtk_widget_set_usize(prefswin_mainwin_font_browse, 85, 17); ++ gtk_box_pack_start(GTK_BOX(prefswin_mainwin_font_hbox), prefswin_mainwin_font_browse, FALSE, TRUE, 0); ++ ++ gtk_notebook_append_page(GTK_NOTEBOOK(prefswin_notebook), prefswin_mainwin_vbox, gtk_label_new(_("Main Window"))); ++ + + /* + * Options page +@@ -1096,6 +1157,7 @@ + is_opening = TRUE; + + gtk_entry_set_text(GTK_ENTRY(prefswin_options_font_entry), cfg.playlist_font); ++ gtk_entry_set_text(GTK_ENTRY(prefswin_mainwin_font_entry), cfg.playinfo_font); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(prefswin_options_ami), cfg.allow_multiple_instances); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(prefswin_options_asc), cfg.always_show_cb); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(prefswin_options_cus), cfg.convert_underscore); +@@ -1117,6 +1179,7 @@ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(prefswin_options_pbs), cfg.pause_between_songs); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(prefswin_options_ubsd), cfg.use_backslash_as_dir_delimiter); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(prefswin_options_edga), cfg.enable_dga); ++ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(prefswin_mainwin_xfont), cfg.xfont_for_playinfo); + sprintf(temp, "%u", cfg.pause_between_songs_time); + gtk_entry_set_text(GTK_ENTRY(prefswin_options_pbs_entry), temp); + +diff -ru xmms-1.2.2/xmms/skin.c xmms-1.2.2-xfont/xmms/skin.c +--- xmms-1.2.2/xmms/skin.c Mon Jun 12 06:27:14 2000 ++++ xmms-1.2.2-xfont/xmms/skin.c Wed Jul 12 00:13:39 2000 +@@ -96,6 +96,56 @@ + return ret; + } + ++static void _find_textbg_textfg(GdkPixmap *text, GdkColor *bgc, GdkColor *fgc) ++{ ++ GdkImage *gi; ++ GdkColormap *cm; ++ int i; ++ int j; ++ ++ if (text == NULL) return; ++ gi = gdk_image_get(text, 0, 0, 155, 6); ++ cm = gdk_colormap_get_system(); ++ for (i = 0; i < 6; i ++) { ++ GdkColor c; ++ gint maxd = -1; ++ gint x; ++ gint y; ++ gint k = 0; ++ bgc[i].pixel = gdk_image_get_pixel(gi, 151, i); ++ if (cm->colors) { ++ for (j = 0; j < cm->size; j ++) if (bgc[i].pixel == cm->colors[j].pixel) { ++ bgc[i].red = cm->colors[j].red; ++ bgc[i].green = cm->colors[j].green; ++ bgc[i].blue = cm->colors[j].blue; ++ break; ++ } ++ } ++ while (maxd < 4 && (i + k) >= 0 && (i + k) < 6) { ++ gint d; ++ for (x = 1; x < 150; x ++) { ++ c.pixel = gdk_image_get_pixel(gi, x, i); ++ if (cm->colors) { ++ for (j = 0; j < cm->size; j ++) if (c.pixel == cm->colors[j].pixel) { ++ c.red = cm->colors[j].red; ++ c.green = cm->colors[j].green; ++ c.blue = cm->colors[j].blue; ++ break; ++ } ++ d = abs(c.red - bgc[i].red) + abs(c.green - bgc[i].green) + abs(c.blue - bgc[i].blue); ++ } else d = abs((c.pixel & 0xff) - (bgc[i].pixel & 0xff)) + abs(((c.pixel >> 8) & 0xff) - ((bgc[i].pixel >> 8) & 0xff)) + abs(((c.pixel >> 16) & 0xff) - ((bgc[i].pixel >> 16) & 0xff)); ++ if (d > maxd) { ++ if (cm->colors) fgc[i] = cm->colors[j]; ++ else fgc[i] = c; ++ maxd = d; ++ } ++ } ++ if (i < 3) k ++; ++ else k --; ++ } ++ } ++} ++ + void init_skins(void) + { + gint i; +@@ -106,6 +156,7 @@ + skin->def_titlebar = gdk_pixmap_create_from_xpm_d(mainwin->window, NULL, NULL, skin_titlebar); + skin->def_shufrep = gdk_pixmap_create_from_xpm_d(mainwin->window, NULL, NULL, skin_shufrep); + skin->def_text = gdk_pixmap_create_from_xpm_d(mainwin->window, NULL, NULL, skin_text); ++ _find_textbg_textfg(skin->def_text, skin->def_textbg, skin->def_textfg); + skin->def_volume = gdk_pixmap_create_from_xpm_d(mainwin->window, NULL, NULL, skin_volume); + skin->def_monostereo = gdk_pixmap_create_from_xpm_d(mainwin->window, NULL, NULL, skin_monoster); + skin->def_playpause = gdk_pixmap_create_from_xpm_d(mainwin->window, NULL, NULL, skin_playpaus); +@@ -488,6 +539,7 @@ + skin->titlebar = load_skin_pixmap(path, "titlebar.bmp", skin->def_titlebar); + skin->shufrep = load_skin_pixmap(path, "shufrep.bmp", skin->def_shufrep); + skin->text = load_skin_pixmap(path, "text.bmp", skin->def_text); ++ _find_textbg_textfg(skin->text, skin->textbg, skin->textfg); + skin->volume = load_skin_pixmap(path, "volume.bmp", skin->def_volume); + skin->balance = load_skin_pixmap(path, "balance.bmp", skin->def_volume); + skin->monostereo = load_skin_pixmap(path, "monoster.bmp", skin->def_monostereo); +@@ -689,6 +741,14 @@ + ret = skin->pledit_selectedbg; + if (!ret) + ret = &skin->def_pledit_selectedbg; ++ break; ++ case SKIN_TEXTBG: ++ if (skin->text) ret = skin->textbg; ++ else ret = skin->def_textbg; ++ break; ++ case SKIN_TEXTFG: ++ if (skin->text) ret = skin->textfg; ++ else ret = skin->def_textfg; + break; + } + return ret; +diff -ru xmms-1.2.2/xmms/skin.h xmms-1.2.2-xfont/xmms/skin.h +--- xmms-1.2.2/xmms/skin.h Wed Apr 12 06:46:18 2000 ++++ xmms-1.2.2-xfont/xmms/skin.h Wed Jul 12 00:13:42 2000 +@@ -30,7 +30,7 @@ + typedef enum + { + SKIN_PLEDIT_NORMAL, SKIN_PLEDIT_CURRENT, SKIN_PLEDIT_NORMALBG, +- SKIN_PLEDIT_SELECTEDBG ++ SKIN_PLEDIT_SELECTEDBG, SKIN_TEXTBG, SKIN_TEXTFG + } SkinColorIndex; + + +@@ -42,6 +42,8 @@ + GdkPixmap *titlebar, *def_titlebar; + GdkPixmap *shufrep, *def_shufrep; + GdkPixmap *text, *def_text; ++ GdkColor textbg[6], def_textbg[6]; ++ GdkColor textfg[6], def_textfg[6]; + GdkPixmap *volume, *def_volume; + GdkPixmap *balance, *def_balance; + GdkPixmap *monostereo, *def_monostereo; +diff -ru xmms-1.2.2/xmms/textbox.c xmms-1.2.2-xfont/xmms/textbox.c +--- xmms-1.2.2/xmms/textbox.c Fri Jun 16 06:17:19 2000 ++++ xmms-1.2.2-xfont/xmms/textbox.c Wed Jul 12 00:13:44 2000 +@@ -55,9 +55,9 @@ + cw = tb->tb_pixmap_width - tb->tb_offset; + if (cw > tb->tb_widget.width) + cw = tb->tb_widget.width; +- gdk_draw_pixmap(obj, tb->tb_widget.gc, src, tb->tb_offset, 0, tb->tb_widget.x, tb->tb_widget.y, cw, 6); ++ gdk_draw_pixmap(obj, tb->tb_widget.gc, src, tb->tb_offset, 0, tb->tb_widget.x, tb->tb_widget.y, cw, tb->tb_widget.height); + if (cw < tb->tb_widget.width) +- gdk_draw_pixmap(obj, tb->tb_widget.gc, src, 0, 0, tb->tb_widget.x + cw, tb->tb_widget.y, tb->tb_widget.width - cw, 6); ++ gdk_draw_pixmap(obj, tb->tb_widget.gc, src, 0, 0, tb->tb_widget.x + cw, tb->tb_widget.y, tb->tb_widget.width - cw, tb->tb_widget.height); + } + } + +@@ -157,6 +157,27 @@ + if (wl * 5 != tb->tb_widget.width) + wl++; + ++ tb->tb_is_scrollable = FALSE; ++ if (tb->tb_font) { ++ if (gdk_text_width(tb->tb_font, tb->tb_text, length) <= tb->tb_widget.width) { ++ tb->tb_is_scrollable = FALSE; ++ if (tb->tb_timeout_tag) { ++ gtk_timeout_remove(tb->tb_timeout_tag); ++ tb->tb_timeout_tag = 0; ++ } ++ } else if (tb->tb_scroll_allowed) { ++ tb->tb_is_scrollable = TRUE; ++ length += 7; ++ tb->tb_text = (gchar *) g_realloc(tb->tb_text, length + 1); ++ strcat(tb->tb_text, " *** "); ++ if (tb->tb_scroll_enabled && !tb->tb_timeout_tag) { ++ if (cfg.smooth_title_scroll) ++ tb->tb_timeout_tag = gtk_timeout_add(TEXTBOX_SCROLL_SMOOTH_TIMEOUT, textbox_scroll, tb); ++ else ++ tb->tb_timeout_tag = gtk_timeout_add(TEXTBOX_SCROLL_TIMEOUT, textbox_scroll, tb); ++ } ++ } ++ } else + if (length <= wl) + { + tb->tb_is_scrollable = FALSE; +@@ -178,6 +199,48 @@ + draw_widget(tb); + } + ++void generate_xfont_pixmap(TextBox * tb) ++{ ++ gint length, i, x, y; ++ GdkGC *gc; ++ GdkColor *c; ++ GdkBitmap *b; ++ ++ length = strlen(tb->tb_text); ++ ++ tb->tb_pixmap_width = gdk_text_width(tb->tb_font, tb->tb_text, length); ++ if (tb->tb_pixmap_width < tb->tb_widget.width) tb->tb_pixmap_width = tb->tb_widget.width; ++ tb->tb_pixmap = gdk_pixmap_new(mainwin->window, tb->tb_pixmap_width, tb->tb_widget.height, gdk_rgb_get_visual()->depth); ++ gc = tb->tb_widget.gc; ++ c = get_skin_color(SKIN_TEXTBG); ++ for (i = 0; i < tb->tb_widget.height; i++) { ++ gdk_gc_set_foreground(gc, &c[6 * i / tb->tb_widget.height]); ++ gdk_draw_line(tb->tb_pixmap, gc, 0, i, tb->tb_pixmap_width, i); ++ } ++ ++ b = gdk_pixmap_new(mainwin->window, tb->tb_pixmap_width, tb->tb_widget.height, 1); ++ c = calloc(sizeof(GdkColor),1); ++ gc = gdk_gc_new(b); ++ c->pixel = 0; ++ gdk_gc_set_foreground(gc, c); ++ gdk_draw_rectangle(b, gc, TRUE, 0, 0, tb->tb_pixmap_width, tb->tb_widget.height); ++ c->pixel = 1; ++ gdk_gc_set_foreground(gc, c); ++ gdk_draw_text(b, tb->tb_font, gc, 0, tb->tb_font->ascent, tb->tb_text, length); ++ gdk_gc_unref(gc); ++ free(c); ++ ++ gc = tb->tb_widget.gc; ++ gdk_gc_set_clip_mask(gc, b); ++ c = get_skin_color(SKIN_TEXTFG); ++ for (i = 0; i < tb->tb_widget.height; i++) { ++ gdk_gc_set_foreground(gc, &c[6 * i / tb->tb_widget.height]); ++ gdk_draw_line(tb->tb_pixmap, gc, 0, i, tb->tb_pixmap_width, i); ++ } ++ gdk_pixmap_unref(b); ++ gdk_gc_set_clip_mask(gc, NULL); ++} ++ + void textbox_generate_pixmap(TextBox * tb) + { + gint length, i, x, y; +@@ -189,6 +252,11 @@ + g_free(tb->tb_pixmap_text); + tb->tb_pixmap_text = g_strdup(tb->tb_text); + ++ if (tb->tb_font) { ++ generate_xfont_pixmap(tb); ++ return; ++ } ++ + length = strlen(tb->tb_text); + + if(tb->tb_is_scrollable && tb->tb_scroll_allowed) +@@ -378,6 +446,19 @@ + + } + ++void config_textbox(TextBox *tb, gint y) { ++ if (tb->tb_font) gdk_font_unref(tb->tb_font); ++ tb->tb_font = NULL; ++ tb->tb_widget.y = y; ++ tb->tb_widget.height = 6; ++ if (!(cfg.xfont_for_playinfo && strlen(cfg.playinfo_font) > 0)) return; ++ tb->tb_font = gdk_fontset_load(cfg.playinfo_font); ++ if (tb->tb_font == NULL) return; ++ tb->tb_widget.height = tb->tb_font->ascent + tb->tb_font->descent; ++ if (tb->tb_widget.height > 6) tb->tb_widget.y -= (tb->tb_widget.height - 6) / 2; ++ else tb->tb_widget.height = 6; ++} ++ + TextBox *create_textbox(GList ** wlist, GdkPixmap * parent, GdkGC * gc, gint x, gint y, gint w, gboolean allow_scroll, SkinIndex si) + { + TextBox *tb; +@@ -405,6 +486,8 @@ + { + if (tb->tb_pixmap) + gdk_pixmap_unref(tb->tb_pixmap); ++ if (tb->tb_font) ++ gdk_font_unref(tb->tb_font); + g_free(tb->tb_text); + g_free(tb); + } +diff -ru xmms-1.2.2/xmms/textbox.h xmms-1.2.2-xfont/xmms/textbox.h +--- xmms-1.2.2/xmms/textbox.h Wed Feb 16 13:05:59 2000 ++++ xmms-1.2.2-xfont/xmms/textbox.h Wed Jul 12 00:13:47 2000 +@@ -33,12 +33,14 @@ + tb_is_dragging; + gint tb_timeout_tag, tb_drag_x, tb_drag_off; + SkinIndex tb_skin_index; ++ GdkFont *tb_font; + } + TextBox; + + void textbox_set_text(TextBox * tb, gchar * text); + void textbox_set_scroll(TextBox * tb, gboolean s); + TextBox *create_textbox(GList ** wlist, GdkPixmap * parent, GdkGC * gc, gint x, gint y, gint w, gboolean allow_scroll, SkinIndex si); ++void config_textbox(TextBox * tb, gint y); + void free_textbox(TextBox * tb); + + #endif |