-/* $Id: macctrls.c,v 1.20 2003/03/29 22:04:21 ben Exp $ */
+/* $Id: macctrls.c,v 1.23 2003/03/30 14:24:20 ben Exp $ */
/*
* Copyright (c) 2003 Ben Harris
* All rights reserved.
for (i = 1; i < cb->nctrlsets; i++)
if (strcmp(cb->ctrlsets[i]->pathname, cb->ctrlsets[i-1]->pathname))
mcs->npanels++;
- mcs->panels = smalloc(sizeof(*mcs->panels) * mcs->npanels);
+ mcs->panels = snewn(mcs->npanels, union macctrl *);
memset(mcs->panels, 0, sizeof(*mcs->panels) * mcs->npanels);
curstate.panelnum = 0;
for (i = 0; i < cb->nctrlsets; i++) {
}
macctrl_layoutset(&curstate, cb->ctrlsets[i], window, mcs);
}
- macctrl_switchtopanel(mcs, 2);
+ macctrl_switchtopanel(mcs, 14);
/* 14 = proxies, 20 = SSH bugs */
}
struct mac_layoutstate *curstate,
union control *ctrl)
{
- union macctrl *mc = smalloc(sizeof *mc);
+ union macctrl *mc = snew(union macctrl);
Rect bounds;
SInt16 height;
struct mac_layoutstate *curstate,
union control *ctrl)
{
- union macctrl *mc = smalloc(sizeof *mc);
+ union macctrl *mc = snew(union macctrl);
Rect lbounds, bounds;
fprintf(stderr, " label = %s\n", ctrl->editbox.label);
SetControlData(mc->editbox.tblabel, kControlEntireControl,
kControlStaticTextTextTag,
strlen(ctrl->editbox.label), ctrl->editbox.label);
- InsetRect(&bounds, 2, 2);
+ InsetRect(&bounds, 3, 3);
mc->editbox.tbctrl = NewControl(window, &bounds, NULL, TRUE, 0, 0, 0,
ctrl->editbox.password ?
kControlEditTextPasswordProc :
struct mac_layoutstate *curstate,
union control *ctrl)
{
- union macctrl *mc = smalloc(sizeof *mc);
+ union macctrl *mc = snew(union macctrl);
Rect bounds;
Str255 title;
unsigned int i, colwidth;
mc->generic.type = MACCTRL_RADIO;
mc->generic.ctrl = ctrl;
mc->generic.privdata = NULL;
- mc->radio.tbctrls =
- smalloc(sizeof(*mc->radio.tbctrls) * ctrl->radio.nbuttons);
+ mc->radio.tbctrls = snewn(ctrl->radio.nbuttons, ControlRef);
colwidth = (curstate->width + 13) / ctrl->radio.ncolumns;
bounds.top = curstate->pos.v;
bounds.bottom = bounds.top + 16;
struct mac_layoutstate *curstate,
union control *ctrl)
{
- union macctrl *mc = smalloc(sizeof *mc);
+ union macctrl *mc = snew(union macctrl);
Rect bounds;
Str255 title;
struct mac_layoutstate *curstate,
union control *ctrl)
{
- union macctrl *mc = smalloc(sizeof *mc);
+ union macctrl *mc = snew(union macctrl);
Rect bounds;
Str255 title;
struct mac_layoutstate *curstate,
union control *ctrl)
{
- union macctrl *mc = smalloc(sizeof *mc);
+ union macctrl *mc = snew(union macctrl);
Rect bounds;
Str255 title;
unsigned int labelwidth;
ControlRef control;
struct macctrls *mcs = mac_winctrls(window);
union macctrl *mc;
+ TEHandle te;
- if (mac_gestalts.apprvers >= 0x100 &&
- GetKeyboardFocus(window, &control) == noErr && control != NULL) {
- HandleControlKey(control, (event->message & keyCodeMask) >> 8,
- event->message & charCodeMask, event->modifiers);
- mc = (union macctrl *)GetControlReference(control);
- ctrlevent(mcs, mc, EVENT_VALCHANGE);
+ if (mac_gestalts.apprvers >= 0x100) {
+ if (GetKeyboardFocus(window, &control) == noErr && control != NULL) {
+ HandleControlKey(control, (event->message & keyCodeMask) >> 8,
+ event->message & charCodeMask, event->modifiers);
+ mc = (union macctrl *)GetControlReference(control);
+ ctrlevent(mcs, mc, EVENT_VALCHANGE);
+ }
+ } else {
+ if (mcs->focus != NULL) {
+ switch (mcs->focus->generic.type) {
+ case MACCTRL_EDITBOX:
+ te = (TEHandle)(*mcs->focus->editbox.tbctrl)->contrlData;
+ TEKey(event->message & charCodeMask, te);
+ break;
+ }
+ }
}
}
index = CountMenuItems(menu) - 1;
if (mc->popup.nids <= index) {
mc->popup.nids = index + 1;
- mc->popup.ids = srealloc(mc->popup.ids,
- mc->popup.nids * sizeof(*mc->popup.ids));
+ mc->popup.ids = sresize(mc->popup.ids, mc->popup.nids, int);
}
mc->popup.ids[index] = id;
}