Пример #1
0
McoStatus TechkonDialog::SetSheetStripText(void)
{
	Rect r;
	short itemType;
	Handle cn1;
	Str255 theString;
	int32 current_row;
	
	
GetDItem ( dp,ids[Cur_sheet], &itemType, (Handle*)&cn1, &r );
NumToString(current_strip+1,theString);
SetIText(cn1,theString);
GetDItem ( dp,ids[Cur_strip], &itemType, (Handle*)&cn1, &r );
current_row = current_patch % patch_per_strip;
if (current_row+1 > 26) 
	{
	theString[0] = 2;
	theString[1] = 'A';
	theString[2] = 'A'+current_row-26;
	}
else
	{
	theString[0] = 1;
	theString[1] = 'A'+current_row;
	}
SetIText(cn1,theString);
return MCO_SUCCESS;
}
Пример #2
0
McoStatus ToneTab::updateWindowData(int changed)
{
Rect r1;
short	iType;
Handle	iHandle;
Str255	text;
char	desc[100];
int 	result;
int newhand;

if (!doc) return MCO_OBJECT_NOT_INITIALIZED;
if (!doc->printData) return MCO_OBJECT_NOT_INITIALIZED;

// see if export is valid
GetDItem (dp, DESCRIPTION+startNum, &iType, (Handle*)&iHandle, &r1);
GetIText(iHandle,text);
ptocstr(text);
strcpy(desc,doc->printData->setting.toneDesc);
if (strcmp((char*)text,desc))
	{
	ctopstr(desc);
	SetIText(iHandle,(unsigned char*)desc);
	}
	
if (last_changed) changed = 0;
last_changed = 0;	
	
if (changed) CopyIntoControl(-1);

return MCO_SUCCESS;
}
Пример #3
0
McoStatus DisplayDialog::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 == 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[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();
				}
			}
		}
	SetPort(oldp);
	return status;	    	
}
Пример #4
0
static pascal Boolean device_dialog_filter_proc(
	DialogPtr dialog,
	EventRecord *event,
	short *item_hit)
{
	GrafPtr old_port;
	short item_type;
	Handle item_handle;
	Rect item_rectangle;
	boolean handled= FALSE;

	GetPort(&old_port);
	SetPort(dialog);
	
	GetDItem(dialog, iDEVICE_AREA, &item_type, &item_handle, &item_rectangle);

	/* preprocess events */	
	switch(event->what)
	{
		case mouseDown:
		{
			Point where= event->where;
			
			GlobalToLocal(&where);
			switch (FindDItem(dialog, where)+1)
			{
				case iDEVICE_AREA:
				{
					GDHandle new_device= click_in_device_area(&device_dialog_globals.device_spec, &item_rectangle, where);
					
					if (new_device && new_device!=device_dialog_globals.device)
					{
						device_dialog_globals.device= new_device;
						BuildExplicitGDSpec(&device_dialog_globals.device_spec, new_device, device_dialog_globals.device_spec.flags, device_dialog_globals.device_spec.bit_depth, 0, 0);
						draw_device_area(&device_dialog_globals.device_spec, device_dialog_globals.device, &item_rectangle);
						
						*item_hit= iDEVICE_AREA;
					}
					handled= TRUE;
					
					break;
				}
			}
			break;
		}
		
		case updateEvt:
			if ((DialogPtr)event->message==dialog)
			{
				draw_device_area(&device_dialog_globals.device_spec, device_dialog_globals.device, &item_rectangle);
			}
			break;
	}

	SetPort(old_port);

	return handled ? TRUE : general_filter_proc(dialog, event, item_hit);
}
Пример #5
0
int16	RchooseDialog::hit(void)
{	
	short		item;	
	short		iType;
	Handle		iHandle;
	Rect 		iRect;	
	int 		which;


	BringToFront(dialogptr);
	ShowWindow(dialogptr);

	do{
		ModalDialog(NULL, &item);
		switch(item){
			case FileType:
				GetDItem (dialogptr, FileType, &iType, &iHandle, &iRect);
				which = GetCtlValue((ControlHandle)iHandle);
				convertToDefault(which);
				setDialogState();
				break;
			case PatchFormat:
				GetDItem (dialogptr, PatchFormat, &iType, &iHandle, &iRect);
				which = GetCtlValue((ControlHandle)iHandle);
				_which_patch = convert[which];
				break;
			case DevicePort:
				GetDItem (dialogptr, DevicePort, &iType, &iHandle, &iRect);
				_which_port = GetCtlValue((ControlHandle)iHandle);
				 break;
	    	case 3:
	    	break;
	    	
	    	case 1:
	    	_Savesettings();
			break;	    	
	    }	
	 } while( item != 1 && item != 3);	
	
	if (item == 3) item = 0;
	return item;	    	
}
Пример #6
0
McoStatus DisplayDialog::SetSheetStripText(void)
{
	Rect r;
	short itemType;
	Handle cn1;
	Str255 theString;
	
	
GetDItem ( dp,ids[Cur_sheet], &itemType, (Handle*)&cn1, &r );
NumToString(current_patch+1,theString);
SetIText(cn1,theString);
return MCO_SUCCESS;
}
Пример #7
0
McoStatus TableDialog::readInPatches(void)
{
int i,count;
short		item;	
short		itemtype;
Handle		cn1,sliderControl;
Rect		r;
McoStatus state;
int32		start_patch;

//current_patch = current_patch/patch_per_strip;
//current_patch *= patch_per_strip;
start_patch = current_patch;


count = 0;
do {
	state = tcom->getNextPatch(current_patch,&patch_data[current_patch*3],0);
	if (state == MCO_SUCCESS) 
		{
		 playSound(EndColumnNum);
		}
	count ++;
	} while ((state != MCO_SUCCESS) && (count < 5));
if (state != MCO_SUCCESS) 
	{
	//tcom->TurnOnStripRead();
	return state;
	}
//playSound(ClickNum);
if (doc->patchtype == No_Patches) doc->patchtype = patchtype;
GetDItem ( dp, Slider, &itemtype, (Handle*)&sliderControl, &r );
SetCtlValue ( (ControlHandle)sliderControl,current_patch);
//ShowPatchScroll(current_patch);
current_patch = next_patch[current_patch];
//current_patch++;
	
// check for error
checkError(start_patch);
if (current_patch >= total_patches) 
	{
	current_patch = total_patches -1;
	_waiting = FALSE;
	}
ShowPatchScroll(current_patch);
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;
SetSheetStripText();
//tcom->TurnOnStripRead();
return MCO_SUCCESS;
}
Пример #8
0
McoStatus BlankTwTab::UpdateWindow(void)	
{			
PicHandle	pict;
Rect r1;
short	iType;
Handle	iHandle;

pict = GetPicture(WAIT_PICT);
GetDItem (dp, WAIT_ID+startNum, &iType, (Handle*)&iHandle, &r1);
if (pict != 0L) 
	{
	DrawPicture(pict,&r1);
	ReleaseResource((Handle)pict);
	}
return MCO_SUCCESS;
}
Пример #9
0
void box_d_item(DialogPtr dp, short item)
{
    Rect r;
    Handle h;
    short itemType;

    GetDItem (dp, item, &itemType, &h, &r);

    PenNormal ();
    PenSize (2, 2);

    InsetRect (&r, -2, -2);
    FrameRect (&r);

    PenNormal ();

}
Пример #10
0
static device_dialog_instantiate_proc(
	DialogPtr dialog)
{
	short item_type;
	Rect item_rectangle;
	Handle item_handle;
	OSErr error;
	
	modify_radio_button_family(dialog, iCOLORS, iGRAYS, (device_dialog_globals.device_spec.flags&deviceIsColor) ? iCOLORS : iGRAYS);

	error= GetNameFromGDevice(device_dialog_globals.device, temporary);
	if (error!=noErr) temporary[0]= 0;
	GetDItem(dialog, iDEVICE_NAME, &item_type, &item_handle, &item_rectangle);
	SetIText(item_handle, (const unsigned char *)temporary);
	
	return;
}
Пример #11
0
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;
}
Пример #12
0
Boolean ThermDialog::DisplayTherm(int k,int maxk,unsigned char *st)
{

    Rect r;
    int	maxr;
    Handle h;
    short itemType;
    long 	temp;
    GrafPtr	tdp;
    WindowPtr   	window;
    short       	thePart;
    Rect        	screenRect, updateRect;
    Point			aPoint = {100, 100};
    Boolean 		QuitFlag = FALSE;
    short			item = 0;
    EventRecord 	event;
    short		the_part;
    DialogPtr 	hitdp;

    GetPort(&tdp);
    SetPort(dp);

    if (st != NULL)
    {
        GetDItem (dp,ids[THERM_TEXT], &itemType, &h, &r);
        SetIText(h,st);
    }


    GetDItem (dp, ids[THERM_BOX], &itemType, &h, &r);

    if (k == -1) k = old_k;
    if (maxk == -1) maxk = old_maxk;

    maxr = r.right;
    temp = ((long)k*((long)r.right - (long)r.left))/(long)maxk;
    r.right = r.left + temp;
    if (r.right>maxr) r.right=maxr;

    old_k = k;
    old_maxk = maxk;

    PenNormal ();
    PenPat(&qd.gray);
    PaintRect(&r);

    PenNormal ();

    SetPort(tdp);

    if (GetNextEvent(0xFFFF,&event))
    {
        if (event.what == mouseDown)
        {
            the_part = FindWindow(event.where, &window);
            if (IsDialogEvent(&event))
            {
                DialogSelect(&event,&hitdp,&item);
                if ((hitdp == dp) && (item == ids[THERM_CANCEL]))
                {
                    Quit = TRUE;
                    return FALSE;
                }
            }
            else switch (the_part) {
                case inSysWindow:
                    SystemClick (&event, window);
                    break;
                case inDrag:
                    screenRect = (**GetGrayRgn()).rgnBBox;
                    DragWindow( window, event.where, &screenRect );
                    break;
                }
        }
        else if (event.what == keyDown)
        {
            if ((event.modifiers & 0x0100) && ( (event.message) & charCodeMask == 0x02E))
            {
                Quit = TRUE;
                return FALSE;
            }
        }
        else if (event.what == updateEvt)
        {
            window = (WindowPtr)event.message;
            updateRect = (**(window->visRgn)).rgnBBox;
            SetPort( window ) ;
            BeginUpdate( window );
            DrawDialog( window );
            if (dp == window) box_d_item(dp,ids[THERM_BOX]);
            EndUpdate( window );
        }
    }
    if (Quit) return FALSE;
    return TRUE;
}
Пример #13
0
// 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;
}
Пример #14
0
RchooseDialog::RchooseDialog(ProfileDocInf *d,int den)
{
	short		iType;
	Handle		iHandle;
	Rect 		iRect;	
	long		id;
	int 		i;
	MenuHandle menuH;
	int 		which;

	doc = d;
	density = den;
	
	_which = doc->defaults->input_type;
	_which_patch = doc->defaults->patch_format;
	_which_port = doc->defaults->port;
	
	if (_which == DT_None) _which = DT_TechkonSP820;
	
	switch (_which) {
		case DT_TiffFile:
			which = DataFile;
			break;
		case DT_DTP51:
			which = DTP51;
			break;
		case DT_XriteDTP41:
			which = DTP41;
			break;
		case DT_TechkonCP300:
			which = TechkonCP300;
			break;
		case DT_TechkonSP820:
			which = TechkonSP820;
			break;
		case DT_TechkonTCRCP300:
			which = TechkonTCRCP300;
			break;
		case DT_TechkonTCRSP820:
			which = TechkonTCRSP820;
			break;
		case DT_GretagHand:
			which = GretagHand;
			break;
		case DT_GretagTable:
			which = GretagTable;
			break;
		case DT_Xrite408:
			which = XR408;
			break;
		}	
	

	setDialog(Rchoose_Dialog);
	frame_button();	

	for (i=0; i<MAX_PATCH_NAMES; i++) 
		{
		convert[i] = 0;
		convert2[i] = 0;
		}
		
	GetDItem (dialogptr, FileType, &iType, &iHandle, &iRect);
	SetCtlValue((ControlHandle)iHandle,which);
	
	if ((XR408 != -1) && (!density))
		{
		menuH = GetMenu(DeviceMenuID);
		DisableItem(menuH,XR408);
		}

	setDialogState();
}	
Пример #15
0
DisplayDialog::DisplayDialog(ProfileDoc *dc,RawData *pD,int wn):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		dtp_ids[] = DISPPATCH_IDS;
	Str255		theString,name;
	
	for (i=0; i<NumInputIDS; i++) ids[i] = dtp_ids[i];

	WinType = DisplayWindow;
	WinNum = wn;

	setDialog(Input_Dialog);

	
	GetIndString(theString,Display_Title,1);
	
	SetWTitle( dp, theString);
	
	// Added by James, 3D the box
	threeD_box(ids[ThreeDBox]);
	

	//playSound(8193);
	
	
	// 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;
						
