Tk Source Code

Artifact [369852e5]
Login

Artifact 369852e547ba9fd75fd80b3a4df478b438da7f57:

Attachment "resource.patch" to ticket [1614362f] added by mdejong 2006-12-13 06:35:59.
2006-12-12  Mo DeJong  <[email protected]>

	* win/tkWinButton.c (InitBoxes): Call Tcl_Panic()
	if loading of bitmap resources fails. This change
	generates an error if Tk is unable to find button
	widget resources instead of silently failing and
	then drawing widgets incorrectly.
	win/rc/tk_base.rc: If the user defines BASE_NO_TK_ICON
	then compile the base resources file without a
	"tk" icon. This change makes it easier to replace the
	default tk icon with a custom icon.
Index: win/tkWinButton.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/win/tkWinButton.c,v
retrieving revision 1.28
diff -u -r1.28 tkWinButton.c
--- win/tkWinButton.c	2 Dec 2005 13:42:29 -0000	1.28
+++ win/tkWinButton.c	12 Dec 2006 23:19:03 -0000
@@ -134,7 +134,10 @@
 	    Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
 
     hrsrc = FindResource(module, "buttons", RT_BITMAP);
-    if (hrsrc) {
+    if (hrsrc == NULL) {
+	Tcl_Panic("FindResource() failed for buttons bitmap resource, "
+            "resources in tk_base.rc must be linked into Tk dll or static executable");
+    } else {
 	hblk = LoadResource(module, hrsrc);
 	tsdPtr->boxesPtr = (LPBITMAPINFOHEADER)LockResource(hblk);
     }
Index: win/rc/tk_base.rc
===================================================================
RCS file: /cvsroot/tktoolkit/tk/win/rc/tk_base.rc,v
retrieving revision 1.3
diff -u -r1.3 tk_base.rc
--- win/rc/tk_base.rc	13 Jan 2004 02:01:55 -0000	1.3
+++ win/rc/tk_base.rc	12 Dec 2006 23:19:03 -0000
@@ -8,8 +8,15 @@
 //
 //  Tk Icon
 //
+//  The BASE_NO_TK_ICON symbol can be defined to avoid
+//  creating an icon named "tk" in this resource file.
+//  The user can then create another icon named tk in
+//  another resource file and link both resource files.
+//  Tk will then use the custom icon instead of tk.ico.
 
+#ifndef BASE_NO_TK_ICON
 tk                      ICON    DISCARDABLE     "tk.ico"
+#endif
 
 #include <dlgs.h>