summaryrefslogtreecommitdiff
path: root/audio/TiMidity++/patches/patch-tclbitmaps
blob: f2e64e59d704e7809aa52765825c1fe2378d433a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
commit 009dd7494916089ca8a4a3c15c37bab4bc6fc7c7
Author: Yair K <cesium2@gmail.com>
Date:   Mon Aug 20 09:32:05 2012 +0200

    Include xbm bitmaps in the tcl interface itself
    
    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>

diff --git a/interface/Makefile.am b/interface/Makefile.am
index e45ce43..6ce4795 100644
--- a/interface/Makefile.am
+++ b/interface/Makefile.am
@@ -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
 
diff --git a/interface/tk_c.c b/interface/tk_c.c
index c5c9074..ff49568 100644
--- a/interface/tk_c.c
+++ b/interface/tk_c.c
@@ -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*/
diff --git a/interface/tkpanel.tcl b/interface/tkpanel.tcl
index e826c54..e64f509 100755
--- a/interface/tkpanel.tcl
+++ b/interface/tkpanel.tcl
@@ -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\