Exemple #1
0
/*
 * Represents the screen presented to the user upon starting the Qt
 * application before any learning occurs.
 */
void QtFront::ShowPretrainWidget()
{
    if (ActiveWindow()) {
        if (ActiveWindow() == PretrainWindow)
            return;
        else {
            DefaultLayout->removeWidget(ActiveWindow());
            ActiveWindow()->hide();
        }
    }
    SetActiveWindow(PretrainWindow);
    DefaultLayout->addWidget(PretrainWindow);
    if (!PretrainWindow->isVisible())
        PretrainWindow->show();
}
Exemple #2
0
void QtFront::ShowTrainingWidget()
{
    if (ActiveWindow()) {
        if (ActiveWindow() == TrainingWindow)
            return;
        else {
            DefaultLayout->removeWidget(ActiveWindow());
            ActiveWindow()->hide();
        }
    }
    SetActiveWindow(TrainingWindow);
    DefaultLayout->addWidget(TrainingWindow);
    if (!TrainingWindow->isVisible())
        TrainingWindow->show();
}
Exemple #3
0
/*
void MerryFrame::OnActivateEvent(wxActivateEvent& e)
{
#ifndef DEBUG_ALWAYS_SHOW
	if (!e.GetActive() && !this->IsShownOnScreen())
		this->Hide();
#endif
}
*/
void MerryFrame::OnShowEvent(wxShowEvent& e)
{
	MerryTextCtrl* textCtrl = m_mainPanel->GetTextCtrl();
	assert(textCtrl);
	if (e.IsShown())
	{
		if (g_config->get(PlayPopupNotify))//ÊÇ·ñ²¥·ÅÌáʾÒô
			wxSound("Popup.wav").Play();
		textCtrl->ChangeValue(wxT(""));
		this->CentreOnce();
		m_listBoxPanel->Dismiss();
		this->Raise();
		g_controller->SetWindowPos(this->GetHWND(),HWND_TOPMOST,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE);
		ActiveWindow(this->GetHWND());
//		textCtrl->SetFocus();
#ifdef __WXMSW__
		textCtrl->SetEnInputMode();
#endif
		if (g_config->get(AutoPopup))
			textCtrl->AppendText(wxT(""));
	}
	else
		textCtrl->ChangeValue(wxT(""));

	textCtrl->EnterArgs = 0;
}
Exemple #4
0
void MoveWindowToFront( window_id wid )
{
    if( !BAD_ID( wid ) ) {
        BringWindowToTop( wid );
        ActiveWindow( wid );
    }
}
void SessionForm::SetActiveSessionBox(const std::string &session_id)
{
	if (session_id.empty())
		return;

	ActiveWindow();

	// 从窗口左侧会话列表找到要激活的会话盒子项
	std::wstring id = nbase::UTF8ToUTF16(session_id);
	MergeItem *merge_item = FindMergeItem(id);
	if (NULL == merge_item)
		return;

	// 如果merge_item处于隐藏状态,则无法顺利触发选择事件,所以这里直接切换到目标会话盒子
	merge_item->Selected(true, false);
	ChangeToSessionBox(id);
}
// Checks mouse position and casts a ray. Will return all entities along the ray, starting with the closest one.
void FirstPersonPlayerProperty::UpdateTargetsByCursorPosition()
{
	Ray ray;
	AppWindow * activeWindow = ActiveWindow();
	if (activeWindow != MainWindow())
		return;
	// Try to get ray.
	if (!activeWindow->GetRayFromScreenCoordinates(inputState->mousePosition, ray))
		return;

	// Do ray cast within the physics system
	PMRaycast * raycast = new PMRaycast(ray);
	raycast->relevantEntity = owner;
	raycast->msg = "UpdateTargetsByCursorPosition";
	PhysicsQueue.Add(raycast);

	/// React to message of it later on.
}
Exemple #7
0
void cbKeyPressed(unsigned char key, int x, int y)
{
    int tmp;
    double tmpd;
    switch (key) {
    
    case 'Q': case 'q': case 27:
        glutDestroyWindow(window_id);
        //        exit(1);
        break;

    // force entropy changes
	case 'a':
		ff_io_entropy_change();
		break;
	
	case 'd':
        Lx *= 1.05;
        Ly *= 1.05;
        Lz *= 1.05;
        break;

    case 'D':
        Lx /= 1.05;
        Ly /= 1.05;
        Lz /= 1.05;
        break;

	case 'V': case 'v':
		show_m = show_m ? 0 : 1;
		show_sphere = show_sphere ? 0 : 1;
		break;

	case 'M': case 'm':
        show_m = show_m?0:1;
        break;

    case 'X': case 'x':
        show_cube = show_cube ? 0 : 1;
        break;

    case '5':
        show_steric = show_steric?0:1;
        break;

    case 'O': case 'o':
        show_droplet = show_droplet?0:1;
        break;

    case 'B': case 'b':
        show_b = show_b?0:1;
        break;

    case 'R': case 'r':
        if (BmanY == 0) {BmanY = BmanX; BmanX = 0;}
        else if (BmanX == 0) {BmanX = -BmanY; BmanY = 0;}
        break;

    case 'l':
        ff_io_load(0);
        break;

    case 'L':
        ff_io_load(100);
        break;

    case 'S': case 's':
        show_sphere = show_sphere?0:1;
        break;

    case 'T': case 't':
        T += 1;
        break;

    case 'C': case 'c':
        T -= 1;
        break;

    case 'P': case 'p':
        projection_type = projection_type ? 0 : 1;
        cbResizeScene(window_width, window_height);
        break;

    case 'E': case 'e':
        show_bext = show_bext?0:1;
        break;
	
	case 'N': case 'n':
		
		out<<"step ="<<step << " V_oleic = " << v_oleic<<" V_car = "<<v_car<<" Bmanz ="<<BmanZ;
		GetScreenShot(out.str());
		out.str("");
		out.flush();
		break;
	case 'z':
		addPosition(x_rot, y_rot, space_k, projection_type);
		break;
	case 'Z':
		delPosition();
		break;
	case 'f':
		ChangePosition();
		break;
	case '0':
		ff_pieces_coord_info();
        BmanX = BmanY = BmanZ = 0;
        break;
    case '1':
        if (manual_field_control)
        {
            BmanX += 10;
        }
        break;
    case '2':
        if (manual_field_control)
        {
            BmanY += 10;
        }
        break;
    case '3':
        if (manual_field_control)
        {
            BmanZ += 10;
        }
        break;
	case '4':
			
			cout << eta_car0 << "-----" << eta_car << "-----------" << eta_oleic <<"------------" <<T<< endl;
			T += 10;
		break;
    case 'i':case 'I':
        show_info = show_info?0:1;
        break;
    case '9':
        Lx /= 2;
        Ly /= 2;
        Lz /= 2;
        break;
    case ' ':
        time_go = time_go?0:1;
		ActiveWindow();
        break;
    
    case '[':
        scaling_cube /= 1.05;
        break;
    
    case ']':
        scaling_cube *= 1.05;
        break;

    case ',':
        gr_quality --;
        break;
    
    case '.':
        gr_quality ++;
        break;

    case 'g':
        gr_x0 -= 0.05;
        break;
    
    case 'h':
        gr_x0 += 0.05;
        break;
    
    case 'j':
        gr_y0 -= 0.05;
        break;
    
    case 'k':
        gr_y0 += 0.05;
        break;

    case ';':
        gr_z0 -= 0.05;
        break;
    
    case '\'':
        gr_z0 += 0.05;
        break;

    case 'u':
        dt *= 1.1;
        break;
    
    case 'y':
        dt /= 1.1;
        break;

    default:
        printf ("KP: No action assigned for %c.\n", key);
        break;
    }
}
Exemple #8
0
BOOL 
ProcessMouseDownMsgClient(
	int iMsg, 
	int x, 
	int y
)
{
	PClipRect pCRect;
	RECT rcClient;
	PWindowsTree pWin,pControl;
	//1. within sub window
	pWin=_lGUI_pWindowsTree->pChildHead;
	while(pWin){
		//1.1within clip region of the sub window
		if(PtInRect(&(pWin->rect),x,y)){
			pCRect=pWin->pClipRgn->pHead;
			while(pCRect){
				if(PtInRect(&(pCRect->rect),x,y)){
					//Move the sub window top. 
					if(pWin->pParent->pChildHead!=pWin)
						ShowWindow((HWND)pWin,true);
					else{
						ActiveWindow((HWND)pWin);
					}
					scrGetClientRect((HWND)pWin,&rcClient);
					if(PtInRect(&rcClient,x,y))
						PostMessage(pWin,LMSG_PENDOWN,(WPARAM)x,(LPARAM)y);
					else
						PostMessage(pWin,LMSG_NCPENDOWN,(WPARAM)x,(LPARAM)y);
					return true;
				}
				pCRect=pCRect->pNext;
			}
			//1.2within the control of the sub window
			pControl=pWin->pControlHead;
			while(pControl){
				if(PtInRect(&(pControl->rect),x,y)){
					//move the sub window top 
					if(pWin->pParent->pChildHead!=pWin)
						ShowWindow((HWND)pControl,true);
					scrGetClientRect((HWND)pControl,&rcClient);
					if(PtInRect(&rcClient,x,y))
						PostMessage(pControl,LMSG_PENDOWN,(WPARAM)x,(LPARAM)y);
					else
						PostMessage(pControl,LMSG_NCPENDOWN,(WPARAM)x,(LPARAM)y);
					SetFocus((HWND)pControl);
					return true;
				}
				pControl=pControl->pNext;
			}
		}
		pWin=pWin->pNext;
	}
	//2.within the main window
	pCRect=_lGUI_pWindowsTree->pClipRgn->pHead;
	while(pCRect){
		if(PtInRect(&(pCRect->rect),x,y)){
			scrGetClientRect((HWND)_lGUI_pWindowsTree,&rcClient);
			if(PtInRect(&rcClient,x,y)){
				PostMessage(_lGUI_pWindowsTree,LMSG_PENDOWN,(WPARAM)x,(LPARAM)y);
			}
			else{
				PostMessage(_lGUI_pWindowsTree,LMSG_NCPENDOWN,(WPARAM)x,(LPARAM)y);

			}
			if(!IsActive(_lGUI_pWindowsTree))
				ActiveWindow(_lGUI_pWindowsTree);
			return true;
		}
		pCRect=pCRect->pNext;
	}
	//3.within the control of the main window 
	pWin=_lGUI_pWindowsTree->pControlHead;
	while(pWin){
		pCRect=pWin->pClipRgn->pHead;
		while(pCRect){
			if(PtInRect(&(pCRect->rect),x,y)){
				scrGetClientRect((HWND)pWin,&rcClient);
				if(PtInRect(&rcClient,x,y))
					PostMessage(pWin,LMSG_PENDOWN,(WPARAM)x,(LPARAM)y);
				else
					PostMessage(pWin,LMSG_NCPENDOWN,(WPARAM)x,(LPARAM)y);
				if(!IsActive((HWND)_lGUI_pWindowsTree)){
					RECT rc;
					_lGUI_pActiveWin = _lGUI_pWindowsTree;
					_lGUI_pWindowsTree->dwStyle |=  WS_ACTIVE;
					wndGetCaptionRect((HWND)_lGUI_pWindowsTree,&rc);
					scrInvalidateRect((HWND)_lGUI_pWindowsTree,&rc,true);				
				}
				SetFocus(pWin);
				return true;
			}
			pCRect=pCRect->pNext;
		}
		pWin=pWin->pNext;
	}
	return true;

}
Exemple #9
0
//Destroy an application
//socket id
// pAttachData iAttachSize no used 
BOOL 
DestroyApplicationServer(
	IpcHand hand, 
	void *pAttachData
)
{
	RECT *rc1;
	PWindowsTree pControl;
	PlGUIAppStat pStat,pCurStat,pPrevStat=NULL;

	BOOL bTop=false;

	pStat = _lGUI_pAppStat;

	if(!pStat)
		return false;
	while(pStat){
		if(pStat->hand==hand){
			break;
		}
		pPrevStat=pStat;
		pStat=pStat->pNext;
	}
	if(!pStat){
		return false;
	}
	if(pStat == _lGUI_pAppStat){
		bTop = true;
		_lGUI_pAppStat = _lGUI_pAppStat->pNext;
	}
	else
		pPrevStat->pNext = pStat->pNext;

	if(pStat->bVisible){//only if this application is visible
		if(pStat->pNext){
			//recalculate clip region of mainwindow under the current
			RecalClipRgnUnderThis(pStat->pNext);
			//send clip region change message to application
			pCurStat=pStat->pNext;
			while(pCurStat){
				SendClipRgnChangeMsg(pCurStat);
				pCurStat=pCurStat->pNext;
			}

			//if this application is at top layer
			// then we should active the nearest application under it
			if(bTop){
				SendMsgByServer(_lGUI_pAppStat,LMSG_IPC_ACTIVEAPP,NULL,0);
			}
			//send redraw message to application
			pCurStat=pStat->pNext;
			while(pCurStat){
			//	memcpy(&pCurStat->invd_rc,&pStat->rc,sizerc1=malloc(sizeof(RECT));
				rc1=malloc(sizeof(RECT));
				memcpy(rc1,&pStat->rc,sizeof(RECT));
				SendMsgByServer(pCurStat,LMSG_IPC_REDRAW,rc1,0);
			//	SendMsgByServer(pCurStat,LMSG_IPC_REDRAW,NULL,0);
				pCurStat=pCurStat->pNext;
			}
		}

		//recalculate clip region of desktop
		ReCalClipRegion(_lGUI_pWindowsTree);
		//recalculate clip region of desktop control
		pControl=_lGUI_pWindowsTree->pControlHead;
		while(pControl){
			ReCalClipRegion(pControl);
			pControl=pControl->pNext;
		}
		//redraw desktop 
		scrInvalidateRect((HWND)_lGUI_pWindowsTree,&(pStat->rc),true);
		//redraw desktop control
		pControl=_lGUI_pWindowsTree->pControlHead;
		while(pControl){
			if(IsVisible(pControl))
				scrInvalidateRect((HWND)pControl,&(pStat->rc),true);
			pControl=pControl->pNext;
		}
		//if all of application have been destroyed,we should active desktop.
		if(!_lGUI_pAppStat){
			ActiveWindow(_lGUI_pWindowsTree);
		}
	}
	sem_post(&pStat->sem_cs);
	return true;
}
Exemple #10
0
/*
 * NewFile - load up a new file
 */
