mirror of
https://github.com/depp/syncfiles.git
synced 2025-01-02 14:31:56 +00:00
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.
|
// Fill memory with zeroes.
|
||||||
void MemClear(void *ptr, Size size);
|
void MemClear(void *ptr, Size size);
|
||||||
|
|
||||||
|
// =============================================================================
|
||||||
|
// Utility Macros
|
||||||
|
// =============================================================================
|
||||||
|
|
||||||
|
#define ARRAY_COUNT(x) (sizeof(x) / sizeof(*(x)))
|
||||||
|
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
// Assertions
|
// Assertions
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
19
macos/main.c
19
macos/main.c
@ -3,10 +3,13 @@
|
|||||||
// Mozilla Public License, version 2.0. See LICENSE.txt for details.
|
// Mozilla Public License, version 2.0. See LICENSE.txt for details.
|
||||||
#include "macos/main.h"
|
#include "macos/main.h"
|
||||||
|
|
||||||
|
#include "lib/defs.h"
|
||||||
#include "macos/error.h"
|
#include "macos/error.h"
|
||||||
#include "macos/project.h"
|
#include "macos/project.h"
|
||||||
#include "macos/resources.h"
|
#include "macos/resources.h"
|
||||||
|
|
||||||
|
#include <StandardFile.h>
|
||||||
|
|
||||||
#ifndef __MWERKS__
|
#ifndef __MWERKS__
|
||||||
// Link error if defined with CodeWarrior.
|
// Link error if defined with CodeWarrior.
|
||||||
QDGlobals qd;
|
QDGlobals qd;
|
||||||
@ -17,6 +20,17 @@ void QuitApp(void)
|
|||||||
ExitToShell();
|
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.
|
// HandleClose handles a request to close the given window.
|
||||||
static void HandleClose(WindowRef window)
|
static void HandleClose(WindowRef window)
|
||||||
{
|
{
|
||||||
@ -57,7 +71,7 @@ static void AdjustMenus(void)
|
|||||||
|
|
||||||
if (fileMenu != NULL) {
|
if (fileMenu != NULL) {
|
||||||
EnableItem(fileMenu, iFile_New);
|
EnableItem(fileMenu, iFile_New);
|
||||||
DisableItem(fileMenu, iFile_Open);
|
EnableItem(fileMenu, iFile_Open);
|
||||||
if (!hasDocument) {
|
if (!hasDocument) {
|
||||||
DisableItem(fileMenu, iFile_Close);
|
DisableItem(fileMenu, iFile_Close);
|
||||||
DisableItem(fileMenu, iFile_Save);
|
DisableItem(fileMenu, iFile_Save);
|
||||||
@ -95,6 +109,9 @@ static void HandleMenuCommand(long command)
|
|||||||
case iFile_New:
|
case iFile_New:
|
||||||
ProjectNew();
|
ProjectNew();
|
||||||
return;
|
return;
|
||||||
|
case iFile_Open:
|
||||||
|
HandleOpen();
|
||||||
|
return;
|
||||||
case iFile_Quit:
|
case iFile_Quit:
|
||||||
QuitApp();
|
QuitApp();
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user