mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-23 06:59:25 -05:00
Add support for using Navigation Services to open saved sessions.
Support for saving sessions using Navigation Services will come later. [originally from svn r2779]
This commit is contained in:
parent
49552525cc
commit
60b6419de5
@ -1,4 +1,4 @@
|
|||||||
/* $Id: mac.c,v 1.42 2003/02/01 23:42:30 ben Exp $ */
|
/* $Id: mac.c,v 1.43 2003/02/02 15:59:00 ben Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999 Ben Harris
|
* Copyright (c) 1999 Ben Harris
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@ -43,6 +43,7 @@
|
|||||||
#include <DiskInit.h>
|
#include <DiskInit.h>
|
||||||
#include <Gestalt.h>
|
#include <Gestalt.h>
|
||||||
#include <LowMem.h>
|
#include <LowMem.h>
|
||||||
|
#include <Navigation.h>
|
||||||
#include <Resources.h>
|
#include <Resources.h>
|
||||||
#include <Script.h>
|
#include <Script.h>
|
||||||
#include <TextCommon.h>
|
#include <TextCommon.h>
|
||||||
@ -175,6 +176,11 @@ static void mac_startup(void) {
|
|||||||
mac_gestalts.uncvattr = (*ti)->tecUnicodeConverterFeatures;
|
mac_gestalts.uncvattr = (*ti)->tecUnicodeConverterFeatures;
|
||||||
DisposeHandle((Handle)ti);
|
DisposeHandle((Handle)ti);
|
||||||
}
|
}
|
||||||
|
/* Navigation Services? */
|
||||||
|
if (NavServicesAvailable())
|
||||||
|
mac_gestalts.navsvers = NavLibraryVersion();
|
||||||
|
else
|
||||||
|
mac_gestalts.navsvers = 0;
|
||||||
|
|
||||||
sk_init();
|
sk_init();
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ struct mac_gestalts {
|
|||||||
long windattr;
|
long windattr;
|
||||||
long encvvers; /* TEC version (from TECGetInfo()) */
|
long encvvers; /* TEC version (from TECGetInfo()) */
|
||||||
long uncvattr; /* Unicode Converter attributes (frem TECGetInfo()) */
|
long uncvattr; /* Unicode Converter attributes (frem TECGetInfo()) */
|
||||||
|
long navsvers; /* Navigation Services version */
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct mac_gestalts mac_gestalts;
|
extern struct mac_gestalts mac_gestalts;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: mac_res.r,v 1.24 2003/01/27 23:46:03 ben Exp $ */
|
/* $Id: mac_res.r,v 1.25 2003/02/02 15:59:00 ben Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2002 Ben Harris
|
* Copyright (c) 1999, 2002 Ben Harris
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@ -142,6 +142,30 @@ resource 'BNDL' (129, purgeable) {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Open resource, for the Translation Manager and Navigation Services */
|
||||||
|
resource 'open' (open_pTTY) {
|
||||||
|
'pTTY',
|
||||||
|
{ 'Sess' }
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Kind resources, for Navigation services etc. */
|
||||||
|
resource 'kind' (128) {
|
||||||
|
'pTTY',
|
||||||
|
verBritain,
|
||||||
|
{
|
||||||
|
'Sess', "PuTTY saved session",
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
resource 'kind' (129) {
|
||||||
|
'pTTI',
|
||||||
|
verBritain,
|
||||||
|
{
|
||||||
|
'HKey', "PuTTY host key database",
|
||||||
|
'Seed', "PuTTY random number seed",
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/* Icons, courtesy of DeRez */
|
/* Icons, courtesy of DeRez */
|
||||||
|
|
||||||
/* Application icon */
|
/* Application icon */
|
||||||
|
68
mac/macdlg.c
68
mac/macdlg.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: macdlg.c,v 1.9 2003/02/01 23:55:00 ben Exp $ */
|
/* $Id: macdlg.c,v 1.10 2003/02/02 15:59:00 ben Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2002 Ben Harris
|
* Copyright (c) 2002 Ben Harris
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@ -33,6 +33,7 @@
|
|||||||
#include <AEDataModel.h>
|
#include <AEDataModel.h>
|
||||||
#include <AppleEvents.h>
|
#include <AppleEvents.h>
|
||||||
#include <Dialogs.h>
|
#include <Dialogs.h>
|
||||||
|
#include <Navigation.h>
|
||||||
#include <Resources.h>
|
#include <Resources.h>
|
||||||
#include <StandardFile.h>
|
#include <StandardFile.h>
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
@ -112,9 +113,59 @@ static OSErr mac_opensessionfrom(FSSpec *fss)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static OSErr mac_openlist(AEDesc docs)
|
||||||
|
{
|
||||||
|
OSErr err;
|
||||||
|
long ndocs, i;
|
||||||
|
FSSpec fss;
|
||||||
|
AEKeyword keywd;
|
||||||
|
DescType type;
|
||||||
|
Size size;
|
||||||
|
|
||||||
|
err = AECountItems(&docs, &ndocs);
|
||||||
|
if (err != noErr) return err;
|
||||||
|
|
||||||
|
for (i = 0; i < ndocs; i++) {
|
||||||
|
err = AEGetNthPtr(&docs, i + 1, typeFSS,
|
||||||
|
&keywd, &type, &fss, sizeof(fss), &size);
|
||||||
|
if (err != noErr) return err;;
|
||||||
|
err = mac_opensessionfrom(&fss);
|
||||||
|
if (err != noErr) return err;
|
||||||
|
}
|
||||||
|
return noErr;
|
||||||
|
}
|
||||||
|
|
||||||
void mac_opensession(void)
|
void mac_opensession(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (mac_gestalts.navsvers > 0) {
|
||||||
|
NavReplyRecord navr;
|
||||||
|
NavDialogOptions navopts;
|
||||||
|
NavTypeListHandle navtypes;
|
||||||
|
AEDesc defaultloc = { 'null', NULL };
|
||||||
|
AEDesc *navdefault = NULL;
|
||||||
|
short vol;
|
||||||
|
long dirid;
|
||||||
|
FSSpec fss;
|
||||||
|
|
||||||
|
if (NavGetDefaultDialogOptions(&navopts) != noErr) return;
|
||||||
|
/* XXX should we create sessions dir? */
|
||||||
|
if (get_session_dir(FALSE, &vol, &dirid) == noErr &&
|
||||||
|
FSMakeFSSpec(vol, dirid, NULL, &fss) == noErr &&
|
||||||
|
AECreateDesc(typeFSS, &fss, sizeof(fss), &defaultloc) == noErr)
|
||||||
|
navdefault = &defaultloc;
|
||||||
|
/* Can't meaningfully preview a saved session yet */
|
||||||
|
navopts.dialogOptionFlags &= ~kNavAllowPreviews;
|
||||||
|
navtypes = (NavTypeListHandle)GetResource('open', open_pTTY);
|
||||||
|
if (NavGetFile(navdefault, &navr, &navopts, NULL, NULL, NULL, navtypes,
|
||||||
|
NULL) == noErr && navr.validRecord)
|
||||||
|
mac_openlist(navr.selection);
|
||||||
|
NavDisposeReply(&navr);
|
||||||
|
if (navtypes != NULL)
|
||||||
|
ReleaseResource((Handle)navtypes);
|
||||||
|
}
|
||||||
#if !TARGET_API_MAC_CARBON /* XXX Navigation Services */
|
#if !TARGET_API_MAC_CARBON /* XXX Navigation Services */
|
||||||
|
else {
|
||||||
StandardFileReply sfr;
|
StandardFileReply sfr;
|
||||||
static const OSType sftypes[] = { 'Sess', 0, 0, 0 };
|
static const OSType sftypes[] = { 'Sess', 0, 0, 0 };
|
||||||
|
|
||||||
@ -123,6 +174,7 @@ void mac_opensession(void)
|
|||||||
|
|
||||||
mac_opensessionfrom(&sfr.sfFile);
|
mac_opensessionfrom(&sfr.sfFile);
|
||||||
/* XXX handle error */
|
/* XXX handle error */
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,12 +232,9 @@ pascal OSErr mac_aevt_odoc(const AppleEvent *req, AppleEvent *reply,
|
|||||||
long refcon)
|
long refcon)
|
||||||
{
|
{
|
||||||
DescType type;
|
DescType type;
|
||||||
AEKeyword keywd;
|
|
||||||
Size size;
|
Size size;
|
||||||
AEDescList docs = { typeNull, NULL };
|
AEDescList docs = { typeNull, NULL };
|
||||||
OSErr err;
|
OSErr err;
|
||||||
long ndocs, i;
|
|
||||||
FSSpec fss;
|
|
||||||
|
|
||||||
err = AEGetParamDesc(req, keyDirectObject, typeAEList, &docs);
|
err = AEGetParamDesc(req, keyDirectObject, typeAEList, &docs);
|
||||||
if (err != noErr) goto out;
|
if (err != noErr) goto out;
|
||||||
@ -196,16 +245,7 @@ pascal OSErr mac_aevt_odoc(const AppleEvent *req, AppleEvent *reply,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = AECountItems(&docs, &ndocs);
|
err = mac_openlist(docs);
|
||||||
if (err != noErr) goto out;
|
|
||||||
|
|
||||||
for (i = 0; i < ndocs; i++) {
|
|
||||||
err = AEGetNthPtr(&docs, i + 1, typeFSS,
|
|
||||||
&keywd, &type, &fss, sizeof(fss), &size);
|
|
||||||
if (err != noErr) goto out;
|
|
||||||
err = mac_opensessionfrom(&fss);
|
|
||||||
if (err != noErr) goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
AEDisposeDesc(&docs);
|
AEDisposeDesc(&docs);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: macresid.h,v 1.7 2003/01/27 00:33:49 ben Exp $ */
|
/* $Id: macresid.h,v 1.8 2003/02/02 15:59:00 ben Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* macresid.h -- Mac resource IDs
|
* macresid.h -- Mac resource IDs
|
||||||
@ -12,6 +12,9 @@
|
|||||||
/* Menu bar IDs */
|
/* Menu bar IDs */
|
||||||
#define MBAR_Main 128
|
#define MBAR_Main 128
|
||||||
|
|
||||||
|
/* Open IDs */
|
||||||
|
#define open_pTTY 128
|
||||||
|
|
||||||
/* Menu IDs */
|
/* Menu IDs */
|
||||||
#define mApple 128
|
#define mApple 128
|
||||||
#define mFile 129
|
#define mFile 129
|
||||||
|
@ -624,6 +624,7 @@ Libs_68K = "{CLibraries}StdCLib.far.o" \xb6
|
|||||||
"{Libraries}MathLib.far.o" \xb6
|
"{Libraries}MathLib.far.o" \xb6
|
||||||
"{Libraries}IntEnv.far.o" \xb6
|
"{Libraries}IntEnv.far.o" \xb6
|
||||||
"{Libraries}Interface.o" \xb6
|
"{Libraries}Interface.o" \xb6
|
||||||
|
"{Libraries}Navigation.far.o" \xb6
|
||||||
"{Libraries}OpenTransport.o" \xb6
|
"{Libraries}OpenTransport.o" \xb6
|
||||||
"{Libraries}OpenTransportApp.o" \xb6
|
"{Libraries}OpenTransportApp.o" \xb6
|
||||||
"{Libraries}OpenTptInet.o" \xb6
|
"{Libraries}OpenTptInet.o" \xb6
|
||||||
@ -633,6 +634,8 @@ Libs_CFM = "{SharedLibraries}InterfaceLib" \xb6
|
|||||||
"{SharedLibraries}StdCLib" \xb6
|
"{SharedLibraries}StdCLib" \xb6
|
||||||
"{SharedLibraries}AppearanceLib" \xb6
|
"{SharedLibraries}AppearanceLib" \xb6
|
||||||
-weaklib AppearanceLib \xb6
|
-weaklib AppearanceLib \xb6
|
||||||
|
"{SharedLibraries}NavigationLib" \xb6
|
||||||
|
-weaklib NavigationLib \xb6
|
||||||
"{SharedLibraries}TextCommon" \xb6
|
"{SharedLibraries}TextCommon" \xb6
|
||||||
-weaklib TextCommon \xb6
|
-weaklib TextCommon \xb6
|
||||||
"{SharedLibraries}UnicodeConverter" \xb6
|
"{SharedLibraries}UnicodeConverter" \xb6
|
||||||
|
Loading…
x
Reference in New Issue
Block a user