plink : [U] uxplink uxcons NONSSH UXSSH be_all logging UXMISC
PuTTY : [M] terminal wcwidth tree234 misc ldisc ldiscucs
- + logging settings be_none mac macstore macterm macucs mac_res.rsrc
- + testback
+ + logging settings be_none mac macdlg macstore macterm macucs
+ + mac_res.rsrc testback
-/* $Id: mac.c,v 1.11 2002/12/30 19:01:44 ben Exp $ */
+/* $Id: mac.c,v 1.12 2002/12/31 01:40:14 ben Exp $ */
/*
* Copyright (c) 1999 Ben Harris
* All rights reserved.
break;
}
break;
+ case wSettings:
+ mac_clickdlg(window, event);
+ break;
}
}
case wTerminal:
mac_activateterm(window, active);
break;
+ case wSettings:
+ mac_activatedlg(window, event);
+ break;
case wAbout:
mac_activateabout(window, event);
break;
mac_updateterm(window);
break;
case wAbout:
+ case wSettings:
BeginUpdate(window);
UpdateDialog(window, window->visRgn);
EndUpdate(window);
*/
static int mac_windowtype(WindowPtr window) {
int kind;
+ long refcon;
if (window == NULL)
return wNone;
return wDA;
if (GetWVariant(window) == zoomDocProc)
return wTerminal;
- return GetWRefCon(window);
+ refcon = GetWRefCon(window);
+ if (refcon < 1024)
+ return refcon;
+ else
+ return wSettings;
}
/*
int font_leading;
int font_boldadjust;
WindowPtr window;
+ WindowPtr settings_window;
PaletteHandle palette;
ControlHandle scrollbar;
WCTabHandle wctab;
UnicodeToTextInfo uni_to_font;
} Session;
-/* from macterm.c */
+/* from macdlg.c */
extern void mac_newsession(void);
+extern void mac_clickdlg(WindowPtr, EventRecord *);
+extern void mac_activatedlg(WindowPtr, EventRecord *);
+/* from macterm.c */
extern void mac_opensession(void);
extern void mac_startsession(Session *);
extern void mac_activateterm(WindowPtr, Boolean);
-/* $Id: mac_res.r,v 1.7 2002/12/30 23:14:11 ben Exp $ */
+/* $Id: mac_res.r,v 1.8 2002/12/31 01:40:14 ben Exp $ */
/*
- * Copyright (c) 1999 Ben Harris
+ * Copyright (c) 1999, 2002 Ben Harris
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person
scrollBarProc, 0, ""
};
+/* Settings dialogue */
+
+resource 'DLOG' (wSettings, "settings", purgeable) {
+ { 0, 0, 46, 240 },
+ noGrowDocProc,
+ invisible,
+ goAway,
+ wSettings,
+ wSettings,
+ "Settings",
+ staggerParentWindowScreen
+};
+
+resource 'dlgx' (wSettings, "settings", purgeable) {
+ versionZero {
+ kDialogFlagsUseThemeBackground | kDialogFlagsUseThemeControls
+ }
+};
+
+resource 'DITL' (wSettings, "settings", purgeable) {
+ {
+ { 13, 13, 33, 227 },
+ Button { enabled, "Open" },
+ }
+};
+
/* "About" box */
resource 'DLOG' (wAbout, "about", purgeable) {
--- /dev/null
+/* $Id: macdlg.c,v 1.1 2002/12/31 01:40:14 ben Exp $ */
+/*
+ * Copyright (c) 2002 Ben Harris
+ * All rights reserved.
+ *
+ * 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
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * macdlg.c - settings dialogue box for Mac OS.
+ */
+
+#include <MacTypes.h>
+#include <Dialogs.h>
+#include <Windows.h>
+
+#include <string.h>
+
+#include "putty.h"
+#include "mac.h"
+#include "macresid.h"
+
+void mac_newsession(void)
+{
+ Session *s;
+
+ /* This should obviously be initialised by other means */
+ s = smalloc(sizeof(*s));
+ memset(s, 0, sizeof(*s));
+ do_defaults(NULL, &s->cfg);
+ s->back = &loop_backend;
+
+ s->settings_window = GetNewDialog(wSettings, NULL, (WindowPtr)-1);
+
+ SetWRefCon(s->settings_window, (long)s);
+ ShowWindow(s->settings_window);
+}
+
+void mac_activatedlg(WindowPtr window, EventRecord *event)
+{
+ DialogItemType itemtype;
+ Handle itemhandle;
+ short item;
+ Rect itemrect;
+ int active;
+
+ active = (event->modifiers & activeFlag) != 0;
+ GetDialogItem(window, wiSettingsOpen, &itemtype, &itemhandle, &itemrect);
+ HiliteControl((ControlHandle)itemhandle, active ? 0 : 255);
+ DialogSelect(event, &window, &item);
+}
+
+void mac_clickdlg(WindowPtr window, EventRecord *event)
+{
+ short item;
+ Session *s = (Session *)GetWRefCon(window);
+
+ if (DialogSelect(event, &(DialogPtr)window, &item))
+ switch (item) {
+ case wiSettingsOpen:
+ CloseWindow(window);
+ mac_startsession(s);
+ break;
+ }
+}
+
+/*
+ * Local Variables:
+ * c-file-style: "simon"
+ * End:
+ */
-/* $Id: macresid.h,v 1.2 2002/12/30 18:21:17 ben Exp $ */
+/* $Id: macresid.h,v 1.3 2002/12/31 01:40:14 ben Exp $ */
/*
* macresid.h -- Mac resource IDs
#define wiAboutVersion 3
#define wTerminal 130
#define wLicence 131
+#define wSettings 132
+#define wiSettingsOpen 1
/* Controls */
#define cVScroll 128
-/* $Id: macterm.c,v 1.26 2002/12/30 18:21:17 ben Exp $ */
+/* $Id: macterm.c,v 1.27 2002/12/31 01:40:14 ben Exp $ */
/*
* Copyright (c) 1999 Simon Tatham
* Copyright (c) 1999, 2002 Ben Harris
DisposeHandle(h);
}
-
-void mac_newsession(void) {
- Session *s;
-
- /* This should obviously be initialised by other means */
- s = smalloc(sizeof(*s));
- memset(s, 0, sizeof(*s));
- do_defaults(NULL, &s->cfg);
- s->back = &loop_backend;
- mac_startsession(s);
-}
-
void mac_opensession(void) {
Session *s;
StandardFileReply sfr;