Glider4/RoomEditor_103/Sources/E-TheMenus.p

1 line
12 KiB
OpenEdge ABL
Raw Normal View History

unit TheMenus; interface uses Balloons, Palettes, About, Globals, Utilities, Drawing, HouseStuff, RoomStuff, ObjectStuff, FileInNOut, FlyGlider; procedure DoNewHouse; procedure DoOpenHouse; procedure DoPrevRoom; procedure DoNextRoom; procedure DoNewRoom; function DoSaveHouse: Boolean; function DoSaveHouseAs: Boolean; procedure DoClear; procedure HandleMenu (theMenu, theItem: integer); {=================================} implementation {=================================} procedure DoTest; begin end; {=================================} procedure DoOpenHouse; var canceled: Boolean; begin if (not DoOpen) then begin DoNewHouse; Exit(DoOpenHouse); end; ErrorCheckHouse; changed := FALSE; roomAt := 1; thisRoom := thisHouse.theRooms[roomAt]; EnableItem(GetMenu(mFile), iSave); EnableItem(GetMenu(mFile), iSaveAs); oneActive := 0; handleRect := nullRect; LoadABackground(thisRoom.backPictID); UpdateMenuItems(fileExists); UpdateMenuItems(editToRoom); DrawAllObjects; DrawRoomNum; OpenTools; end; {=================================} procedure DoNewHouse; var cancelIt: Boolean; index: Integer; begin roomAt := 1; FlushRoom(thisRoom); with thisHouse do begin version := $0100; numberORooms := 0; for index := 0 to 19 do begin hiScores[index] := 0; hiLevel[index] := 0; hiName[index] := 'no one...'; hiRoom[index] := 'no room...'; end; pictFile := resourceName; nextFile := ''; firstFile := ''; theRooms[roomAt] := thisRoom; end; changed := FALSE; oneActive := 0; handleRect := nullRect; thisHouse.numberORooms := 1; cancelIt := FALSE; DoRoomBackInfo(cancelIt); LoadABackground(thisRoom.backPictID); UpdateMenuItems(fileIsNew); UpdateMenuItems(editToRoom); OpenTools; end; {=================================} procedure DoMenuClose; const saveBut = 1; cancelBut = 6; var buttonClicked: Integer; dummyBool: Boolean; begin Deselect; if (changed) then begin buttonClicked := SaveNoClose; if (buttonClicked = saveBut) then begin thisHouse.theRooms[roomAt] := thisRoom; if (fileIsOpen) then begin if (not DoSaveHouse) then begin dummyBool := DoClose; Exit(DoMenuClose); end; dummyBool := DoClose; end else begin if (not DoSaveHouseAs) then Exit(DoMenuClose); end; end else if (buttonClicked = cancelBut) then begin Exit(DoMenuClose); end else dummyBool := DoClose; end else dummyBool := DoClose; FlushRoom(thisRoom); roomAt := 0; changed := FALSE; SetPort(GrafPtr(mainWndo)); EraseRect(wholeArea); if (inColor) then SetPort(GrafPtr(loadCPtr)) else SetPort(offLoadPort); EraseRect(wholeArea); if (inColor) then SetPort(GrafPtr(virginCPtr)) else SetPort(offVirginPort); EraseRect(wholeArea); CloseTools; UpdateMenuItems(noFileOpen); end; {=================================} procedure DoGoToRoom; var wasRoom: Integer; begin thisHouse.theRooms[roomAt] := thisRoom; wasRoom := roomAt; DoGotoDial; if (wasRoom <> roomAt) then begin thisRoom := thisHouse.theRooms[roomAt]; Deselect; LoadABackground(thisRoom.backPictID); DrawAllObjects; DrawRoomNum; UpdateMenuItems(editToRoom); end; end; {=================================} procedure DoPrevRoom; begin thisHouse.theRooms[roomAt] := thisRoom; roomAt := roomAt - 1; if (roomAt < 1) then roomAt := thisHouse.numberORooms; thisRoom := thisHouse.theRooms[roomAt]; Deselect; LoadABackground(thisRoom.backPictID); DrawAllObjects; DrawRoomNum; UpdateMenuItems(editToRoom); end; {=================================} procedure DoNextRoom; begin thisHouse.theRooms[roomAt] := thisRoom; roomAt := roomAt + 1; if (roomAt > thisHouse.numberORooms) then roomAt := 1; thisRoom := thisHouse.theRooms[roomAt]; Deselect; LoadABackground(thisRoom.backPictID); DrawAllObjects; DrawRoomNum; UpdateMenuItems(editToRoom); end; {===============