short PGFAlert(char *inCStr, short allowCancel) { #ifdef PGP_MACINTOSH DialogPtr pfAlert; GrafPtr savePort; short result=0, i; Str255 s; GetPort(&savePort); strcpy((char *)s, inCStr); c2pstr((char *)s); if((pfAlert = GetNewDialog(130,nil,(WindowPtr)-1L)) != NULL) { SetPort(pfAlert); ParamText((uchar *)s,"\p","\p","\p"); if(!allowCancel) HideDialogItem(pfAlert,2); SetDialogCancelItem(pfAlert, 2); SetDialogDefaultItem(pfAlert, 1); ShowWindow(pfAlert); SysBeep(30); ModalDialog(nil, &i); DisposeDialog(pfAlert); result = (i==1); }
static DialogRef DrawDialogTheSystem6or7Way(void) { DialogItemType itemType; Handle itemHandle; Rect itemBox; DialogRef theDialog = GetNewDialog(256, NULL, (WindowRef)-1L); if (theDialog == NULL) return(NULL); // Move it! MoveWindow(GetDialogWindow(theDialog), 10, 271, false); // Setting the check box GetDialogItem(theDialog, 2, &itemType, &itemHandle, &itemBox); SetControlValue((ControlHandle)itemHandle, 1); // Setting a radio button GetDialogItem(theDialog, 3, &itemType, &itemHandle, &itemBox); SetControlValue((ControlHandle)itemHandle, 1); // Setting the draw proc for the user item GetDialogItem(theDialog, 13, &itemType, &itemHandle, &itemBox); gUserH = (itemBox.left + itemBox.right) / 2; gUserV = (itemBox.top + itemBox.bottom) / 2; SetDialogItem(theDialog, 13, itemType, (Handle)&MyDrawUserItem, &itemBox); // Setting the action proc for the scroll bar so that the PageUp/PageDown/Up/Down buttons work GetDialogItem(theDialog, 14, &itemType, &itemHandle, &itemBox); SetControlAction((ControlHandle)itemHandle, ScrollBarActionProc); ShowWindow(GetDialogWindow(theDialog)); return(theDialog); }
void mac_openabout(void) { DialogItemType itemtype; Handle item; VersRecHndl vers; Rect box; StringPtr longvers; WinInfo *wi; if (windows.about) SelectWindow(windows.about); else { windows.about = GetDialogWindow(GetNewDialog(wAbout, NULL, (WindowPtr)-1)); wi = snew(WinInfo); memset(wi, 0, sizeof(*wi)); wi->wtype = wAbout; wi->update = &mac_updateabout; wi->click = &mac_clickabout; wi->activate = &mac_activateabout; wi->close = &mac_closeabout; SetWRefCon(windows.about, (long)wi); vers = (VersRecHndl)Get1Resource('vers', 1); if (vers != NULL && *vers != NULL) { longvers = (*vers)->shortVersion + (*vers)->shortVersion[0] + 1; GetDialogItem(GetDialogFromWindow(windows.about), wiAboutVersion, &itemtype, &item, &box); assert(itemtype & kStaticTextDialogItem); SetDialogItemText(item, longvers); } ShowWindow(windows.about); } }
// -------------------------------------------------------------------------------------- void OpenPrefsDialog(void) { DialogRef dialog; WindowRef dialogWindow; ControlRef control; ListHandle iconList; Cell theCell; dialog = GetNewDialog(rPrefsDialogPlatinum, NULL, kFirstWindowOfClass); if (dialog == NULL) ExitToShell(); SetPortDialogPort(dialog); dialogWindow = GetDialogWindow(dialog); SetDialogDefaultItem(dialog, kStdOkItemIndex); SetDialogCancelItem(dialog, kStdCancelItemIndex); GetDialogItemAsControl(dialog, iIconList, &control); GetControlData(control, kControlEntireControl, kControlListBoxListHandleTag, sizeof(ListHandle), &iconList, NULL); AddRowsAndDataToIconList(iconList, rIconListIconBaseID); (*iconList)->selFlags = lOnlyOne; SetPt(&theCell, 0, 0); LSetSelect(true, theCell, iconList); SetKeyboardFocus(dialogWindow, control, kControlFocusNextPart); gPanelNumber = 0; DisableMenuItem(GetMenuRef(mDemonstration), iPrefsDialog); ShowWindow(dialogWindow); } // OpenPrefsDialog
static DialogPtr OpenThisDialog(StringPtr nameString, StringPtr descString) { short type; Handle hndl; Rect box; GrafPtr oldPort; DialogPtr dlog; unsigned char *p,str[256]; DebugStr ( "/pOpenThisDialog" ); DPRINT (( "OpenThisDialog - nameString : %s descString : %s", nameString, descString )); return NIL; GetPort(&oldPort); dlog = GetNewDialog(thisDialogID,NIL,FRONT_WINDOW); if (dlog == NIL) { SysBeep(1); return(NIL); } /* Poor man's error message */ CenterWindow(dlog,0); SetPort(dlog); // insert the initial values into our fields PutDlgString(dlog, EDIT6, descString, FALSE); PutDlgString(dlog, EDIT5, nameString, TRUE); ShowWindow(dlog); return(dlog); }
static int OneButtonBox (char *text, char *button1) { DialogPtr theDialog; short itemHit,itemType; Handle item; Rect box; char buffer[256]; theDialog = GetNewDialog(oneButtonDialog,NULL,(WindowPtr) -1); /* draw OK Button */ GetDialogItem(theDialog,OKButton,&itemType,&item,&box); SetPort((GrafPtr) theDialog); PenSize(3,3); InsetRect(&box,-4,-4); FrameRoundRect(&box,16,16); /* change text of button 1 */ strcpy(buffer,button1); SetControlTitle((ControlHandle) item,c2pstr(buffer)); GetDialogItem(theDialog,2,&itemType,&item,&box); strcpy(buffer,text); SetDialogItemText(item,c2pstr(buffer)); itemHit=0; while (itemHit!=OKButton) { ModalDialog(NULL,&itemHit); } DisposeDialog(theDialog); return(itemHit); }
static void DoAboutBox( void ) { DialogPtr myDialog; short itemHit; myDialog = GetNewDialog(kAboutDialog, nil, (WindowPtr) -1); ModalDialog(nil, &itemHit); DisposeDialog(myDialog); }
void MPU98DialogProc(void) { DialogPtr hDlg; int done; short item; ControlHandle lst[2]; UINT8 mpu; short value; hDlg = GetNewDialog(IDD_MPU98II, NULL, (WindowPtr)-1); if (!hDlg) { return; } lst[0] = (ControlHandle)GetDlgItem(hDlg, IDC_MPUPORT); lst[1] = (ControlHandle)GetDlgItem(hDlg, IDC_MPUIRQ); mpu = np2cfg.mpuopt; SetControlValue(lst[0], ((mpu >> 4) & 15) + 1); SetControlValue(lst[1], (mpu & 3) + 1); SetDialogDefaultItem(hDlg, IDOK); done = 0; while(!done) { ModalDialog(NULL, &item); switch(item) { case IDOK: mpu = np2cfg.mpuopt; value = GetControlValue(lst[0]); if (value) { mpu &= ~0xf0; mpu |= (UINT8)((value - 1) << 4); } value = GetControlValue(lst[1]); if (value) { mpu &= ~0x03; mpu |= (UINT8)((value - 1) & 3); } if (np2cfg.mpuopt != mpu) { np2cfg.mpuopt = mpu; sysmng_update(SYS_UPDATEOSCFG); } done = IDOK; break; case IDCANCEL: done = IDCANCEL; break; case IDC_MPUDEF: SetControlValue(lst[0], ((0x82 >> 4) & 15) + 1); SetControlValue(lst[1], (0x82 & 3) + 1); break; } } DisposeDialog(hDlg); }
void DoAbout() { DialogPtr ad; EventRecord e; ad=GetNewDialog(kAboutDlogID, nil, (DialogPtr)-1); DrawDialog(ad); while(!GetNextEvent(keyDownMask+mDownMask,&e)) ; DisposeDialog(ad); }
static int DoXOPAlert(short dlogID, const char* title, const char* message) { DialogPtr theDialog; WindowRef theWindow; short hit; unsigned char temp[256]; int result = 0; ArrowCursor(); paramtext(message, "", "", ""); theDialog = GetNewDialog(dlogID, NULL, (WindowPtr)-1L); // This must access Igor's data fork which contains the DLOG resources for these dialogs. if (theDialog == NULL) return -1; theWindow = GetDialogWindow(theDialog); if (theWindow == NULL) return -1; CopyCStringToPascal(title, temp); SetWTitle(theWindow, temp); ShowDialogWindow(theDialog); do { ModalDialog(NULL, &hit); switch(hit) { case 1: // OK or Yes. result = 1; break; case 2: // No or Cancel. if (dlogID == IGOR_OK_CANCEL_DLOG) result = -1; // Cancel result is -1. else result = 2; break; case 3: // Cancel. result = -1; break; } } while(result == 0); DisposeDialog(theDialog); return result; }
/* GetXOPDialog(dialogID) This routine is implemented on Macintosh only. Thread Safety: GetXOPDialog is not thread-safe. */ DialogPtr GetXOPDialog(int dialogID) { DialogPtr theDialog; int saveResFile; saveResFile = CurResFile(); UseResFile(XOPRefNum()); theDialog = GetNewDialog(dialogID, NULL, (WindowPtr)-1); UseResFile(saveResFile); if (theDialog == NULL) return NULL; gXOPDialogFilterUPP = NewModalFilterUPP(XOPDialogFilter); return theDialog; }
void showAboutMeDialog() { GrafPtr savePort; DialogPtr theDialog; short itemHit; GetPort(&savePort); theDialog = GetNewDialog(aboutMeDLOG, nil, (WindowPtr) -1); //SetPort(theDialog); SetPortDialogPort(theDialog); do { ModalDialog(nil, &itemHit); } while (itemHit != okButton); //CloseDialog(theDialog); DisposeDialog(theDialog); SetPort(savePort); return; }
static PyObject * MacOS_splash(PyObject *self, PyObject *args) { int resid = -1; static DialogPtr curdialog = NULL; DialogPtr olddialog; WindowRef theWindow; CGrafPtr thePort; #if 0 short xpos, ypos, width, height, swidth, sheight; #endif if (!PyArg_ParseTuple(args, "|i", &resid)) return NULL; olddialog = curdialog; curdialog = NULL; if ( resid != -1 ) { curdialog = GetNewDialog(resid, NULL, (WindowPtr)-1); if ( curdialog ) { theWindow = GetDialogWindow(curdialog); thePort = GetWindowPort(theWindow); #if 0 width = thePort->portRect.right - thePort->portRect.left; height = thePort->portRect.bottom - thePort->portRect.top; swidth = qd.screenBits.bounds.right - qd.screenBits.bounds.left; sheight = qd.screenBits.bounds.bottom - qd.screenBits.bounds.top - LMGetMBarHeight(); xpos = (swidth-width)/2; ypos = (sheight-height)/5 + LMGetMBarHeight(); MoveWindow(theWindow, xpos, ypos, 0); ShowWindow(theWindow); #endif DrawDialog(curdialog); } } if (olddialog) DisposeDialog(olddialog); Py_INCREF(Py_None); return Py_None; }
/* showNetNumbers - Show the current network numbers. */ void showNetNumbers( void) { char tmpout[256]; /* IP Number */ DialogPtr dptr; /* dialog box pointer */ short scratchshort; int tmp[4]; /* Integer copy of IP Number */ unsigned char tmp2[4]; if (TelInfo->ipModeless) { SelectWindow(TelInfo->ipModeless); return; } Mnetinit(); // RAB BetterTelnet 1.0fc4 netgetip(tmp2); for(scratchshort=0; scratchshort<4; scratchshort++) tmp[scratchshort] = (int)tmp2[scratchshort]; /* Get integer numbers */ sprintf(&tmpout[0],"IP Address:\r%d.%d.%d.%d",tmp[0],tmp[1],tmp[2],tmp[3]); /* create Human-readable numbers */ c2pstr(tmpout); /* BYU LSC */ // RAB BetterTelnet 1.2 - we can't use ParamText() for modeless dialogs // ParamText(0L, (StringPtr)tmpout,0L,0L); /* BYU LSC - Put Parms in Dlog */ dptr = GetNewDialog(MyIPDLOG, NULL, kInFront); SetTEText(dptr, 1, (unsigned char *)tmpout); DrawDialog(dptr); /* Display Dialog */ TelInfo->ipModeless = dptr; // ModalDialog(NULL, &scratchshort); /* Wait for a click */ // DisposeDialog(dptr); // Alert(MyIPDLOG, 0L); AdjustMenus(); DoTheMenuChecks(); }
void mac_newkey(void) { KeyState *ks; WinInfo *wi; Handle h; short type; Rect rect; ks = snew(KeyState); ks->box = GetNewDialog(wKey, NULL, (WindowPtr)-1); GetDialogItem(ks->box, wiKeyProgress, &type, &h, &rect); ks->progress = (ControlHandle)h; wi = snew(WinInfo); memset(wi, 0, sizeof(*wi)); wi->ks = ks; wi->wtype = wKey; wi->update = &mac_updatekey; wi->click = &mac_clickkey; wi->activate = &mac_activatekey; SetWRefCon(GetDialogWindow(ks->box), (long)wi); ShowWindow(GetDialogWindow(ks->box)); }
void do_about_box( void) { GrafPtr oldPort; DialogPtr dptr; short item, itemType; Handle itemHdl; Rect itemRect; dptr = GetNewDialog( rAboutBox, nil, (WindowPtr)-1L); if( dptr == (DialogPtr)0){ Handle items = NewHandle( sizeof(missing_DITL)); static Rect bounds = {40, 20, 150, 340}; if( ! items) return; BlockMove( missing_DITL, *items, sizeof(missing_DITL)); dptr = NewColorDialog( nil, &bounds, (unsigned char*)"\005About", false, dBoxProc, (WindowPtr)-1L, false, 0, items); } if( dptr == (DialogPtr)0) return; GetPort (&oldPort); SetPort (GetDialogPort(dptr)); GetDialogItem( dptr, ok, &itemType, &itemHdl, &itemRect); InsetRect( &itemRect, -4, -4); SetDialogItem( dptr, 6, userItem + itemDisable, (Handle)outline_hook_upp, &itemRect); FlushEvents( everyEvent, 0); ShowWindow( GetDialogWindow(dptr)); do { ModalDialog( about_filter_upp, &item); } while( item != ok); DisposeDialog( dptr); SetPort( oldPort); }
static void Utils_Macintosh_DisplayMsg(char *msg) { DialogPtr theDlog; Handle item = NULL; Rect box; theDlog = GetNewDialog(kMsgDialogRsrcID, NULL, (WindowPtr)-1); if (theDlog != NULL) { short itemType; GetDialogItem(theDlog, kMsgItemID, &itemType, &item, &box); if (item != NULL) { short itemHit; SetDialogItemText(item, c2pstr(msg)); ModalDialog(NULL, &itemHit); DisposeDialog(theDlog); p2cstr((StringPtr)msg); /* restore C-string */ } } }
/* Initialize the QuickTime grabber */ static int qt_open_grabber(struct qt_grabber_state *s, char *fmt) { GrafPtr savedPort; WindowPtr gMonitor; //SGModalFilterUPP seqGrabModalFilterUPP; assert(s != NULL); assert(s->magic == MAGIC_QT_GRABBER); /****************************************************************************************/ /* Step 0: Initialise the QuickTime movie toolbox. */ InitCursor(); EnterMovies(); /****************************************************************************************/ /* Step 1: Create an off-screen graphics world object, into which we can capture video. */ /* Lock it into position, to prevent QuickTime from messing with it while capturing. */ OSType pixelFormat; pixelFormat = FOUR_CHAR_CODE('BGRA'); /****************************************************************************************/ /* Step 2: Open and initialise the default sequence grabber. */ s->grabber = OpenDefaultComponent(SeqGrabComponentType, 0); if (s->grabber == 0) { debug_msg("Unable to open grabber\n"); return 0; } gMonitor = GetDialogWindow(GetNewDialog(1000, NULL, (WindowPtr) - 1L)); GetPort(&savedPort); SetPort((GrafPtr)gMonitor); if (SGInitialize(s->grabber) != noErr) { debug_msg("Unable to init grabber\n"); return 0; } SGSetGWorld(s->grabber, GetDialogPort((DialogPtr)gMonitor), NULL); /****************************************************************************************/ /* Specify the destination data reference for a record operation tell it */ /* we're not making a movie if the flag seqGrabDontMakeMovie is used, */ /* the sequence grabber still calls your data function, but does not */ /* write any data to the movie file writeType will always be set to */ /* seqGrabWriteAppend */ if (SGSetDataRef(s->grabber, 0, 0, seqGrabDontMakeMovie) != noErr) { CloseComponent(s->grabber); debug_msg("Unable to set data ref\n"); return 0; } if (SGSetGWorld(s->grabber, NULL, NULL) != noErr) { debug_msg("Unable to get gworld from grabber\n"); return 0; } if (SGNewChannel(s->grabber, VideoMediaType, &s->video_channel) != noErr) { debug_msg("Unable to open video channel\n"); return 0; } /* do not check for grab audio in case that we will only display usage */ if (SGNewChannel(s->grabber, SoundMediaType, &s->audio_channel) != noErr) { fprintf(stderr, "Warning: Creating audio channel failed. " "Disabling sound output.\n"); s->grab_audio = FALSE; } /* Print available devices */ int i; int j; SGDeviceInputList inputList; SGDeviceList deviceList; if (strcmp(fmt, "help") == 0) { printf("\nUsage:\t-t quicktime:<device>:<mode>:<pixel_type>[:<audio_device>:<audio_mode>]\n\n"); if (SGGetChannelDeviceList (s->video_channel, sgDeviceListIncludeInputs, &deviceList) == noErr) { fprintf(stdout, "\nAvailable capture devices:\n"); for (i = 0; i < (*deviceList)->count; i++) { SGDeviceName *deviceEntry = &(*deviceList)->entry[i]; fprintf(stdout, " Device %d: ", i); nprintf((char *) deviceEntry->name); if (deviceEntry->flags & sgDeviceNameFlagDeviceUnavailable) { fprintf(stdout, " - ### NOT AVAILABLE ###"); } if (i == (*deviceList)->selectedIndex) { fprintf(stdout, " - ### ACTIVE ###"); } fprintf(stdout, "\n"); short activeInputIndex = 0; inputList = deviceEntry->inputs; if (inputList && (*inputList)->count >= 1) { SGGetChannelDeviceAndInputNames (s->video_channel, NULL, NULL, &activeInputIndex); for (j = 0; j < (*inputList)->count; j++) { fprintf(stdout, "\t"); fprintf(stdout, "- %d. ", j); nprintf((char *) &(*inputList)->entry [j].name); if ((i == (*deviceList)->selectedIndex) && (j == activeInputIndex)) fprintf(stdout, " - ### ACTIVE ###"); fprintf(stdout, "\n"); } } } SGDisposeDeviceList(s->grabber, deviceList); CodecNameSpecListPtr list; GetCodecNameList(&list, 1); printf("\nCompression types:\n"); for (i = 0; i < list->count; i++) { int fcc = list->list[i].cType; printf("\t%d) ", i); nprintf((char *) list->list[i].typeName); printf(" - FCC (%c%c%c%c)", fcc >> 24, (fcc >> 16) & 0xff, (fcc >> 8) & 0xff, (fcc) & 0xff); printf(" - codec id %x", (unsigned int)(list->list[i].codec)); printf(" - cType %x", (unsigned int)list->list[i].cType); printf("\n"); } }
pascal DialogRef SafeGetNewDialog(short dialogID, void *dStorage, WindowRef behind) { StAcroResourceContext resContext; return GetNewDialog(dialogID, dStorage, behind); }
void OpenProxySettings(void) { short itemHit = 999; short itemType; Handle item; Rect itemBox; Str255 itemText, pswdBuf, blindPswdText; DialogPtr psDlg; Boolean bDefault = true; /* show dialog */ psDlg = GetNewDialog(rDlgProxySettg, NULL, (WindowPtr) -1); /* show dialog title, button and lable from install.ini */ GetResourcedString(itemText, rInstList, sProxyDlg); SetWTitle(psDlg, itemText); GetDialogItem(psDlg, rProxyStrOK, &itemType, &item, &itemBox); GetResourcedString(itemText, rInstList, sOKBtn); SetControlTitle((ControlRecord **)item, itemText); SetControlData((ControlRecord **)item, kControlNoPart, kControlPushButtonDefaultTag, sizeof(bDefault),(Ptr) &bDefault); GetDialogItem(psDlg, rProxyStrCancel, &itemType, &item, &itemBox); GetResourcedString(itemText, rInstList, sCancel); SetControlTitle((ControlRecord **)item, itemText); GetDialogItem(psDlg, rProxyStrHostLab, &itemType, &item, &itemBox); GetResourcedString(itemText, rInstList, sProxyHost); SetDialogItemText(item, itemText); GetDialogItem(psDlg, rProxyStrPortLab, &itemType, &item, &itemBox); GetResourcedString(itemText, rInstList, sProxyPort); SetDialogItemText(item, itemText); GetDialogItem(psDlg, rProxyStrUserLab, &itemType, &item, &itemBox); GetResourcedString(itemText, rInstList, sProxyUsername); SetDialogItemText(item, itemText); GetDialogItem(psDlg, rProxyStrPswdLab, &itemType, &item, &itemBox); GetResourcedString(itemText, rInstList, sProxyPassword); SetDialogItemText(item, itemText); /* pre-populate text fields */ if (gControls->opt->proxyHost) { my_c2pstrcpy(gControls->opt->proxyHost, itemText); GetDialogItem(psDlg, rProxyHostItem, &itemType, &item, &itemBox); SetDialogItemText(item, itemText); } if (gControls->opt->proxyPort) { my_c2pstrcpy(gControls->opt->proxyPort, itemText); GetDialogItem(psDlg, rProxyPortItem, &itemType, &item, &itemBox); SetDialogItemText(item, itemText); } if (gControls->opt->proxyUsername) { my_c2pstrcpy(gControls->opt->proxyUsername, itemText); GetDialogItem(psDlg, rProxyUserItem, &itemType, &item, &itemBox); SetDialogItemText(item, itemText); } if (gControls->opt->proxyPassword) { int pswdLen = strlen(gControls->opt->proxyPassword); memset(&blindPswdText[1], '¥', pswdLen); blindPswdText[0] = pswdLen; GetDialogItem(psDlg, rProxyPswdItem, &itemType, &item, &itemBox); SetDialogItemText(item, blindPswdText); } if (gControls->opt->proxyPassword) my_c2pstrcpy(gControls->opt->proxyPassword, pswdBuf); else pswdBuf[0] = 0; do { ModalDialog(NULL, &itemHit); /* special handling for "blind" password field */ if (itemHit == rProxyPswdItem) { GetDialogItem(psDlg, rProxyPswdItem, &itemType, &item, &itemBox); GetDialogItemText(item, itemText); /* char deleted ? */ if (itemText[0] < pswdBuf[0]) { /* truncate password buffer */ pswdBuf[0] = itemText[0]; } else { /* store new char in password buffer */ pswdBuf[itemText[0]] = itemText[itemText[0]]; pswdBuf[0] = itemText[0]; } memset(&blindPswdText[1], '¥', pswdBuf[0]); blindPswdText[0] = itemText[0]; SetDialogItemText(item, blindPswdText); } } while(itemHit != 1 && itemHit != 2); /* if OK was hit then take changed settings */ if (itemHit == 1) { GetDialogItem(psDlg, rProxyHostItem, &itemType, &item, &itemBox); GetDialogItemText(item, itemText); if (itemText[0] > 0) { if (gControls->opt->proxyHost) free(gControls->opt->proxyHost); gControls->opt->proxyHost = (char *) malloc(itemText[0] + 1); strncpy(gControls->opt->proxyHost, (const char *)&itemText[1], itemText[0]); *(gControls->opt->proxyHost + itemText[0]) = 0; } GetDialogItem(psDlg, rProxyPortItem, &itemType, &item, &itemBox); GetDialogItemText(item, itemText); if (itemText[0] > 0) { if (gControls->opt->proxyPort) free(gControls->opt->proxyPort); gControls->opt->proxyPort = (char *) malloc(itemText[0] + 1); strncpy(gControls->opt->proxyPort, (const char *)&itemText[1], itemText[0]); *(gControls->opt->proxyPort + itemText[0]) = 0; } GetDialogItem(psDlg, rProxyUserItem, &itemType, &item, &itemBox); GetDialogItemText(item, itemText); if (itemText[0] > 0) { if (gControls->opt->proxyUsername) free(gControls->opt->proxyUsername); gControls->opt->proxyUsername = (char *) malloc(itemText[0] + 1); strncpy(gControls->opt->proxyUsername, (const char *)&itemText[1], itemText[0]); *(gControls->opt->proxyUsername + itemText[0]) = 0; } if (pswdBuf[0] > 0) { if (gControls->opt->proxyPassword) free(gControls->opt->proxyPassword); gControls->opt->proxyPassword = (char *) malloc(pswdBuf[0] + 1); strncpy(gControls->opt->proxyPassword, (const char *)&pswdBuf[1], pswdBuf[0]); *(gControls->opt->proxyPassword + pswdBuf[0]) = 0; } } DisposeDialog(psDlg); }
McoStatus ThermDialog::SetUpTherm(int therm_num) { Rect r; Handle h; short itemType; short wi,hi; short ids1[] = THERM_IDs_1; short ids2[] = THERM_IDs_2; int i; Str255 theString; Quit = FALSE; //if (therm_num == 3) for (i=0; i<NUM_THERM_IDS; i++) ids[i] = ids2[i]; //else for (i=0; i<NUM_THERM_IDS; i++) ids[i] = ids1[i]; GetPort(&olddp); dt = (DialogTHndl) GetResource ('DLOG',ids[THERM_DLG]); if (! dt) return(MCO_RSRC_ERROR); HNoPurge ((Handle) dt); r = (**dt).boundsRect; #define menuHeight 20 wi = qd.screenBits.bounds.right; hi = qd.screenBits.bounds.bottom; OffsetRect (&r, -r.left, -r.top); OffsetRect (&r, (wi - r.right) / 2, (hi - r.bottom - menuHeight) / 3 + menuHeight); (**dt).boundsRect = r; #undef menuHeight dp = GetNewDialog (ids[THERM_DLG], nil, (WindowPtr) -1); if (! dp) { HPurge ((Handle) dt); return(MCO_RSRC_ERROR); } GetDItem (dp,ids[THERM_TEXT], &itemType, &h, &r); GetIndString(theString,THERM_MESS,therm_num); SetIText(h,theString); SetPort(dp); ShowWindow(dp); DrawDialog(dp); box_d_item(dp,ids[THERM_BOX]); return MCO_SUCCESS; }
Boolean QTInfo_EditAnnotation (Movie theMovie, OSType theType) { DialogPtr myDialog = NULL; short myItem; short mySavedResFile; GrafPtr mySavedPort; Handle myHandle = NULL; short myItemKind; Handle myItemHandle; UserData myUserData = NULL; Rect myItemRect; Str255 myString; Boolean myIsChanged = false; OSErr myErr = noErr; ////////// // // save the current resource file and graphics port // ////////// mySavedResFile = CurResFile(); GetPort(&mySavedPort); // set the application's resource file UseResFile(gAppResFile); // get the movie user data myUserData = GetMovieUserData(theMovie); if (myUserData == NULL) goto bail; ////////// // // create the dialog box in which the user will add or edit the annotation // ////////// myDialog = GetNewDialog(kEditTextResourceID, NULL, (WindowPtr)-1L); if (myDialog == NULL) goto bail; MacSetPort(GetDialogPort(myDialog)); SetDialogDefaultItem(myDialog, kEditTextItemOK); SetDialogCancelItem(myDialog, kEditTextItemCancel); // get a string for the specified annotation type switch (theType) { case kUserDataTextFullName: GetIndString(myString, kTextKindsResourceID, kTextKindsFullName); break; case kUserDataTextCopyright: GetIndString(myString, kTextKindsResourceID, kTextKindsCopyright); break; case kUserDataTextInformation: GetIndString(myString, kTextKindsResourceID, kTextKindsInformation); break; } GetDialogItem(myDialog, kEditTextItemEditLabel, &myItemKind, &myItemHandle, &myItemRect); SetDialogItemText(myItemHandle, myString); ////////// // // set the current annotation of the specified type, if it exists // ////////// myHandle = NewHandleClear(4); if (myHandle != NULL) { myErr = GetUserDataText(myUserData, myHandle, theType, 1, GetScriptManagerVariable(smRegionCode)); if (myErr == noErr) { QTInfo_TextHandleToPString(myHandle, myString); GetDialogItem(myDialog, kEditTextItemEditBox, &myItemKind, &myItemHandle, &myItemRect); SetDialogItemText(myItemHandle, myString); SelectDialogItemText(myDialog, kEditTextItemEditBox, 0, myString[0]); } DisposeHandle(myHandle); } MacShowWindow(GetDialogWindow(myDialog)); ////////// // // display and handle events in the dialog box until the user clicks OK or Cancel // ////////// do { ModalDialog(gModalFilterUPP, &myItem); } while ((myItem != kEditTextItemOK) && (myItem != kEditTextItemCancel)); ////////// // // handle the selected button // ////////// if (myItem != kEditTextItemOK) goto bail; // retrieve the edited text myHandle = NewHandleClear(4); if (myHandle != NULL) { GetDialogItem(myDialog, kEditTextItemEditBox, &myItemKind, &myItemHandle, &myItemRect); GetDialogItemText(myItemHandle, myString); QTInfo_PStringToTextHandle(myString, myHandle); myErr = AddUserDataText(myUserData, myHandle, theType, 1, GetScriptManagerVariable(smRegionCode)); myIsChanged = (myErr == noErr); DisposeHandle(myHandle); } bail: // restore the previous resource file and graphics port MacSetPort(mySavedPort); UseResFile(mySavedResFile); if (myDialog != NULL) DisposeDialog(myDialog); return(myIsChanged); }
void dialog_scropt(void) { DialogPtr hDlg; ControlHandle chipbtn[2]; ControlHandle grcgbtn[4]; ControlHandle lcdbtn[2]; ControlHandle skipbtn; ControlHandle c16btn; UINT chip; UINT grcg; UINT color16; UINT lcd; UINT skipline; UINT val; char work[32]; Str255 workstr; int done; short item; UINT update; UINT renewal; BYTE waitval[6]; hDlg = GetNewDialog(IDD_SCREENOPT, NULL, (WindowPtr)-1); if (!hDlg) { return; } chipbtn[0] = (ControlHandle)GetDlgItem(hDlg, IDC_GDC7220); chipbtn[1] = (ControlHandle)GetDlgItem(hDlg, IDC_GDC72020); grcgbtn[0] = (ControlHandle)GetDlgItem(hDlg, IDC_GRCGNON); grcgbtn[1] = (ControlHandle)GetDlgItem(hDlg, IDC_GRCG); grcgbtn[2] = (ControlHandle)GetDlgItem(hDlg, IDC_GRCG2); grcgbtn[3] = (ControlHandle)GetDlgItem(hDlg, IDC_EGC); c16btn = (ControlHandle)GetDlgItem(hDlg, IDC_PC980124); lcdbtn[0] = (ControlHandle)GetDlgItem(hDlg, IDC_LCD); lcdbtn[1] = (ControlHandle)GetDlgItem(hDlg, IDC_LCDX); skipbtn = (ControlHandle)GetDlgItem(hDlg, IDC_SKIPLINE); chip = (np2cfg.uPD72020)?1:0; setchip(chipbtn, chip); grcg = np2cfg.grcg & 3; setgrcg(grcgbtn, grcg); color16 = (np2cfg.color16)?1:0; SetControlValue(c16btn, color16); val = np2cfg.wait[0]; if (val > 32) { val = 32; } SPRINTF(work, str_u, val); mkstr255(workstr, work); SetDialogItemText(GetDlgItem(hDlg, IDC_TRAMWAIT), workstr); val = np2cfg.wait[2]; if (val > 32) { val = 32; } SPRINTF(work, str_u, val); mkstr255(workstr, work); SetDialogItemText(GetDlgItem(hDlg, IDC_VRAMWAIT), workstr); val = np2cfg.wait[4]; if (val > 32) { val = 32; } SPRINTF(work, str_u, val); mkstr255(workstr, work); SetDialogItemText(GetDlgItem(hDlg, IDC_GRCGWAIT), workstr); val = np2cfg.realpal; if (val > 64) { val = 64; } SPRINTF(work, str_d, val - 32); mkstr255(workstr, work); SetDialogItemText(GetDlgItem(hDlg, IDC_REALPAL), workstr); lcd = np2cfg.LCD_MODE & 3; SetControlValue(lcdbtn[0], lcd & 1); SetControlValue(lcdbtn[1], (lcd & 2) >> 1); skipline = (np2cfg.skipline)?1:0; SetControlValue(skipbtn, skipline); SPRINTF(work, str_u, np2cfg.skiplight); mkstr255(workstr, work); SetDialogItemText(GetDlgItem(hDlg, IDC_SKIPLIGHT), workstr); SetDialogDefaultItem(hDlg, IDOK); SetDialogCancelItem(hDlg, IDCANCEL); done = 0; while(!done) { ModalDialog(NULL, &item); switch(item) { case IDOK: update = 0; if (np2cfg.uPD72020 != chip) { np2cfg.uPD72020 = chip; update |= SYS_UPDATECFG; gdc_restorekacmode(); gdcs.grphdisp |= GDCSCRN_ALLDRAW2; } if (np2cfg.grcg != grcg) { np2cfg.grcg = grcg; update |= SYS_UPDATECFG; gdcs.grphdisp |= GDCSCRN_ALLDRAW2; } if (np2cfg.color16 != color16) { np2cfg.color16 = color16; update |= SYS_UPDATECFG; } GetDialogItemText(GetDlgItem(hDlg, IDC_TRAMWAIT), workstr); mkcstr(work, sizeof(work), workstr); val = milstr_solveINT(work); if (val > 32) { val = 32; } waitval[0] = val; waitval[1] = (val)?1:0; GetDialogItemText(GetDlgItem(hDlg, IDC_VRAMWAIT), workstr); mkcstr(work, sizeof(work), workstr); val = milstr_solveINT(work); if (val > 32) { val = 32; } waitval[2] = val; waitval[3] = (val)?1:0; GetDialogItemText(GetDlgItem(hDlg, IDC_GRCGWAIT), workstr); mkcstr(work, sizeof(work), workstr); val = milstr_solveINT(work); if (val > 32) { val = 32; } waitval[4] = val; waitval[5] = (val)?1:0; if (memcmp(np2cfg.wait, waitval, 6)) { CopyMemory(np2cfg.wait, waitval, 6); update |= SYS_UPDATECFG; } GetDialogItemText(GetDlgItem(hDlg, IDC_REALPAL), workstr); mkcstr(work, sizeof(work), workstr); val = milstr_solveINT(work) + 32; if (val > 64) { val = 64; } if (np2cfg.realpal != val) { np2cfg.realpal = val; update |= SYS_UPDATECFG; } renewal = 0; if (np2cfg.skipline != skipline) { np2cfg.skipline = skipline; renewal = 1; } GetDialogItemText(GetDlgItem(hDlg, IDC_SKIPLIGHT), workstr); mkcstr(work, sizeof(work), workstr); val = milstr_solveINT(work); if (val > 255) { val = 255; } if (np2cfg.skiplight != val) { np2cfg.skiplight = val; renewal = 1; } if (renewal) { pal_makeskiptable(); } if (np2cfg.LCD_MODE != lcd) { np2cfg.LCD_MODE = lcd; pal_makelcdpal(); renewal = 1; } if (renewal) { update |= SYS_UPDATECFG; scrndraw_redraw(); } sysmng_update(update); done = IDOK; break; case IDCANCEL: done = IDCANCEL; break; case IDC_LCD: lcd ^= 1; SetControlValue(lcdbtn[0], lcd & 1); break; case IDC_LCDX: lcd ^= 2; SetControlValue(lcdbtn[1], (lcd & 2) >> 1); break; case IDC_SKIPLINE: skipline ^= 1; SetControlValue(skipbtn, skipline); break; case IDC_GDC7220: chip = 0; setchip(chipbtn, chip); break; case IDC_GDC72020: chip = 1; setchip(chipbtn, chip); break; case IDC_GRCGNON: grcg = 0; setgrcg(grcgbtn, grcg); break; case IDC_GRCG: grcg = 1; setgrcg(grcgbtn, grcg); break; case IDC_GRCG2: grcg = 2; setgrcg(grcgbtn, grcg); break; case IDC_EGC: grcg = 3; setgrcg(grcgbtn, grcg); break; case IDC_PC980124: color16 ^= 1; SetControlValue(c16btn, color16); break; } } DisposeDialog(hDlg); }
static DialogRef DrawDialogTheMacOS8or9Way(void) { short i; ControlRef theControl; DialogRef theDialog = GetNewDialog(257, NULL, (WindowRef)-1L); if (theDialog == NULL) return(NULL); // Let's get a pulsing blue default button! GetDialogItemAsControl(theDialog, 1, &theControl); SetWindowDefaultButton(GetDialogWindow(theDialog), theControl); // Setting the check box GetDialogItemAsControl(theDialog, 2, &theControl); SetControl32BitValue(theControl, 1); // We need to autoembed our radio buttons in the radio group // so that they work automatically for (i = 4; i <= 8; i++) { GetDialogItemAsControl(theDialog, i, &theControl); AutoEmbedControl(theControl, GetDialogWindow(theDialog)); } // we assign a key filter on our edit text box so that only digits can be entered ControlRef theTextControl; ControlKeyFilterUPP keyFilter = MyEditKeyFilter; GetDialogItemAsControl(theDialog, 9, &theTextControl); SetKeyboardFocus(GetDialogWindow(theDialog), theTextControl, kControlFocusNextPart); SetControlData(theTextControl, kControlEntireControl, kControlEditTextKeyFilterTag, sizeof(keyFilter), &keyFilter); // Setting the action proc for the scroll bar so that the PageUp/PageDown/Up/Down buttons work // We also associate the previous edit text box with the scroll bar so it gets updated GetDialogItemAsControl(theDialog, 14, &theControl); SetControlAction(theControl, ScrollBar32BitActionProc); SetControl32BitMaximum(theControl, 0x7fffffff); SetControlReference(theControl, (SInt32)theTextControl); // The static text control is created as a resource but we could only set its title and // not its content. We set the content now! GetDialogItemAsControl(theDialog, 15, &theControl); Str255 theTitle; GetControlTitle(theControl, theTitle); SetControlData(theControl, kControlEntireControl, kControlStaticTextTextTag, theTitle[0], &theTitle[1]); // We set up our User Pane Control with the draw, hit test, and track (actually action) procs GetDialogItemAsControl(theDialog, 13, &theControl); Rect bounds; GetControlBounds(theControl, &bounds); gUserH = (bounds.left + bounds.right) / 2; gUserV = (bounds.top + bounds.bottom) / 2; ControlUserPaneDrawUPP userPaneDraw = MyUserPaneDrawProc; SetControlData(theControl, kControlEntireControl, kControlUserPaneDrawProcTag, sizeof(userPaneDraw), &userPaneDraw); ControlUserPaneHitTestUPP userPaneHitTest = MyUserPaneHitTestProc; SetControlData(theControl, kControlEntireControl, kControlUserPaneHitTestProcTag, sizeof(userPaneHitTest), &userPaneHitTest); SetControlAction(theControl, MoveSpotActionProc); ShowWindow(GetDialogWindow(theDialog)); return(theDialog); }
char *QTTarg_GetStringFromUser (short thePromptStringIndex) { short myItem; short mySavedResFile; GrafPtr mySavedPort; DialogPtr myDialog = NULL; short myItemKind; Handle myItemHandle; Rect myItemRect; Str255 myString; char *myCString = NULL; OSErr myErr = noErr; ////////// // // save the current resource file and graphics port // ////////// mySavedResFile = CurResFile(); GetPort(&mySavedPort); // set the application's resource file UseResFile(gAppResFile); ////////// // // create the dialog box in which the user will enter a URL // ////////// myDialog = GetNewDialog(kGetStr_DLOGID, NULL, (WindowPtr)-1L); if (myDialog == NULL) goto bail; QTFrame_ActivateController(QTFrame_GetFrontMovieWindow(), false); MacSetPort(GetDialogPort(myDialog)); SetDialogDefaultItem(myDialog, kGetStr_OKButton); SetDialogCancelItem(myDialog, kGetStr_CancelButton); // set the prompt string GetIndString(myString, kTextKindsResourceID, thePromptStringIndex); GetDialogItem(myDialog, kGetStr_StrLabelItem, &myItemKind, &myItemHandle, &myItemRect); SetDialogItemText(myItemHandle, myString); MacShowWindow(GetDialogWindow(myDialog)); ////////// // // display and handle events in the dialog box until the user clicks OK or Cancel // ////////// do { ModalDialog(gModalFilterUPP, &myItem); } while ((myItem != kGetStr_OKButton) && (myItem != kGetStr_CancelButton)); ////////// // // handle the selected button // ////////// if (myItem != kGetStr_OKButton) { myErr = userCanceledErr; goto bail; } // retrieve the edited text GetDialogItem(myDialog, kGetStr_StrTextItem, &myItemKind, &myItemHandle, &myItemRect); GetDialogItemText(myItemHandle, myString); myCString = QTUtils_ConvertPascalToCString(myString); bail: // restore the previous resource file and graphics port MacSetPort(mySavedPort); UseResFile(mySavedResFile); if (myDialog != NULL) DisposeDialog(myDialog); return(myCString); }
Boolean DoUI (GPtr globals) { short item; Str255 hS = ""; //histstatus int16 currentResources = 0; DialogPtr dp; DialogTHndl dt; gStuff->theRect.top = gStuff->theRect.left = gStuff->theRect.bottom = gStuff->theRect.right = 0; dt = (DialogTHndl) GetResource ('DLOG', uiID); HNoPurge ((Handle) dt); CenterDialog (dt); dp = GetNewDialog (uiID, nil, (WindowPtr) -1); (void) SetDialogDefaultItem (dp, ok); (void) SetDialogCancelItem (dp, cancel); PIGetString(kHistStatus, hS); // get status string do { currentResources = CountPIResources(histResource); if (gCurrentHistory < 1) gCurrentHistory = 1; if (gCurrentHistory > currentResources) gCurrentHistory = currentResources; if (currentResources <= kDHistTotal || gCurrentHistory+kDHistTotal > currentResources) PIDisableControl (dp, kDDownButton); // nothing extra to show else PIEnableControl (dp, kDDownButton); if (gCurrentHistory < 2) PIDisableControl (dp, kDUpButton); else PIEnableControl (dp, kDUpButton); if (currentResources >= gCurrentHistory && currentResources > 0) { PIEnableControl (dp, kDTrimFirst); PIEnableControl (dp, kDTrimLast); } else { PIDisableControl (dp, kDTrimFirst); PIDisableControl (dp, kDTrimLast); } UpdateHistories(globals, dp, currentResources, hS); MoveableModalDialog (dp, gStuff->processEvent, nil, &item); switch (item) { case cancel: gResult = userCanceledErr; // have to set this so we don't get recorded break; case kDTrimFirst: if (currentResources >= gCurrentHistory) { DeletePIResource (histResource, gCurrentHistory); gStuff->dirty = TRUE; } break; case kDTrimLast: if (currentResources >= gCurrentHistory + kDHistTotal-1) { DeletePIResource (histResource, gCurrentHistory+ kDHistTotal-1); gStuff->dirty = TRUE; } else if (currentResources > 0) { DeletePIResource (histResource, currentResources); gStuff->dirty = TRUE; } break; case kDUpButton: gCurrentHistory--; break; case kDDownButton: gCurrentHistory++; break; } // end switch (item) } while (item != ok && item != cancel); DisposeDialog (dp); HPurge ((Handle) dt); return (item == ok); }
// -------------------------------------------------------------------------------------- void OpenPrefsDialog(void) { ListDefSpec listSpec; DialogRef dialog; WindowRef dialogWindow; EventTypeSpec dialogEvents[] = { {kEventClassControl, kEventControlHit} }; ControlID controlID = {kAppSignature, 0}; ControlRef control; EventTypeSpec listBoxControlEvents[] = { {kEventClassTextInput, kEventTextInputUnicodeForKeyEvent} }; ListHandle iconList; Cell theCell; listSpec.defType = kListDefUserProcType; listSpec.u.userProc = NewListDefUPP(IconListDef); // this is automatically disposed // when the program exits RegisterListDefinition(kIconListLDEF, &listSpec); dialog = GetNewDialog(rPrefsDialog, NULL, kFirstWindowOfClass); if (dialog == NULL) ExitToShell(); SetPortDialogPort(dialog); dialogWindow = GetDialogWindow(dialog); // install window handlers ChangeWindowAttributes(dialogWindow, kWindowStandardHandlerAttribute, kWindowNoAttributes); gDialogEventHandler = NewEventHandlerUPP(dialogEventHandler); InstallWindowEventHandler(dialogWindow, gDialogEventHandler, GetEventTypeCount(dialogEvents), dialogEvents, (void *)dialog, NULL); GetDialogItemAsControl(dialog, kStdOkItemIndex, &control); // set control IDs to controlID.id = kStdOkItemIndex; // match dialog item SetControlID(control, &controlID); // indices which are SetWindowDefaultButton(dialogWindow, control); // not tracked by any // standard handlers GetDialogItemAsControl(dialog, kStdCancelItemIndex, &control); // also set the default controlID.id = kStdCancelItemIndex; // and cancel buttons (because Mac OS 8/9 SetControlID(control, &controlID); // under CarbonLib doesn't respect the SetWindowCancelButton(dialogWindow, control); // dialog's default and cancel buttons) GetDialogItemAsControl(dialog, iIconList, &control); controlID.id = iIconList; SetControlID(control, &controlID); /* We need to postprocess keyboard events on the icon list so that we can change panels after the user changes the selected cell by using the keyboard. */ gListBoxControlEventHandler = NewEventHandlerUPP(listBoxControlEventHandler); InstallControlEventHandler(control, gListBoxControlEventHandler, GetEventTypeCount(listBoxControlEvents), listBoxControlEvents, (void *)dialog, NULL); GetControlData(control, kControlEntireControl, kControlListBoxListHandleTag, sizeof(ListHandle), &iconList, NULL); AddRowsAndDataToIconList(iconList, rIconListIconBaseID); SetListSelectionFlags(iconList, lOnlyOne); SetPt(&theCell, 0, 0); LSetSelect(true, theCell, iconList); SetKeyboardFocus(dialogWindow, control, kControlFocusNextPart); gPanelNumber = 0; SetPrefsDialogHelpTags(dialog); DisableMenuItem(GetMenuRef(mDemonstration), iPrefsDialog); ShowWindow(dialogWindow); } // OpenPrefsDialog
Boolean DoUI (GPtr globals) { short item, lastitem; short numberErr = noErr; long x; DialogPtr dp; DialogTHndl dialogHdl; dialogHdl = (DialogTHndl) GetResource ('DLOG', uiID); if (dialogHdl == NULL || *dialogHdl == NULL) return false; else { HNoPurge ((Handle) dialogHdl); CenterDialog (dialogHdl); dp = GetNewDialog (uiID, nil, (WindowPtr) -1); /* I am throwing away the results from these routines. Toolbox TechNote 37 does not document what error values they return. Also, the worst that happens is that the interface isn't quite right. */ (void) SetDialogDefaultItem (dp, ok); (void) SetDialogCancelItem (dp, cancel); (void) SetDialogTracksCursor (dp, TRUE); SetRadioGroupState (dp, kFirstItem, kLastItem, kFirstItem + gWhatArea); SetRadioGroupState (dp, kUseRadio1, kUseRadioLast, kUseRadio1 + gWhatChannels); SetRadioGroupState (dp, kCreateRadio1, kCreateRadioLast, kCreateRadio1 + gCreate); ShowHideItem (dp, kPercentStatic, (gWhatArea == iSelectRandom)); ShowHideItem (dp, kPercentEdit, (gWhatArea == iSelectRandom)); ShowHideItem (dp, kPercentSymbol, (gWhatArea == iSelectRandom)); StuffNumber(dp, kPercentEdit, gPercent); if (gWhatArea == iSelectRandom) SelectTextItem(dp, kPercentEdit); SelectWindow (GetDialogWindow(dp)); do { MoveableModalDialog (dp, gStuff->processEvent, nil, &item); if (lastitem != item && item != cancel) { /* we just left this area. Check to make sure its within bounds. */ switch (lastitem) { case kPercentEdit: numberErr = FetchNumber(dp, kPercentEdit, kPercentMin, kPercentMax, &x); if (numberErr != noErr) { // shows alert if there's an error AlertNumber(dp, kPercentEdit, kPercentMin, kPercentMax, &x, AlertID, numberErr); item = kPercentEdit; // stay here } gPercent = x; break; } } switch (item) { case ok: gWhatArea = GetRadioGroupState(dp, kFirstItem, kLastItem) - kFirstItem; gWhatChannels = GetRadioGroupState(dp, kUseRadio1, kUseRadioLast) - kUseRadio1; gCreate = GetRadioGroupState(dp, kCreateRadio1, kCreateRadioLast) - kCreateRadio1; if (gWhatArea == iSelectRandom) { numberErr = FetchNumber(dp, kPercentEdit, kPercentMin, kPercentMax, &x); if (numberErr != noErr) { // shows alert if there's an error AlertNumber(dp, kPercentEdit, kPercentMin, kPercentMax, &x, AlertID, numberErr); item = kPercentEdit; // go back } else gPercent = x; // it's okay, move on } break; case cancel: gResult = userCanceledErr; break; case kPercentEdit: // grab the number whether it's right or not numberErr = FetchNumber(dp, kPercentEdit, kPercentMin, kPercentMax, &x); if (numberErr == noErr) { // no errors getting the number gPercent = x; // update display here } break; default: if (item >= kFirstItem && item <= kLastItem) { SetRadioGroupState (dp, kFirstItem, kLastItem, item); ShowHideItem (dp, kPercentStatic, (item == iSelectRandom + kFirstItem)); ShowHideItem (dp, kPercentEdit, (item == iSelectRandom + kFirstItem)); ShowHideItem (dp, kPercentSymbol, (item == iSelectRandom + kFirstItem)); if (item == iSelectRandom + kFirstItem) SelectTextItem(dp, kPercentEdit); } else if (item >= kUseRadio1 && item <= kUseRadioLast) SetRadioGroupState (dp, kUseRadio1, kUseRadioLast, item); else if (item >= kCreateRadio1 && item <= kCreateRadioLast) SetRadioGroupState (dp, kCreateRadio1, kCreateRadioLast, item); break; } lastitem = item; } while (item != ok && item != cancel); DisposeDialog (dp); if (dialogHdl != NULL && *dialogHdl != NULL) HPurge ((Handle) dialogHdl); dp = NULL; dialogHdl = NULL; return item == ok; } // else }