Exemplo n.º 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;
}
Exemplo n.º 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;
}
Exemplo n.º 3
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;
}
Exemplo n.º 4
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;
}
Exemplo n.º 5
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();
}	
Exemplo n.º 6
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;	    	
}
Exemplo n.º 7
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();
}	
Exemplo n.º 8
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;
}
Exemplo n.º 9
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;
}