예제 #1
0
void
ShowTxt(void)
{	    
	switch (gCurrWin)
	{
		case kLicenseID:
			if(gControls->lw->licTxt)
			{
			    RGBColor backColorOld;
			    Rect     textRect;
			    
			    // get back color
			    GetBackColor(&backColorOld);
			    
			    // set to white
			    BackColor(whiteColor);
			    
			    // erase rect and update
			    textRect = (**(gControls->lw->licTxt)).viewRect;
			    EraseRect(&textRect);
				TEUpdate(&textRect, gControls->lw->licTxt);
				
				// restore back color
				RGBBackColor(&backColorOld);
			}
			break;
		default:
			break;
	}		
}
예제 #2
0
void
UpdateTerminalWin(void)
{
	GrafPtr	oldPort;
	int i;
	Rect	instMsgRect;
	GetPort(&oldPort);
	SetPort(gWPtr);
	
	if (!gInstallStarted)
    	TEUpdate(&gControls->tw->startMsgBox, gControls->tw->startMsg);

    if (gControls->tw->dlProgressBar)
    {
        for (i = 0; i < kNumDLFields; ++i)
        {
            if (gControls->tw->dlLabels[i])
            {
                ShowControl(gControls->tw->dlLabels[i]);
            }
        }

        // XXX   TO DO
        // update the dl TEs
    }
	else if (gControls->tw->allProgressMsg)
	{
		HLock((Handle)gControls->tw->allProgressMsg);
		SetRect(&instMsgRect, (*gControls->tw->allProgressMsg)->viewRect.left,
				(*gControls->tw->allProgressMsg)->viewRect.top,
				(*gControls->tw->allProgressMsg)->viewRect.right,
				(*gControls->tw->allProgressMsg)->viewRect.bottom );
		HUnlock((Handle)gControls->tw->allProgressMsg);
		
		TEUpdate(&instMsgRect, gControls->tw->allProgressMsg);
	}
	else
	{ 
	    if (gControls->tw->saveBitsMsg)
	    {
	        TEUpdate(&gControls->tw->saveBitsMsgBox, gControls->tw->saveBitsMsg);
	    }
	}
	
	SetPort(oldPort);
}
예제 #3
0
void
UpdateAdditionsWin(void)
{
	Rect		r;
	Cell		c;
	int			i;
	GrafPtr		oldPort;
	GetPort(&oldPort);
	
	SetPort(gWPtr);
	
	MoveTo( gControls->aw->compListBox.left, gControls->aw->compListBox.top - kInterWidgetPad + 1);
	HLock(gControls->cfg->selAddMsg);
	DrawString( CToPascal(*gControls->cfg->selAddMsg));
	HUnlock(gControls->cfg->selAddMsg);
	
#if 0
	RGBColor backColorOld;
    Rect adjustedRect, *clRect = &gControls->aw->compListBox;
    SetRect(&adjustedRect, clRect->left, clRect->top+1, clRect->right, clRect->bottom-1);
    GetBackColor(&backColorOld);
    BackColor(whiteColor);
    EraseRect(&adjustedRect);
    RGBBackColor(&backColorOld);
#endif
   
	LUpdate( (*gControls->aw->compList)->port->visRgn, gControls->aw->compList);
	SetRect(&r, gControls->aw->compListBox.left, gControls->aw->compListBox.top,
	            gControls->aw->compListBox.right + 1, gControls->aw->compListBox.bottom);
	FrameRect(&r);	
	
	SetPt(&c, 0, 0);
	if (LGetSelect(true, &c, gControls->aw->compList))
	{
		HLock((Handle)gControls->aw->compDescTxt);
		SetRect(&r, (*gControls->aw->compDescTxt)->viewRect.left,
					(*gControls->aw->compDescTxt)->viewRect.top,
					(*gControls->aw->compDescTxt)->viewRect.right,
					(*gControls->aw->compDescTxt)->viewRect.bottom);
		HUnlock((Handle)gControls->aw->compDescTxt);
		TEUpdate(&r, gControls->aw->compDescTxt);	
	}
	
	DrawDiskSpaceMsgs( gControls->opt->vRefNum );
	
	for (i = 0; i < numRows; i++)
	{
		if (gControls->cfg->comp[rowToComp[i]].highlighted)
		{
			AddInitRowHighlight(i);
			break;
		}
	}
	
	SetPort(oldPort);
}
예제 #4
0
static PyObject *TEObj_TEUpdate(TEObject *_self, PyObject *_args)
{
    PyObject *_res = NULL;
    Rect rUpdate;
#ifndef TEUpdate
    PyMac_PRECHECK(TEUpdate);
#endif
    if (!PyArg_ParseTuple(_args, "O&",
                          PyMac_GetRect, &rUpdate))
        return NULL;
    TEUpdate(&rUpdate,
             _self->ob_itself);
    Py_INCREF(Py_None);
    _res = Py_None;
    return _res;
}
예제 #5
0
/* Update procedure for textedit window
 */
