haven't got a working backend at the moment, but it all looks OK.
[originally from svn r118]
-# $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.
# Users of non-Mac systems will see some pretty strange characters around.
PuTTY ÄÄ {Objects¥68K} {Libs¥68K}
IF (`exists {Targ}.NJ`)
ILink ¶
+ -compact ¶
-o {Targ} {Sym¥68K} ¶
-t 'APPL' ¶
-c 'pTTY' ¶
-newerdeps {NewerDeps}
ELSE
ILink ¶
+ -compact ¶
-o {Targ} {Sym¥68K} ¶
-t 'APPL' ¶
-c 'pTTY' ¶
-/* $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
* All rights reserved.
static void mac_menucommand(long result) {
short menu, item;
Str255 da;
+ WindowPtr window;
menu = HiWord(result);
item = LoWord(result);
+ window = FrontWindow();
+ /* Things which do the same whatever window we're in. */
switch (menu) {
case mApple:
switch (item) {
case iAbout:
- GetNewDialog(wAbout, NULL, (GrafPort *)-1);
- break;
+ if (windows.about)
+ SelectWindow(windows.about);
+ else
+ windows.about = GetNewDialog(wAbout, NULL, (WindowPtr)-1);
+ goto done;
default:
GetMenuItemText(GetMenuHandle(mApple), item, da);
OpenDeskAcc(da);
- break;
+ goto done;
}
break;
case mFile:
switch (item) {
case iNew:
mac_newsession();
- break;
+ goto done;
case iClose:
- mac_closewindow(FrontWindow());
- break;
+ mac_closewindow(window);
+ goto done;
case iQuit:
mac_shutdown();
- break;
+ goto done;
}
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);
}
case wTerminal:
/* FIXME: end session and stuff */
break;
+ case wAbout:
+ windows.about = NULL;
+ CloseWindow(window);
+ break;
default:
CloseWindow(window);
break;
menu = GetMenuHandle(mFile);
EnableItem(menu, 0);
EnableItem(menu, iNew);
+ if (window != NULL)
+ EnableItem(menu, iClose);
+ else
+ DisableItem(menu, iClose);
EnableItem(menu, iQuit);
switch (mac_windowtype(window)) {
extern void mac_clickterm(WindowPtr, EventRecord *);
extern void mac_growterm(WindowPtr, EventRecord *);
extern void mac_keyterm(WindowPtr, EventRecord *);
+extern void mac_menuterm(WindowPtr, short, short);
/* from maccfg.c */
extern void mac_loadconfig(Config *);
-/* $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
* All rights reserved.
resource 'TEXT' (wLicence, "licence", purgeable) {
"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 "
"obtaining a copy of this software and associated documentation "
"files (the \"Software\"), to deal in the Software without "
/* Colour options */
boolean bold_font, bold_colour;
align long;
+ /* Selection options */
+ boolean no_implicit_copy, implicit_copy;
+ align long;
/* Non-boolean options */
integer; integer; /* host */
longint; /* port */
no_auto_cr,
use_icon_name,
bold_colour,
+ no_implicit_copy,
#define PREF_strings 1024
PREF_strings, 1, /* host 'STR#' */
23, prot_telnet, /* port, protocol */
"", 'BBIT',
"", 'BBIT',
"", 'ALNG',
+ "Implicit copy", 'BBIT',
+ "", 'BBIT',
+ "", 'BBIT',
+ "", 'BBIT',
+ "", 'BBIT',
+ "", 'BBIT',
+ "", 'BBIT',
+ "", 'BBIT',
+ "", 'ALNG',
"Host STR# ID", 'DWRD',
"Host STR# index", 'DWRD',
"Port", 'DLNG',
-/* $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
*/
#define WIN_NAME_ALWAYS 0x10000000
unsigned long colour_flags;
#define BOLD_COLOUR 0x80000000
+ unsigned long selection_flags;
+#define IMPLICIT_COPY 0x80000000
struct strloc host;
long port;
long protocol;
if (cfg->colours == NULL)
fatalbox("Failed to get default palette");
/* Selection */
+ cfg->implicit_copy = (s->selection_flags & IMPLICIT_COPY) != 0;
get_wordness(s->wordness_id, cfg->wordness);
SetResAttrs(h, GetResAttrs(h) & ~resLocked);
ReleaseResource(h);
-/* $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
* All rights reserved.
#include <Controls.h>
#include <Fonts.h>
#include <Gestalt.h>
+#include <MacMemory.h>
#include <MacWindows.h>
#include <Palettes.h>
#include <Quickdraw.h>
static void mac_initpalette(struct mac_session *);
static void mac_adjustwinbg(struct mac_session *);
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 do_text_for_device(short, short, GDHandle, long);
static pascal void mac_set_attr_mask(short, short, GDHandle, long);
EnableItem(menu, 0);
DisableItem(menu, iUndo);
DisableItem(menu, iCut);
- DisableItem(menu, iCopy);
+ if (term_hasselection())
+ EnableItem(menu, iCopy);
+ else
+ DisableItem(menu, iCopy);
if (GetScrap(NULL, 'TEXT', &offset) == noTypeErr)
DisableItem(menu, iPaste);
else
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) {
struct mac_session *s;
Point mouse;
}
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) {
PmBackColor(DEFAULT_BG); /* HideControl clears behind the control */
HideControl(s->scrollbar);
}
+ mac_drawgrowicon(s);
}
void mac_updateterm(WindowPtr window) {
struct mac_session *s;
- Rect clip;
s = (struct mac_session *)GetWRefCon(window);
BeginUpdate(window);
if (FrontWindow() != window)
EraseRect(&(*s->scrollbar)->contrlRect);
UpdateControls(window, window->visRgn);
+ mac_drawgrowicon(s);
+ free_ctx(NULL);
+ 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, window->portRect.right - 15, SHRT_MIN, SHRT_MAX, SHRT_MAX);
+ SetRect(&clip, s->window->portRect.right - 15, SHRT_MIN,
+ SHRT_MAX, SHRT_MAX);
ClipRect(&clip);
- DrawGrowIcon(window);
+ DrawGrowIcon(s->window);
clip.left = SHRT_MIN;
ClipRect(&clip);
- free_ctx(NULL);
- EndUpdate(window);
-}
+}
struct do_text_args {
struct mac_session *s;
unsigned char colours[22][3];
#endif /* not macintosh */
/* Selection options */
-#ifndef macintosh
+ int implicit_copy;
+#ifdef macintosh
int mouse_is_xterm;
#endif
short wordness[256];
void term_mouse (Mouse_Button, Mouse_Action, int, int);
void term_copy(void);
void term_paste(void);
+int term_hasselection(void);
void term_deselect (void);
void term_update (void);
void term_invalidate(void);
sel_spread();
} else if ((b == MB_SELECT || b == MB_EXTEND) && a == MA_RELEASE)
if (selstate == DRAGGING) {
- term_copy();
+ if (cfg.implicit_copy)
+ term_copy();
selstate = SELECTED;
} else
selstate = NO_SELECTION;
get_clip(NULL, NULL);
}
+/*
+ * Find out if there's a selection.
+ */
+int term_hasselection(void) {
+
+ return selstate == SELECTED;
+}
+
static void deselect (void) {
selstate = NO_SELECTION;
selstart = selend = scrtop;