void debug_freehand(void *ptr) { long i; Handle h; if (current_level < 0) return; if (!ptr) McoErrorAlert(MCO_INVALID_PTR); if (!dbg_hand_ptrs) return; for (i=0; i<max_hand; i++) if (dbg_hand_ptrs[i] == ptr) { h = (Handle)ptr; HLock((Handle)h); fill_mem(dbg_hand_sizes[i],*h,HAND_FILL_D); HUnlock((Handle)h); dbg_hand_ptrs[i] = 0L; dbg_hand_sizes[i] = 0; dbg_hand_counts[i] = 0; dbg_hand_levels[i] = 0; break; } if (i == max_hand) McoErrorAlert(MCO_INVALID_PTR); }
TechkonDialog::TechkonDialog(ProfileDoc *dc,RawData *pD):InputDialog(dc,pD,1) { short iType; Handle iHandle; Handle sHandle; Rect iRect, r,pRect,tRect; UserItemUPP box3D; QDErr error; GDHandle oldGD; GWorldPtr oldGW; RGBColor c,oldbackcolor,oldforecolor; WindowPtr oldP; OSErr err; int32 i,wi,hi; double w,h; short gtsl_ids[] = GTSL_IDS; Str255 theString; PixMapHandle bigPixMap; McoStatus state; for (i=0; i<NumInputIDS; i++) ids[i] = gtsl_ids[i]; WinType = TechkonWindow; WinNum = 0; setDialog(Input_Dialog); frame_button(ids[Ok_Box]); // Added by James, 3D the box threeD_box(ids[ThreeDBox]); HideDItem(dp,ids[Redo]); GetDItem ( dp,ids[Message], &iType, (Handle*)&iHandle, &iRect ); GetIndString(theString,Message_List_ID,6); SetIText(iHandle,theString); Scramble = FALSE; if (Scramble) { voice_set = 1; } else { Disable(dp,ids[VoiceSet]); voice_set = 2; } // initialize comminications with the device state = doc->openInputDevice(0,0,0); if (state != MCO_SUCCESS) McoErrorAlert(state); // initialize the big gworld GetDItem (dp, ids[Strip_Rect], &iType, (Handle*)&iHandle, &iRect); tRect = iRect; OffsetRect(&tRect,-iRect.left,-iRect.top); error = NewGWorld( &BigGW, 32, &tRect, 0, 0, 0 ); if (error != 0) { delete this; return; } GetGWorld(&oldGW,&oldGD); SetGWorld(BigGW,nil); // GetBackColor(&oldbackcolor); GetForeColor(&oldforecolor); c.red = 65535; c.green = 65535; c.blue = 65535; RGBBackColor(&c); c.red = 0; c.green = 0; c.blue = 0; RGBForeColor(&c); bigPixMap = GetGWorldPixMap ( BigGW ); if (LockPixels ( bigPixMap )) EraseRect( &tRect ); SetGWorld(oldGW,oldGD); // RGBBackColor(&oldbackcolor); RGBForeColor(&oldforecolor); // SetPort(oldP); GetDItem (dp, ids[Patch_Rect], &iType, (Handle*)&iHandle, &pRect); num_display_patch = (iRect.bottom-iRect.top)/(pRect.bottom-pRect.top); top_patch = 0; //init the static members //current_patch = total_patches-1; //current_patch = 0; current_patch = 0; current_strip = 0; current_sheet = 0; _done = 0; _waiting = 0; SetSheetStripText(); current_top = current_patch - 2*num_display_patch/3; current_bottom = current_top + num_display_patch - 1; if (current_top < 0) { current_top = 0; current_bottom = current_top + num_display_patch - 1; } if (current_bottom >= total_patches-1) { current_bottom = total_patches - 1; current_top = current_bottom - num_display_patch + 1; } current_disp = 2*num_display_patch/3; init(); getpatchRGB(); Disable(dp,ids[Redo]); GetDItem (dp, ids[Slider], &iType, (Handle*)&iHandle, &pRect); SetCtlMin((ControlHandle)iHandle,0); SetCtlMax((ControlHandle)iHandle,total_patches-1); GetDItem(dp, ids[VoiceSet], &iType, (Handle*)&iHandle, &pRect); SetCtlValue((ControlHandle)iHandle,1); //voice_set = 1; checkFinished(); DrawWindow(); }
// Open a gammut surface dialog, use info passed in data if data is valid McoStatus AllWins::openGammutSurface1(void) { GamutSurfaceWin *gamutsurf; int32 maxwinnum = 0; McoStatus state = MCO_SUCCESS; int i; Str255 patchFName; RawData *raw; StandardFileReply sinReply; SFTypeList filelist; Str255 inname; FILE *fs; if (!QD3D_Present) return MCO_NO_QD3D; if (xyztorgb == NULL) return MCO_FAILURE; // raw is deleted by the window raw = new RawData(); filelist[0] = 'TEXT'; StandardGetFile(nil, 1, filelist, &sinReply); if(sinReply.sfGood == 0) return MCO_CANCEL; copy_str(patchFName,sinReply.sfFile.name); memcpy(inname, sinReply.sfFile.name, *(sinReply.sfFile.name)+1); PathNameFromDirID(sinReply.sfFile.parID, sinReply.sfFile.vRefNum, inname); ptocstr(inname); fs = fopen( (char*)inname, "r" ); if(!fs) return MCO_FILE_OPEN_ERROR; raw->loadData(fs); fclose(fs); //for (i=0; i<tempdoc->_condata.smooth; i++) raw->smooth_patch(); maxwinnum = 0; for (i=0; i<numWins; i++) if (wins[i]->isMyWindowType(GammutSurfaceTherm1)) { if (wins[i]->WinNum >= maxwinnum) maxwinnum = wins[i]->WinNum+1; } memcpy(inname, sinReply.sfFile.name, *(sinReply.sfFile.name)+1); // the flag after raw indicates that the window should delete raw gamutsurf = new GamutSurfaceWin(0L,raw,1,GammutSurfaceTherm1,maxwinnum,inname); if (gamutsurf == 0L) return MCO_MEM_ALLOC_ERROR; if (gamutsurf->error == MCO_MEM_ALLOC_ERROR) { McoErrorAlert(gamutsurf->error); delete gamutsurf; return MCO_SUCCESS; } if (gamutsurf->error != MCO_SUCCESS) { state = gamutsurf->error; delete gamutsurf; return state; } return AddWin(gamutsurf,0L); }
// The event handler for the main menu McoStatus ToneTab::DoEvents(short item, Point clickPoint, WindowCode *wc, int32 *numwc, void **data,Boolean &changed) { int didit = 0; int i,j; McoStatus status = MCO_SUCCESS; short item2 = item - startNum; Str255 prompt; StandardFileReply soutReply,sinReply; Str255 outname = "\p"; SFTypeList filelist; Str255 inname; Rect r1; short iType; Handle iHandle; WindowPtr oldP; GetPort(&oldP); SetPort( dp ) ; // no codes passed back *numwc = 0; for (i=0; i<numControls; i++) { status = controls[i]->DoEvents(item,clickPoint,wc,numwc,data,changed,&didit); if (status) return status; if (changed) { doc->changedLinearTone = 1; last_changed = 1; CopyOutofControl(i); CopyIntoControl(i); } else last_changed = 0; if (didit) return status; } if (item2 == EXPORT) { if (doc->calCurves) { GetIndString(prompt,PROMPT_STRINGS,STANDARD_PROMPT); StandardPutFile(prompt, outname, &soutReply); if(soutReply.sfGood) { memcpy(outname, soutReply.sfFile.name, *(soutReply.sfFile.name)+1); PathNameFromDirID(soutReply.sfFile.parID, soutReply.sfFile.vRefNum, outname); ptocstr(outname); status = doc->calCurves->exportTone((char*)outname); if (status) McoErrorAlert(status); else { FileFormat ff; ff.setInfo(&soutReply.sfFile,MONACO_SIG,'TEXT'); } } } } else if (item2 == IMPORT) { if (doc->calCurves) { filelist[0] = 'TEXT'; StandardGetFile(0L, 1, filelist, &sinReply); if(sinReply.sfGood) { memcpy(inname, sinReply.sfFile.name, *(sinReply.sfFile.name)+1); PathNameFromDirID(sinReply.sfFile.parID, sinReply.sfFile.vRefNum, inname); ptocstr(inname); status = doc->calCurves->importTone((char*)inname); if (status) McoErrorAlert(status); else { CopyIntoControl(-1); doc->changedLinearTone = 1; } status = MCO_SUCCESS; } } } else { GetDItem (dp, DESCRIPTION+startNum, &iType, (Handle*)&iHandle, &r1); GetIText(iHandle,inname); if (inname[0] > 100) inname[0] = 100; ptocstr(inname); strcpy(doc->printData->setting.toneDesc,(char*)inname); } SetPort(oldP); return status; }
SpChInDialog::SpChInDialog(ProfileDoc *dc,RawData *pD):TableDialog(dc,pD) { short iType; Handle iHandle; Handle sHandle; Rect iRect, r,pRect,tRect; UserItemUPP box3D; QDErr error; GDHandle oldGD; GWorldPtr oldGW; RGBColor c,oldbackcolor,oldforecolor; WindowPtr oldP; OSErr err; int32 i,wi,hi; double w,h; short spc_ids[] = SPC_IDS; McoStatus state; int papernum; for (i=0; i<NumInputIDS; i++) ids[i] = spc_ids[i]; WinType = StripDialog; WinNum = 0; setDialog(Input_Dialog); frame_button(ids[Ok_Box]); SetSheetStripText(); // Added by James, 3D the box threeD_box(ids[ThreeDBox]); // initialize comminications with the specrolino state = doc->openInputDevice(0,0,0); if (state != MCO_SUCCESS) McoErrorAlert(state); w = patchD->patches.width; h = patchD->patches.height; if (patchD->type == CMYKPatches) papernum = 0; else if (patchD->type == RGBPatches) papernum = patchD->format.total; if (doc->tcom != 0L) ((SpectroChart*)(doc->tcom))->setUpPatches(patchD->patches.columns,patchD->patches.rows,w,h,patchD->patches.starting,patchD->patches.direction,papernum); if (doc->tcom->device_num != DT_GretagTable) { McoErrorAlert(MCO_FAILURE); } // initialize the big gworld GetDItem (dp, ids[Strip_Rect], &iType, (Handle*)&iHandle, &iRect); tRect = iRect; OffsetRect(&tRect,-iRect.left,-iRect.top); error = NewGWorld( &BigGW, 32, &tRect, 0, 0, 0 ); if (error != 0) { delete this; return; } GetGWorld(&oldGW,&oldGD); SetGWorld(BigGW,nil); // GetBackColor(&oldbackcolor); GetForeColor(&oldforecolor); c.red = 65535; c.green = 65535; c.blue = 65535; RGBBackColor(&c); c.red = 0; c.green = 0; c.blue = 0; RGBForeColor(&c); // EraseRect( &tRect ); SetGWorld(oldGW,oldGD); // RGBBackColor(&oldbackcolor); RGBForeColor(&oldforecolor); // SetPort(oldP); GetDItem (dp, ids[Patch_Rect], &iType, (Handle*)&iHandle, &pRect); num_display_patch = (iRect.bottom-iRect.top)/(pRect.bottom-pRect.top); top_patch = 0; current_top = current_patch - 2*num_display_patch/3; current_bottom = current_top + num_display_patch - 1; if (current_top < 0) { current_top = 0; current_bottom = current_top + num_display_patch - 1; } if (current_bottom >= total_patches-1) { current_bottom = total_patches - 1; current_top = current_bottom - num_display_patch + 1; } current_disp = 2*num_display_patch/3; init(); getpatchRGB(); dtype = DType_Density; Disable(dp,ids[Redo]); GetDItem (dp, ids[Slider], &iType, (Handle*)&iHandle, &pRect); SetCtlMin((ControlHandle)iHandle,0); SetCtlMax((ControlHandle)iHandle,total_patches-1); if (ids[VoiceSet] > -1) { GetDItem(dp, ids[VoiceSet], &iType, (Handle*)&iHandle, &pRect); SetCtlValue((ControlHandle)iHandle,1); } //voice_set = 1; if (ids[Lift] > -1) HideDItem(dp,ids[Lift]); checkFinished(); DrawWindow(); }