зеркало из https://github.com/github/putty.git
Add support for displaying the licence window.
[originally from svn r2255]
This commit is contained in:
Родитель
a1b5ba2270
Коммит
5de2925051
48
mac/mac.c
48
mac/mac.c
|
@ -1,4 +1,4 @@
|
|||
/* $Id: mac.c,v 1.3 2002/11/23 18:22:47 ben Exp $ */
|
||||
/* $Id: mac.c,v 1.4 2002/11/24 15:08:52 ben Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1999 Ben Harris
|
||||
* All rights reserved.
|
||||
|
@ -69,10 +69,12 @@ static void mac_growwindow(WindowPtr, EventRecord *);
|
|||
static void mac_activatewindow(WindowPtr, EventRecord *);
|
||||
static void mac_activateabout(WindowPtr, EventRecord *);
|
||||
static void mac_updatewindow(WindowPtr);
|
||||
static void mac_updatelicence(WindowPtr);
|
||||
static void mac_keypress(EventRecord *);
|
||||
static int mac_windowtype(WindowPtr);
|
||||
static void mac_menucommand(long);
|
||||
static void mac_openabout(void);
|
||||
static void mac_openlicence(void);
|
||||
static void mac_adjustcursor(RgnHandle);
|
||||
static void mac_adjustmenus(void);
|
||||
static void mac_closewindow(WindowPtr);
|
||||
|
@ -240,7 +242,7 @@ static void mac_contentclick(WindowPtr window, EventRecord *event) {
|
|||
if (DialogSelect(event, &(DialogPtr)window, &item))
|
||||
switch (item) {
|
||||
case wiAboutLicence:
|
||||
/* XXX: Do something */
|
||||
mac_openlicence();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -295,11 +297,30 @@ static void mac_updatewindow(WindowPtr window) {
|
|||
EndUpdate(window);
|
||||
break;
|
||||
case wLicence:
|
||||
/* Do something */
|
||||
break;
|
||||
mac_updatelicence(window);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void mac_updatelicence(WindowPtr window)
|
||||
{
|
||||
Handle h;
|
||||
int len;
|
||||
|
||||
SetPort(window);
|
||||
BeginUpdate(window);
|
||||
TextFont(applFont);
|
||||
TextSize(9);
|
||||
h = Get1Resource('TEXT', wLicence);
|
||||
len = GetResourceSizeOnDisk(h);
|
||||
if (h != NULL) {
|
||||
HLock(h);
|
||||
TETextBox(*h, len, &window->portRect, teFlushDefault);
|
||||
HUnlock(h);
|
||||
}
|
||||
EndUpdate(window);
|
||||
}
|
||||
|
||||
/*
|
||||
* Work out what kind of window we're dealing with.
|
||||
* Concept shamelessly nicked from SurfWriter.
|
||||
|
@ -410,6 +431,21 @@ static void mac_openabout(void) {
|
|||
}
|
||||
}
|
||||
|
||||
static void mac_openlicence(void) {
|
||||
DialogItemType itemtype;
|
||||
Handle item;
|
||||
VersRecHndl vers;
|
||||
Rect box;
|
||||
StringPtr longvers;
|
||||
|
||||
if (windows.licence)
|
||||
SelectWindow(windows.licence);
|
||||
else {
|
||||
windows.licence = GetNewWindow(wLicence, NULL, (WindowPtr)-1);
|
||||
ShowWindow(windows.licence);
|
||||
}
|
||||
}
|
||||
|
||||
static void mac_closewindow(WindowPtr window) {
|
||||
|
||||
switch (mac_windowtype(window)) {
|
||||
|
@ -423,6 +459,10 @@ static void mac_closewindow(WindowPtr window) {
|
|||
windows.about = NULL;
|
||||
CloseWindow(window);
|
||||
break;
|
||||
case wLicence:
|
||||
windows.licence = NULL;
|
||||
CloseWindow(window);
|
||||
break;
|
||||
default:
|
||||
CloseWindow(window);
|
||||
break;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: mac_res.r,v 1.1 2002/11/19 02:14:35 ben Exp $ */
|
||||
/* $Id: mac_res.r,v 1.2 2002/11/24 15:08:52 ben Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1999 Ben Harris
|
||||
* All rights reserved.
|
||||
|
@ -435,7 +435,7 @@ resource 'DITL' (wAbout, "about", purgeable) {
|
|||
/* Licence box */
|
||||
|
||||
resource 'WIND' (wLicence, "licence", purgeable) {
|
||||
{ 0, 0, 300, 300 },
|
||||
{ 0, 0, 250, 400 },
|
||||
noGrowDocProc,
|
||||
visible,
|
||||
goAway,
|
||||
|
@ -451,8 +451,8 @@ type 'TEXT' {
|
|||
resource 'TEXT' (wLicence, "licence", purgeable) {
|
||||
"PuTTY is copyright 1997-2001 Simon Tatham.\n"
|
||||
"\n"
|
||||
"Portions copyright Robert de Bath, Joris van Rantwijk, Delian\n"
|
||||
"Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas Barry,\n"
|
||||
"Portions copyright Robert de Bath, Joris van Rantwijk, Delian"
|
||||
"Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas Barry,"
|
||||
"Justin Bradford, and CORE SDI S.A.\n"
|
||||
"\n"
|
||||
"Permission is hereby granted, free of charge, to any person "
|
||||
|
|
Загрузка…
Ссылка в новой задаче