コード例 #1
0
ファイル: GBWindow.cpp プロジェクト: AgentE382/grobots
void GBWindow::Update(bool running) {
#if MAC
	GrafPtr savePort;
	GetPort(&savePort);
	SetPort(GetWindowPort(window));
	if ( view->NeedsResize() )
		ResizeSelf();
	if ( view->NeedsRedraw(running) ) {
		BeginUpdate(window);
		EndUpdate(window);
		if ( showGrowBox ) DrawGrowIcon(window);
		view->DoDraw();
	} else {
		BeginUpdate(window);
		if ( showGrowBox ) DrawGrowIcon(window);
		view->DoDraw();
		EndUpdate(window);
	}
	SetPort(savePort);
#elif WINDOWS
	PAINTSTRUCT paint;
	HDC dc = BeginPaint(win, &paint);
	GBGraphics graphics(dc);
	view->SetGraphics(&graphics);
	view->DoDraw();
	EndPaint(win, &paint);
#endif
}
コード例 #2
0
void CTexture::ClampImageToSurfaceS()
{
   if( !m_bClampedS && m_dwWidth < m_dwCreatedTextureWidth )
   {       
      DrawInfo di;
      if( StartUpdate(&di) )
      {
         if(  m_dwTextureFmt == TEXTURE_FMT_A8R8G8B8 )
         {
            for( uint32_t y = 0; y<m_dwHeight; y++ )
            {
               uint32_t* line = (uint32_t*)((uint8_t*)di.lpSurface+di.lPitch*y);
               uint32_t val = line[m_dwWidth-1];
               for( uint32_t x=m_dwWidth; x<m_dwCreatedTextureWidth; x++ )
                  line[x] = val;
            }
         }
         else
         {
            for( uint32_t y = 0; y<m_dwHeight; y++ )
            {
               uint16_t* line = (uint16_t*)((uint8_t*)di.lpSurface+di.lPitch*y);
               uint16_t val = line[m_dwWidth-1];
               for( uint32_t x=m_dwWidth; x<m_dwCreatedTextureWidth; x++ )
                  line[x] = val;
            }
         }
         EndUpdate(&di);
      }
   }
   m_bClampedS = true;
}
コード例 #3
0
void CTexture::ClampImageToSurfaceT()
{
   if( !m_bClampedT && m_dwHeight < m_dwCreatedTextureHeight )
   {
      DrawInfo di;
      if( StartUpdate(&di) )
      {
         if(  m_dwTextureFmt == TEXTURE_FMT_A8R8G8B8 )
         {
            uint32_t* linesrc = (uint32_t*)((uint8_t*)di.lpSurface+di.lPitch*(m_dwHeight-1));
            for( uint32_t y = m_dwHeight; y<m_dwCreatedTextureHeight; y++ )
            {
               uint32_t* linedst = (uint32_t*)((uint8_t*)di.lpSurface+di.lPitch*y);
               for( uint32_t x=0; x<m_dwCreatedTextureWidth; x++ )
                  linedst[x] = linesrc[x];
            }
         }
         else
         {
            uint16_t* linesrc = (uint16_t*)((uint8_t*)di.lpSurface+di.lPitch*(m_dwHeight-1));
            for( uint32_t y = m_dwHeight; y<m_dwCreatedTextureHeight; y++ )
            {
               uint16_t* linedst = (uint16_t*)((uint8_t*)di.lpSurface+di.lPitch*y);
               for( uint32_t x=0; x<m_dwCreatedTextureWidth; x++ )
                  linedst[x] = linesrc[x];
            }
         }
         EndUpdate(&di);
      }
   }
   m_bClampedT = true;
}
コード例 #4
0
void QTApp_Draw (WindowReference theWindow)
{
	GrafPtr 					mySavedPort = NULL;
	GrafPtr 					myWindowPort = NULL;
	WindowPtr					myWindow = NULL;
	Rect						myRect;
	
	GetPort(&mySavedPort);
	
	myWindowPort = QTFrame_GetPortFromWindowReference(theWindow);
	myWindow = QTFrame_GetWindowFromWindowReference(theWindow);
	
	if (myWindowPort == NULL)
		return;
		
	MacSetPort(myWindowPort);
	
#if TARGET_API_MAC_CARBON
	GetPortBounds(myWindowPort, &myRect);
#else
	myRect = myWindowPort->portRect;
#endif

	BeginUpdate(myWindow);

	// erase any part of a movie window that hasn't already been updated
	// by the movie controller
	if (QTFrame_IsMovieWindow(theWindow))
		EraseRect(&myRect);

	// ***insert application-specific drawing here***
	
	EndUpdate(myWindow);
	MacSetPort(mySavedPort);
}
コード例 #5
0
ファイル: Objects.cpp プロジェクト: JohanMes/JohanEngine
void Objects::Delete(Object* thisobject) {
	if(thisobject) {
		BeginUpdate();
		objects.erase(thisobject->bufferlocation);
		EndUpdate();
	}
}
コード例 #6
0
ファイル: macabout.c プロジェクト: svn2github/kitty
static void mac_updatelicence(WindowPtr window)
{
    Handle h;
    int len;
    long fondsize;
    Rect textrect;

    SetPort((GrafPtr)GetWindowPort(window));
    BeginUpdate(window);
    fondsize = GetScriptVariable(smRoman, smScriptSmallFondSize);
    TextFont(HiWord(fondsize));
    TextSize(LoWord(fondsize));
    h = Get1Resource('TEXT', wLicence);
    len = GetResourceSizeOnDisk(h);
#if TARGET_API_MAC_CARBON
    GetPortBounds(GetWindowPort(window), &textrect);
#else
    textrect = window->portRect;
#endif
    if (h != NULL) {
	HLock(h);
	TETextBox(*h, len, &textrect, teFlushDefault);
	HUnlock(h);
    }
    EndUpdate(window);
}
コード例 #7
0
ファイル: GB_Interface.c プロジェクト: zenmumbler/GrayBox
void DoWindowUpdate(WindowPtr whichWindow)
{
	BeginUpdate(whichWindow);

	if(whichWindow == nesWind) {
		NES_ScrnUpdate(false);
	}
	if(whichWindow == wpWind) {
		WP_Update();
	}
	if(whichWindow == srchWind) {
		Srch_Update();
	}

#ifdef GB_DEBUG
	if(whichWindow == statWind) {
		Stat_Update();
	}
	if(whichWindow == patWind) {
		NES_PatUpdate();
	}
	if(whichWindow == namWind) {
		NES_NamUpdate();
	}
	if(whichWindow == palWind) {
		NES_PalUpdate();
	}
#endif

	EndUpdate(whichWindow);
}
コード例 #8
0
void CTexture::RestoreAlphaChannel(void)
{
    DrawInfo di;

    if ( StartUpdate(&di) )
    {
        uint32 *pSrc = (uint32 *)di.lpSurface;
        int lPitch = di.lPitch;

        for (uint32 y = 0; y < m_dwHeight; y++)
        {
            uint32 * dwSrc = (uint32 *)((uint8 *)pSrc + y*lPitch);
            for (uint32 x = 0; x < m_dwWidth; x++)
            {
                uint32 dw = dwSrc[x];
                uint32 dwRed   = (uint8)((dw & 0x00FF0000)>>16);
                uint32 dwGreen = (uint8)((dw & 0x0000FF00)>>8 );
                uint32 dwBlue  = (uint8)((dw & 0x000000FF)    );
                uint32 dwAlpha = (dwRed+dwGreen+dwBlue)/3;
                dw &= 0x00FFFFFF;
                dw |= (dwAlpha<<24);

                /*
                uint32 dw = dwSrc[x];
                if( (dw&0x00FFFFFF) > 0 )
                    dw |= 0xFF000000;
                else
                    dw &= 0x00FFFFFF;
                    */
            }
        }
        EndUpdate(&di);
    }
コード例 #9
0
ファイル: Classes.cpp プロジェクト: opengl-ms/Far-NetBox
void TStrings::SetTextStr(const UnicodeString & Text)
{
  BeginUpdate();
  SCOPE_EXIT
  {
    EndUpdate();
  };
  {
    Clear();
    const wchar_t * P = Text.c_str();
    if (P != nullptr)
    {
      while (*P != 0x00)
      {
        const wchar_t * Start = P;
        while (!((*P == 0x00) || (*P == 0x0A) || (*P == 0x0D)))
        {
          P++;
        }
        UnicodeString S;
        S.SetLength(P - Start);
        memmove(const_cast<wchar_t *>(S.c_str()), Start, (P - Start) * sizeof(wchar_t));
        Add(S);
        if (*P == 0x0D) { P++; }
        if (*P == 0x0A) { P++; }
      }
    }
  }
}
コード例 #10
0
bool CWizDatabase::CreateDocumentAndInit(const CString& strHtml, \
        const CString& strHtmlUrl, \
        int nFlags, \
        const CString& strTitle, \
        const CString& strName, \
        const CString& strLocation, \
        const CString& strURL, \
        WIZDOCUMENTDATA& data)
{
    bool bRet = false;
    try
    {
        BeginUpdate();

        data.strKbGUID = kbGUID();
        bRet = CreateDocument(strTitle, strName, strLocation, strHtmlUrl, data);
        if (bRet)
        {
            bRet = UpdateDocumentData(data, strHtml, strURL, nFlags);

            Q_EMIT documentCreated(data);
        }
    }
    catch (...)
    {

    }

    EndUpdate();

    return bRet;
}
コード例 #11
0
ファイル: macstuff.c プロジェクト: AMDmi3/analog
void MacIdle(void)
{
  extern logical anywarns;
  static long time = 0;

  EventRecord myEvent;
  WindowPtr whichWindow;
#if TARGET_API_MAC_CARBON
  Rect tempRect;
#endif
  char theChar;

  if (TickCount()<time) return;
  if (mac_quit_now) {
    anywarns = FALSE;  /* kludge so that window doesn't sit around */
    my_exit(1);
  }
#if !TARGET_API_MAC_CARBON
  SystemTask();
#endif
  if (WaitNextEvent(everyEvent, &myEvent, 1, nil)) {

    if (!SIOUXHandleOneEvent(&myEvent)) switch (myEvent.what) {

    case mouseDown:
      switch (FindWindow(myEvent.where,&whichWindow)) {

      case inMenuBar:
	MenuSelect(myEvent.where);
	break;
#if !TARGET_API_MAC_CARBON
      case inSysWindow:
	SystemClick(&myEvent,whichWindow);
	break;
#endif
      case inContent:
	SelectWindow(whichWindow);
	break;
      case inDrag:
#if TARGET_API_MAC_CARBON
	GetRegionBounds(GetGrayRgn(),&tempRect);
	DragWindow(whichWindow,myEvent.where,&tempRect);
#else
	DragWindow(whichWindow,myEvent.where,&qd.screenBits.bounds);
#endif
	break;
      }
      break;
    case keyDown:
      theChar = myEvent.message & charCodeMask;
      break;
    case updateEvt:
      BeginUpdate((WindowPtr) myEvent.message);
      EndUpdate((WindowPtr) myEvent.message);
      break;
    }
  }
  time=TickCount()+20;
}
コード例 #12
0
void doEventLoop()
{
	EventRecord event;
	WindowPtr   window;
	short       clickArea;
	Rect        screenRect;
	RgnHandle	rgnHandle = NewRgn();

	for (;;)
	{
		if (WaitNextEvent( everyEvent, &event, 0, nil ))
		{
			if (event.what == mouseDown)
			{
				clickArea = FindWindow( event.where, &window );
				
				if (clickArea == inDrag)
				{
					//screenRect = (**GetGrayRgn ()).rgnBBox;
					GetRegionBounds(GetGrayRgn(), &screenRect);
					DragWindow( window, event.where, &screenRect );
				}
				else if (clickArea == inContent)
				{
					if (window != FrontWindow())
						SelectWindow( window );
				}
				else if (clickArea == inGoAway)
					if (TrackGoAway( window, event.where ))
						return;
			}
			else if (event.what == updateEvt)
			{
				window = (WindowPtr)event.message;	
				//SetPort( window );
				SetPortWindowPort( window );
				
				BeginUpdate( window );
				drawPixelImageData();
				EndUpdate( window );
				QDFlushPortBuffer(GetWindowPort(window), GetPortVisibleRegion(GetWindowPort(window), rgnHandle));
			}
			else if (event.what == activateEvt) 
			{
				/*if (event.modifiers & activeFlag) {
					window = (WindowPtr)event.message;
					SetPortWindowPort(window);
					drawPixelImageData();
					QDFlushPortBuffer(GetWindowPort(window), GetPortVisibleRegion(GetWindowPort(window), rgnHandle));
				}*/
				/*if (event.modifiers & activeFlag)
					PostEvent(updateEvt, (unsigned long)gWindow);*/
			}
		}
	}
	
	DisposeRgn(rgnHandle);
}
コード例 #13
0
ファイル: Objects.cpp プロジェクト: JohanMes/JohanEngine
Object* Objects::Add(Object* object) {
	BeginUpdate();
	{
		objects.push_back(object);
		object->bufferlocation = --objects.end();
	}
	EndUpdate(); // sort
	return object;
}
コード例 #14
0
ファイル: shell.c プロジェクト: MaddTheSane/tntbasic
static void update_window(
	WindowPtr wp)
{
	BeginUpdate(wp);
	draw_window_contents(wp);
	EndUpdate(wp);
	
	return;
}
コード例 #15
0
ファイル: ZoomRecter.c プロジェクト: fruitsamples/ZoomRecter
void doEventLoop()
{
	EventRecord anEvent;
	WindowPtr   evtWind;
	short       clickArea;
	Rect        screenRect;
	Point		thePoint;
	Rect		zoomFrom, zoomTo;
	
	zoomFrom.top = zoomTo.top = -1;

	while (!gDone)
	{
		if (WaitNextEvent( everyEvent, &anEvent, 0, nil ))
		{
			if (anEvent.what == mouseDown)
			{
				clickArea = FindWindow( anEvent.where, &evtWind );
				
				if (clickArea == inDrag)
				{
					GetRegionBounds( GetGrayRgn(), &screenRect );
					DragWindow( evtWind, anEvent.where, &screenRect );
				}
				else if (clickArea == inContent)
				{
					if (evtWind != FrontWindow())
						SelectWindow( evtWind );
					else
					{
						thePoint = anEvent.where;
						GlobalToLocal( &thePoint );
						//Handle click in window content here
						GetRect(&zoomFrom, &zoomTo);
					}
				}
				else if (clickArea == inGoAway)
					if (TrackGoAway( evtWind, anEvent.where ))
						gDone = true;
			}
			else if (anEvent.what == updateEvt)
			{
				evtWind = (WindowPtr)anEvent.message;	
				SetPortWindowPort( evtWind );
				
				BeginUpdate( evtWind );
				//Call Draw Function here....
				if (zoomFrom.top != -1)
					FrameRect(&zoomFrom);
				if (zoomTo.top != -1)
					FrameRect(&zoomTo);
				EndUpdate (evtWind);
			}
		}
	}
}
コード例 #16
0
//----------------------------------------
// osx needs this for modal dialogs.
Boolean SeqGrabberModalFilterUPP (DialogPtr theDialog, const EventRecord *theEvent, short *itemHit, long refCon){
	#pragma unused(theDialog, itemHit)
  	Boolean  handled = false;
  	if ((theEvent->what == updateEvt) &&
    ((WindowPtr) theEvent->message == (WindowPtr) refCon))
  	{
    	BeginUpdate ((WindowPtr) refCon);
    	EndUpdate ((WindowPtr) refCon);
    	handled = true;
  	}
  	return (handled);
}
コード例 #17
0
ファイル: Objects.cpp プロジェクト: JohanMes/JohanEngine
void Objects::Clear() {
	BeginUpdate();
	{
		ObjectIterator i = objects.begin();
		while(i != objects.end()) { // Make sure we can remove items while iterating
			ObjectIterator next = std::next(i); // Store next item iterator (as current will be invalidated)
			delete *i; // Delete current
			i = next; // Goto next
		}
	}
	EndUpdate();
}
コード例 #18
0
ファイル: main.c プロジェクト: fruitsamples/CTMDemo
void DrawWindow(WindowRef window)
{
    GrafPtr		curPort;
	
    GetPort(&curPort);
    SetPort(GetWindowPort(window));
    BeginUpdate(window);

    DrawControls(window);
    DrawGrowIcon(window);
    EndUpdate(window);
    SetPort(curPort);
}
コード例 #19
0
static void DoDialogUpdate(DialogPtr dlog)
	{
		GrafPtr oldPort;

		GetPort(&oldPort); SetPort(dlog);
		BeginUpdate(dlog);

		UpdateDialog(dlog,dlog->visRgn);
		FrameDefault(dlog,BUT1_OK,TRUE);

		EndUpdate(dlog);
		SetPort(oldPort);
	}
コード例 #20
0
ファイル: main.c プロジェクト: dvincent/frontier
static void handleupdate (EventRecord *ev) {
	
	WindowPtr w;
	
	w = (WindowPtr) (*ev).message;
	
	BeginUpdate (w);
	
	SetPort (w);
	
	updatemainwindow ();
	
	EndUpdate (w);
	} /*handleupdate*/
コード例 #21
0
ファイル: nsStyleSet.cpp プロジェクト: ahadzi/celtx
nsresult
nsStyleSet::SetAuthorStyleDisabled(PRBool aStyleDisabled)
{
  if (aStyleDisabled == !mAuthorStyleDisabled) {
    mAuthorStyleDisabled = aStyleDisabled;
    BeginUpdate();
    mDirty |= 1 << eDocSheet |
              1 << ePresHintSheet |
              1 << eHTMLPresHintSheet |
              1 << eStyleAttrSheet;
    return EndUpdate();
  }
  return NS_OK;
}
コード例 #22
0
ファイル: main.c プロジェクト: fruitsamples/CGGamma
void DrawWindow(WindowRef window)
{
    Rect		tempRect;
    GrafPtr		curPort;
	
    GetPort(&curPort);
    SetPort(GetWindowPort(window));
    BeginUpdate(window);
    EraseRect(GetWindowPortBounds(window, &tempRect));
    DrawControls(window);
    DrawGrowIcon(window);
    EndUpdate(window);
    SetPort(curPort);
}
コード例 #23
0
ファイル: Classes.cpp プロジェクト: nineclock/Far-NetBox
void TStrings::AddStrings(const TStrings * Strings)
{
  BeginUpdate();
  auto cleanup = finally([&]()
  {
    EndUpdate();
  });
  {
    for (intptr_t I = 0; I < Strings->GetCount(); I++)
    {
      AddObject(Strings->GetString(I), Strings->GetObject(I));
    }
  }
}
コード例 #24
0
static void DoUpdate(WindowPtr	myWindow)
{ 
	GrafPtr		origPort;
	
	GetPort(&origPort);
	SetPort(myWindow);
		
	BeginUpdate(myWindow);	
	EndUpdate(myWindow);
	
	aglUpdateContext(aglGetCurrentContext());
	
	SetPort(origPort);
}
コード例 #25
0
ファイル: np2.cpp プロジェクト: perabuss/np2wii
static void HandleUpdateEvent(EventRecord *pevent) {

	WindowPtr	hWnd;

	hWnd = (WindowPtr)pevent->message;
	BeginUpdate(hWnd);
	if (np2running) {
		scrndraw_redraw();
	}
	else {
		np2open();
	}
	EndUpdate(hWnd);
}
コード例 #26
0
ファイル: dmmain.c プロジェクト: hackqiang/gs
void doUpdate(EventRecord *eventStrucPtr)
{
    WindowRef windowRef;

    windowRef = (WindowRef) eventStrucPtr->message;

    window_adjust_scrollbars(windowRef);

    BeginUpdate(windowRef);

    SetPortWindowPort(windowRef);
    doUpdateWindow(eventStrucPtr);

    EndUpdate(windowRef);
}
コード例 #27
0
void TStrings::SetDelimitedText(const UnicodeString & Value)
{
  BeginUpdate();
  SCOPE_EXIT
  {
    EndUpdate();
  };
  Clear();
  rde::vector<UnicodeString> Lines;
  UnicodeString Delimiter(UnicodeString(GetDelimiter()) + L'\n');
  tokenize(Value, Lines, Delimiter, true);
  for (size_t Index = 0; Index < Lines.size(); Index++)
  {
    Add(Lines[Index]);
  }
}
コード例 #28
0
void TStrings::Assign(const TPersistent * Source)
{
  const TStrings * Strings = NB_STATIC_DOWNCAST_CONST(TStrings, Source);
  if (Strings != nullptr)
  {
    BeginUpdate();
    SCOPE_EXIT
    {
      EndUpdate();
    };
    Clear();
    DebugAssert(Strings);
    FQuoteChar = Strings->FQuoteChar;
    FDelimiter = Strings->FDelimiter;
    AddStrings(Strings);
  }
コード例 #29
0
ファイル: Snapshot.c プロジェクト: fruitsamples/Snapshot
void doEventLoop()
{
	EventRecord anEvent;
	WindowPtr   evtWind;
	short       clickArea;
	Rect        screenRect;

	while (!gDone)
	{
		if (WaitNextEvent( everyEvent, &anEvent, 0, nil ))
		{
			if (anEvent.what == mouseDown)
			{
				clickArea = FindWindow( anEvent.where, &evtWind );
				
				if (clickArea == inMenuBar)
					handleMenuSelection(MenuSelect(anEvent.where));
				else if (clickArea == inDrag)
				{
					//screenRect = (**GetGrayRgn ()).rgnBBox;
					GetRegionBounds(GetGrayRgn(), &screenRect);
					DragWindow( evtWind, anEvent.where, &screenRect );
				}
				else if (clickArea == inContent)
				{
					if (evtWind != FrontWindow())
						SelectWindow( evtWind );
				}
				else if (clickArea == inGoAway)
					if (TrackGoAway( evtWind, anEvent.where ))
						gDone = true;
			}
			else if (anEvent.what == updateEvt)
			{
				evtWind = (WindowPtr)anEvent.message;	
				//SetPort( evtWind );
				SetPortWindowPort( evtWind );
				
				BeginUpdate( evtWind );
				drawImage( evtWind );
				EndUpdate (evtWind);
			}
			else if (anEvent.what == autoKey || anEvent.what == keyDown)
				handleKeyPress(&anEvent);
		}
	}
}
コード例 #30
0
ファイル: toplevel.cpp プロジェクト: Duion/Torsion
void wxTopLevelWindowMac::MacUpdate( long timestamp)
{
    wxMacPortStateHelper help( (GrafPtr) GetWindowPort( (WindowRef) m_macWindow) ) ;

    RgnHandle       visRgn = NewRgn() ;
    GetPortVisibleRegion( GetWindowPort( (WindowRef)m_macWindow ), visRgn );
    BeginUpdate( (WindowRef)m_macWindow ) ;

    RgnHandle       updateRgn = NewRgn();
    RgnHandle       diffRgn = NewRgn() ;

    if ( updateRgn && diffRgn )
    {
#if 1
        // macos internal control redraws clean up areas we'd like to redraw ourselves
        // therefore we pick the boundary rect and make sure we can redraw it
        // this has to be intersected by the visRgn in order to avoid drawing over its own
        // boundaries
        RgnHandle trueUpdateRgn = NewRgn() ;
        Rect trueUpdateRgnBoundary ;
        GetPortVisibleRegion( GetWindowPort( (WindowRef)m_macWindow ), trueUpdateRgn );
        GetRegionBounds( trueUpdateRgn , &trueUpdateRgnBoundary ) ;
        RectRgn( updateRgn , &trueUpdateRgnBoundary ) ;
        SectRgn( updateRgn , visRgn , updateRgn ) ;
        if ( trueUpdateRgn )
            DisposeRgn( trueUpdateRgn ) ;
        SetPortVisibleRegion(  GetWindowPort( (WindowRef)m_macWindow ), updateRgn ) ;
#else
        GetPortVisibleRegion( GetWindowPort( (WindowRef)m_macWindow ), updateRgn );
#endif
        DiffRgn( updateRgn , (RgnHandle) m_macNoEraseUpdateRgn , diffRgn ) ;
        if ( !EmptyRgn( updateRgn ) )
        {
            MacRedraw( updateRgn , timestamp , m_macNeedsErasing || !EmptyRgn( diffRgn )  ) ;
        }
    }
    if ( updateRgn )
        DisposeRgn( updateRgn );
    if ( diffRgn )
        DisposeRgn( diffRgn );
    if ( visRgn )
        DisposeRgn( visRgn ) ;

    EndUpdate( (WindowRef)m_macWindow ) ;
    SetEmptyRgn( (RgnHandle) m_macNoEraseUpdateRgn ) ;
    m_macNeedsErasing = false ;
}