From 71581f966353977ea2ee12e2ec02ac5905fdcb5d Mon Sep 17 00:00:00 2001 From: owen Date: Wed, 26 Jan 2005 23:30:34 +0000 Subject: [PATCH] Add a Change Settings dialogue box. Doesn't do anything yet. git-svn-id: svn://svn.tartarus.org/sgt/putty@5216 cda61777-01e9-0310-a592-d414129be87e --- mac/mac.c | 4 ++++ mac/mac.h | 1 + mac/mac_res.r | 5 +++-- mac/macctrls.c | 3 ++- mac/macdlg.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++---------- mac/macresid.h | 13 +++++++------ mac/macterm.c | 1 + 7 files changed, 64 insertions(+), 19 deletions(-) diff --git a/mac/mac.c b/mac/mac.c index 992f3675..747acdc6 100644 --- a/mac/mac.c +++ b/mac/mac.c @@ -474,6 +474,9 @@ static void mac_menucommand(long result) { case iOpen: mac_opensession(); goto done; + case iChange: + mac_reconfig(); + goto done; case iClose: mac_closewindow(window); goto done; @@ -569,6 +572,7 @@ static void mac_adjustmenus(void) { if (window != NULL && mac_wininfo(window)->adjustmenus != NULL) (*mac_wininfo(window)->adjustmenus)(window); else { + DisableItem(menu, iChange); DisableItem(menu, iSave); DisableItem(menu, iSaveAs); DisableItem(menu, iDuplicate); diff --git a/mac/mac.h b/mac/mac.h index 570ceda3..1fef9660 100644 --- a/mac/mac.h +++ b/mac/mac.h @@ -150,6 +150,7 @@ typedef struct KeyState { extern WindowPtr mac_frontwindow(void); /* from macdlg.c */ extern void mac_newsession(void); +extern void mac_reconfig(void); extern void mac_dupsession(void); extern void mac_savesession(void); extern void mac_savesessionas(void); diff --git a/mac/mac_res.r b/mac/mac_res.r index b0e4fb24..3c1619cc 100644 --- a/mac/mac_res.r +++ b/mac/mac_res.r @@ -895,12 +895,13 @@ resource 'MENU' (mApple, preload) { resource 'MENU' (mFile, preload) { mFile, textMenuProc, - 0b11111111111111111111111101111011, + 0b11111111111111111111111011110111, enabled, "Session", { "New", noicon, "N", nomark, plain, "Open\0xc9", noicon, "O", nomark, plain, + "Change Settings", noicon, nokey, nomark, plain, "-", noicon, nokey, nomark, plain, "Close", noicon, "W", nomark, plain, "Save", noicon, "S", nomark, plain, @@ -1143,4 +1144,4 @@ resource 'ldes' (ldes_Default) { 0, /* LDEF number */ noGrowSpace } -}; \ No newline at end of file +}; diff --git a/mac/macctrls.c b/mac/macctrls.c index d49d6e6e..55614531 100644 --- a/mac/macctrls.c +++ b/mac/macctrls.c @@ -1,4 +1,4 @@ -/* $Id: macctrls.c,v 1.42 2003/05/10 20:51:39 ben Exp $ */ +/* $Id$ */ /* * Copyright (c) 2003 Ben Harris * All rights reserved. @@ -248,6 +248,7 @@ void macctrl_layoutbox(struct controlbox *cb, WindowPtr window, mcs->focus = NULL; mcs->defbutton = NULL; mcs->canbutton = NULL; + mcs->curpanel = 1; /* Count the number of panels */ mcs->npanels = 1; for (i = 1; i < cb->nctrlsets; i++) diff --git a/mac/macdlg.c b/mac/macdlg.c index 57b73ad9..2ec10625 100644 --- a/mac/macdlg.c +++ b/mac/macdlg.c @@ -47,20 +47,37 @@ #include "macresid.h" #include "storage.h" +static void mac_config(int); static void mac_closedlg(WindowPtr); -static void mac_enddlg(WindowPtr, int); +static void mac_enddlg_config(WindowPtr, int); +static void mac_enddlg_reconfig(WindowPtr, int); void mac_newsession(void) { + mac_config(FALSE); +} + +void mac_reconfig(void) +{ + mac_config(TRUE); +} + +static void mac_config(int midsession) +{ Session *s; WinInfo *wi; static struct sesslist sesslist; Str255 mactitle; - - s = snew(Session); - memset(s, 0, sizeof(*s)); - do_defaults(NULL, &s->cfg); - s->hasfile = FALSE; + char *str; + + if (midsession) { + s = mac_windowsession(FrontWindow()); + } else { + s = snew(Session); + memset(s, 0, sizeof(*s)); + do_defaults(NULL, &s->cfg); + s->hasfile = FALSE; + } if (HAVE_COLOR_QD()) s->settings_window = GetNewCWindow(wSettings, NULL, (WindowPtr)-1); @@ -69,10 +86,14 @@ void mac_newsession(void) get_sesslist(&sesslist, TRUE); s->ctrlbox = ctrl_new_box(); - setup_config_box(s->ctrlbox, &sesslist, FALSE, 0, 0); + setup_config_box(s->ctrlbox, &sesslist, midsession, 0, 0); s->settings_ctrls.data = &s->cfg; - s->settings_ctrls.end = &mac_enddlg; + if (midsession) + s->settings_ctrls.end = &mac_enddlg_reconfig; + else + s->settings_ctrls.end = &mac_enddlg_config; + macctrl_layoutbox(s->ctrlbox, s->settings_window, &s->settings_ctrls); wi = snew(WinInfo); @@ -87,7 +108,11 @@ void mac_newsession(void) wi->adjustmenus = &macctrl_adjustmenus; wi->close = &mac_closedlg; SetWRefCon(s->settings_window, (long)wi); - c2pstrcpy(mactitle, "PuTTY Configuration"); + if (midsession) + str = dupprintf("%s Reconfiguration", appname); + else + str = dupprintf("%s Configuration", appname); + c2pstrcpy(mactitle, str); SetWTitle(s->settings_window, mactitle); ShowWindow(s->settings_window); } @@ -102,7 +127,7 @@ static void mac_closedlg(WindowPtr window) sfree(s); } -static void mac_enddlg(WindowPtr window, int value) +static void mac_enddlg_config(WindowPtr window, int value) { Session *s = mac_windowsession(window); @@ -114,6 +139,17 @@ static void mac_enddlg(WindowPtr window, int value) } } +static void mac_enddlg_reconfig(WindowPtr window, int value) +{ + Session *s = mac_windowsession(window); + + if (value == 0) + mac_closedlg(window); + else { + mac_closedlg(window); + } +} + void mac_dupsession(void) { Session *s1 = mac_windowsession(FrontWindow()); diff --git a/mac/macresid.h b/mac/macresid.h index 76e0e525..b327211c 100644 --- a/mac/macresid.h +++ b/mac/macresid.h @@ -1,4 +1,4 @@ -/* $Id: macresid.h,v 1.16 2003/04/18 13:09:08 ben Exp $ */ +/* $Id$ */ /* * macresid.h -- Mac resource IDs @@ -27,11 +27,12 @@ /* File menu */ #define iNew 1 #define iOpen 2 -#define iClose 4 -#define iSave 5 -#define iSaveAs 6 -#define iDuplicate 7 -#define iQuit 9 +#define iChange 3 +#define iClose 5 +#define iSave 6 +#define iSaveAs 7 +#define iDuplicate 8 +#define iQuit 10 /* Edit menu */ #define iUndo 1 #define iCut 3 diff --git a/mac/macterm.c b/mac/macterm.c index c81e6359..44fb5af8 100644 --- a/mac/macterm.c +++ b/mac/macterm.c @@ -466,6 +466,7 @@ static void mac_adjusttermmenus(WindowPtr window) menu = GetMenuHandle(mFile); DisableItem(menu, iSave); /* XXX enable if modified */ EnableItem(menu, iSaveAs); + EnableItem(menu, iChange); EnableItem(menu, iDuplicate); menu = GetMenuHandle(mEdit); EnableItem(menu, 0); -- 2.11.0