mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 14:53:52 +00:00
Re-add clipboard functions
This commit is contained in:
@@ -230,6 +230,7 @@ void CloseThisWindow (WindowPtr *);
|
||||
// THREEWORDINLINE(0x4218, 0x10B8, 0x0260);
|
||||
#endif
|
||||
|
||||
|
||||
extern Boolean hasScrap, scrapIsARoom;
|
||||
|
||||
#include "GliderDefines.h"
|
||||
|
@@ -435,8 +435,8 @@ void QuickBandsRefresh (Boolean);
|
||||
void QuickFoilRefresh (Boolean);
|
||||
void HandleScore (void);
|
||||
|
||||
//void PutRoomScrap (void); // --- Scrap.c
|
||||
//void PutObjectScrap (void);
|
||||
void PutRoomScrap (void); // --- Scrap.c
|
||||
void PutObjectScrap (void);
|
||||
void GetRoomScrap (void);
|
||||
void GetObjectScrap (void);
|
||||
//void SeeIfValidScrapAvailable (Boolean);
|
||||
|
@@ -185,6 +185,7 @@
|
||||
<ClCompile Include="RubberBands.cpp" />
|
||||
<ClCompile Include="SavedGames.cpp" />
|
||||
<ClCompile Include="Scoreboard.cpp" />
|
||||
<ClCompile Include="Scrap.cpp" />
|
||||
<ClCompile Include="SelectHouse.cpp" />
|
||||
<ClCompile Include="Settings.cpp" />
|
||||
<ClCompile Include="Sound.cpp" />
|
||||
|
@@ -213,6 +213,9 @@
|
||||
<ClCompile Include="SoundSync_Win32.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Scrap.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="SoundSync.h">
|
||||
|
@@ -157,7 +157,7 @@ void VariableInit (void)
|
||||
paused = false;
|
||||
hasMirror = false;
|
||||
demoGoing = false;
|
||||
// scrapIsARoom = true;
|
||||
scrapIsARoom = true;
|
||||
splashDrawn = false;
|
||||
|
||||
#ifndef COMPILEDEMO
|
||||
|
@@ -198,21 +198,21 @@ void UpdateClipboardMenus (void)
|
||||
|
||||
mm->SetItemEnabled(houseMenu, iCut - 1, true);
|
||||
mm->SetItemEnabled(houseMenu, iCopy - 1, true);
|
||||
// if (hasScrap)
|
||||
// {
|
||||
// EnableMenuItem(houseMenu, iPaste);
|
||||
// if (scrapIsARoom)
|
||||
// {
|
||||
// GetLocalizedString(42, title);
|
||||
// SetMenuItemText(houseMenu, iPaste, title);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// GetLocalizedString(43, title);
|
||||
// SetMenuItemText(houseMenu, iPaste, title);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
if (hasScrap)
|
||||
{
|
||||
EnableMenuItem(houseMenu, iPaste);
|
||||
if (scrapIsARoom)
|
||||
{
|
||||
GetLocalizedString(42, title);
|
||||
SetMenuItemText(houseMenu, iPaste, title);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetLocalizedString(43, title);
|
||||
SetMenuItemText(houseMenu, iPaste, title);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mm->SetItemEnabled(houseMenu, iPaste - 1, false);
|
||||
GetLocalizedString(44, title);
|
||||
@@ -516,12 +516,12 @@ void DoHouseMenu (short theItem)
|
||||
{
|
||||
if (objActive > kNoObjectSelected)
|
||||
{
|
||||
// PutObjectScrap();
|
||||
PutObjectScrap();
|
||||
DeleteObject();
|
||||
}
|
||||
else
|
||||
{
|
||||
// PutRoomScrap();
|
||||
PutRoomScrap();
|
||||
DeleteRoom(false);
|
||||
}
|
||||
UpdateClipboardMenus();
|
||||
@@ -531,10 +531,10 @@ void DoHouseMenu (short theItem)
|
||||
case iCopy:
|
||||
if (houseUnlocked)
|
||||
{
|
||||
// if (objActive > kNoObjectSelected)
|
||||
// PutObjectScrap();
|
||||
// else
|
||||
// PutRoomScrap();
|
||||
if (objActive > kNoObjectSelected)
|
||||
PutObjectScrap();
|
||||
else
|
||||
PutRoomScrap();
|
||||
UpdateClipboardMenus();
|
||||
}
|
||||
break;
|
||||
@@ -542,12 +542,11 @@ void DoHouseMenu (short theItem)
|
||||
case iPaste:
|
||||
if (houseUnlocked)
|
||||
{
|
||||
/* if (scrapIsARoom)
|
||||
if (scrapIsARoom)
|
||||
GetRoomScrap();
|
||||
else
|
||||
GetObjectScrap();
|
||||
UpdateClipboardMenus();
|
||||
*/
|
||||
}
|
||||
break;
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
547
GpApp/Scrap.cpp
Normal file
547
GpApp/Scrap.cpp
Normal file
@@ -0,0 +1,547 @@
|
||||
|
||||
//============================================================================
|
||||
//----------------------------------------------------------------------------
|
||||
// Scrap.c
|
||||
//----------------------------------------------------------------------------
|
||||
//============================================================================
|
||||
|
||||
#include "Externs.h"
|
||||
#include "Environ.h"
|
||||
#include "MemoryManager.h"
|
||||
|
||||
|
||||
|
||||
Boolean hasScrap, scrapIsARoom;
|
||||
|
||||
extern WindowPtr mapWindow;
|
||||
extern Rect roomObjectRects[];
|
||||
extern short objActive;
|
||||
|
||||
|
||||
//============================================================== Functions
|
||||
|
||||
THandle<void> scrapData;
|
||||
int32_t scrapType;
|
||||
|
||||
PLError_t ZeroScrap()
|
||||
{
|
||||
scrapType = 0;
|
||||
scrapData.Dispose();
|
||||
scrapData = nullptr;
|
||||
return PLErrors::kNone;
|
||||
}
|
||||
|
||||
PLError_t PutScrap(size_t size, int32_t typeID, const void *data)
|
||||
{
|
||||
scrapData.Dispose();
|
||||
|
||||
if (size)
|
||||
{
|
||||
scrapData = THandle<void>(PortabilityLayer::MemoryManager::GetInstance()->AllocHandle(size));
|
||||
if (!scrapData)
|
||||
return PLErrors::kOutOfMemory;
|
||||
|
||||
memcpy(*scrapData, data, size);
|
||||
}
|
||||
|
||||
scrapType = typeID;
|
||||
|
||||
return PLErrors::kNone;
|
||||
}
|
||||
|
||||
PLError_t GetScrap(THandle<void> destHdl, int32_t typeID, long *outSize)
|
||||
{
|
||||
if (scrapType != typeID || !scrapData)
|
||||
return PLErrors::kInvalidParameter;
|
||||
|
||||
size_t scrapSize = scrapData.MMBlock()->m_size;
|
||||
|
||||
if (scrapSize)
|
||||
{
|
||||
PortabilityLayer::MemoryManager::GetInstance()->ResizeHandle(destHdl.MMBlock(), scrapSize);
|
||||
memcpy(*destHdl, *scrapData, scrapSize);
|
||||
}
|
||||
|
||||
return PLErrors::kNone;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- PutRoomScrap
|
||||
|
||||
#ifndef COMPILEDEMO
|
||||
void PutRoomScrap (void)
|
||||
{
|
||||
// this function copies the current room into the clipboard
|
||||
Rect largeBounds, smallBounds;
|
||||
PLError_t theErr;
|
||||
|
||||
theErr = ZeroScrap();
|
||||
if (theErr == PLErrors::kNone)
|
||||
{
|
||||
SetRect(&largeBounds, 0, 0, kRoomWide, kTileHigh);
|
||||
SetRect(&smallBounds, 0, 0, kRoomWide / 4, kTileHigh / 4);
|
||||
|
||||
theErr = PutScrap(sizeof(roomType), 'Room', (Ptr)thisRoom);
|
||||
if (theErr == PLErrors::kNone)
|
||||
{
|
||||
if (!hasScrap)
|
||||
{
|
||||
hasScrap = true;
|
||||
UpdateMenus(false);
|
||||
}
|
||||
scrapIsARoom = true;
|
||||
}
|
||||
else
|
||||
YellowAlert(kYellowScrapError, theErr);
|
||||
}
|
||||
else
|
||||
YellowAlert(kYellowScrapError, theErr);
|
||||
}
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------------------- PutObjectScrap
|
||||
|
||||
#ifndef COMPILEDEMO
|
||||
void PutObjectScrap (void)
|
||||
{
|
||||
// this function copies the currently selected object into the clipboard
|
||||
Str255 kindStr;
|
||||
objectPtr scrapObjPtr;
|
||||
long theErr;
|
||||
|
||||
theErr = ZeroScrap();
|
||||
if (theErr == PLErrors::kNone)
|
||||
{
|
||||
scrapObjPtr = &(thisRoom->objects[objActive]);
|
||||
theErr = PutScrap(sizeof(objectType), 'Obj.', (Ptr)scrapObjPtr);
|
||||
if (theErr == PLErrors::kNone)
|
||||
{
|
||||
if (!hasScrap)
|
||||
{
|
||||
hasScrap = true;
|
||||
UpdateMenus(false);
|
||||
}
|
||||
scrapIsARoom = false;
|
||||
}
|
||||
else
|
||||
YellowAlert(kYellowScrapError, theErr);
|
||||
}
|
||||
else
|
||||
YellowAlert(kYellowScrapError, theErr);
|
||||
}
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------------------- GetRoomScrap
|
||||
|
||||
#ifndef COMPILEDEMO
|
||||
void GetRoomScrap (void)
|
||||
{
|
||||
// this function pastes a room from the clipboard
|
||||
Handle tempRoom;
|
||||
long theErr, scrapOffset;
|
||||
short wasFloor, wasSuite, srcRoomNumber, destRoomNumber, i;
|
||||
short linkRoomNumber;
|
||||
|
||||
tempRoom = NewHandle(0L);
|
||||
if (tempRoom == nil)
|
||||
{
|
||||
YellowAlert(kYellowNoMemory, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
theErr = GetScrap(tempRoom, 'Room', &scrapOffset);
|
||||
if (theErr < 0)
|
||||
YellowAlert(kYellowScrapError, theErr);
|
||||
else
|
||||
{
|
||||
DeselectObject();
|
||||
|
||||
wasFloor = thisRoom->floor;
|
||||
wasSuite = thisRoom->suite;
|
||||
destRoomNumber = GetRoomNumber(thisRoom->floor, thisRoom->suite);
|
||||
|
||||
memcpy(thisRoom, *tempRoom, sizeof(roomType));
|
||||
tempRoom.Dispose();
|
||||
|
||||
srcRoomNumber = GetRoomNumber(thisRoom->floor, thisRoom->suite);
|
||||
thisRoom->floor = wasFloor;
|
||||
thisRoom->suite = wasSuite;
|
||||
|
||||
for (i = 0; i < kMaxRoomObs; i++) // fix links
|
||||
{ // first see if a linkable object
|
||||
if ((ObjectIsLinkTransport(&thisRoom->objects[i])) ||
|
||||
(ObjectIsLinkSwitch(&thisRoom->objects[i])))
|
||||
{
|
||||
linkRoomNumber = GetRoomLinked (&thisRoom->objects[i]);
|
||||
if (linkRoomNumber == srcRoomNumber)
|
||||
{ // if linked to an object in same room<6F>
|
||||
if (ObjectIsLinkSwitch(&thisRoom->objects[i]))
|
||||
{ // point to new room location
|
||||
thisRoom->objects[i].data.d.where =
|
||||
(wasSuite * 100) + wasFloor + kNumUndergroundFloors;
|
||||
}
|
||||
else
|
||||
{ // point to new room location
|
||||
thisRoom->objects[i].data.e.where =
|
||||
(wasSuite * 100) + wasFloor + kNumUndergroundFloors;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CopyThisRoomToRoom();
|
||||
ReflectCurrentRoom(false);
|
||||
fileDirty = true;
|
||||
UpdateMenus(false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------------------- GetObjectScrap
|
||||
|
||||
#ifndef COMPILEDEMO
|
||||
void GetObjectScrap (void)
|
||||
{
|
||||
// this function pastes an object from the clipboard
|
||||
objectType tempObject;
|
||||
Handle tempObjectHand;
|
||||
Point noPoint;
|
||||
long theErr, scrapOffset;
|
||||
short direction, dist;
|
||||
|
||||
tempObjectHand = NewHandle(0L);
|
||||
if (tempObjectHand == nil)
|
||||
{
|
||||
YellowAlert(kYellowNoMemory, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
theErr = GetScrap(tempObjectHand, 'Obj.', &scrapOffset);
|
||||
if (theErr < 0)
|
||||
YellowAlert(kYellowScrapError, theErr);
|
||||
else
|
||||
{
|
||||
DeselectObject();
|
||||
|
||||
noPoint.h = 100;
|
||||
noPoint.v = 100;
|
||||
memcpy(&tempObject, *tempObjectHand, sizeof(objectType));
|
||||
if (AddNewObject(noPoint, tempObject.what, false))
|
||||
{
|
||||
thisRoom->objects[objActive] = tempObject;
|
||||
ReadyBackground(thisRoom->background, thisRoom->tiles);
|
||||
GetThisRoomsObjRects();
|
||||
DrawThisRoomsObjects();
|
||||
|
||||
UpdateMainWindow();
|
||||
|
||||
if (ObjectHasHandle(&direction, &dist))
|
||||
{
|
||||
StartMarqueeHandled(&roomObjectRects[objActive], direction, dist);
|
||||
HandleBlowerGlider();
|
||||
}
|
||||
else
|
||||
StartMarquee(&roomObjectRects[objActive]);
|
||||
}
|
||||
|
||||
tempObjectHand.Dispose();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------------------- SeeIfValidScrapAvailable
|
||||
|
||||
#ifndef COMPILEDEMO
|
||||
void SeeIfValidScrapAvailable (Boolean updateMenus)
|
||||
{
|
||||
Handle tempRoom, tempObject;
|
||||
long theErr, scrapOffset;
|
||||
|
||||
hasScrap = false;
|
||||
|
||||
tempRoom = NewHandle(0L);
|
||||
if (tempRoom != nil)
|
||||
{
|
||||
theErr = GetScrap(tempRoom, 'Room', &scrapOffset);
|
||||
if (theErr >= 0)
|
||||
{
|
||||
hasScrap = true;
|
||||
scrapIsARoom = true;
|
||||
}
|
||||
tempRoom.Dispose();
|
||||
}
|
||||
|
||||
tempObject = NewHandle(0L);
|
||||
if (tempObject != nil)
|
||||
{
|
||||
theErr = GetScrap(tempObject, 'Obj.', &scrapOffset);
|
||||
if (theErr >= 0)
|
||||
{
|
||||
hasScrap = true;
|
||||
scrapIsARoom = false;
|
||||
}
|
||||
tempObject.Dispose();
|
||||
}
|
||||
|
||||
if (updateMenus)
|
||||
UpdateClipboardMenus();
|
||||
}
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------------------- DropLocationIsTrash
|
||||
#if 0
|
||||
Boolean DropLocationIsTrash (AEDesc *dropLocation)
|
||||
{
|
||||
AEDesc dropSpec;
|
||||
FSSpec *theSpec;
|
||||
CInfoPBRec thePB;
|
||||
long trashDirID;
|
||||
OSErr theErr;
|
||||
short trashVRefNum;
|
||||
|
||||
if ((dropLocation->descriptorType != typeNull) &&
|
||||
(AECoerceDesc(dropLocation, typeFSS, &dropSpec) == noErr))
|
||||
{
|
||||
HLock(dropSpec.dataHandle);
|
||||
theSpec = (FSSpec *) *dropSpec.dataHandle;
|
||||
|
||||
thePB.dirInfo.ioCompletion = 0L;
|
||||
thePB.dirInfo.ioNamePtr = (StringPtr) &theSpec->name;
|
||||
thePB.dirInfo.ioVRefNum = theSpec->vRefNum;
|
||||
thePB.dirInfo.ioFDirIndex = 0;
|
||||
thePB.dirInfo.ioDrDirID = theSpec->parID;
|
||||
|
||||
theErr = PBGetCatInfo(&thePB, false);
|
||||
|
||||
HUnlock(dropSpec.dataHandle);
|
||||
AEDisposeDesc(&dropSpec);
|
||||
|
||||
if (theErr != noErr)
|
||||
return(false);
|
||||
|
||||
if (!(thePB.dirInfo.ioFlAttrib & (1 << 4)))
|
||||
return(false);
|
||||
|
||||
FindFolder(theSpec->vRefNum, kTrashFolderType, kCreateFolder,
|
||||
&trashVRefNum, &trashDirID);
|
||||
|
||||
if (thePB.dirInfo.ioDrDirID == trashDirID)
|
||||
return(true);
|
||||
}
|
||||
|
||||
return(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------------------- DragTrackingFunc
|
||||
|
||||
#if 0
|
||||
pascal OSErr DragTrackingFunc (DragTrackingMessage theMessage, WindowPtr theWindow,
|
||||
void *theRefCon, DragReference theDrag)
|
||||
{
|
||||
DragAttributes attributes;
|
||||
OSErr theErr;
|
||||
|
||||
theErr = noErr;
|
||||
|
||||
GetDragAttributes(theDrag, &attributes);
|
||||
|
||||
switch (theMessage)
|
||||
{
|
||||
case dragTrackingEnterWindow:
|
||||
xxx;
|
||||
break;
|
||||
|
||||
case dragTrackingInWindow:
|
||||
xxx;
|
||||
break;
|
||||
|
||||
case dragTrackingLeaveWindow:
|
||||
xxx;
|
||||
break;
|
||||
}
|
||||
|
||||
return (theErr);
|
||||
}
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------------------- DragRoom
|
||||
#if 0
|
||||
Boolean DragRoom (EventRecord *theEvent, Rect *roomSrc, short roomNumber)
|
||||
{
|
||||
DragReference theDrag;
|
||||
DragAttributes attributes;
|
||||
AEDesc dropLocation;
|
||||
Rect largeBounds, smallBounds;
|
||||
PicHandle smallPict;
|
||||
roomType *theRoom;
|
||||
RgnHandle boundsRgn, tempRgn;
|
||||
// Point dragPoint;
|
||||
OSErr theErr;
|
||||
short mouseDnMods, mouseUpMods, copyRoom;
|
||||
char wasState;
|
||||
|
||||
if (thisMac.hasDrag)
|
||||
{
|
||||
if (!WaitMouseMoved(theEvent->where))
|
||||
return(false);
|
||||
|
||||
SetPort((GrafPtr)mainWindow);
|
||||
BeginUpdate((GrafPtr)mainWindow);
|
||||
UpdateMainWindow();
|
||||
EndUpdate((GrafPtr)mainWindow);
|
||||
|
||||
theErr = NewDrag(&theDrag);
|
||||
if (theErr != noErr)
|
||||
return (false);
|
||||
|
||||
wasState = HGetState((Handle)thisHouse);
|
||||
HLock((Handle)thisHouse);
|
||||
theRoom = &((*thisHouse)->rooms[roomNumber]);
|
||||
|
||||
theErr = AddDragItemFlavor(theDrag, (ItemReference)roomNumber,
|
||||
(FlavorType)'Room', (Ptr)theRoom,
|
||||
sizeof(roomType), (FlavorFlags)0);
|
||||
if (theErr != noErr)
|
||||
{
|
||||
HSetState((Handle)thisHouse, wasState);
|
||||
DisposeDrag(theDrag);
|
||||
return (false);
|
||||
}
|
||||
|
||||
SetRect(&largeBounds, 0, 0, kRoomWide, kTileHigh);
|
||||
SetRect(&smallBounds, 0, 0, kRoomWide / 4, kTileHigh / 4);
|
||||
smallPict = OpenPicture(&smallBounds);
|
||||
CopyBits(&(((GrafPtr)mainWindow)->portBits), &(((GrafPtr)mainWindow)->portBits),
|
||||
&largeBounds, &smallBounds, srcCopy, nil);
|
||||
ClosePicture();
|
||||
HLock((Handle)smallPict);
|
||||
theErr = AddDragItemFlavor(theDrag, (ItemReference)roomNumber,
|
||||
(FlavorType)'PICT', (Ptr)(*smallPict),
|
||||
GetHandleSize((Handle)smallPict), (FlavorFlags)0);
|
||||
HUnlock((Handle)smallPict);
|
||||
KillPicture(smallPict);
|
||||
|
||||
HSetState((Handle)thisHouse, wasState);
|
||||
if (theErr != noErr)
|
||||
{
|
||||
DisposeDrag(theDrag);
|
||||
return (false);
|
||||
}
|
||||
|
||||
theErr = SetDragItemBounds(theDrag, (ItemReference)roomNumber, roomSrc);
|
||||
if (theErr != noErr)
|
||||
{
|
||||
DisposeDrag(theDrag);
|
||||
return (false);
|
||||
}
|
||||
|
||||
boundsRgn = NewRgn();
|
||||
RectRgn(boundsRgn, roomSrc);
|
||||
|
||||
tempRgn = NewRgn();
|
||||
CopyRgn(boundsRgn, tempRgn);
|
||||
InsetRgn(tempRgn, 1, 1);
|
||||
DiffRgn(boundsRgn, tempRgn, boundsRgn);
|
||||
DisposeRgn(tempRgn);
|
||||
|
||||
theErr = TrackDrag(theDrag, theEvent, boundsRgn);
|
||||
|
||||
if ((theErr != noErr) && (theErr != userCanceledErr))
|
||||
{
|
||||
DisposeRgn(boundsRgn);
|
||||
DisposeDrag(theDrag);
|
||||
return(true);
|
||||
}
|
||||
|
||||
theErr = GetDragAttributes(theDrag, &attributes);
|
||||
if (theErr != noErr)
|
||||
{
|
||||
DisposeRgn(boundsRgn);
|
||||
DisposeDrag(theDrag);
|
||||
return(true);
|
||||
}
|
||||
|
||||
theErr = GetDropLocation(theDrag, &dropLocation);
|
||||
if (theErr != noErr)
|
||||
{
|
||||
DisposeRgn(boundsRgn);
|
||||
DisposeDrag(theDrag);
|
||||
return(true);
|
||||
}
|
||||
|
||||
theErr = GetDragModifiers(theDrag, 0L, &mouseDnMods, &mouseUpMods);
|
||||
if (theErr != noErr)
|
||||
{
|
||||
DisposeRgn(boundsRgn);
|
||||
DisposeDrag(theDrag);
|
||||
return(true);
|
||||
}
|
||||
|
||||
copyRoom = (mouseDnMods | mouseUpMods) & optionKey;
|
||||
|
||||
if (!(attributes & kDragInsideSenderApplication))
|
||||
{
|
||||
if ((!copyRoom) && (DropLocationIsTrash(&dropLocation)))
|
||||
{
|
||||
DeselectObject();
|
||||
DeleteRoom(true);
|
||||
}
|
||||
}
|
||||
else if (attributes & kDragInsideSenderWindow)
|
||||
{
|
||||
// SetPort(mapWindow);
|
||||
// GetDragMouse(theDrag, &dragPoint, 0L);
|
||||
// GlobalToLocal(&dragPoint);
|
||||
// MoveRoom(dragPoint);
|
||||
}
|
||||
|
||||
DisposeRgn(boundsRgn);
|
||||
DisposeDrag(theDrag);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------------------- InitDragInfo
|
||||
|
||||
#if 0
|
||||
OSErr InitDragInfo (DragInfoHandle dragInfo)
|
||||
{
|
||||
OSErr theErr;
|
||||
DragTrackingHandlerUPP trackingProc;
|
||||
DragReceiveHandlerUPP receiveProc;
|
||||
|
||||
if (!HasDragManager())
|
||||
return (noErr);
|
||||
|
||||
trackingProc = NewDragTrackingHandlerProc(DragTrackingFunc);
|
||||
(**dragInfo).dragTrackingProc = trackingProc;
|
||||
theErr = InstallTrackingHandler(trackingProc, mapWindow, dragInfo);
|
||||
if (theErr != noErr)
|
||||
return (theErr);
|
||||
|
||||
receiveProc = NewDragReceiveHandlerProc(DragReceiveFunc);
|
||||
(**dragInfo).dragReceiveProc = receiveProc;
|
||||
theErr = InstallReceiveHandler(receiveProc, (**dragInfo).window, dragInfo);
|
||||
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------------------- KillDragInfo
|
||||
|
||||
#if 0
|
||||
void KillDragInfo (DragInfoHandle dragInfo)
|
||||
{
|
||||
OSErr theErr;
|
||||
|
||||
if (!HasDragManager())
|
||||
return (noErr);
|
||||
|
||||
theErr = RemoveTrackingHandler((**dragInfo).dragTrackingProc,
|
||||
(**dragInfo).window);
|
||||
theErr = RemoveReceiveHandler((**dragInfo).dragReceiveProc,
|
||||
(**dragInfo).window);
|
||||
}
|
||||
#endif
|
@@ -122,8 +122,18 @@ namespace PortabilityLayer
|
||||
|
||||
bool MemoryManagerImpl::ResizeHandle(MMHandleBlock *hdl, size_t newSize)
|
||||
{
|
||||
if (hdl->m_contents == nullptr)
|
||||
return false;
|
||||
if (hdl->m_contents == nullptr)
|
||||
{
|
||||
if (newSize != 0)
|
||||
{
|
||||
void *newBuf = Alloc(newSize);
|
||||
if (!newBuf)
|
||||
return false;
|
||||
|
||||
hdl->m_contents = newBuf;
|
||||
hdl->m_size = newSize;
|
||||
}
|
||||
}
|
||||
|
||||
if (newSize != hdl->m_size)
|
||||
{
|
||||
|
@@ -4,6 +4,6 @@
|
||||
|
||||
void THandleBase::Dispose() const
|
||||
{
|
||||
if (m_hdl)
|
||||
if (m_hdl)
|
||||
PortabilityLayer::MemoryManager::GetInstance()->ReleaseHandle(m_hdl);
|
||||
}
|
||||
|
@@ -82,5 +82,6 @@ void AppendMenuItem(MenuHandle menu, int8_t iconResID, uint8_t key, uint8_t subm
|
||||
|
||||
void SetMenuItemText(MenuHandle menu, int index, const PLPasStr &text)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
PortabilityLayer::MenuManager *mm = PortabilityLayer::MenuManager::GetInstance();
|
||||
mm->SetItemText(menu, index - 1, text);
|
||||
}
|
||||
|
Reference in New Issue
Block a user