//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[Message], &iType, (Handle*)&iHandle, &pRect );
//	SetIText(iHandle,"\p");
	
	GetDItem ( dp,PatchLabel, &iType, (Handle*)&iHandle, &pRect );
	GetIndString(theString,Message_List_ID,Patch_Message);
	SetIText(iHandle,theString);
	
	strcpy((char*)name,pD->desc);
	ctopstr((char*)name);
	SetWTitle( dp, name);
	
	DrawWindow();
}	
Пример #16
0
TableDialog::TableDialog(ProfileDoc *dc,RawData *pD): InputDialog(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 wi,hi;
	double w,h;
	McoColorSync *mon,*lab,*list[2];
	

	//Scramble = !(isPressed(0x3a));
	Scramble = FALSE;
	
	
	_rgbpatchH = NULL;
	_labpatchrefH = NULL;


	
	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;
 	
 	next_patch = new int32[total_patches];
 	
 int32 i,start_odd_even,odd_even,up_down;	
 	

 	current_patch = 0;
 	start_odd_even =  0;	
 	for (i=0; i<total_patches; i++)
 		{
 		odd_even = (i/NUM_ROWS_CMYK)%2;
 		if ((start_odd_even && odd_even) || (!start_odd_even && !odd_even)) up_down = 1;
 		else  up_down = -1;
 		next_patch[i] = i + up_down;
 		if (i%NUM_ROWS_CMYK == 0) 
 			if (start_odd_even == 0)
 				{
 				 if (odd_even == 1) next_patch[i] = i + NUM_ROWS_CMYK;
 				 }
 			else if (odd_even == 1) next_patch[i] = i + NUM_ROWS_CMYK;
 		if ((i+1)%NUM_ROWS_CMYK == 0) 
 			if (start_odd_even == 0)
 				{
 				 if (odd_even == 0) next_patch[i] = i + NUM_ROWS_CMYK;
 				 }
 			else if (odd_even == 0) next_patch[i] = i + NUM_ROWS_CMYK;		
 		if (next_patch[i] < 0) next_patch[i] = total_patches;

 		}
 		

	GetDItem (dp, (short)(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;
	
}	
Пример #17
0
void 	RchooseDialog::setDialogState(void)
{
int i,m;
MenuHandle menuH;
short menucount;
	short		item;	
	short		iType;
	Handle		iHandle;
	Rect 		iRect;	
	
	
switch (_which) {
	case DT_TiffFile:
		if (DataFile < 0) _which = 1;
		break;
	case DT_DTP51:
		if (DTP51 < 0) _which = 1;
		break;
	case DT_XriteDTP41:
		if (DTP41 < 0) _which = 1;
		break;
	case DT_TechkonCP300:
		if (TechkonCP300 < 0) _which = 1;
		break;
	case DT_TechkonSP820:
		if (TechkonSP820 < 0) _which = 1;
		break;
	case DT_TechkonTCRCP300:
		if (TechkonTCRCP300 < 0) _which = 1;
		break;
	case DT_TechkonTCRSP820:
		if (TechkonTCRSP820 < 0) _which = 1;
		break;
	case DT_GretagHand:
		if (GretagHand < 0) _which = 1;
		break;
	case DT_GretagTable:
		if (GretagTable < 0) _which = 1;
		break;
	case DT_Xrite408:
		if (XR408 < 0) _which = 1;
		break;
	}	
	

switch (_which) {
	case (DT_DataFile):
		Disable(dialogptr,PatchFormat);
		Disable(dialogptr,DevicePort);
		menuH = GetMenu(Table_menu);
		menucount = CountMItems(menuH);

		for( i = menucount; i > 0; i-- )
			DelMenuItem(menuH,i);
			
		_which_patch = 1;
		GetDItem (dialogptr, PatchFormat, &iType, &iHandle, &iRect);
		SetCtlValue((ControlHandle)iHandle,_which_patch);
		DrawControls(dialogptr);
		break;
	case (DT_DTP51):
		Enable(dialogptr,PatchFormat);
		Enable(dialogptr,DevicePort);
		menuH = GetMenu(Table_menu);
		menucount = CountMItems(menuH);

		for( i = menucount; i > 0; i-- )
			DelMenuItem(menuH,i);
		
		m = 1;
		for (i=0; i<doc->patchset->filenum; i++)
			{
			if (doc->patchset->patches[i] != NULL)
				{
				if ( doc->patchset->patches[i]->patches.strips == 1) 
					{
					convert[m] = i;
					convert2[i] = m;
					InsMenuItem(menuH, doc->patchset->patchames[i], m++);
					}
				}
			}
			
		//_which_patch = 1;
		GetDItem (dialogptr, PatchFormat, &iType, &iHandle, &iRect);
		SetCtlValue((ControlHandle)iHandle,convert2[_which_patch]);
		GetDItem (dialogptr, DevicePort, &iType, &iHandle, &iRect);
		SetCtlValue((ControlHandle)iHandle,_which_port);
		DrawControls(dialogptr);
		break;
	case (DT_TiffFile):
		Enable(dialogptr,PatchFormat);
		Disable(dialogptr,DevicePort);
		
		menuH = GetMenu(Table_menu);
		menucount = CountMItems(menuH);

		for( i = menucount; i > 0; i-- )
			DelMenuItem(menuH,i);
		
		m = 1;
		for (i=0; i<doc->patchset->filenum; i++)
			{
			if (doc->patchset->patches[i] != NULL)
				{
				if (doc->patchset->patches[i]->patches.strips == 0) 
					{
					convert[m] = i;
					convert2[i] = m;
					InsMenuItem(menuH, doc->patchset->patchames[i], m++);
					}
				}
			}
		//_which_patch = 1;
		GetDItem (dialogptr, PatchFormat, &iType, &iHandle, &iRect);
		SetCtlValue((ControlHandle)iHandle,convert2[_which_patch]);
		GetDItem (dialogptr, DevicePort, &iType, &iHandle, &iRect);
		SetCtlValue((ControlHandle)iHandle,_which_port);
		DrawControls(dialogptr);
		break;
	case (DT_TechkonCP300):
	case (DT_TechkonSP820):
	case (DT_TechkonTCRCP300):
	case (DT_TechkonTCRSP820):
	case (DT_GretagHand):
	case (DT_GretagTable):
		Enable(dialogptr,PatchFormat);
		Enable(dialogptr,DevicePort);
		
		menuH = GetMenu(Table_menu);
		menucount = CountMItems(menuH);

		for( i = menucount; i > 0; i-- )
			DelMenuItem(menuH,i);
		
		m = 1;
		for (i=0; i<doc->patchset->filenum; i++)
			{
			if (doc->patchset->patches[i] != NULL)
				{
				if (doc->patchset->patches[i]->patches.strips == 0) 
					{
					convert[m] = i;
					convert2[i] = m;
					InsMenuItem(menuH, doc->patchset->patchames[i], m++);
					}
				}
			}
		//_which_patch = 1;
		GetDItem (dialogptr, PatchFormat, &iType, &iHandle, &iRect);
		SetCtlValue((ControlHandle)iHandle,convert2[_which_patch]);
		GetDItem (dialogptr, DevicePort, &iType, &iHandle, &iRect);
		SetCtlValue((ControlHandle)iHandle,_which_port);
		DrawControls(dialogptr);
		break;
	case (DT_Xrite408):
		Disable(dialogptr,PatchFormat);
		break;
	}
	
if ((!density) && (_which == DT_Xrite408)) Disable(dialogptr,1);
else Enable(dialogptr,1);	

}
Пример #18
0
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;	    	
}
Пример #19
0
McoStatus SpChInDialog::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;
SpectroChart *tcom = (SpectroChart*)(doc->tcom);


	GetPort(&oldp);
	SetPort(dp);

	Changed = FALSE;
	*numwc = 0;
	status = MCO_SUCCESS;

	if (isPressed(0x38)) m = 10;

	if (item != -1) {
		if (item == TIMER_ITEM ) // a timer event has occured
			{   
			_last_tick_time2 = TickCount();
			if (_waiting)
				{
				doc->needsSave = TRUE;
			//	GetDItem ( dp,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,Message, &itemtype, (Handle*)&cn1, &r );
				//	GetIndString(theString,Message_List_ID,5);
				//	SetIText(cn1,theString);
					_done == TRUE;
					if (current_patch == total_patches) _waiting = FALSE;
					Disable(dp,ids[Redo]);
					//Disable(dp,ReadNext);
					if (NotAlreadFinished) Disable(dp,Cancel);
					Enable(dp,ids[Save_as]);	
					Enable(dp,OK);			
					}
				else
					{

				//	GetDItem ( dp,Message, &itemtype, (Handle*)&cn1, &r );
				//	GetIndString(theString,Message_List_ID,2);
				//	SetIText(cn1,theString);
					}
				if (!_waiting)
					{
					GetDItem ( dp,ids[Start], &itemtype, (Handle*)&cn1, &r );
					GetIndString(theString,Button_Labels,1);
					SetCTitle((ControlHandle)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
			{
			if (_waiting) 
				{
				_waiting = 0;
				GetDItem ( dp,ids[Start], &itemtype, (Handle*)&cn1, &r );
				GetIndString(theString,Button_Labels,1);
				SetCTitle((ControlHandle)cn1,theString);
				current_patch = last_patch;
				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;
				}
			else 
				{
				if (DoStart() == MCO_SUCCESS)
					{
					GetDItem ( dp,ids[Start], &itemtype, (Handle*)&cn1, &r );
					GetIndString(theString,Button_Labels,2);
					SetCTitle((ControlHandle)cn1,theString);
					}
				}
			}
		else if (item == ids[Position_Up])
			{
			if (!_waiting)
				{
				tcom->moveDistance(0,m*0.5);
				}
			}
		else if (item == ids[Position_Down])
			{
			if (!_waiting)
				{	
				tcom->moveDistance(0,-0.5*m);
				}
			}
		else if (item == ids[Position_Left])
			{
			if (!_waiting)
				{
				tcom->moveDistance(-0.5*m,0);
				}
			}
		else if (item == ids[Position_Right])
			{
			if (!_waiting)
				{
				tcom->moveDistance(0.5*m,0);
				}
			}		
		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 == 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;
			doc->patchtype = oldpatchtype;
			}
		}
	SetPort(oldp);
	changed = Changed;
	return status;	    	
}
Пример #20
0
// initialize the 3D and load an object
LogoWin2::LogoWin2(XyztoRgb *xtor,double mg) 
{
	TQ3Status	myStatus;
	//Rect		rBounds;
	FSSpec		theFileSpec ;				// the file we are opening
	Str255 		title = "\p";
	McoStatus   status;
	Handle			item_handle;
	short			item_type;
	int			Q3DIDS[] = LW_IDS;
	int			i;
	
	priority = 3;
	
	xyztorgb = xtor;
	monitor_z = mg;
	
	ambient = 0.6;
	point = 1.5;
	fill = 0.2;
	
	Document.fCameraFrom.x = 0.0; 
	Document.fCameraFrom.y = 0.0;
	Document.fCameraFrom.z = 30.0;
	
	Document.fCameraTo.x = 0.0; 
	Document.fCameraTo.y = 0.0;
	Document.fCameraTo.z = 0.0;
	
	WinNum = 0;
	WinType = Startup_Dialog;
	
//	the_window = NewCWindow(nil,&rBounds,title,false,noGrowDocProc,(WindowPtr)-1,true,nil);
//	if (the_window == NULL) goto fail;

	for (i=0; i<NUM_QD3D_IDS; i++) ids[i] = Q3DIDS[i];

	setDialog(ids[QD3D_Dial],0,-140);
	the_window = dp;

	GetDItem (dp, ids[QD3D_Box], &item_type, &item_handle, &box_rect);

	// initialise our document structure
	InitDocumentData( &Document ) ;
	
	num_objects = 0;
	
	status = ChangeGeometry(MP_Logo	,0);
	if (status != MCO_SUCCESS) goto fail;
			
	
	AdjustCamera(	&Document,
					(box_rect.right - box_rect.left),
					(box_rect.bottom - box_rect.top) ) ;

	SetWTitle( the_window, "\p" );
	ShowWindow( the_window );
	SetPort( the_window );

	DocumentDraw3DData(&Document);
	DocumentDrawOnscreen( &Document, &box_rect ) ;
	
	Current_Button = ids[QD3D_Rotate];
	Disable(dp,ids[QD3D_Rotate]);
	
	tick_start = TickCount();
	
fail:	
	return;

	//delete this;
}
Пример #21
0
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();
}	
Пример #22
0
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();
}	
Пример #23
0
McoStatus SpChInDialog::readInPatches(void)
{
int i,count;
short		item;	
short		itemtype;
Handle		cn1,sliderControl;
Rect		r;
McoStatus state;
int32		start_patch;
double		data[4];
SpectroChart *tcom = (SpectroChart*)(doc->tcom);

//current_patch = current_patch/patch_per_strip;
//current_patch *= patch_per_strip;
start_patch = current_patch;

if (!doc->tcom) return MCO_SUCCESS;

count = 0;

if ((current_patch < patchD->format.total) || (patchD->format.numLinear == 0)) doc->tcom->SetLabOutput();
else doc->tcom->SetDensityOutput();

do {
	state = doc->tcom->getNextPatch(current_patch,data);
	if (state == MCO_SUCCESS) 
		{
		 playSound(EndColumnNum);
		}
	count ++;
	} while ((state != MCO_SUCCESS) && (count < 1));
if (state != MCO_SUCCESS) 
	{
	//tcom->TurnOnStripRead();
	return state;
	}
if ((current_patch < patchD->format.total) || (patchD->format.numLinear == 0))
	{
	patch_data[current_patch*3] = data[0];
	patch_data[current_patch*3+1] = data[1];
	patch_data[current_patch*3+2] = data[2];
	}
else 
	{
	i = (current_patch-patchD->format.total)/(patchD->format.numLinear-1);
	patch_data[current_patch*3] = data[i];
	patch_data[current_patch*3+1] = 0;
	patch_data[current_patch*3+2] = 0;
	}
	
//playSound(ClickNum);
if (doc->patchtype == No_Patches) doc->patchtype = patchtype;
GetDItem ( dp,ids[Slider], &itemtype, (Handle*)&sliderControl, &r );
SetCtlValue ( (ControlHandle)sliderControl,current_patch);
//ShowPatchScroll(current_patch);
last_patch = current_patch;
current_patch = next_patch[current_patch];
//current_patch++;
	
// check for error
//checkError(start_patch);
if (current_patch >= total_patches) 
	{
	current_patch = total_patches -1;
	_waiting = FALSE;
	}
ShowPatchScroll(current_patch);
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;
SetSheetStripText();
//tcom->TurnOnStripRead();
return MCO_SUCCESS;
}