mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 18:07:59 +00:00
Add a Change Settings dialogue box. Doesn't do anything yet.
[originally from svn r5216]
This commit is contained in:
parent
3f725a56ef
commit
2374544eb3
@ -474,6 +474,9 @@ static void mac_menucommand(long result) {
|
|||||||
case iOpen:
|
case iOpen:
|
||||||
mac_opensession();
|
mac_opensession();
|
||||||
goto done;
|
goto done;
|
||||||
|
case iChange:
|
||||||
|
mac_reconfig();
|
||||||
|
goto done;
|
||||||
case iClose:
|
case iClose:
|
||||||
mac_closewindow(window);
|
mac_closewindow(window);
|
||||||
goto done;
|
goto done;
|
||||||
@ -569,6 +572,7 @@ static void mac_adjustmenus(void) {
|
|||||||
if (window != NULL && mac_wininfo(window)->adjustmenus != NULL)
|
if (window != NULL && mac_wininfo(window)->adjustmenus != NULL)
|
||||||
(*mac_wininfo(window)->adjustmenus)(window);
|
(*mac_wininfo(window)->adjustmenus)(window);
|
||||||
else {
|
else {
|
||||||
|
DisableItem(menu, iChange);
|
||||||
DisableItem(menu, iSave);
|
DisableItem(menu, iSave);
|
||||||
DisableItem(menu, iSaveAs);
|
DisableItem(menu, iSaveAs);
|
||||||
DisableItem(menu, iDuplicate);
|
DisableItem(menu, iDuplicate);
|
||||||
|
@ -150,6 +150,7 @@ typedef struct KeyState {
|
|||||||
extern WindowPtr mac_frontwindow(void);
|
extern WindowPtr mac_frontwindow(void);
|
||||||
/* from macdlg.c */
|
/* from macdlg.c */
|
||||||
extern void mac_newsession(void);
|
extern void mac_newsession(void);
|
||||||
|
extern void mac_reconfig(void);
|
||||||
extern void mac_dupsession(void);
|
extern void mac_dupsession(void);
|
||||||
extern void mac_savesession(void);
|
extern void mac_savesession(void);
|
||||||
extern void mac_savesessionas(void);
|
extern void mac_savesessionas(void);
|
||||||
|
@ -895,12 +895,13 @@ resource 'MENU' (mApple, preload) {
|
|||||||
resource 'MENU' (mFile, preload) {
|
resource 'MENU' (mFile, preload) {
|
||||||
mFile,
|
mFile,
|
||||||
textMenuProc,
|
textMenuProc,
|
||||||
0b11111111111111111111111101111011,
|
0b11111111111111111111111011110111,
|
||||||
enabled,
|
enabled,
|
||||||
"Session",
|
"Session",
|
||||||
{
|
{
|
||||||
"New", noicon, "N", nomark, plain,
|
"New", noicon, "N", nomark, plain,
|
||||||
"Open\0xc9", noicon, "O", nomark, plain,
|
"Open\0xc9", noicon, "O", nomark, plain,
|
||||||
|
"Change Settings", noicon, nokey, nomark, plain,
|
||||||
"-", noicon, nokey, nomark, plain,
|
"-", noicon, nokey, nomark, plain,
|
||||||
"Close", noicon, "W", nomark, plain,
|
"Close", noicon, "W", nomark, plain,
|
||||||
"Save", noicon, "S", nomark, plain,
|
"Save", noicon, "S", nomark, plain,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: macctrls.c,v 1.42 2003/05/10 20:51:39 ben Exp $ */
|
/* $Id$ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003 Ben Harris
|
* Copyright (c) 2003 Ben Harris
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@ -248,6 +248,7 @@ void macctrl_layoutbox(struct controlbox *cb, WindowPtr window,
|
|||||||
mcs->focus = NULL;
|
mcs->focus = NULL;
|
||||||
mcs->defbutton = NULL;
|
mcs->defbutton = NULL;
|
||||||
mcs->canbutton = NULL;
|
mcs->canbutton = NULL;
|
||||||
|
mcs->curpanel = 1;
|
||||||
/* Count the number of panels */
|
/* Count the number of panels */
|
||||||
mcs->npanels = 1;
|
mcs->npanels = 1;
|
||||||
for (i = 1; i < cb->nctrlsets; i++)
|
for (i = 1; i < cb->nctrlsets; i++)
|
||||||
|
46
mac/macdlg.c
46
mac/macdlg.c
@ -47,20 +47,37 @@
|
|||||||
#include "macresid.h"
|
#include "macresid.h"
|
||||||
#include "storage.h"
|
#include "storage.h"
|
||||||
|
|
||||||
|
static void mac_config(int);
|
||||||
static void mac_closedlg(WindowPtr);
|
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)
|
void mac_newsession(void)
|
||||||
|
{
|
||||||
|
mac_config(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void mac_reconfig(void)
|
||||||
|
{
|
||||||
|
mac_config(TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void mac_config(int midsession)
|
||||||
{
|
{
|
||||||
Session *s;
|
Session *s;
|
||||||
WinInfo *wi;
|
WinInfo *wi;
|
||||||
static struct sesslist sesslist;
|
static struct sesslist sesslist;
|
||||||
Str255 mactitle;
|
Str255 mactitle;
|
||||||
|
char *str;
|
||||||
|
|
||||||
|
if (midsession) {
|
||||||
|
s = mac_windowsession(FrontWindow());
|
||||||
|
} else {
|
||||||
s = snew(Session);
|
s = snew(Session);
|
||||||
memset(s, 0, sizeof(*s));
|
memset(s, 0, sizeof(*s));
|
||||||
do_defaults(NULL, &s->cfg);
|
do_defaults(NULL, &s->cfg);
|
||||||
s->hasfile = FALSE;
|
s->hasfile = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (HAVE_COLOR_QD())
|
if (HAVE_COLOR_QD())
|
||||||
s->settings_window = GetNewCWindow(wSettings, NULL, (WindowPtr)-1);
|
s->settings_window = GetNewCWindow(wSettings, NULL, (WindowPtr)-1);
|
||||||
@ -69,10 +86,14 @@ void mac_newsession(void)
|
|||||||
|
|
||||||
get_sesslist(&sesslist, TRUE);
|
get_sesslist(&sesslist, TRUE);
|
||||||
s->ctrlbox = ctrl_new_box();
|
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.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);
|
macctrl_layoutbox(s->ctrlbox, s->settings_window, &s->settings_ctrls);
|
||||||
|
|
||||||
wi = snew(WinInfo);
|
wi = snew(WinInfo);
|
||||||
@ -87,7 +108,11 @@ void mac_newsession(void)
|
|||||||
wi->adjustmenus = &macctrl_adjustmenus;
|
wi->adjustmenus = &macctrl_adjustmenus;
|
||||||
wi->close = &mac_closedlg;
|
wi->close = &mac_closedlg;
|
||||||
SetWRefCon(s->settings_window, (long)wi);
|
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);
|
SetWTitle(s->settings_window, mactitle);
|
||||||
ShowWindow(s->settings_window);
|
ShowWindow(s->settings_window);
|
||||||
}
|
}
|
||||||
@ -102,7 +127,7 @@ static void mac_closedlg(WindowPtr window)
|
|||||||
sfree(s);
|
sfree(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mac_enddlg(WindowPtr window, int value)
|
static void mac_enddlg_config(WindowPtr window, int value)
|
||||||
{
|
{
|
||||||
Session *s = mac_windowsession(window);
|
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)
|
void mac_dupsession(void)
|
||||||
{
|
{
|
||||||
Session *s1 = mac_windowsession(FrontWindow());
|
Session *s1 = mac_windowsession(FrontWindow());
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: macresid.h,v 1.16 2003/04/18 13:09:08 ben Exp $ */
|
/* $Id$ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* macresid.h -- Mac resource IDs
|
* macresid.h -- Mac resource IDs
|
||||||
@ -27,11 +27,12 @@
|
|||||||
/* File menu */
|
/* File menu */
|
||||||
#define iNew 1
|
#define iNew 1
|
||||||
#define iOpen 2
|
#define iOpen 2
|
||||||
#define iClose 4
|
#define iChange 3
|
||||||
#define iSave 5
|
#define iClose 5
|
||||||
#define iSaveAs 6
|
#define iSave 6
|
||||||
#define iDuplicate 7
|
#define iSaveAs 7
|
||||||
#define iQuit 9
|
#define iDuplicate 8
|
||||||
|
#define iQuit 10
|
||||||
/* Edit menu */
|
/* Edit menu */
|
||||||
#define iUndo 1
|
#define iUndo 1
|
||||||
#define iCut 3
|
#define iCut 3
|
||||||
|
@ -466,6 +466,7 @@ static void mac_adjusttermmenus(WindowPtr window)
|
|||||||
menu = GetMenuHandle(mFile);
|
menu = GetMenuHandle(mFile);
|
||||||
DisableItem(menu, iSave); /* XXX enable if modified */
|
DisableItem(menu, iSave); /* XXX enable if modified */
|
||||||
EnableItem(menu, iSaveAs);
|
EnableItem(menu, iSaveAs);
|
||||||
|
EnableItem(menu, iChange);
|
||||||
EnableItem(menu, iDuplicate);
|
EnableItem(menu, iDuplicate);
|
||||||
menu = GetMenuHandle(mEdit);
|
menu = GetMenuHandle(mEdit);
|
||||||
EnableItem(menu, 0);
|
EnableItem(menu, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user