Show open dialog for open menu item
This commit is contained in:
parent
2be29e4b87
commit
873192318f
|
@ -128,6 +128,12 @@ Boolean ResizeHandle(Handle h, Size newSize);
|
|||
// Fill memory with zeroes.
|
||||
void MemClear(void *ptr, Size size);
|
||||
|
||||
// =============================================================================
|
||||
// Utility Macros
|
||||
// =============================================================================
|
||||
|
||||
#define ARRAY_COUNT(x) (sizeof(x) / sizeof(*(x)))
|
||||
|
||||
// =============================================================================
|
||||
// Assertions
|
||||
// =============================================================================
|
||||
|
|
19
macos/main.c
19
macos/main.c
|
@ -3,10 +3,13 @@
|
|||
// Mozilla Public License, version 2.0. See LICENSE.txt for details.
|
||||
#include "macos/main.h"
|
||||
|
||||
#include "lib/defs.h"
|
||||
#include "macos/error.h"
|
||||
#include "macos/project.h"
|
||||
#include "macos/resources.h"
|
||||
|
||||
#include <StandardFile.h>
|
||||
|
||||
#ifndef __MWERKS__
|
||||
// Link error if defined with CodeWarrior.
|
||||
QDGlobals qd;
|
||||
|
@ -17,6 +20,17 @@ void QuitApp(void)
|
|||
ExitToShell();
|
||||
}
|
||||
|
||||
// kFileTypes is a list of all file types that we can open.
|
||||
static const OSType kFileTypes[] = {kTypeProject};
|
||||
|
||||
// HandleOpen handles the Open menu command.
|
||||
static void HandleOpen(void)
|
||||
{
|
||||
StandardFileReply sfreply;
|
||||
|
||||
StandardGetFile(NULL, ARRAY_COUNT(kFileTypes), kFileTypes, &sfreply);
|
||||
}
|
||||
|
||||
// HandleClose handles a request to close the given window.
|
||||
static void HandleClose(WindowRef window)
|
||||
{
|
||||
|
@ -57,7 +71,7 @@ static void AdjustMenus(void)
|
|||
|
||||
if (fileMenu != NULL) {
|
||||
EnableItem(fileMenu, iFile_New);
|
||||
DisableItem(fileMenu, iFile_Open);
|
||||
EnableItem(fileMenu, iFile_Open);
|
||||
if (!hasDocument) {
|
||||
DisableItem(fileMenu, iFile_Close);
|
||||
DisableItem(fileMenu, iFile_Save);
|
||||
|
@ -95,6 +109,9 @@ static void HandleMenuCommand(long command)
|
|||
case iFile_New:
|
||||
ProjectNew();
|
||||
return;
|
||||
case iFile_Open:
|
||||
HandleOpen();
|
||||
return;
|
||||
case iFile_Quit:
|
||||
QuitApp();
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue