|
From: <pbr...@us...> - 2011-03-01 06:06:35
|
Revision: 1833
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1833&view=rev
Author: pbrentsimmons
Date: 2011-03-01 06:06:29 +0000 (Tue, 01 Mar 2011)
Log Message:
-----------
Fixed a bug loading custom icons in customiconload.
Modified Paths:
--------------
Frontier/trunk/Common/source/icon.c
Modified: Frontier/trunk/Common/source/icon.c
===================================================================
--- Frontier/trunk/Common/source/icon.c 2011-03-01 06:05:14 UTC (rev 1832)
+++ Frontier/trunk/Common/source/icon.c 2011-03-01 06:06:29 UTC (rev 1833)
@@ -239,63 +239,64 @@
} /*customicongetresid*/
- static boolean customiconload (bigstring bsiconname, short *rnum) {
-
- //
- // 2006-06-18 creedon: FSRef-ized
- //
- // 7.0b9 PBS: Open a resource file just once, store info about it, so it doesn't have to be opened for each rendering.
- //
-
- bigstring bsappearancefolder = "\x0a" "Appearance";
- bigstring bsiconsfolder = "\x05" "Icons";
- tyfilespec programfilespec, appearancefolder, iconsfolder, iconfilespec;
- short r, ixcurricon;
-
- if (ixnexticon >= maxcustomicontypes)
- return (false); // limit reached
-
- // get app filespec
-
- getapplicationfilespec (nil, &programfilespec);
-
- // get Appearances folder
-
- if (macgetfilespecchildfrombigstring (&programfilespec, bsappearancefolder, &appearancefolder) != noErr)
- return (false);
-
- // get Icons folder
-
- if (macgetfilespecchildfrombigstring (&appearancefolder, bsiconsfolder, &iconsfolder) != noErr)
- return (false);
-
- // get icon file
-
- if (macgetfilespecchildfrombigstring (&iconsfolder, bsiconname, &iconfilespec) != noErr)
- return (false);
-
- if (!openresourcefile (&iconfilespec, &r, resourcefork))
- return (false);
+static boolean customiconload (bigstring bsiconname, short *rnum) {
+
+ //
+ // 2006-06-18 creedon: FSRef-ized
+ //
+ // 7.0b9 PBS: Open a resource file just once, store info about it, so it doesn't have to be opened for each rendering.
+ //
+
+ bigstring bsappearancefolder = "\x0a" "Appearance";
+ bigstring bsiconsfolder = "\x05" "Icons";
+ tyfilespec programfilespec, appfolderfilespec, appearancefolder, iconsfolder, iconfilespec;
+ short r, ixcurricon;
+
+ if (ixnexticon >= maxcustomicontypes)
+ return (false); // limit reached
+
+ // get app filespec
+
+ getapplicationfilespec (nil, &programfilespec);
+ macgetfilespecparent(&programfilespec, &appfolderfilespec); //PBS 8 Sep 2010: need parent folder of app before getting Appearance folder
+
+ // get Appearances folder
+
+ if (macgetfilespecchildfrombigstring (&appfolderfilespec, bsappearancefolder, &appearancefolder) != noErr)
+ return (false);
+
+ // get Icons folder
+
+ if (macgetfilespecchildfrombigstring (&appearancefolder, bsiconsfolder, &iconsfolder) != noErr)
+ return (false);
+
+ // get icon file
+
+ if (macgetfilespecchildfrombigstring (&iconsfolder, bsiconname, &iconfilespec) != noErr)
+ return (false);
+
+ if (!openresourcefile (&iconfilespec, &r, resourcefork))
+ return (false);
+
+ if (r == -1)
+ return (false);
+
+ *rnum = r;
+
+ ixcurricon = ixnexticon;
+
+ ixnexticon++;
+
+ alllower (bsiconname);
+
+ copystring (bsiconname, icontypes [ixcurricon].bstype);
+
+ icontypes [ixcurricon].rnum = r;
+
+ return (true);
+
+} // customiconload
- if (r == -1)
- return (false);
-
- *rnum = r;
-
- ixcurricon = ixnexticon;
-
- ixnexticon++;
-
- alllower (bsiconname);
-
- copystring (bsiconname, icontypes [ixcurricon].bstype);
-
- icontypes [ixcurricon].rnum = r;
-
- return (true);
-
- } // customiconload
-
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|