short NATEupdatep(na_win *winp, Boolean newsize)
{
	TEHandle	hTE = teinfo->hTE;
	WindowPtr	window = winp->pwin;
	Rect		prect, vrect, hrect, drect;
	
	prect = window->portRect;
	prect.top += teinfo->topoff;
	EraseRect(&prect);
	hrect = vrect = prect;
	vrect.top--;
	hrect.left--;
	vrect.left = ++vrect.right - 16;
	hrect.top = ++hrect.bottom - 16;
	vrect.bottom -= 14;
	hrect.right -= 14;
	InsetRect(&prect, 4, 4);
	prect.right -= 15;
	if (!(winp->flags & NATE_NOHSCROLL)) prect.bottom -= 15;
	prect.bottom -= (prect.bottom - prect.top) % teinfo->lheight;
	if (newsize) {
		drect = (*hTE)->viewRect = prect;
		drect.right = drect.left + (short) teinfo->docwidth;
		(*hTE)->destRect = drect;
		RectRgn(winp->cursorRgn, &prect);
		OffsetRgn(winp->cursorRgn, -window->portBits.bounds.left,
			-window->portBits.bounds.top);
		TECalText(hTE);
		TESelView(hTE);
		if (teinfo->hctrl != (ControlHandle) NULL) HideControl(teinfo->hctrl);
		if (teinfo->vctrl != (ControlHandle) NULL) HideControl(teinfo->vctrl);
	}
	TEUpdate(&prect, hTE);
	if (newsize) NATEsetscroll(winp, true, &hrect, &vrect);
	
	return (NA_NOTPROCESSED);
}
예제 #6
0
void		
AddUpdateLongDesc(int row)
{
	Rect		viewRect;
	
	HLock((Handle)gControls->aw->compDescBox);
	SetRect(&viewRect, (*gControls->aw->compDescBox)->contrlRect.left,
					   (*gControls->aw->compDescBox)->contrlRect.top,
					   (*gControls->aw->compDescBox)->contrlRect.right,
					   (*gControls->aw->compDescBox)->contrlRect.bottom);
	HUnlock((Handle)gControls->aw->compDescBox);
	viewRect.top += kInterWidgetPad;
	SetRect(&viewRect, viewRect.left + kTxtRectPad,
						viewRect.top + kTxtRectPad,
						viewRect.right - kTxtRectPad,
						viewRect.bottom - kTxtRectPad);
	EraseRect(&viewRect);
	
	HLock(gControls->cfg->comp[rowToComp[row]].longDesc);
	TESetText( *gControls->cfg->comp[rowToComp[row]].longDesc, 
				strlen(*gControls->cfg->comp[rowToComp[row]].longDesc), gControls->aw->compDescTxt );
	TEUpdate( &viewRect, gControls->aw->compDescTxt );
	HUnlock(gControls->cfg->comp[rowToComp[row]].longDesc);
}
예제 #7
0
static void update_DocWin()
{
	SetPortWindowPort(win.ref);
	DrawGrowIcon(win.ref);
	TEUpdate(&win.ref->portRect, gDocTE);
}
예제 #8
0
static void update_LogWin()
{
	SetPortWindowPort(win.ref);
	TEUpdate(&win.ref->portRect, gLogTE);
}
예제 #9
0
void 
ShowTerminalWin(void)
{
	Str255		next, back;
	Handle		rectH;
	Rect		viewRect;
	short		reserr;
	MenuHandle 			popupMenu;
	PopupPrivateData ** pvtDataHdl;
	unsigned char *		currMenuItem;
	short 				i, vRefNum;
	long 				cwdDirID, dirID;
	Boolean				isDir = false;
	Str255				pModulesDir;
	OSErr 				err = noErr;
	GrafPtr		oldPort;
	GetPort(&oldPort);

	if (gWPtr != NULL)
	{
		SetPort(gWPtr);
	
		gCurrWin = kTerminalID; 
		/* gControls->tw = (TermWin*) NewPtrClear(sizeof(TermWin)); */
	
		GetResourcedString(next, rInstList, sInstallBtn);
		GetResourcedString(back, rInstList, sBackBtn);
	
		// malloc and get control
		rectH = Get1Resource('RECT', rStartMsgBox);
		reserr = ResError();
		if (reserr == noErr && rectH != NULL)
		{
			viewRect = (Rect) **((Rect **)rectH);
			ReleaseResource(rectH);
        }
		else
		{
			ErrorHandler(reserr, nil);
			return;
		}
		
		gControls->tw->siteSelector = NULL;
		gControls->tw->saveBitsCheckbox = NULL;
		
		gControls->tw->startMsgBox = viewRect;
	
		gControls->tw->startMsg = TENew(&viewRect, &viewRect);
        if (gControls->tw->startMsg == NULL)
        {
        	ErrorHandler(eMem, nil);
        	return;
        }
    
		// save bits after download and install
	
		/* get the "Installer Modules" relative subdir */
		ERR_CHECK(GetCWD(&cwdDirID, &vRefNum));
		GetIndString(pModulesDir, rStringList, sInstModules);
		GetDirectoryID(vRefNum, cwdDirID, pModulesDir, &dirID, &isDir);
		if (isDir)
		{
			if (!ExistArchives(vRefNum, dirID))  // going to download
			{			    
        		if (gControls->cfg->numSites > 0)
        		{
                    // download settings groupbox
                    Str255 dlSettingsGBTitle;
                    gControls->tw->dlSettingsGB = GetNewControl(rDLSettingsGB, gWPtr);
                    if (gControls->tw->dlSettingsGB)
                    {
                        GetResourcedString(dlSettingsGBTitle, rInstList, sDLSettings);
                        SetControlTitle(gControls->tw->dlSettingsGB, dlSettingsGBTitle);
                        ShowControl(gControls->tw->dlSettingsGB);
                    }
                    
                    // site selector label
                    Str255 siteSelMsgStr;
                    gControls->tw->siteSelMsg = GetNewControl(rSiteSelMsg, gWPtr);
                    if (gControls->tw->siteSelMsg)
                    {
                        GetResourcedString(siteSelMsgStr, rInstList, sSiteSelMsg);
                        SetControlData(gControls->tw->siteSelMsg, kControlNoPart, 
                            kControlStaticTextTextTag, siteSelMsgStr[0], (Ptr)&siteSelMsgStr[1]); 
                        ShowControl(gControls->tw->siteSelMsg);
                    }
                    
    		        // site selector
        			gControls->tw->siteSelector = GetNewControl( rSiteSelector, gWPtr );
        			if (!gControls->tw->siteSelector)
        			{
        				ErrorHandler(eMem, nil);
        				return;
        			}
        			
        			// populate popup button menus
        			HLock((Handle)gControls->tw->siteSelector);
        			pvtDataHdl = (PopupPrivateData **) (*(gControls->tw->siteSelector))->contrlData;
        			HLock((Handle)pvtDataHdl);
        			popupMenu = (MenuHandle) (**pvtDataHdl).mHandle;
        			for (i=0; i<gControls->cfg->numSites; i++)
        			{
        				HLock(gControls->cfg->site[i].desc);
        				currMenuItem = CToPascal(*gControls->cfg->site[i].desc);		
        				HUnlock(gControls->cfg->site[i].desc);
        				InsertMenuItem( popupMenu, currMenuItem, i );
        			}
        			HUnlock((Handle)pvtDataHdl);
        			HUnlock((Handle)gControls->tw->siteSelector);
        			SetControlMaximum(gControls->tw->siteSelector, gControls->cfg->numSites);
        			SetControlValue(gControls->tw->siteSelector, gControls->opt->siteChoice);
        			ShowControl(gControls->tw->siteSelector);
        		}
		
				// show check box and message
				gControls->tw->saveBitsCheckbox = GetNewControl( rSaveCheckbox, gWPtr );
				if (!gControls->tw->saveBitsCheckbox)
				{
					ErrorHandler(eMem, nil);
					return;
				}
				if (gControls->opt->saveBits)
				    SetControlValue(gControls->tw->saveBitsCheckbox, 1);
				ShowControl(gControls->tw->saveBitsCheckbox);
				
				// get rect for save bits message
				rectH = Get1Resource('RECT', rSaveBitsMsgBox);
				reserr = ResError();
				if (reserr == noErr && rectH != NULL)
				{
					 gControls->tw->saveBitsMsgBox  = (Rect) **((Rect **)rectH);
					 DisposeHandle(rectH);
			    }
				else
				{
					ErrorHandler(reserr, nil);
					return;
				}
				
				// get text edit record for save bits message
				gControls->tw->saveBitsMsg = TENew(&gControls->tw->saveBitsMsgBox,
												   &gControls->tw->saveBitsMsgBox );
			    if (gControls->tw->saveBitsMsg == NULL)
			    {
			    	ErrorHandler(eMem, nil);
			    	return;
			    }
			    HLock(gControls->cfg->saveBitsMsg);
				TESetText(*gControls->cfg->saveBitsMsg, strlen(*gControls->cfg->saveBitsMsg),
					gControls->tw->saveBitsMsg);
				HUnlock(gControls->cfg->saveBitsMsg);
				
				// show save bits msg
				TEUpdate(&gControls->tw->saveBitsMsgBox, gControls->tw->saveBitsMsg);
				
				// proxy settings button
				gControls->tw->proxySettingsBtn = GetNewControl(rProxySettgBtn, gWPtr);
				if (!gControls->tw->proxySettingsBtn)
				{
					ErrorHandler(eMem, nil);
					return;
				}
				Str255 proxySettingsTitle;
				GetResourcedString(proxySettingsTitle, rInstList, sProxySettings);
				SetControlTitle(gControls->tw->proxySettingsBtn, proxySettingsTitle);
				ShowControl(gControls->tw->proxySettingsBtn);
            }
		}
				
		// populate control
		HLock(gControls->cfg->startMsg);
		TESetText(*gControls->cfg->startMsg, strlen(*gControls->cfg->startMsg), 
					gControls->tw->startMsg);
		HUnlock(gControls->cfg->startMsg);
	
		// show controls
		TEUpdate(&viewRect, gControls->tw->startMsg);
		ShowNavButtons( back, next );
	}
	
	SetPort(oldPort);
}
예제 #10
0
void 	
xpicbProgress(const char* msg, PRInt32 val, PRInt32 max)
{
	Boolean indeterminateFlag = false;
	Rect	r;
	Str255	installingStr, fileStr, ofStr;
	char	*valStr, *maxStr, *leaf;
	StringPtr	pleaf = nil;
	long		last;
	GrafPtr oldPort;
	GetPort(&oldPort);
	
	if (gWPtr)
	{
		SetPort(gWPtr);
		if (gControls->tw->xpiProgressBar)
		{
			if (!bProgMsgInit)
				ProgressMsgInit();
				
			if (max!=0 && !bMaxDiscovered)
			{
				SetControlData(gControls->tw->xpiProgressBar, kControlNoPart, kControlProgressBarIndeterminateTag,
								sizeof(indeterminateFlag), (Ptr) &indeterminateFlag);
				SetControlMaximum(gControls->tw->xpiProgressBar, max);
				if (gControls->tw->allProgressBar)
					SetControlValue(gControls->tw->allProgressBar,
									GetControlValue(gControls->tw->allProgressBar)+1);
									
				bMaxDiscovered = true;
			}
			else if (!bMaxDiscovered)
			{
				if (gWPtr)
					IdleControls(gWPtr);
				if (gControls->tw->xpiProgressMsg)
				{	
					HLock((Handle)gControls->tw->xpiProgressMsg);
					SetRect(&r, (*gControls->tw->xpiProgressMsg)->viewRect.left,
								(*gControls->tw->xpiProgressMsg)->viewRect.top,
								(*gControls->tw->xpiProgressMsg)->viewRect.right,
								(*gControls->tw->xpiProgressMsg)->viewRect.bottom );
					HUnlock((Handle)gControls->tw->xpiProgressMsg);
					if (msg)
					{
						EraseRect(&r);
						
						GetResourcedString(installingStr, rInstList, sProcessing);
						leaf = strrchr(msg, ':');
						if (leaf)
						{
							pleaf = CToPascal(leaf+1);
							pstrcat(installingStr, pleaf);
						}
						else
						{
							installingStr[0] = 1;
							installingStr[1] = ' ';
						}
						
						last = installingStr[0] + 1;
						if (last > 255)
							last = 255;
						installingStr[last] = 0;
						
						if (installingStr[0] > 0)	
							TESetText(&installingStr[1], installingStr[0], gControls->tw->xpiProgressMsg);
							
						TEUpdate(&r, gControls->tw->xpiProgressMsg);
						
						if (pleaf)
							DisposePtr((Ptr) pleaf);
					}
				}
			}
			
			if (bMaxDiscovered)
			{
				SetControlValue(gControls->tw->xpiProgressBar, val);
				
				if (gControls->tw->xpiProgressMsg)
				{
					GetResourcedString(installingStr, rInstList, sProcessing);
					GetResourcedString(fileStr, rInstList, sFileSp);
					GetResourcedString(ofStr, rInstList, sSpOfSp);
					HLock((Handle)gControls->tw->xpiProgressMsg);
					SetRect(&r, (*gControls->tw->xpiProgressMsg)->viewRect.left,
								(*gControls->tw->xpiProgressMsg)->viewRect.top,
								(*gControls->tw->xpiProgressMsg)->viewRect.right,
								(*gControls->tw->xpiProgressMsg)->viewRect.bottom );
					HUnlock((Handle)gControls->tw->xpiProgressMsg);
									
					valStr = ltoa(val);
					maxStr = ltoa(max);
				
					EraseRect(&r);
					if (valStr && maxStr)
					{
						TESetText(&installingStr[1], installingStr[0], gControls->tw->xpiProgressMsg);
						TEInsert(&fileStr[1], fileStr[0], gControls->tw->xpiProgressMsg);
						TEInsert(valStr, strlen(valStr), gControls->tw->xpiProgressMsg);
						TEInsert(&ofStr[1], ofStr[0], gControls->tw->xpiProgressMsg);
						TEInsert(maxStr, strlen(maxStr), gControls->tw->xpiProgressMsg);
						TEUpdate(&r, gControls->tw->xpiProgressMsg);
					}
					
					if (valStr)
						free(valStr);
					if (maxStr)
						free(maxStr);
				}
			}
		}
	}
	
	SetPort(oldPort);
	return;
}
예제 #11
0
void RunLoop()
{
	EventRecord    theEvent;
	WindowPtr whichWindow;
	Rect txRect;
	
	txRect = qd.thePort->portRect;
	
	InsetRect(&txRect,4,0);
	textH = TENew(&txRect,&txRect);
	
	while (!quit)
	{
		SystemTask();
		TEIdle(textH);

		if (GetNextEvent(everyEvent, &theEvent))
		{
			switch (theEvent.what)
			{
				case mouseDown:
				{
					switch (FindWindow(theEvent.where, &whichWindow))
					{
						case inSysWindow:
						{
							SystemClick(&theEvent, whichWindow);
							break;
						}
						case inMenuBar:
						{
							DoCommand(MenuSelect(theEvent.where));
							break;
						}
						case inDrag:
						{
							DragWindow(whichWindow, theEvent.where, &qd.screenBits.bounds);
							break;
						}
						case inContent:
						{
							if (whichWindow != FrontWindow())
							{
								SelectWindow(whichWindow);
							}
							else
							{
								GlobalToLocal(&theEvent.where);
								if (theEvent.modifiers&shiftKey)
									isShift = true;
								
								TEClick(theEvent.where, isShift, textH);
							}
							break;
						}

						case inGoAway:
						{
							if (TrackGoAway(whichWindow, theEvent.where)) {
								quit = true;
							}
							break;
						}

						default:
							break;
					}
					break;
				}
				case autoKey:
				case keyDown:
				{
					char theChar = (theEvent.message&charCodeMask);
					
					if (theEvent.modifiers&cmdKey)
					{
						DoCommand(MenuKey(theChar));
						
						if (theChar == 'm')
						{
							quit = true;
						}
					}
					else
					{
						TEKey(theChar, textH);
					}
					
					break;
				}
				case activateEvt:
				{
					if (theEvent.modifiers&activeFlag)
					{
						TEActivate(textH);
					}
					else
					{
						TEDeactivate(textH);
					}
					break;
				}
				case updateEvt:
				{
					BeginUpdate((WindowPtr)theEvent.message);
					EraseRect(&(qd.thePort->portRect));
					TEUpdate(&(qd.thePort->portRect), textH);
					EndUpdate((WindowPtr)theEvent.message);
					break;
				}
				default:
					break;
			}
		}
	}
}