OSDN Git Service

Include xbm bitmaps in the tcl interface itself
authorYair K <cesium2@gmail.com>
Mon, 20 Aug 2012 07:32:05 +0000 (09:32 +0200)
committerHans de Goede <hdegoede@redhat.com>
Mon, 20 Aug 2012 07:32:05 +0000 (09:32 +0200)
Include xbm bitmaps in the tcl interface itself rather than as files in the
system.

Also, include tcl.h a bit later to avoid a redefine warning on reverb.h.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
interface/Makefile.am
interface/tk_c.c
interface/tkpanel.tcl

index e45ce43..6ce4795 100644 (file)
@@ -275,7 +275,7 @@ if ENABLE_DYNAMIC_XAW
 install_xaw = install.xaw
 endif
 
-install.tk: $(ALLTCLF) install.bitmaps
+install.tk: $(ALLTCLF)
        test -d $(DESTDIR)$(TCL_DIR) || mkdir -p $(DESTDIR)$(TCL_DIR)
        for f in $(ALLTCLF) ''; do case ".$$f" in .);; *) $(INSTALL_DATA) $$f $(DESTDIR)$(TCL_DIR);; esac; done
 
index c5c9074..ff49568 100644 (file)
@@ -46,8 +46,6 @@
 #include <sys/ipc.h>
 #include <sys/shm.h>
 #include <sys/sem.h>
-#include <tcl.h>
-#include <tk.h>
 #include <sys/wait.h>
 
 #include "timidity.h"
@@ -60,6 +58,9 @@
 #include "miditrace.h"
 #include "aq.h"
 
+#include <tcl.h>
+#include <tk.h>
+
 #ifndef TKPROGPATH
 #define TKPROGPATH PKGLIBDIR "/tkmidity.tcl"
 #endif /* TKPROGPATH */
@@ -871,6 +872,21 @@ static Tcl_Interp *my_interp;
 
 static int AppInit(Tcl_Interp *interp)
 {
+#include "bitmaps/back.xbm"
+#include "bitmaps/fwrd.xbm"
+#include "bitmaps/next.xbm"
+#include "bitmaps/pause.xbm"
+#include "bitmaps/play.xbm"
+#include "bitmaps/prev.xbm"
+#include "bitmaps/quit.xbm"
+#include "bitmaps/stop.xbm"
+#include "bitmaps/timidity.xbm"
+
+#define DefineBitmap(Bitmap) do { \
+       Tk_DefineBitmap (interp, Tk_GetUid(#Bitmap), Bitmap##_bits, \
+                        Bitmap##_width, Bitmap##_height); \
+       } while(0)
+
        my_interp = interp;
 
        if (Tcl_Init(interp) == TCL_ERROR) {
@@ -890,7 +906,19 @@ static int AppInit(Tcl_Interp *interp)
                          (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
        Tcl_CreateCommand(interp, "TraceUpdate", (Tcl_CmdProc*) TraceUpdate,
                          (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
+
+       DefineBitmap(back);
+       DefineBitmap(fwrd);
+       DefineBitmap(next);
+       DefineBitmap(pause);
+       DefineBitmap(play);
+       DefineBitmap(prev);
+       DefineBitmap(quit);
+       DefineBitmap(stop);
+       DefineBitmap(timidity);
+
        return TCL_OK;
+#undef DefineBitmap
 }
 
 /*ARGSUSED*/
index e826c54..e64f509 100755 (executable)
@@ -87,7 +87,7 @@ proc InitGlobal {} {
     wm title . "TkMidity"
     wm iconname . "TkMidity"
     global bitmap_path
-    wm iconbitmap . @$bitmap_path/timidity.xbm
+    wm iconbitmap . "timidity"
 }
 
 
@@ -825,22 +825,14 @@ proc CreateWindow {} {
     global bitmap_path
     frame .body.button -relief raised -bd 1
     pack .body.button -side top -expand 1 -fill x
-    button .body.button.play -bitmap @$bitmap_path/play.xbm\
-           -command "PlayCmd"
-    button .body.button.stop -bitmap @$bitmap_path/stop.xbm\
-           -command "StopCmd"
-    button .body.button.prev -bitmap @$bitmap_path/prev.xbm\
-           -command "PrevCmd"
-    button .body.button.back -bitmap @$bitmap_path/back.xbm\
-           -command "BackwardCmd"
-    button .body.button.fwrd -bitmap @$bitmap_path/fwrd.xbm\
-           -command "ForwardCmd"
-    button .body.button.next -bitmap @$bitmap_path/next.xbm\
-           -command "NextCmd"
-    button .body.button.pause -bitmap @$bitmap_path/pause.xbm\
-           -command "PauseCmd"
-    button .body.button.quit -bitmap @$bitmap_path/quit.xbm\
-           -command "QuitCmd"
+    button .body.button.play -bitmap "play" -command "PlayCmd"
+    button .body.button.stop -bitmap "stop" -command "StopCmd"
+    button .body.button.prev -bitmap "prev" -command "PrevCmd"
+    button .body.button.back -bitmap "back" -command "BackwardCmd"
+    button .body.button.fwrd -bitmap "fwrd" -command "ForwardCmd"
+    button .body.button.next -bitmap "next" -command "NextCmd"
+    button .body.button.pause -bitmap "pause" -command "PauseCmd"
+    button .body.button.quit -bitmap "quit" -command "QuitCmd"
     pack .body.button.play .body.button.pause\
            .body.button.prev .body.button.back\
            .body.button.stop\