McoStatus Techkon::Calibrate(void) { char st[5000]; char c; int code,error; McoMessAlert(MCO_CALIB,0L); }
McoStatus TechkonDialog::DoEvents(short item, Point clickPoint, WindowCode *wc, int32 *numwc, void **data, Boolean &changed) { UserItemUPP myfilter; Str255 theString; short itemtype; Handle cn1,sliderControl; Rect r; short part; Point mpoint; int32 next_patch; McoStatus status; WindowPtr oldp; int32 temp; double m=1; GetPort(&oldp); SetPort(dp); Changed = FALSE; *numwc = 0; status = MCO_SUCCESS; if (isPressed(0x38)) m = 10; if (item != -1) { if ((item == TIMER_ITEM ) && (doc->tcom)) // a timer event has occured { _last_tick_time2 = TickCount(); if (_waiting) { if (!doc->tcom->IsBufferEmpty()) // has a strip been read in { changed = TRUE; // check to see if a strip has been read in if (doc->tcom->IsDataPresent()) { doc->needsSave = TRUE; GetDItem ( dp,ids[Message], &itemtype, (Handle*)&cn1, &r ); GetIndString(theString,Message_List_ID,4); SetIText(cn1,theString); readInPatches(); Changed = TRUE; next_patch = findNextPatch(); if (next_patch == -1) { GetDItem ( dp,ids[Message], &itemtype, (Handle*)&cn1, &r ); GetIndString(theString,Message_List_ID,5); SetIText(cn1,theString); _done == TRUE; _waiting = FALSE; Disable(dp,ids[Redo]); Disable(dp,ids[Start]); Disable(dp,ids[Cancel]); Enable(dp,ids[Save_as]); Enable(dp,OK); } else { GetDItem ( dp,ids[Message], &itemtype, (Handle*)&cn1, &r ); GetIndString(theString,Message_List_ID,7); SetIText(cn1,theString); } } } checkFinished(); } } else if (item == ids[Slider]) // the slider has been adjusted { GetMouse(&mpoint); do { current_patch = GetSlider(mpoint,ids[Slider]); ShowPatchScroll(current_patch); SetSheetStripText(); current_sheet = current_patch/(patch_per_strip*strip_per_sheet); current_strip = (current_patch - current_sheet*(patch_per_strip*strip_per_sheet))/patch_per_strip; GetMouse(&mpoint); } while ( StillDown ( ) ); checkError((current_patch/patch_per_strip)*patch_per_strip); //_waiting = 0; Enable(dp,ids[Redo]); SetSheetStripText(); } else if (item == ids[Start]) // start or stop reading { status = MCO_SUCCESS; if (_first) { status = doc->tcom->Calibrate(); playSound(EndColumnNum); if (status != MCO_SUCCESS) { McoMessAlert(MCO_FAIL_CALIB,0L); status = MCO_SUCCESS; goto bail; } } if (status == MCO_SUCCESS) { _waiting = 1; current_patch = findNextPatch(); // reset the display, current patch, sheet, strip, and text ShowPatch(current_patch); // display the window current_sheet = current_patch/(patch_per_strip*strip_per_sheet); current_strip = (current_patch - current_sheet*(patch_per_strip*strip_per_sheet))/patch_per_strip; Disable(dp,ids[Start]); GetDItem ( dp,ids[Message], &itemtype, (Handle*)&cn1, &r ); GetIndString(theString,Message_List_ID,7); SetIText(cn1,theString); SetSheetStripText(); _first = 0; } status = MCO_SUCCESS; } else if (item == ids[Save_as]) { StorePatches(); doc->patchtype = patchtype; doc->handle_save_datafile(patchD); ShowPatch(current_patch); } else if (item == ids[VoiceSet]) { GetDItem(dp, ids[VoiceSet], &itemtype, (Handle*)&cn1, &r ); voice_set = GetCtlValue((ControlHandle)cn1); } else if (item == ids[Strip_Rect]) { GlobalToLocal(&clickPoint); temp = whichPatch(clickPoint); if (temp != -1) { current_patch = temp; current_disp = current_patch-current_top; GetDItem ( dp, ids[Slider], &itemtype, (Handle*)&sliderControl, &r ); SetCtlValue ( (ControlHandle)sliderControl,current_patch); ShowPatch(current_patch); SetSheetStripText(); } } else if (item == ids[Redo]) // Reread a strip { _waiting = 1; // reset the display, current patch, sheet, strip, and text Disable(dp,ids[Redo]); Disable(dp,ids[Start]); GetDItem ( dp,ids[Message], &itemtype, (Handle*)&cn1, &r ); GetIndString(theString,Message_List_ID,7); SetIText(cn1,theString); } else if (item == OK) { StorePatches(); doc->copyWaiting(patchD); doc->patchtype = patchtype; //doc->needsSave = TRUE; *numwc = 1; wc[0].code = WE_Close_Window; wc[0].wintype = WinType; wc[0].winnum = WinNum; wc[0].doc = doc; } else if (item == Cancel) { *numwc = 1; wc[0].code = WE_Close_Window; wc[0].wintype = WinType; wc[0].winnum = WinNum; wc[0].doc = doc; } } bail: SetPort(oldp); changed = Changed; return status; }
McoStatus SpChInDialog::DoStart(void) { Str255 st; int32 wi,hi; double w,h; short iType; Handle iHandle; Handle sHandle; Rect iRect, r,pRect,tRect; double patchPoints[6]; int32 tablePoints[6]; McoStatus state = MCO_SUCCESS; SpectroChart *tcom = (SpectroChart*)(doc->tcom); int papernum; if (!doc->tcom) return MCO_SUCCESS; w = patchD->patches.width; h = patchD->patches.height; if (patchD->type == CMYKPatches) papernum = 0; else if (patchD->type == RGBPatches) papernum = patchD->format.total-1; if (doc->tcom != 0L) state = tcom->setUpPatches(patchD->patches.columns,patchD->patches.rows,w,h,patchD->patches.starting,patchD->patches.direction,papernum); if (state != MCO_SUCCESS) return state; // check to see if auto alignment is to be used if (McoMessAlert(MCO_FIND_PATCHS,0L) == MCO_SUCCESS) { tcom->getPatchPoint(0,&patchPoints[0]); tcom->getPatchPoint(patchD->patches.rows-1,&patchPoints[2]); tcom->getPatchPoint(patchD->patches.rows*(patchD->patches.columns-1),&patchPoints[4]); //tcom->setCurrentPatch(0); tcom->moveToPatch(0,1); state = PositionTable(tcom,&tablePoints[0],1,0); if (state != MCO_SUCCESS) return state; tcom->setPoints_1(tablePoints,patchPoints); tcom->moveToPatch(patchD->patches.rows-1,1); state = PositionTable(tcom,&tablePoints[2],2,0); if (state != MCO_SUCCESS) return state; tcom->setPoints_1(tablePoints,patchPoints); tcom->moveToPatch(patchD->patches.rows*(patchD->patches.columns-1),1); state = PositionTable(tcom,&tablePoints[4],3,0); if (state != MCO_SUCCESS) return state; tcom->setPoints_3(tablePoints,patchPoints); state = tcom->Calibrate(); if (state != MCO_SUCCESS) return state; state = tcom->moveToPatch(current_patch,0); if (state != MCO_SUCCESS) return state; tcom->SetDensityOutput(); tcom->GetPaperDensity(); tcom->SetLabOutput(); _waiting=1; return MCO_SUCCESS; } else if (McoMessAlert(MCO_ALIGN_PATCHES,0L) == MCO_SUCCESS) { //tcom->setCurrentPatch(current_patch); _waiting=1; return MCO_SUCCESS; } return MCO_FAILURE; }