Bug fixes.

This commit is contained in:
Marcio T 2021-12-01 12:23:36 -07:00
parent f565090afb
commit b00a01b948
4 changed files with 63 additions and 25 deletions

Binary file not shown.

View File

@ -274,7 +274,8 @@ long EnumerateIomegaDevices(uint8_t *DrivesSkipped) {
// On the Mac, we want to ignore drives that have media in them at // On the Mac, we want to ignore drives that have media in them at
// program entry, as this means the volume is mounted in Mac OS // program entry, as this means the volume is mounted in Mac OS
const bool driveEmpty = GetCartridgeStatus(Device) == DISK_NOT_PRESENT; JazDrive = isJaz;
const bool driveEmpty = (GetCartridgeStatus(Device) == DISK_NOT_PRESENT);
if(driveEmpty) { if(driveEmpty) {
DriveArray[DriveCount].flags = flags; DriveArray[DriveCount].flags = flags;
DriveArray[DriveCount].scsi_id = Device; DriveArray[DriveCount].scsi_id = Device;

View File

@ -5,9 +5,11 @@
#include <ctype.h> #include <ctype.h>
#include <SIOUX.h> #include <SIOUX.h>
#include <Menus.h>
#include <Windows.h> #include <Windows.h>
#include <Quickdraw.h> #include <Quickdraw.h>
#include "TrapAvail.h"
#include "pstring.h" #include "pstring.h"
#include "LaunchLib.h" #include "LaunchLib.h"
#include "mac_vol.h" #include "mac_vol.h"
@ -34,7 +36,8 @@ void DisposeTipWindow();
void AddTipMenus(); void AddTipMenus();
void RunCommandLine(); void RunCommandLine();
void DoEvent(EventRecord &event, RgnHandle *cursorRgn); void DoEvent(EventRecord &event, RgnHandle *cursorRgn);
void DoMenuEvent(EventRecord &event); void DoMenuEventPostSIOUX(EventRecord &event);
bool DoMenuSelection(long choice);
void DoUpdate(WindowPtr window); void DoUpdate(WindowPtr window);
void DoMouseDown(EventRecord &event); void DoMouseDown(EventRecord &event);
void DoMouseMove(EventRecord &event, RgnHandle *cursorRegion); void DoMouseMove(EventRecord &event, RgnHandle *cursorRegion);
@ -144,6 +147,13 @@ void NewTipWindow() {
} }
void AddTipMenus() { void AddTipMenus() {
if(!TrapAvailable(0xAA66)) {
// If MenuChoice is available, we can let SIOUX handle the menus,
// otherwise we have to handle it ourselves
SIOUXSettings.setupmenus = FALSE;
}
// Add our menu
tipMenu = GetMenu(128); tipMenu = GetMenu(128);
InsertMenu(tipMenu, 0); InsertMenu(tipMenu, 0);
DrawMenuBar(); DrawMenuBar();
@ -204,36 +214,54 @@ void DoEvent(EventRecord &event, RgnHandle *cursorRgn) {
case osEvt: DoMouseMove(event, cursorRgn); break; case osEvt: DoMouseMove(event, cursorRgn); break;
} }
} else { // Trap unhandled SIOUX menu events } else { // Trap unhandled SIOUX menu events
DoMenuEvent(event); DoMenuEventPostSIOUX(event);
} }
} }
void DoMenuEvent(EventRecord &event) { void DoMenuEventPostSIOUX(EventRecord &event) {
// SIOUX will handle the menu event, but we can check after the fact if(!SIOUXSettings.setupmenus) return;
// to see whether the user selected one of our menus
/* If MenuChoice is available, it is best to let SIOUX handle the menu
* event so Copy and Paste will work. We can check after the fact
* to see whether the user selected one of our menus using MenuChoice.
* However, if that trap is not available, we must handle the menu
* ourselves and certain menu items will not work
*/
WindowPtr thisWindow; WindowPtr thisWindow;
if(event.what == mouseDown && FindWindow(event.where, &thisWindow) == inMenuBar) { if((event.what == mouseDown) && (FindWindow(event.where, &thisWindow) == inMenuBar)) {
long int choice = MenuChoice(); DoMenuSelection(MenuChoice());
int menuId = HiWord(choice); }
int itemId = LoWord(choice); }
switch(menuId) {
case 32000: // Apple menu bool DoMenuSelection(long choice) {
SysBeep(10); bool handled = false;
break; int menuId = HiWord(choice);
case 32001: // File menu int itemId = LoWord(choice);
if (itemId == 9) { //printf("Menu choice: %d, %d\n", menuId, itemId);
WndProc(WM_COMMAND, IDB_QUIT); switch(menuId) {
} case 32000: // Apple menu SysBeep(10);
break; break;
case 32002: // Edit menu case 32001: // File menu
case 128: // TIP menu if (itemId == 9) { // Quit
switch(itemId) { WndProc(WM_COMMAND, IDB_QUIT);
case 1: HiliteMenu(0); RunCommandLine(); break; handled = true;
} }
} break;
case 32002: // Edit menu
break;
case 128: // TIP menu
switch(itemId) {
case 1: // Run Command Line...
HiliteMenu(0);
RunCommandLine();
handled = true;
break;
}
break;
} }
HiliteMenu(0); HiliteMenu(0);
return handled;
} }
void DoUpdate(WindowPtr window) { void DoUpdate(WindowPtr window) {
@ -257,6 +285,7 @@ void DoUpdate(WindowPtr window) {
DrawEdge(&(*richText)->frame, BDR_SUNKENOUTER, BF_RECT); DrawEdge(&(*richText)->frame, BDR_SUNKENOUTER, BF_RECT);
ReleaseDC(hExplainWnd); ReleaseDC(hExplainWnd);
SetColor(BLACK_COLOR);
UpdateControls(window, window->visRgn); UpdateControls(window, window->visRgn);
EndUpdate(window); EndUpdate(window);
@ -311,6 +340,14 @@ void DoMouseDown(EventRecord &event) {
gDone = true; gDone = true;
} }
break; break;
case inMenuBar:
if(!DoMenuSelection(MenuSelect(event.where))) {
SysBeep(10);
}
break;
case inDrag:
DragWindow(thisWindow, event.where, &(*GetGrayRgn())->rgnBBox);
break;
} }
} }