[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/macfns.c
From: |
Steven Tamm |
Subject: |
[Emacs-diffs] Changes to emacs/src/macfns.c |
Date: |
Wed, 05 Jan 2005 22:20:15 -0500 |
Index: emacs/src/macfns.c
diff -c emacs/src/macfns.c:1.46 emacs/src/macfns.c:1.47
*** emacs/src/macfns.c:1.46 Wed Dec 29 17:25:02 2004
--- emacs/src/macfns.c Thu Jan 6 02:53:39 2005
***************
*** 55,60 ****
--- 55,61 ----
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
+ #include <sys/param.h>
#include <stdlib.h>
#include <string.h>
***************
*** 4237,4242 ****
--- 4238,4246 ----
File selection dialog
***********************************************************************/
+ static pascal void mac_nav_event_callback P_ ((NavEventCallbackMessage,
+ NavCBRecPtr, void *));
+
/**
There is a relatively standard way to do this using applescript to run
a (choose file) method. However, this doesn't do "the right thing"
***************
*** 4261,4268 ****
Lisp_Object file = Qnil;
int count = SPECPDL_INDEX ();
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
! char filename[1001];
int default_filter_index = 1; /* 1: All Files, 2: Directories only */
GCPRO6 (prompt, dir, default_filename, mustmatch, file, only_dir_p);
CHECK_STRING (prompt);
--- 4265,4273 ----
Lisp_Object file = Qnil;
int count = SPECPDL_INDEX ();
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
! char filename[MAXPATHLEN];
int default_filter_index = 1; /* 1: All Files, 2: Directories only */
+ static NavEventUPP mac_nav_event_callbackUPP = NULL;
GCPRO6 (prompt, dir, default_filename, mustmatch, file, only_dir_p);
CHECK_STRING (prompt);
***************
*** 4290,4305 ****
options.optionFlags |= kNavSelectAllReadableItem;
if (!NILP(prompt))
{
! message = cfstring_create_with_utf8_cstring (SDATA (prompt));
options.message = message;
}
/* Don't set the application, let it use default.
options.clientName = CFSTR ("Emacs");
*/
if (!NILP (only_dir_p))
! status = NavCreateChooseFolderDialog(&options, NULL, NULL, NULL,
! &dialogRef);
else if (NILP (mustmatch))
{
/* This is a save dialog */
--- 4295,4314 ----
options.optionFlags |= kNavSelectAllReadableItem;
if (!NILP(prompt))
{
! message =
! cfstring_create_with_utf8_cstring (SDATA (ENCODE_UTF_8 (prompt)));
options.message = message;
}
/* Don't set the application, let it use default.
options.clientName = CFSTR ("Emacs");
*/
+ if (mac_nav_event_callbackUPP == NULL)
+ mac_nav_event_callbackUPP = NewNavEventUPP (mac_nav_event_callback);
+
if (!NILP (only_dir_p))
! status = NavCreateChooseFolderDialog(&options,
mac_nav_event_callbackUPP,
! NULL, NULL, &dialogRef);
else if (NILP (mustmatch))
{
/* This is a save dialog */
***************
*** 4310,4329 ****
if (!NILP(default_filename))
{
saveName =
! cfstring_create_with_utf8_cstring (SDATA (default_filename));
options.saveFileName = saveName;
options.optionFlags |= kNavSelectDefaultLocation;
}
status = NavCreatePutFileDialog(&options,
'TEXT', kNavGenericSignature,
! NULL, NULL, &dialogRef);
}
else
{
/* This is an open dialog*/
status = NavCreateChooseFileDialog(&options, fileTypes,
! NULL, NULL, NULL, NULL,
! &dialogRef);
}
/* Set the default location and continue*/
--- 4319,4340 ----
if (!NILP(default_filename))
{
saveName =
! cfstring_create_with_utf8_cstring (SDATA (ENCODE_UTF_8
! (default_filename)));
options.saveFileName = saveName;
options.optionFlags |= kNavSelectDefaultLocation;
}
status = NavCreatePutFileDialog(&options,
'TEXT', kNavGenericSignature,
! mac_nav_event_callbackUPP, NULL,
! &dialogRef);
}
else
{
/* This is an open dialog*/
status = NavCreateChooseFileDialog(&options, fileTypes,
! mac_nav_event_callbackUPP, NULL,
! NULL, NULL, &dialogRef);
}
/* Set the default location and continue*/
***************
*** 4331,4343 ****
if (!NILP(dir)) {
FSRef defLoc;
AEDesc defLocAed;
! status = FSPathMakeRef(SDATA(dir), &defLoc, NULL);
if (status == noErr)
{
AECreateDesc(typeFSRef, &defLoc, sizeof(FSRef), &defLocAed);
NavCustomControl(dialogRef, kNavCtlSetLocation, (void*) &defLocAed);
}
- AEDisposeDesc(&defLocAed);
}
status = NavDialogRun(dialogRef);
--- 4342,4354 ----
if (!NILP(dir)) {
FSRef defLoc;
AEDesc defLocAed;
! status = FSPathMakeRef(SDATA(ENCODE_FILE(dir)), &defLoc, NULL);
if (status == noErr)
{
AECreateDesc(typeFSRef, &defLoc, sizeof(FSRef), &defLocAed);
NavCustomControl(dialogRef, kNavCtlSetLocation, (void*) &defLocAed);
+ AEDisposeDesc(&defLocAed);
}
}
status = NavDialogRun(dialogRef);
***************
*** 4363,4369 ****
status = NavDialogGetReply(dialogRef, &reply);
AECoerceDesc(&reply.selection, typeFSRef, &aed);
AEGetDescData(&aed, (void *) &fsRef, sizeof (FSRef));
! FSRefMakePath(&fsRef, (UInt8 *) filename, 1000);
AEDisposeDesc(&aed);
if (reply.saveFileName)
{
--- 4374,4380 ----
status = NavDialogGetReply(dialogRef, &reply);
AECoerceDesc(&reply.selection, typeFSRef, &aed);
AEGetDescData(&aed, (void *) &fsRef, sizeof (FSRef));
! FSRefMakePath(&fsRef, (UInt8 *) filename, sizeof (filename));
AEDisposeDesc(&aed);
if (reply.saveFileName)
{
***************
*** 4372,4380 ****
if (len && filename[len-1] != '/')
filename[len++] = '/';
CFStringGetCString(reply.saveFileName, filename+len,
! 1000-len, kCFStringEncodingUTF8);
}
! file = DECODE_FILE(build_string (filename));
NavDisposeReply(&reply);
}
break;
--- 4383,4393 ----
if (len && filename[len-1] != '/')
filename[len++] = '/';
CFStringGetCString(reply.saveFileName, filename+len,
! sizeof (filename) - len,
! kCFStringEncodingUTF8);
}
! file = DECODE_FILE (make_unibyte_string (filename,
! strlen (filename)));
NavDisposeReply(&reply);
}
break;
***************
*** 4400,4405 ****
--- 4413,4427 ----
}
+ /* Need to register some event callback function for enabling drag and
+ drop in Navigation Service dialogs. */
+ static pascal void
+ mac_nav_event_callback (selector, parms, data)
+ NavEventCallbackMessage selector;
+ NavCBRecPtr parms;
+ void *data ;
+ {
+ }
#endif
/***********************************************************************
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] Changes to emacs/src/macfns.c,
Steven Tamm <=