Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 01a2d9e

Browse files
committed
Use FSpCreateResFile() in stead of CreateResFile().
Don't call OpenDeskAcc() and AppendResMenu() on Carbon.
1 parent bf21bef commit 01a2d9e

9 files changed

Lines changed: 14 additions & 18 deletions

File tree

Mac/Demo/waste/htmled.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import Scrap
1515
import os
1616
import macfs
17+
import MACFS
1718
import regsub
1819
import string
1920
import htmllib
@@ -243,7 +244,7 @@ def menu_save(self):
243244
try:
244245
rf = Res.FSpOpenResFile(self.path, 3)
245246
except Res.Error:
246-
Res.CreateResFile(self.path)
247+
Res.FSpCreateResFile(self.path, '????', 'TEXT', MACFS.smAllScripts)
247248
rf = Res.FSpOpenResFile(self.path, 3)
248249
styles = Res.Resource('')
249250
soup = Res.Resource('')

Mac/Demo/waste/swed.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import Scrap
1515
import os
1616
import macfs
17+
import MACFS
1718

1819
UNDOLABELS = [ # Indexed by WEGetUndoInfo() value
1920
None, "", "typing", "Cut", "Paste", "Clear", "Drag", "Style"]
@@ -212,7 +213,7 @@ def menu_save(self):
212213
try:
213214
rf = Res.FSpOpenResFile(self.path, 3)
214215
except Res.Error:
215-
Res.CreateResFile(self.path)
216+
Res.FSpCreateResFile(self.path, '????', 'TEXT', MACFS.smAllScripts)
216217
rf = Res.FSpOpenResFile(self.path, 3)
217218
styles = Res.Resource('')
218219
soup = Res.Resource('')

Mac/Lib/FrameWork.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,12 +674,13 @@ def __init__(self, bar, abouttext="About me...", aboutcallback=None):
674674
Menu.__init__(self, bar, "\024")
675675
self.additem(abouttext, None, aboutcallback)
676676
self.addseparator()
677-
self.menu.AppendResMenu('DRVR')
677+
if MacOS.runtimemodel == 'ppc':
678+
self.menu.AppendResMenu('DRVR')
678679

679680
def dispatch(self, id, item, window, event):
680681
if item == 1:
681682
Menu.dispatch(self, id, item, window, event)
682-
else:
683+
elif MacOS.runtimemodel == 'ppc':
683684
name = self.menu.GetMenuItemText(item)
684685
OpenDeskAcc(name)
685686

Mac/Lib/buildtools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def process_common(template, progress, code, rsrcname, destname, is_update, copy
140140
try:
141141
output = Res.FSpOpenResFile(dest_fss, WRITE)
142142
except MacOS.Error:
143-
Res.CreateResFile(destname)
143+
Res.FSpCreateResFile(destname, '????', 'APPL', MACFS.smAllScripts)
144144
output = Res.FSpOpenResFile(dest_fss, WRITE)
145145

146146
# Copy the resources from the target specific resource template, if any

Mac/Lib/lib-toolbox/Menus.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Generated from 'Macintosh HD:SWDev:Metrowerks Codewarrior 6.0:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:Menus.h'
1+
# Generated from "Sap:Programma's:Metrowerks CodeWarrior 6.0:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:Menus.h"
22

33
def FOUR_CHAR_CODE(x): return x
44
noMark = 0

Mac/Lib/lib-toolbox/MiniAEFrame.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ def __init__(self):
3636
Menu.ClearMenuBar()
3737
self.applemenu = applemenu = Menu.NewMenu(self.appleid, "\024")
3838
applemenu.AppendMenu("%s;(-" % self.getaboutmenutext())
39-
applemenu.AppendResMenu('DRVR')
39+
if MacOS.runtimemodel == 'ppc':
40+
applemenu.AppendResMenu('DRVR')
4041
applemenu.InsertMenu(0)
4142
self.quitmenu = Menu.NewMenu(self.quitid, "File")
4243
self.quitmenu.AppendMenu("Quit")
@@ -93,7 +94,7 @@ def lowlevelhandler(self, event):
9394
if id == self.appleid:
9495
if item == 1:
9596
EasyDialogs.Message(self.getabouttext())
96-
elif item > 1:
97+
elif item > 1 and hasattr(Menu, 'OpenDeskAcc'):
9798
name = self.applemenu.GetMenuItemText(item)
9899
Menu.OpenDeskAcc(name)
99100
elif id == self.quitid and item == 1:

Mac/Lib/lib-toolbox/QuickDraw.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Generated from 'Macintosh HD:SWDev:Metrowerks Codewarrior 6.0:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:QuickDraw.h'
1+
# Generated from "Sap:Programma's:Metrowerks CodeWarrior 6.0:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:QuickDraw.h"
22

33

44
def FOUR_CHAR_CODE(x): return x
@@ -173,7 +173,7 @@ def FOUR_CHAR_CODE(x): return x
173173
kCursorComponentMove = 0x0008
174174
kCursorComponentAnimate = 0x0009
175175
kCursorComponentLastReserved = 0x0050
176-
# Generated from 'Macintosh HD:SWDev:Metrowerks Codewarrior 6.0:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:QuickDrawText.h'
176+
# Generated from "Sap:Programma's:Metrowerks CodeWarrior 6.0:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:QuickDrawText.h"
177177

178178

179179
def FOUR_CHAR_CODE(x): return x

Mac/Lib/test/AEservertest.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ def __init__(self):
7575
Menu.ClearMenuBar()
7676
self.applemenu = applemenu = Menu.NewMenu(self.appleid, "\024")
7777
applemenu.AppendMenu("All about echo...;(-")
78-
applemenu.AppendResMenu('DRVR')
7978
applemenu.InsertMenu(0)
8079

8180
self.filemenu = Menu.NewMenu(self.fileid, 'File')
@@ -146,9 +145,6 @@ def menuhit(self, result):
146145
if id == self.appleid:
147146
if item == 1:
148147
mymessage("Echo -- echo AppleEvents")
149-
elif item > 1:
150-
name = self.applemenu.GetItem(item)
151-
Qd.OpenDeskAcc(name)
152148
elif id == self.fileid:
153149
if item == 1:
154150
raise Quit

Mac/Lib/test/echo.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ def __init__(self):
5656
Menu.ClearMenuBar()
5757
self.applemenu = applemenu = Menu.NewMenu(self.appleid, "\024")
5858
applemenu.AppendMenu("All about echo...;(-")
59-
applemenu.AppendResMenu('DRVR')
6059
applemenu.InsertMenu(0)
6160
Menu.DrawMenuBar()
6261

@@ -105,9 +104,6 @@ def lowlevelhandler(self, event):
105104
if id == self.appleid:
106105
if item == 1:
107106
mymessage("Echo -- echo AppleEvents")
108-
elif item > 1:
109-
name = self.applemenu.GetItem(item)
110-
Qd.OpenDeskAcc(name)
111107
elif what <> autoKey:
112108
print "Event:", (eventname(what), message, when, (h, v), modifiers)
113109
## MacOS.HandleEvent(event)

0 commit comments

Comments
 (0)