Bug #4296. Support insertion of floppies.

This commit is contained in:
mcmullen%netscape.com 1999-04-06 22:03:36 +00:00
Родитель 375818613a
Коммит 3065d1487e
4 изменённых файлов: 44 добавлений и 1 удалений

Просмотреть файл

@ -16,12 +16,16 @@
* Reserved.
*/
#include <LowMem.h>
#include "nsMacEventHandler.h"
#include "nsWindow.h"
#include "nsToolkit.h"
#include "prinrval.h"
#include <ToolUtils.h>
#include <DiskInit.h>
#include <LowMem.h>
// from MacHeaders.c
#ifndef topLeft
#define topLeft(r) (((Point *) &(r))[0])
@ -100,6 +104,10 @@ PRBool nsMacEventHandler::HandleOSEvent(
retVal = HandleMouseUpEvent(aOSEvent);
break;
case diskEvt:
retVal = HandleDiskEvent(aOSEvent);
break;
case osEvt:
unsigned char eventType = ((aOSEvent.message >> 24) & 0x00ff);
if (eventType == suspendResumeMessage)
@ -632,6 +640,21 @@ PRBool nsMacEventHandler::HandleMouseMoveEvent(
return retVal;
}
//-------------------------------------------------------------------------
PRBool nsMacEventHandler::HandleDiskEvent(const EventRecord& anEvent)
//-------------------------------------------------------------------------
{
if (HiWord(anEvent.message) != noErr)
{
// Error mounting disk. Ask if user wishes to format it.
Point pt = {120, 120}; // System 7 will auto-center dialog
::DILoad();
::DIBadMount(pt, (SInt32) anEvent.message);
::DIUnload();
}
return PR_TRUE;
}
#pragma mark -
//-------------------------------------------------------------------------

Просмотреть файл

@ -42,6 +42,7 @@ protected:
virtual PRBool HandleMouseDownEvent(EventRecord& aOSEvent);
virtual PRBool HandleMouseUpEvent(EventRecord& aOSEvent);
virtual PRBool HandleMouseMoveEvent(EventRecord& aOSEvent);
virtual PRBool HandleDiskEvent(const EventRecord& anEvent);
virtual void ConvertOSEventToMouseEvent(
EventRecord& aOSEvent,

Просмотреть файл

@ -41,6 +41,7 @@
#include <MacWindows.h>
#include <ToolUtils.h>
#include <DiskInit.h>
#include <LowMem.h>
#include <PP_Types.h>
@ -173,6 +174,10 @@ void nsMacMessagePump::DoMessagePump()
DoActivate(theEvent);
break;
case diskEvt:
DoDisk(theEvent);
break;
case osEvt:
unsigned char eventType = ((theEvent.message >> 24) & 0x00ff);
switch (eventType)
@ -534,6 +539,19 @@ void nsMacMessagePump::DoKey(EventRecord &anEvent)
}
}
//-------------------------------------------------------------------------
void nsMacMessagePump::DoDisk(const EventRecord& anEvent)
//-------------------------------------------------------------------------
{
if (HiWord(anEvent.message) != noErr)
{
// Error mounting disk. Ask if user wishes to format it.
Point pt = {120, 120}; // System 7 will auto-center dialog
::DILoad();
::DIBadMount(pt, (SInt32) anEvent.message);
::DIUnload();
}
}
//-------------------------------------------------------------------------
//

Просмотреть файл

@ -72,6 +72,7 @@ private:
void DoUpdate(EventRecord &anEvent);
void DoKey(EventRecord &anEvent);
void DoMenu(EventRecord &anEvent, long menuResult);
void DoDisk(const EventRecord &anEvent);
void DoActivate(EventRecord &anEvent);
void DoIdle(EventRecord &anEvent);