Exemple #1
0
void CUIGameLog::Update()
{
	CUIScrollView::Update();
	toDelList.clear();	


	// REMOVE ITEMS WITH COMPLETED ANIMATION
	WINDOW_LIST_it end_it = m_pad->GetChildWndList().end();
	WINDOW_LIST_it begin_it = m_pad->GetChildWndList().begin();

	for(WINDOW_LIST_it it = begin_it; it!=end_it; ++it)
	{
		CUIStatic* pItem = smart_cast<CUIStatic*>(*it);
		VERIFY(pItem);
		pItem->Update();

		if (pItem->IsClrAnimStoped())
			toDelList.push_back(pItem);
	}

	// Delete elements
	{
		xr_vector<CUIWindow*>::iterator it;
		for (it = toDelList.begin(); it != toDelList.end(); it++)
			RemoveWindow(*it);
	}

	// REMOVE INVISIBLE AND PART VISIBLE ITEMS
	if(m_flags.test	(eNeedRecalc) )
		RecalcSize			();

	toDelList.clear();
	Frect visible_rect;
	GetAbsoluteRect(visible_rect);
	for(	WINDOW_LIST_it it = m_pad->GetChildWndList().begin(); 
			m_pad->GetChildWndList().end()!=it; 
			++it)
	{
		Frect	r;
		(*it)->GetAbsoluteRect(r);
		if(! (visible_rect.in(r.x1, r.y1) && visible_rect.in(r.x2, r.y1) && visible_rect.in(r.x1, r.y2) && visible_rect.in(r.x2, r.y2)))
		{
			toDelList.push_back(*it);			
		}
			
	}

	// Delete elements
	{
		xr_vector<CUIWindow*>::iterator it;
		for (it = toDelList.begin(); it != toDelList.end(); it++)
			RemoveWindow(*it);
	}

	if(m_flags.test	(eNeedRecalc) )
		RecalcSize			();
}
Exemple #2
0
/* ------- move a window to the end of its parents list ----- */
void ReFocus(WINDOW wnd)
{
	if (GetParent(wnd) != NULL)	{
		RemoveWindow(wnd);
		AppendWindow(wnd);
		ReFocus(GetParent(wnd));
	}
}
Exemple #3
0
void OSD::DialogQuit(void)
{
    if (!m_Dialog)
        return;

    RemoveWindow(m_Dialog->objectName());
    m_Dialog = NULL;
    m_PulsedDialogText = QString();
}
Exemple #4
0
static void
killwin(Widget w, XtPointer client_data, XtPointer call_data)
{
    GRAPH *graph = (GRAPH *) client_data;

    NG_IGNORE(call_data);
    NG_IGNORE(w);

    RemoveWindow(graph);
}
void
sbWindowWatcher::RemoveAllWindows()
{
  // Operate within the monitor.
  mozilla::ReentrantMonitorAutoEnter autoMonitor(mMonitor);

  // Remove all of the windows.
  PRInt32 windowCount = mWindowList.Count();
  for (PRInt32 i = windowCount - 1; i >= 0; i--) {
    RemoveWindow(mWindowList[i]);
  }
}
Exemple #6
0
// _____________________________________________________________________ //
//
// Global event listener
// _____________________________________________________________________ //
void CALLBACK WinEventProc(HWINEVENTHOOK hWinEventHook, DWORD event, HWND hwnd, LONG idObject, LONG idChild, DWORD dwEventThread, DWORD dwmsEventTime)
{
	if(IsPaused)
		return;

	switch(event)
	{
	case EVENT_OBJECT_LOCATIONCHANGE:
		if(!idObject && HasWindow(hwnd))
			ScheduleWindowPlacementUpdate(hwnd);
	break;

	case EVENT_OBJECT_CREATE:
	case EVENT_OBJECT_SHOW:
		if(!HasWindow(hwnd) && IsApplicationWindow(hwnd))
			AddWindow(hwnd);
	break;

	case EVENT_OBJECT_DESTROY:
	case EVENT_OBJECT_HIDE:
		if(!idObject)
			RemoveWindow(hwnd);
	break;

	case EVENT_OBJECT_PARENTCHANGE:
		if(HasWindow(hwnd))
		{
			if(!IsApplicationWindow(hwnd))
				RemoveWindow(hwnd);
		}
		else if(IsApplicationWindow(hwnd))
		{
			AddWindow(hwnd);
		}
	break;
	}
}
Exemple #7
0
/* callback function for catching window deletion by WM x-button */
static void
handle_wm_messages(Widget w, XtPointer client_data, XEvent *ev, Boolean *cont)
{
    GRAPH *graph = (GRAPH *) client_data;

    NG_IGNORE(w);
    NG_IGNORE(cont);

    if (ev->type == ClientMessage &&
        ev->xclient.message_type == atom_wm_protocols &&
        (Atom) ev->xclient.data.l[0] == atom_wm_delete_window)
    {
        RemoveWindow(graph);
    }
}
Exemple #8
0
TWindow::~TWindow()
{
	TTopLevelWindow* topLevel = GetTopLevelWindow();
	if (topLevel && topLevel->GetTarget() == this)
		topLevel->TargetDied();

	if (fParent)
		fParent->RemoveChild(this);

	TListIterator<TWindow>	iter(fChildren);

	TWindow* window;
	
	while ((window = iter.Next()) != NULL)
	{
		ASSERT(window->fParent == this);
		window->fParent = NULL;
	}

	if (IsCreated())
		RemoveWindow(this);

	// remove from sFirstUpdate linked list
	TWindow* previous = NULL;
	TWindow* current = sFirstUpdate;
	
	delete fUpdateRegion;
	delete fInputContext;
	
	while (current)
	{
		if (current == this)
		{
			if (previous)
				previous->fNextUpdate = current->fNextUpdate;
			else
				sFirstUpdate = current->fNextUpdate;
			
			break;
		}
		
		previous = current;
		current = current->fNextUpdate;
	}
}
Exemple #9
0
int GenericSLM::Shutdown()
{
   if (initialized_)
   {
      initialized_ = false;
      LogMessage("GenericSLM::Shutdown()");
      DestroyDrawContext();

      thd_->Stop();
      thd_->wait();

      RemoveWindow();
      DetachDisplayDevice(&displays_[chosenDisplayIndex_]);

      Sleep(500);
   }
   return HandleErrors();
   

}
nsresult
sbWindowWatcher::OnDOMWindowClosed(nsISupports*     aSubject,
                                   const PRUnichar* aData)
{
  // Validate arguments and state.
  NS_ASSERTION(aSubject, "aSubject is null");
  NS_ASSERTION(SB_IsMainThread(mThreadManager), "not on main thread");

  // Function variables.
  nsresult rv;

  // Get the event window.
  nsCOMPtr<nsIDOMWindow> window = do_QueryInterface(aSubject, &rv);
  NS_ENSURE_SUCCESS(rv, rv);

  // Remove the window.
  rv = RemoveWindow(window);
  NS_ENSURE_SUCCESS(rv, rv);

  return NS_OK;
}
Exemple #11
0
AUI_ERRCODE aui_UI::CreateEditModeDialog(BOOL make)
{
	AUI_ERRCODE auiErr = AUI_ERRCODE_OK;

	if ( make ) {
		if ( m_editWindow ) return AUI_ERRCODE_OK;
		m_editWindow = new aui_Window( &auiErr, aui_UniqueId(),
								0, 0, 
								200,
								82,
								m_primary->BitsPerPixel(),
								AUI_WINDOW_TYPE_FLOATING );
		Assert( AUI_NEWOK( m_editWindow, auiErr ) );
		if ( !AUI_NEWOK( m_editWindow, auiErr ) )
			return AUI_ERRCODE_MEMALLOCFAILED;

		m_editWindow->SetDraggable( TRUE );

		
		m_localRectText = new aui_Static( &auiErr, aui_UniqueId(),
										5, 5,
										190, 17, "000, 000, 000, 000" );
		Assert( AUI_NEWOK( m_localRectText, auiErr ) );
		if ( !AUI_NEWOK( m_localRectText, auiErr ) )
			return AUI_ERRCODE_MEMALLOCFAILED;

		m_localRectText->SetBlindness( TRUE );

		m_editWindow->AddControl( m_localRectText );

		m_absoluteRectText = new aui_Static( &auiErr, aui_UniqueId(),
										5, 21,
										190, 17, "000, 000, 000, 000" );
		Assert( AUI_NEWOK( m_absoluteRectText, auiErr ) );
		if ( !AUI_NEWOK( m_absoluteRectText, auiErr ) )
			return AUI_ERRCODE_MEMALLOCFAILED;

		m_absoluteRectText->SetBlindness( TRUE );

		m_editWindow->AddControl( m_absoluteRectText );

		m_editModeLdlName = new aui_Static( &auiErr, aui_UniqueId(),
										5, 39,
										190, 40, "                                                    " );
		Assert( AUI_NEWOK( m_editModeLdlName, auiErr ) );
		if ( !AUI_NEWOK( m_editModeLdlName, auiErr ) )
			return AUI_ERRCODE_MEMALLOCFAILED;

		m_editModeLdlName->SetBlindness( TRUE );

		m_editWindow->AddControl( m_editModeLdlName );

		AddWindow( m_editWindow );

	} else {

		if ( !m_editWindow ) return AUI_ERRCODE_OK;
		
		RemoveWindow( m_editWindow->Id( ) );

		delete m_localRectText;
		m_localRectText = NULL;

		delete m_absoluteRectText;
		m_absoluteRectText = NULL;

		delete m_editModeLdlName;
		m_editModeLdlName = NULL;

		delete m_editWindow;
		m_editWindow = NULL;

	}

	return AUI_ERRCODE_OK;

}
////////////////////////////////////////////////////////////////////////////////////////
///                                                                                   //
/// void LRESULT CALLBACK WndProc(HWND hWnd, UINT msg,WPARAM wParam, LPARAM lParam)   //            
///                                                                                   //
////////////////////////////////////////////////////////////////////////////////////////
static LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
 if (msg==MSG_DISPLAY_HOOK)
 {
   if (lParam==HCBT_ACTIVATE)
    {
     TButtonList ButtonList;

     ButtonList.NumButtons=0;

     if ((FindWindow((HWND)wParam)==NULL) )//&& 
		  //(FindWindow(GetAncestor((HWND)wParam,GA_ROOTOWNER))==NULL))
	 {
       if (EnumChildWindows((HWND)wParam, EnumChildWindowCallback,(LPARAM)&ButtonList))
        { 
		  if (CheckButtons(&ButtonList)) return(0);
	    }
#ifdef PRINTCAPTIONS
        char Text[512];
		  if (GetWindowText((HWND)wParam,Text,sizeof(Text))>0)
		  {
			  printf("Caption %s\n",Text);
		  }
#endif
       DWORD dwStyle; 
       dwStyle=GetWindowLong((HWND)wParam,GWL_STYLE);
       if (((dwStyle & WS_SYSMENU)==WS_SYSMENU) &&
	       ((dwStyle & WS_CAPTION )==WS_CAPTION))
         {
 
		  if (SendCloseWindows)
		  { 
           printf("Sent WM_CLOSE\n");
           PostMessage((HWND)wParam,WM_CLOSE,0,0);
           printf("Sent WM_QUIT\n");
           PostMessage((HWND)wParam,WM_QUIT,0,0);
		  }

	      return(0);
         }
	 }
	 else 
	 {
	   return DefWindowProc(hWnd, msg, wParam, lParam);
	 }
	}
   else if (lParam==HCBT_CREATEWND)
   {
   }
   else if (lParam==HCBT_DESTROYWND)
   {
    TWindowDataBase  *TmpWindow=FindWindow((HWND)wParam);
    if (TmpWindow)
	{
        RemoveWindow(TmpWindow);
		return DefWindowProc(hWnd, msg, wParam, lParam);
	}
   }
   return 0;
 }
 switch (msg)
    { 
         case WM_TIMER :
			   CheckUnhookable();
			   break;
         case WM_DESTROY : 
			   if ((wParam==0xDEAD) && (lParam==0xBEEF)) 
				    PostQuitMessage (0xDEADBEEF) ; 
               break; 
         default: 
			   return DefWindowProc(hWnd, msg, wParam, lParam); 
               break; 
    } 
   return 0;
}
////////////////////////////////////////////////////////////////////////////////////////
///                                                                                   //
/// static void  DeleteAllWindows(void)                                               //            
///                                                                                   //
////////////////////////////////////////////////////////////////////////////////////////
static void  DeleteAllWindows(void)
{
   while (pWindowHead != NULL)
      RemoveWindow(pWindowHead);
}
Exemple #14
0
void TrackEncoder( void)
{
	const int MaxTries = 9;
	int count = 0;
	int step;
	double StepsPerSec;
	int rate;

	TE = (struct AZLong*) malloc( MsInWindings * sizeof( struct AZLong));
	if( TE == NULL)
		BadExit( "Problem with malloc of TE in TrackEncoder()");

	WriteWindow( MsgFrame);

	gotoxy( MsgFrame.Left + 2, MsgFrame.Top + 1);
	printf( "moving motors to start position...");
	/* attempt to move both motors to microstep '0' on winding 'A' */
	do
	{
		Steps.A = (MsIx.A/MaxPWM) % MsInWindings;
		if( Steps.A && Dir.A == CW)
			Steps.A = MsInWindings - Steps.A;
		Steps.Z = (MsIx.Z/MaxPWM) % MsInWindings;
		if( Steps.Z && Dir.Z == CW)
			Steps.Z = MsInWindings - Steps.Z;
		MoveMs_f_ptr();
		count++;
	}while( count < MaxTries && (Steps.A || Steps.Z));

	/* get rate of motion */
	gotoxy( MsgFrame.Left + 2, MsgFrame.Top + 2);
	printf( "Please enter speed in microsteps per second ");
	if( !GetDouble( &StepsPerSec))
		/* if user aborts, then set it up so that no more execution occurs */
		count = MaxTries;
	else
		/* split rate in half bec. encoders read halfway through */
		rate = (int) (.5 + ClockTicksSec / (2.*StepsPerSec));

	if( count < MaxTries)
	{
		/* move MsInWindings microsteps, taking encoder readings as we go */
		for( step = 0; step < MsInWindings; step++)
		{
			Steps.A = Steps.Z = 1;
			for( Ix = 0; Ix < rate; Ix++)
				MoveMs_f_ptr();
			QueryEncoders_f_ptr();
			for( Ix = 0; Ix < rate; Ix++)
				MoveMs_f_ptr();
			if( EncoderState == ReadReady)
				ReadEncoders_f_ptr();
			TE[step].A = EncoderCount.A;
			TE[step].Z = EncoderCount.Z;
			gotoxy( MsgFrame.Left + 2, MsgFrame.Top + 3);
			printf( "microstep %d: encA %ld encZ %ld", step, TE[step].A, TE[step].Z);
		}
		gotoxy( MsgFrame.Left + 2, MsgFrame.Top + 4);
		printf( "writing %s file", TrackEncodersFile);
		Output = fopen( TrackEncodersFile, "w");
		if( Input == NULL)
			BadExit( strcat( "Could not open ", TrackEncodersFile));
		for( step = 0; step < MsInWindings; step++)
			fprintf( Output, "%d %ld %ld\n", step, TE[step].A, TE[step].Z);
		fclose( Output);
		gotoxy( MsgFrame.Left + 2, MsgFrame.Top + 5);
		ContMsgRoutine();
		RemoveWindow( MsgFrame);
	}
	else
	{
		RemoveWindow( MsgFrame);
		PressKeyToContMsg( "could not move motors to start position");
	}
	free( TE);
	PauseUntilNewSidTime();
	HPEventGetEquat();
}
Exemple #15
0
void DisplayInit( void)
{
	int StartX = InitFrame.Left + 5;
	int StartY = InitFrame.Top + 1;
	int AltX, AzX, RaX, DecX, SidTX;

	AltX = StartX + 3;
	AzX = AltX + SizeofDegX + 1;
	RaX = AzX + SizeofDegX + 1;
	DecX = RaX + SizeofHMSX + 1;
	SidTX = DecX + SizeofDMSX + 1;

	WriteWindow( InitFrame);

	TextAttr = DefaultText;
	VidMemXY.Y = StartY;
	VidMemXY.X = AltX;

	if( One.Init)
	{
		sprintf( StrBuf, "Alt");
		WriteStrBufToScreen_f_ptr();
		VidMemXY.X = AzX;
		sprintf( StrBuf, "Az");
		WriteStrBufToScreen_f_ptr();
		VidMemXY.X = RaX;
		sprintf( StrBuf, "Ra");
		WriteStrBufToScreen_f_ptr();
		VidMemXY.X = DecX;
		sprintf( StrBuf, "Dec");
		WriteStrBufToScreen_f_ptr();
		VidMemXY.X = SidTX;
		sprintf( StrBuf, "SidT");
		WriteStrBufToScreen_f_ptr();

		VidMemXY.Y++;
		VidMemXY.X = StartX;
		sprintf( StrBuf, "1:");
		WriteStrBufToScreen_f_ptr();
		VidMemXY.X = AltX;
		VidMemDeg( One.Alt);
		VidMemXY.X = AzX;
		VidMemDeg( One.Az);
		VidMemXY.X = RaX;
		VidMemRaHMS( &One);
		VidMemXY.X = DecX;
		VidMemDecDMS( &One);
		VidMemXY.X = SidTX;
		VidMemSidT( &One);
	}
	else
	{
		sprintf( StrBuf, "no inits to display");
		WriteStrBufToScreen_f_ptr();
		VidMemXY.Y++;
	}

	if( Two.Init)
	{
		VidMemXY.Y++;
		VidMemXY.X = StartX;
		sprintf( StrBuf, "2:");
		WriteStrBufToScreen_f_ptr();
		VidMemXY.X = AltX;
		VidMemDeg( Two.Alt);
		VidMemXY.X = AzX;
		VidMemDeg( Two.Az);
		VidMemXY.X = RaX;
		VidMemRaHMS( &Two);
		VidMemXY.X = DecX;
		VidMemDecDMS( &Two);
		VidMemXY.X = SidTX;
		VidMemSidT( &Two);
	}
	if( Three.Init)
	{
		VidMemXY.Y++;
		VidMemXY.X = StartX;
		sprintf( StrBuf, "3:");
		WriteStrBufToScreen_f_ptr();
		VidMemXY.X = AltX;
		VidMemDeg( Three.Alt);
		VidMemXY.X = AzX;
		VidMemDeg( Three.Az);
		VidMemXY.X = RaX;
		VidMemRaHMS( &Three);
		VidMemXY.X = DecX;
		VidMemDecDMS( &Three);
		VidMemXY.X = SidTX;
		VidMemSidT( &Three);                 
	}
	if( Two.Init)
	{
		VidMemXY.Y += 2;
		VidMemXY.X = StartX;
		sprintf( StrBuf, "Lat: ");
		WriteStrBufToScreen_f_ptr();
		VidMemDeg( Lat);
		sprintf( StrBuf, " (dif %3.3f)", Lat*RadToDeg - LatitudeDeg);
		WriteStrBufToScreen_f_ptr();

		sprintf( StrBuf, " Long: ");
		WriteStrBufToScreen_f_ptr();
		VidMemDeg( LongitudeRad);
		sprintf( StrBuf, " (dif %3.3f)", LongitudeRad*RadToDeg - LongitudeDeg);
		WriteStrBufToScreen_f_ptr();

		VidMemXY.Y++;
		VidMemXY.X = StartX;
		sprintf( StrBuf, "AzOff: ");
		WriteStrBufToScreen_f_ptr();
		VidMemDeg( AzOff);

		sprintf( StrBuf, " HAOff: ");
		WriteStrBufToScreen_f_ptr();
		GetHMSH( RadToHundSec*HAOff + 0.5, &HAOffHMSH);
		StrBufSHMS( HAOffHMSH);
		WriteStrBufToScreen_f_ptr();
		sprintf( StrBuf, " or %3.3f deg", HAOff*RadToDeg);
		WriteStrBufToScreen_f_ptr();

		VidMemXY.Y+=2;
		VidMemXY.X = StartX;
		sprintf( StrBuf, "To polar align, move %3.3f deg %s, %3.3f deg %s",
		fabs( PolarAlign.A*RadToDeg), PolarAlign.A<0.?"down":"up",
		fabs( PolarAlign.Z*RadToDeg), PolarAlign.Z<0.?"left":"right");
		WriteStrBufToScreen_f_ptr();
		VidMemXY.Y++;
	}
	VidMemXY.Y++;
	VidMemXY.X = StartX;
	sprintf( StrBuf, "Z1: %3.3f   Z2: %3.3f   Z3: %3.3f", Z1*RadToDeg,
	Z2*RadToDeg, Z3*RadToDeg);
	WriteStrBufToScreen_f_ptr();

	gotoxy( StartX + 6, VidMemXY.Y += 3);
	ContMsgRoutine();
	RemoveWindow( InitFrame);
}