mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-04-27 07:42:09 -05:00
The edit menu is now mostly functional. I'm not sure about paste, since I
haven't got a working backend at the moment, but it all looks OK. [originally from svn r118]
This commit is contained in:
parent
fc69aeef23
commit
e43dc5ecd4
@ -1,4 +1,4 @@
|
|||||||
# $Id: Makefile.mpw,v 1.1.2.2 1999/03/14 20:07:04 ben Exp $
|
# $Id: Makefile.mpw,v 1.1.2.3 1999/03/16 20:27:30 ben Exp $
|
||||||
# This is the Makefile for building PuTTY for the Mac OS.
|
# This is the Makefile for building PuTTY for the Mac OS.
|
||||||
# Users of non-Mac systems will see some pretty strange characters around.
|
# Users of non-Mac systems will see some pretty strange characters around.
|
||||||
|
|
||||||
@ -34,12 +34,14 @@ Libs
|
|||||||
PuTTY ÄÄ {Objects¥68K} {Libs¥68K}
|
PuTTY ÄÄ {Objects¥68K} {Libs¥68K}
|
||||||
IF (`exists {Targ}.NJ`)
|
IF (`exists {Targ}.NJ`)
|
||||||
ILink ¶
|
ILink ¶
|
||||||
|
-compact ¶
|
||||||
-o {Targ} {Sym¥68K} ¶
|
-o {Targ} {Sym¥68K} ¶
|
||||||
-t 'APPL' ¶
|
-t 'APPL' ¶
|
||||||
-c 'pTTY' ¶
|
-c 'pTTY' ¶
|
||||||
-newerdeps {NewerDeps}
|
-newerdeps {NewerDeps}
|
||||||
ELSE
|
ELSE
|
||||||
ILink ¶
|
ILink ¶
|
||||||
|
-compact ¶
|
||||||
-o {Targ} {Sym¥68K} ¶
|
-o {Targ} {Sym¥68K} ¶
|
||||||
-t 'APPL' ¶
|
-t 'APPL' ¶
|
||||||
-c 'pTTY' ¶
|
-c 'pTTY' ¶
|
||||||
|
37
mac.c
37
mac.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: mac.c,v 1.1.2.15 1999/03/14 13:08:43 ben Exp $ */
|
/* $Id: mac.c,v 1.1.2.16 1999/03/16 20:27:30 ben Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999 Ben Harris
|
* Copyright (c) 1999 Ben Harris
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@ -304,35 +304,48 @@ static void mac_keypress(EventRecord *event) {
|
|||||||
static void mac_menucommand(long result) {
|
static void mac_menucommand(long result) {
|
||||||
short menu, item;
|
short menu, item;
|
||||||
Str255 da;
|
Str255 da;
|
||||||
|
WindowPtr window;
|
||||||
|
|
||||||
menu = HiWord(result);
|
menu = HiWord(result);
|
||||||
item = LoWord(result);
|
item = LoWord(result);
|
||||||
|
window = FrontWindow();
|
||||||
|
/* Things which do the same whatever window we're in. */
|
||||||
switch (menu) {
|
switch (menu) {
|
||||||
case mApple:
|
case mApple:
|
||||||
switch (item) {
|
switch (item) {
|
||||||
case iAbout:
|
case iAbout:
|
||||||
GetNewDialog(wAbout, NULL, (GrafPort *)-1);
|
if (windows.about)
|
||||||
break;
|
SelectWindow(windows.about);
|
||||||
|
else
|
||||||
|
windows.about = GetNewDialog(wAbout, NULL, (WindowPtr)-1);
|
||||||
|
goto done;
|
||||||
default:
|
default:
|
||||||
GetMenuItemText(GetMenuHandle(mApple), item, da);
|
GetMenuItemText(GetMenuHandle(mApple), item, da);
|
||||||
OpenDeskAcc(da);
|
OpenDeskAcc(da);
|
||||||
break;
|
goto done;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case mFile:
|
case mFile:
|
||||||
switch (item) {
|
switch (item) {
|
||||||
case iNew:
|
case iNew:
|
||||||
mac_newsession();
|
mac_newsession();
|
||||||
break;
|
goto done;
|
||||||
case iClose:
|
case iClose:
|
||||||
mac_closewindow(FrontWindow());
|
mac_closewindow(window);
|
||||||
break;
|
goto done;
|
||||||
case iQuit:
|
case iQuit:
|
||||||
mac_shutdown();
|
mac_shutdown();
|
||||||
break;
|
goto done;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/* If we get here, handling is up to window-specific code. */
|
||||||
|
switch (mac_windowtype(window)) {
|
||||||
|
case wTerminal:
|
||||||
|
mac_menuterm(window, menu, item);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
done:
|
||||||
HiliteMenu(0);
|
HiliteMenu(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -345,6 +358,10 @@ static void mac_closewindow(WindowPtr window) {
|
|||||||
case wTerminal:
|
case wTerminal:
|
||||||
/* FIXME: end session and stuff */
|
/* FIXME: end session and stuff */
|
||||||
break;
|
break;
|
||||||
|
case wAbout:
|
||||||
|
windows.about = NULL;
|
||||||
|
CloseWindow(window);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
CloseWindow(window);
|
CloseWindow(window);
|
||||||
break;
|
break;
|
||||||
@ -371,6 +388,10 @@ static void mac_adjustmenus(void) {
|
|||||||
menu = GetMenuHandle(mFile);
|
menu = GetMenuHandle(mFile);
|
||||||
EnableItem(menu, 0);
|
EnableItem(menu, 0);
|
||||||
EnableItem(menu, iNew);
|
EnableItem(menu, iNew);
|
||||||
|
if (window != NULL)
|
||||||
|
EnableItem(menu, iClose);
|
||||||
|
else
|
||||||
|
DisableItem(menu, iClose);
|
||||||
EnableItem(menu, iQuit);
|
EnableItem(menu, iQuit);
|
||||||
|
|
||||||
switch (mac_windowtype(window)) {
|
switch (mac_windowtype(window)) {
|
||||||
|
1
mac.h
1
mac.h
@ -27,6 +27,7 @@ extern void mac_updateterm(WindowPtr);
|
|||||||
extern void mac_clickterm(WindowPtr, EventRecord *);
|
extern void mac_clickterm(WindowPtr, EventRecord *);
|
||||||
extern void mac_growterm(WindowPtr, EventRecord *);
|
extern void mac_growterm(WindowPtr, EventRecord *);
|
||||||
extern void mac_keyterm(WindowPtr, EventRecord *);
|
extern void mac_keyterm(WindowPtr, EventRecord *);
|
||||||
|
extern void mac_menuterm(WindowPtr, short, short);
|
||||||
/* from maccfg.c */
|
/* from maccfg.c */
|
||||||
extern void mac_loadconfig(Config *);
|
extern void mac_loadconfig(Config *);
|
||||||
|
|
||||||
|
21
mac_res.r
21
mac_res.r
@ -1,4 +1,4 @@
|
|||||||
/* $Id: mac_res.r,v 1.1.2.12 1999/03/15 00:40:55 ben Exp $ */
|
/* $Id: mac_res.r,v 1.1.2.13 1999/03/16 20:27:30 ben Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999 Ben Harris
|
* Copyright (c) 1999 Ben Harris
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@ -459,8 +459,10 @@ type 'TEXT' {
|
|||||||
|
|
||||||
resource 'TEXT' (wLicence, "licence", purgeable) {
|
resource 'TEXT' (wLicence, "licence", purgeable) {
|
||||||
"Copyright © 1997-9 Simon Tatham\n"
|
"Copyright © 1997-9 Simon Tatham\n"
|
||||||
"Portions copyright Gary S. Brown, Eric Young and Ben Harris\n\n"
|
"Portions copyright © 1999 Ben Harris\n"
|
||||||
|
"Portions copyright © 1993 Eric Young\n"
|
||||||
|
"Portions copyright © 1986 Gary S. Brown\n"
|
||||||
|
"\n"
|
||||||
"Permission is hereby granted, free of charge, to any person "
|
"Permission is hereby granted, free of charge, to any person "
|
||||||
"obtaining a copy of this software and associated documentation "
|
"obtaining a copy of this software and associated documentation "
|
||||||
"files (the \"Software\"), to deal in the Software without "
|
"files (the \"Software\"), to deal in the Software without "
|
||||||
@ -525,6 +527,9 @@ type 'pSET' {
|
|||||||
/* Colour options */
|
/* Colour options */
|
||||||
boolean bold_font, bold_colour;
|
boolean bold_font, bold_colour;
|
||||||
align long;
|
align long;
|
||||||
|
/* Selection options */
|
||||||
|
boolean no_implicit_copy, implicit_copy;
|
||||||
|
align long;
|
||||||
/* Non-boolean options */
|
/* Non-boolean options */
|
||||||
integer; integer; /* host */
|
integer; integer; /* host */
|
||||||
longint; /* port */
|
longint; /* port */
|
||||||
@ -556,6 +561,7 @@ resource 'pSET' (PREF_settings, "settings", purgeable) {
|
|||||||
no_auto_cr,
|
no_auto_cr,
|
||||||
use_icon_name,
|
use_icon_name,
|
||||||
bold_colour,
|
bold_colour,
|
||||||
|
no_implicit_copy,
|
||||||
#define PREF_strings 1024
|
#define PREF_strings 1024
|
||||||
PREF_strings, 1, /* host 'STR#' */
|
PREF_strings, 1, /* host 'STR#' */
|
||||||
23, prot_telnet, /* port, protocol */
|
23, prot_telnet, /* port, protocol */
|
||||||
@ -653,6 +659,15 @@ resource 'TMPL' (128, "pSET") {
|
|||||||
"", 'BBIT',
|
"", 'BBIT',
|
||||||
"", 'BBIT',
|
"", 'BBIT',
|
||||||
"", 'ALNG',
|
"", 'ALNG',
|
||||||
|
"Implicit copy", 'BBIT',
|
||||||
|
"", 'BBIT',
|
||||||
|
"", 'BBIT',
|
||||||
|
"", 'BBIT',
|
||||||
|
"", 'BBIT',
|
||||||
|
"", 'BBIT',
|
||||||
|
"", 'BBIT',
|
||||||
|
"", 'BBIT',
|
||||||
|
"", 'ALNG',
|
||||||
"Host STR# ID", 'DWRD',
|
"Host STR# ID", 'DWRD',
|
||||||
"Host STR# index", 'DWRD',
|
"Host STR# index", 'DWRD',
|
||||||
"Port", 'DLNG',
|
"Port", 'DLNG',
|
||||||
|
5
maccfg.c
5
maccfg.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: maccfg.c,v 1.1.2.2 1999/03/14 15:48:35 ben Exp $ */
|
/* $Id: maccfg.c,v 1.1.2.3 1999/03/16 20:27:30 ben Exp $ */
|
||||||
/*
|
/*
|
||||||
* maccfg.c -- Mac port configuration
|
* maccfg.c -- Mac port configuration
|
||||||
*/
|
*/
|
||||||
@ -60,6 +60,8 @@ struct pSET {
|
|||||||
#define WIN_NAME_ALWAYS 0x10000000
|
#define WIN_NAME_ALWAYS 0x10000000
|
||||||
unsigned long colour_flags;
|
unsigned long colour_flags;
|
||||||
#define BOLD_COLOUR 0x80000000
|
#define BOLD_COLOUR 0x80000000
|
||||||
|
unsigned long selection_flags;
|
||||||
|
#define IMPLICIT_COPY 0x80000000
|
||||||
struct strloc host;
|
struct strloc host;
|
||||||
long port;
|
long port;
|
||||||
long protocol;
|
long protocol;
|
||||||
@ -127,6 +129,7 @@ void mac_loadconfig(Config *cfg) {
|
|||||||
if (cfg->colours == NULL)
|
if (cfg->colours == NULL)
|
||||||
fatalbox("Failed to get default palette");
|
fatalbox("Failed to get default palette");
|
||||||
/* Selection */
|
/* Selection */
|
||||||
|
cfg->implicit_copy = (s->selection_flags & IMPLICIT_COPY) != 0;
|
||||||
get_wordness(s->wordness_id, cfg->wordness);
|
get_wordness(s->wordness_id, cfg->wordness);
|
||||||
SetResAttrs(h, GetResAttrs(h) & ~resLocked);
|
SetResAttrs(h, GetResAttrs(h) & ~resLocked);
|
||||||
ReleaseResource(h);
|
ReleaseResource(h);
|
||||||
|
64
macterm.c
64
macterm.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: macterm.c,v 1.1.2.24 1999/03/15 14:22:45 ben Exp $ */
|
/* $Id: macterm.c,v 1.1.2.25 1999/03/16 20:27:31 ben Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999 Ben Harris
|
* Copyright (c) 1999 Ben Harris
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@ -33,6 +33,7 @@
|
|||||||
#include <Controls.h>
|
#include <Controls.h>
|
||||||
#include <Fonts.h>
|
#include <Fonts.h>
|
||||||
#include <Gestalt.h>
|
#include <Gestalt.h>
|
||||||
|
#include <MacMemory.h>
|
||||||
#include <MacWindows.h>
|
#include <MacWindows.h>
|
||||||
#include <Palettes.h>
|
#include <Palettes.h>
|
||||||
#include <Quickdraw.h>
|
#include <Quickdraw.h>
|
||||||
@ -78,6 +79,7 @@ static void mac_initfont(struct mac_session *);
|
|||||||
static void mac_initpalette(struct mac_session *);
|
static void mac_initpalette(struct mac_session *);
|
||||||
static void mac_adjustwinbg(struct mac_session *);
|
static void mac_adjustwinbg(struct mac_session *);
|
||||||
static void mac_adjustsize(struct mac_session *, int, int);
|
static void mac_adjustsize(struct mac_session *, int, int);
|
||||||
|
static void mac_drawgrowicon(struct mac_session *s);
|
||||||
static pascal void mac_scrolltracker(ControlHandle, short);
|
static pascal void mac_scrolltracker(ControlHandle, short);
|
||||||
static pascal void do_text_for_device(short, short, GDHandle, long);
|
static pascal void do_text_for_device(short, short, GDHandle, long);
|
||||||
static pascal void mac_set_attr_mask(short, short, GDHandle, long);
|
static pascal void mac_set_attr_mask(short, short, GDHandle, long);
|
||||||
@ -233,6 +235,9 @@ void mac_adjusttermmenus(WindowPtr window) {
|
|||||||
EnableItem(menu, 0);
|
EnableItem(menu, 0);
|
||||||
DisableItem(menu, iUndo);
|
DisableItem(menu, iUndo);
|
||||||
DisableItem(menu, iCut);
|
DisableItem(menu, iCut);
|
||||||
|
if (term_hasselection())
|
||||||
|
EnableItem(menu, iCopy);
|
||||||
|
else
|
||||||
DisableItem(menu, iCopy);
|
DisableItem(menu, iCopy);
|
||||||
if (GetScrap(NULL, 'TEXT', &offset) == noTypeErr)
|
if (GetScrap(NULL, 'TEXT', &offset) == noTypeErr)
|
||||||
DisableItem(menu, iPaste);
|
DisableItem(menu, iPaste);
|
||||||
@ -242,6 +247,23 @@ void mac_adjusttermmenus(WindowPtr window) {
|
|||||||
EnableItem(menu, iSelectAll);
|
EnableItem(menu, iSelectAll);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mac_menuterm(WindowPtr window, short menu, short item) {
|
||||||
|
struct mac_session *s;
|
||||||
|
|
||||||
|
s = (struct mac_session *)GetWRefCon(window);
|
||||||
|
switch (menu) {
|
||||||
|
case mEdit:
|
||||||
|
switch (item) {
|
||||||
|
case iCopy:
|
||||||
|
term_copy();
|
||||||
|
break;
|
||||||
|
case iPaste:
|
||||||
|
term_paste();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void mac_clickterm(WindowPtr window, EventRecord *event) {
|
void mac_clickterm(WindowPtr window, EventRecord *event) {
|
||||||
struct mac_session *s;
|
struct mac_session *s;
|
||||||
Point mouse;
|
Point mouse;
|
||||||
@ -321,8 +343,24 @@ void write_clip(void *data, int len) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void get_clip(void **p, int *lenp) {
|
void get_clip(void **p, int *lenp) {
|
||||||
|
static Handle h = NULL;
|
||||||
|
long offset;
|
||||||
|
|
||||||
/* XXX: do something */
|
if (p == NULL) {
|
||||||
|
/* release memory */
|
||||||
|
if (h != NULL)
|
||||||
|
DisposeHandle(h);
|
||||||
|
h = NULL;
|
||||||
|
} else
|
||||||
|
if (GetScrap(NULL, 'TEXT', &offset) > 0) {
|
||||||
|
h = NewEmptyHandle();
|
||||||
|
*lenp = GetScrap(h, 'TEXT', &offset);
|
||||||
|
HLock(h);
|
||||||
|
*p = *h;
|
||||||
|
} else {
|
||||||
|
*p = NULL;
|
||||||
|
*lenp = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static pascal void mac_scrolltracker(ControlHandle control, short part) {
|
static pascal void mac_scrolltracker(ControlHandle control, short part) {
|
||||||
@ -565,11 +603,11 @@ void mac_activateterm(WindowPtr window, Boolean active) {
|
|||||||
PmBackColor(DEFAULT_BG); /* HideControl clears behind the control */
|
PmBackColor(DEFAULT_BG); /* HideControl clears behind the control */
|
||||||
HideControl(s->scrollbar);
|
HideControl(s->scrollbar);
|
||||||
}
|
}
|
||||||
|
mac_drawgrowicon(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mac_updateterm(WindowPtr window) {
|
void mac_updateterm(WindowPtr window) {
|
||||||
struct mac_session *s;
|
struct mac_session *s;
|
||||||
Rect clip;
|
|
||||||
|
|
||||||
s = (struct mac_session *)GetWRefCon(window);
|
s = (struct mac_session *)GetWRefCon(window);
|
||||||
BeginUpdate(window);
|
BeginUpdate(window);
|
||||||
@ -585,16 +623,24 @@ void mac_updateterm(WindowPtr window) {
|
|||||||
if (FrontWindow() != window)
|
if (FrontWindow() != window)
|
||||||
EraseRect(&(*s->scrollbar)->contrlRect);
|
EraseRect(&(*s->scrollbar)->contrlRect);
|
||||||
UpdateControls(window, window->visRgn);
|
UpdateControls(window, window->visRgn);
|
||||||
/* Stop DrawGrowIcon giving us space for a horizontal scrollbar */
|
mac_drawgrowicon(s);
|
||||||
SetRect(&clip, window->portRect.right - 15, SHRT_MIN, SHRT_MAX, SHRT_MAX);
|
|
||||||
ClipRect(&clip);
|
|
||||||
DrawGrowIcon(window);
|
|
||||||
clip.left = SHRT_MIN;
|
|
||||||
ClipRect(&clip);
|
|
||||||
free_ctx(NULL);
|
free_ctx(NULL);
|
||||||
EndUpdate(window);
|
EndUpdate(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void mac_drawgrowicon(struct mac_session *s) {
|
||||||
|
Rect clip;
|
||||||
|
|
||||||
|
SetPort(s->window);
|
||||||
|
/* Stop DrawGrowIcon giving us space for a horizontal scrollbar */
|
||||||
|
SetRect(&clip, s->window->portRect.right - 15, SHRT_MIN,
|
||||||
|
SHRT_MAX, SHRT_MAX);
|
||||||
|
ClipRect(&clip);
|
||||||
|
DrawGrowIcon(s->window);
|
||||||
|
clip.left = SHRT_MIN;
|
||||||
|
ClipRect(&clip);
|
||||||
|
}
|
||||||
|
|
||||||
struct do_text_args {
|
struct do_text_args {
|
||||||
struct mac_session *s;
|
struct mac_session *s;
|
||||||
Rect textrect;
|
Rect textrect;
|
||||||
|
4
putty.h
4
putty.h
@ -164,7 +164,8 @@ typedef struct {
|
|||||||
unsigned char colours[22][3];
|
unsigned char colours[22][3];
|
||||||
#endif /* not macintosh */
|
#endif /* not macintosh */
|
||||||
/* Selection options */
|
/* Selection options */
|
||||||
#ifndef macintosh
|
int implicit_copy;
|
||||||
|
#ifdef macintosh
|
||||||
int mouse_is_xterm;
|
int mouse_is_xterm;
|
||||||
#endif
|
#endif
|
||||||
short wordness[256];
|
short wordness[256];
|
||||||
@ -246,6 +247,7 @@ void term_clrsb (void);
|
|||||||
void term_mouse (Mouse_Button, Mouse_Action, int, int);
|
void term_mouse (Mouse_Button, Mouse_Action, int, int);
|
||||||
void term_copy(void);
|
void term_copy(void);
|
||||||
void term_paste(void);
|
void term_paste(void);
|
||||||
|
int term_hasselection(void);
|
||||||
void term_deselect (void);
|
void term_deselect (void);
|
||||||
void term_update (void);
|
void term_update (void);
|
||||||
void term_invalidate(void);
|
void term_invalidate(void);
|
||||||
|
@ -1427,6 +1427,7 @@ void term_mouse (Mouse_Button b, Mouse_Action a, int x, int y) {
|
|||||||
sel_spread();
|
sel_spread();
|
||||||
} else if ((b == MB_SELECT || b == MB_EXTEND) && a == MA_RELEASE)
|
} else if ((b == MB_SELECT || b == MB_EXTEND) && a == MA_RELEASE)
|
||||||
if (selstate == DRAGGING) {
|
if (selstate == DRAGGING) {
|
||||||
|
if (cfg.implicit_copy)
|
||||||
term_copy();
|
term_copy();
|
||||||
selstate = SELECTED;
|
selstate = SELECTED;
|
||||||
} else
|
} else
|
||||||
@ -1492,6 +1493,14 @@ void term_paste() {
|
|||||||
get_clip(NULL, NULL);
|
get_clip(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Find out if there's a selection.
|
||||||
|
*/
|
||||||
|
int term_hasselection(void) {
|
||||||
|
|
||||||
|
return selstate == SELECTED;
|
||||||
|
}
|
||||||
|
|
||||||
static void deselect (void) {
|
static void deselect (void) {
|
||||||
selstate = NO_SELECTION;
|
selstate = NO_SELECTION;
|
||||||
selstart = selend = scrtop;
|
selstart = selend = scrtop;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user