vi_rc NewFile( char *name, bool same_file )
{
    vi_rc       rc;
    bool        dup;
    status_type oldstatus;

    dup = EditFlags.DuplicateFile;
    EditFlags.DuplicateFile = false;
    oldstatus = UpdateCurrentStatus( CSTATUS_READING );

    ScreenPage( 1 );
#ifdef __WIN__
    EditFlags.ResizeableWindow = true;
#endif
    rc = createNewFile( name, same_file );
    if( rc != ERR_NO_ERR && rc != NEW_FILE ) {
        ScreenPage( -1 );
        if( !EditFlags.Starting ) {
            MoveWindowToFrontDammit( MessageWindow, true );
            MoveWindowToFrontDammit( CurrentWindow, true );
        }
        UpdateCurrentStatus( oldstatus );
        return( rc );
    }
    GoToLineNoRelCurs( 1 );
    GoToColumnOnCurrentLine( 1 );
    FileSPVAR();
    SaveCurrentInfo();
    if( !same_file ) {
        inReadHook++;
        rc = SourceHook( SRC_HOOK_READ, rc );
        inReadHook--;
    }

    /*
     * back from hook, so all loadings are done
     * (who should have priority - hook or fts commands?)
     */
#if 0
    rc = FTSRunCmds( CurrentFile->name );
    FTSRunCmds( CurrentFile->name );
#endif

    /*
     * reset the screen to the display page, display everything
     */
    ScreenPage( -1 );
    MoveWindowToFrontDammit( CurrentWindow, true );
    UpdateStatusWindow();
    SetWindowCursor();
    DCDisplayAllLines();
    EditFlags.DuplicateFile = dup;
    DisplayFileStatus();
    SaveCurrentInfo();
    ActiveWindow( CurrentWindow );
    VarAddRandC();
    SetModifiedVar( false );
    UpdateCurrentStatus( oldstatus );
    if( !same_file && !inReadHook ) {
        UpdateLastFileList( CurrentFile->name );
    }
#ifdef __WIN__
    DCUpdateAll();
    ResetEditWindowCursor( CurrentWindow );
    SetWindowCursorForReal();
    GotoFile( CurrentWindow );
#endif
    return( rc );

} /* NewFile */