From d50c2df3a49fc88945948331821b4eb09e2919f8 Mon Sep 17 00:00:00 2001 From: ben Date: Sun, 13 Apr 2003 14:37:07 +0000 Subject: [PATCH] Add a list box to the config dialogue to switch between panels. Now I don't have to recompile to change panels! git-svn-id: svn://svn.tartarus.org/sgt/putty@3116 cda61777-01e9-0310-a592-d414129be87e --- mac/macctrls.c | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/mac/macctrls.c b/mac/macctrls.c index 5a2ea4da..16c6ee11 100644 --- a/mac/macctrls.c +++ b/mac/macctrls.c @@ -1,4 +1,4 @@ -/* $Id: macctrls.c,v 1.32 2003/04/13 13:52:44 ben Exp $ */ +/* $Id: macctrls.c,v 1.33 2003/04/13 14:37:07 ben Exp $ */ /* * Copyright (c) 2003 Ben Harris * All rights reserved. @@ -213,6 +213,17 @@ static int macctrl_cmp_byctrl_find(void *av, void *bv) return 0; } +static union control panellist; + +static void panellist_handler(union control *ctrl, void *dlg, void *data, + int event) +{ + struct macctrls *mcs = dlg; + + if (event == EVENT_SELCHANGE) + macctrl_switchtopanel(mcs, dlg_listbox_index(ctrl, dlg) + 1); +} + void macctrl_layoutbox(struct controlbox *cb, WindowPtr window, struct macctrls *mcs) { @@ -222,16 +233,13 @@ void macctrl_layoutbox(struct controlbox *cb, WindowPtr window, Rect rect; macctrl_init(); + if (mac_gestalts.apprvers >= 0x100) + CreateRootControl(window, &root); #if TARGET_API_MAC_CARBON GetPortBounds(GetWindowPort(window), &rect); #else rect = window->portRect; #endif - curstate.pos.h = rect.left + 13; - curstate.pos.v = rect.bottom - 33; - curstate.width = rect.right - rect.left - (13 * 2); - if (mac_gestalts.apprvers >= 0x100) - CreateRootControl(window, &root); mcs->window = window; mcs->byctrl = newtree234(macctrl_cmp_byctrl); mcs->focus = NULL; @@ -245,12 +253,26 @@ void macctrl_layoutbox(struct controlbox *cb, WindowPtr window, mcs->panels = snewn(mcs->npanels, union macctrl *); memset(mcs->panels, 0, sizeof(*mcs->panels) * mcs->npanels); curstate.panelnum = 0; + + curstate.pos.h = rect.left + 13; + curstate.pos.v = rect.top + 13; + curstate.width = 160; + panellist.listbox.type = CTRL_LISTBOX; + panellist.listbox.handler = &panellist_handler; + panellist.listbox.height = 15; + panellist.listbox.percentwidth = 100; + macctrl_listbox(mcs, window, &curstate, &panellist); + + curstate.pos.h = rect.left + 13 + 160 + 13; + curstate.pos.v = rect.bottom - 33; + curstate.width = rect.right - (rect.left + 13 + 160) - (13 * 2); for (i = 0; i < cb->nctrlsets; i++) { if (i > 0 && strcmp(cb->ctrlsets[i]->pathname, cb->ctrlsets[i-1]->pathname)) { curstate.pos.v = rect.top + 13; curstate.panelnum++; assert(curstate.panelnum < mcs->npanels); + dlg_listbox_add(&panellist, mcs, cb->ctrlsets[i]->pathname); } macctrl_layoutset(&curstate, cb->ctrlsets[i], window, mcs); } -- 2.11.0