Пример #1
0
void CWorkspaceViewsDialog::Wire()
{
    //	Setup things

	connect( mViewsListWidget, SIGNAL( itemActivated(QListWidgetItem*) ), this, SLOT( accept() ) );

	connect( mButtonBox, SIGNAL( accepted() ), this, SLOT( accept() ) );
	connect( mButtonBox, SIGNAL( rejected() ), this, SLOT( reject() ) );

	auto displays = mModel.Workspace< CWorkspaceDisplay >()->GetDisplays();
	for ( auto const &display_entry : *displays )
	{
		CDisplay *display = dynamic_cast<CDisplay*>( display_entry.second );							assert__( display );
		auto v = display->GetOperations();
		if ( v.size() == 0 )				//old workspace ?
			continue;

		QListWidgetItem *item = new QListWidgetItem( display->GetName().c_str(), mViewsListWidget );
		std::string tip = 
			display->IsZLatLonType() ? "Type: map" : ( display->IsZYFXType() ? "Type: Z=F(X,Y)" : "Type: Y=F(X)" );
		std::string operation_names;
		for ( auto *op : v )
		{
			operation_names	+= ( "\n\t" + op->GetName() );
		}
		if ( !operation_names.empty() )
		{
			tip += ( "\nOperation:" + operation_names );
		}
		item->setToolTip( tip.c_str() );
	}
	mViewsListWidget->setCurrentRow( 0 );
}
Пример #2
0
void UIMachineView::cleanupFrameBuffer()
{
    if (m_pFrameBuffer)
    {
        /* Process pending frame-buffer resize events: */
        QApplication::sendPostedEvents(this, VBoxDefs::ResizeEventType);
#ifdef VBOX_WITH_VIDEOHWACCEL
        if (m_fAccelerate2DVideo)
        {
            /* When 2D is enabled we do not re-create Framebuffers. This is done to
             * 1. avoid 2D command loss during the time slot when no framebuffer is assigned to the display
             * 2. make it easier to preserve the current 2D state */
            Assert(m_pFrameBuffer == uisession()->frameBuffer(screenId()));
            m_pFrameBuffer->setView(NULL);
#ifdef VBOX_WITH_CROGL
            /* Call SetFramebuffer to ensure 3D gets notified of view being destroyed */
            CDisplay display = session().GetConsole().GetDisplay();
            display.SetFramebuffer(m_uScreenId, CFramebuffer(m_pFrameBuffer));
#endif
        }
        else
#endif /* VBOX_WITH_VIDEOHWACCEL */
        {
            /* Warn framebuffer about its no more necessary: */
            m_pFrameBuffer->setDeleted(true);
            /* Detach framebuffer from Display: */
            CDisplay display = session().GetConsole().GetDisplay();
            display.SetFramebuffer(m_uScreenId, CFramebuffer(NULL));
            /* Release the reference: */
            m_pFrameBuffer->Release();
//          delete m_pFrameBuffer; // TODO_NEW_CORE: possibly necessary to really cleanup
            m_pFrameBuffer = NULL;
        }
    }
}
void UISingleTextInputDialog::MoveWindow(int _iLeft, int _iTop, int _iWidth, int _iHeight)
{
    DebugPrintf(DLC_UISINGLETEXTINPUTDLG, "%s, %d, %s, %s START", __FILE__,  __LINE__, GetClassName(), __FUNCTION__);
    CDisplay* pDisplay = CDisplay::GetDisplay();
    if (pDisplay)
    {
        _iWidth = m_DEFAULT_WIDTH;
        _iHeight = m_DEFAULT_HEIGHT;
        _iLeft = (pDisplay->GetScreenWidth() - _iWidth) >> 1;
        _iTop = 200;
    }
    UIWindow::MoveWindow(_iLeft, _iTop, _iWidth, _iHeight);

    int iTop = m_DEFAULT_MARGIN;
    int iLeft = m_DEFAULT_MARGIN;
    int iWidth = m_iWidth - (m_DEFAULT_MARGIN << 1);
    m_txtPasswordHintLabel.MoveWindow (iLeft, iTop, iWidth, m_DEFAULT_ELEMHEIGHT);
    iTop += m_DEFAULT_ELEMHEIGHT + m_DEFAULT_ELEMSPACING;
    
    m_tbPassword.MoveWindow(iLeft, iTop, iWidth, m_DEFAULT_ELEMHEIGHT);
    iTop += (m_DEFAULT_ELEMHEIGHT + m_DEFAULT_ELEMSPACING);
    
    if(m_iDialogType == Type_Default)
    {
        const int iBtnWidth = (iWidth - m_DEFAULT_ELEMSPACING) >> 1;
        m_btnCancel.MoveWindow(iLeft, iTop, iBtnWidth, m_DEFAULT_ELEMHEIGHT);
        iLeft += iBtnWidth + m_DEFAULT_ELEMSPACING;

        m_btnOK.MoveWindow(iLeft, iTop, iBtnWidth, m_DEFAULT_ELEMHEIGHT);
    }
    else if(m_iDialogType == Type_AddLabel)
Пример #4
0
void UIMachineView::sltMachineStateChanged()
{
    /* Get machine state: */
    KMachineState state = uisession()->machineState();
    switch (state)
    {
        case KMachineState_Paused:
        case KMachineState_TeleportingPausedVM:
        {
            if (   vboxGlobal().vmRenderMode() != VBoxDefs::TimerMode
                && m_pFrameBuffer
                &&
                (   state           != KMachineState_TeleportingPausedVM
                 || m_previousState != KMachineState_Teleporting))
            {
                takePauseShotLive();
                /* Fully repaint to pick up m_pauseShot: */
                viewport()->update();
            }
            break;
        }
        case KMachineState_Restoring:
        {
            /* Only works with the primary screen currently. */
            if (screenId() == 0)
            {
                takePauseShotSnapshot();
                /* Fully repaint to pick up m_pauseShot: */
                viewport()->update();
            }
            break;
        }
        case KMachineState_Running:
        {
            if (   m_previousState == KMachineState_Paused
                || m_previousState == KMachineState_TeleportingPausedVM
                || m_previousState == KMachineState_Restoring)
            {
                if (vboxGlobal().vmRenderMode() != VBoxDefs::TimerMode && m_pFrameBuffer)
                {
                    /* Reset the pixmap to free memory: */
                    resetPauseShot();
                    /* Ask for full guest display update (it will also update
                     * the viewport through IFramebuffer::NotifyUpdate): */
                    CDisplay dsp = session().GetConsole().GetDisplay();
                    dsp.InvalidateAndUpdate();
                }
            }
            break;
        }
        default:
            break;
    }

    m_previousState = state;
}
Пример #5
0
void UIMachineViewScale::takePauseShotLive()
{
    /* Take a screen snapshot. Note that TakeScreenShot() always needs a 32bpp image: */
    QImage shot = QImage(m_pFrameBuffer->width(), m_pFrameBuffer->height(), QImage::Format_RGB32);
    /* If TakeScreenShot fails or returns no image, just show a black image. */
    shot.fill(0);
    CDisplay dsp = session().GetConsole().GetDisplay();
    dsp.TakeScreenShot(screenId(), shot.bits(), shot.width(), shot.height());
    m_pPauseImage = new QImage(shot);
    scalePauseShot();
}
Пример #6
0
///////////////////////////////////////
// FindOtherNote: 用于回溯 寻找另一个节点 
// 参数:当前G值
// 返回值:是否找到新节点
///////////////////////////////////////
BOOL CMain::FindOtherNote(int CurrentG)
{
	POSITION pos = m_DispList.GetTailPosition();
	while(pos)
	{
		CDisplay *Item = (CDisplay *)m_DispList.GetPrev(pos);
		if(Item->GetCurrentG() != CurrentG) continue;//没有到当前层
		if(Item->GetNoteType() != NotYet) continue;//当前结点不是没有被扩展的结点
		m_CurOpItem = Item;
		return TRUE;
	}
	return FALSE;
}
Пример #7
0
void UIFootNoteDialog::MoveWindow(int left, int top, int width, int height)
{
    DebugPrintf(DLC_UIFOOTNOTEDIALOG, "%s:%d:%s  %s start", __FILE__, __LINE__, __FUNCTION__, GetClassName());
    CDisplay* pDisplay = CDisplay::GetDisplay();
    if (pDisplay)
    {
        left = (pDisplay->GetScreenWidth() - m_maxWidth) >> 1;
    }
    UIWindow::MoveWindow(left, top, m_maxWidth, height);
    m_bottomSizer->Show(m_totalPage > 1);

    Layout();
    DebugPrintf(DLC_UIFOOTNOTEDIALOG, "%s:%d:%s  %s end", __FILE__, __LINE__, __FUNCTION__, GetClassName());
}
Пример #8
0
void UIMachineView::takePauseShotLive()
{
    /* Take a screen snapshot. Note that TakeScreenShot() always needs a 32bpp image: */
    QImage shot = QImage(m_pFrameBuffer->width(), m_pFrameBuffer->height(), QImage::Format_RGB32);
    /* If TakeScreenShot fails or returns no image, just show a black image. */
    shot.fill(0);
    CDisplay dsp = session().GetConsole().GetDisplay();
    dsp.TakeScreenShot(screenId(), shot.bits(), shot.width(), shot.height());
    /* TakeScreenShot() may fail if, e.g. the Paused notification was delivered
     * after the machine execution was resumed. It's not fatal: */
    if (dsp.isOk())
        dimImage(shot);
    m_pauseShot = QPixmap::fromImage(shot);
}
Пример #9
0
int Game()
{
    int x = 0;
    int y = 0;
    CDisplay GameDisplay;//sets up the display object for curses
    Player playerONE(1);
    Enemy EnemyONE(1);
    //sets up time layout for 1 seconds
    // struct timespec tim,tim2;
    // tim.tv_sec = 0;
    // tim.tv_nsec = 50000000L;

    while(play == true)
    {

        clear();
        GameDisplay.init_StatusBar(0,playerONE);
        GameDisplay.Display(WinWidth,WinHeight,x,y,26,13,Map[maplocation]);
        //GameDisplay.DebugScreen(x,y,Map1);
        //GameDisplay.Message(WinWidth/6,(4*WinHeight)/5,(2*WinWidth)/3,WinHeight/5,"Hello young one, i am a traveler from a different land, please help me and I will give you a magic ball");
        //GameDisplay.Message(0,0,WinWidth,WinHeight,"abcdefghijklmnopqrstuvwxyz");
        GameDisplay.init_Border(Displaycenset);
        //GameDisplay.Message("test");
        Move(x,y,26,13,Map[maplocation]);
        // nanosleep(&tim,&tim2);

        if(BattleMode == true)
        {
            Battle battle1;
            battle1.StartBattle(playerONE,EnemyONE);
        }

        if(DungeonMode == true)
        {
            Dungeon Dungeon1;
            Dungeon1.StartDungeon(playerONE,1);
        }

        if(AutoDisplay==true)
        {
            getmaxyx(stdscr,WinHeight,WinWidth);
        }
        refresh();//refreshes the screen
        //GameDisplay.wait(10000);
    }

    return 0;
}
Пример #10
0
void TimerUnit::Initialize(int LargeNumberSpriteID, int SmallNumberSpriteID, int CasingSpriteID, int CaptionFontID)
{
	LargeNumberSprite.InitializeSpriteCopy(GetGlobalSpriteData(LargeNumberSpriteID));
	SmallNumberSprite.InitializeSpriteCopy(GetGlobalSpriteData(SmallNumberSpriteID));
	CasingSprite.InitializeSpriteCopy(GetGlobalSpriteData(CasingSpriteID));
	CaptionFont = GetFontBySizeIndex(CaptionFontID);

	

	//NOW WE MUST FIGURE OUT WHERE TO PUT EVERYTHING.
	//FIRST, THE CASING.
	RECT Client;
	GetClientRect(TheDisplay.GetHWnd(), &Client);
	AbsCasingOrigin.x = ((Client.right - Client.left) / 2) - (CasingSprite.GetWidth() / 2) + 100;
	AbsCasingOrigin.y = CasingSprite.GetHeight() * -1;
	CasingSprite.SetLoc(AbsCasingOrigin); 
	RelCaptionOrigin.y = CasingSprite.GetHeight();
	SetCaption("TIMER");
	//TIME HEIGHT AND WIDTH
	RelTimeOrigin.y = 13;
	//5 BIG DIGITS AND 3 SMALL ONES
	int TimeWidth = 5 * LargeNumberSprite.GetWidth() + 3 * SmallNumberSprite.GetWidth();
	RelTimeOrigin.x = (CasingSprite.GetWidth() / 2);
	RelTimeOrigin.x -= (TimeWidth / 2);
	//ALL WIDTHS AND HEIGHTS ACCOUNTED FOR.
	Status = 3;
	
}
Пример #11
0
void CPointTool::OnLButtonDown(_CVIEW * pView, UINT nFlags, CPoint& point)
{
	CMiniCADDoc* pDoc = pView->GetDocument();
	if (pDoc==NULL)return;
	CADGraphics	*pGraphics = &pDoc->m_Graphics;
	CDisplay *pDisplay = pGraphics->m_pDisplay;
	if (pDisplay == NULL) return;
	CADPoint* pPoint;
	pPoint=new CADPoint();
	ADPOINT adPoint=pDoc->m_Graphics.ClientToDoc(point);
	pPoint->pt=adPoint;
	pPoint->m_nLayer=pDoc->m_LayerGroup.indexOf(pDoc->m_curLayer);
	pDoc->m_Graphics.m_Entities.Add((CObject*)pPoint);
	pDoc->m_Graphics.DrawGraphics(pDisplay->GetDC(),pPoint);
	pView->ReBitBlt();
	CDrawTool::OnLButtonDown(pView, nFlags, point);
}
Пример #12
0
void CursorPhysicsMachine::Update(int TimeDiff, POINT SystemCursor)
{
	//CALCULATE SYSTEM DELTA.
	mSystemDelta.x = (mSystemCursor.x - SystemCursor.x);
	mSystemDelta.y = (mSystemCursor.y - SystemCursor.y);

	//DEAL W/ NO PHYSICS.
	if(!mPhysicsActive){
		mGameCursor.x = mSystemCursor.x - mSystemDelta.x;
		mGameCursor.y = mSystemCursor.y - mSystemDelta.y;
	}

	else{
	//ELSE, PHYSICS BEGINS. FIRST, TRANSLATE THE SYSTEM DELTA INTO ACCEL DELTA.
	mGameDeltaAccel.x = (double)(mSystemDelta.x * TimeDiff) * mAccel;
	mGameDeltaAccel.y = (double)(mSystemDelta.y * TimeDiff) * mAccel;

	//NOW, UPLOAD THEM TO THE SPEED.
	mGameDeltaSpeed.x -= mGameDeltaAccel.x;
	mGameDeltaSpeed.y -= mGameDeltaAccel.y;

	//NOW UPLOAD THE SPEED TO THE POSITION.
	mGameCursor.x += mGameDeltaSpeed.x;
	mGameCursor.y += mGameDeltaSpeed.y;

	//NOW BLEED OFF THE DRAG.
	if(mGameDeltaSpeed.x < 0){
		mGameDeltaSpeed.x += mDrag;
		if(mGameDeltaSpeed.x > 0)
			mGameDeltaSpeed.x = 0;
	}
	else if(mGameDeltaSpeed.x > 0){
		mGameDeltaSpeed.x -= mDrag;
		if(mGameDeltaSpeed.x < 0)
			mGameDeltaSpeed.x = 0;
	}

	if(mGameDeltaSpeed.y < 0){
		mGameDeltaSpeed.y += mDrag;
		if(mGameDeltaSpeed.y > 0)
			mGameDeltaSpeed.y = 0;
	}
	else if(mGameDeltaSpeed.y > 0){
		mGameDeltaSpeed.y -= mDrag;
		if(mGameDeltaSpeed.y < 0)
			mGameDeltaSpeed.y = 0;
	}
	}

	//STORE NEW CURSOR POS.
	if(mPhysicsActive)
	StopGameCursorAtBounds();

	mSystemCursor = GetGameCursorPoint();
	POINT mTo = mSystemCursor;
	ClientToScreen(TheDisplay.GetHWnd(), &mTo);
	SetCursorPos(mTo.x, mTo.y);
}
Пример #13
0
///////////////////////////////////////////
// FindBestMoveFlag:寻找最佳移动方式 并移动之
// 入口: GenerateChild();
// 参数:子节点集
// 返回值:错误代码
//////////////////////////////////////////
UINT CMain::FindBestMoveFlag(List *pList)
{
	//计算移动后是否有重复项 重复项不参加最佳选择运算
	IsReadyExist(pList);
	//在没有出现过移动结果中选择最佳解
	POSITION Pos = pList->GetHeadPosition();
	int H[4]={65535,65535,65535,65535},i=0,Min = 65535;
	POSITION MinPos;
	while(Pos)
	{
	 POSITION CurPos = Pos;
	 CDisplay *Item = (CDisplay *)pList->GetNext(Pos);
	 if(Item->GetNoteType() == AlReady) {i++;continue;}
	 H[i] = CaculateH(Item);
	 if(Min>H[i]) {Min=H[i];MinPos = CurPos;}
	 i++;
	}
	
	if(Min == 65535)
	{/*
	 //没有找到最佳方法 表示这个结点所有子项都已扩展。要回溯
	 //但在本程序中 由于输入值一定有解,可以不要回溯
	 for(int CurrentG = this->m_CurrentG;CurrentG>0;CurrentG--)
	  if(FindOtherNote(CurrentG)) return NoError;//找到了另一个未扩展的结点返回
	 */
		return ErrorCode;//没有未扩展的结点了 本题无解
	}	

	//标记最佳解
	Pos = pList->GetHeadPosition();
	while(Pos)
	{
	 POSITION CurPos = Pos;
	 CDisplay *Item = (CDisplay *)m_DispList.GetNext(Pos);
	 if(CurPos == MinPos) 
	 {
	  Item->SetThisIsAAnswer();//是解
	  Item->SetNoteType(AlReady);//被扩展
	  m_CurOpItem = Item;
	 }
	 m_DispList.AddTail(Item);
	}
	return NoError;
}
Пример #14
0
Sprite::Sprite(const Sprite& ref)
{
	if(mImageAlloc)
		delete mFullImage;
	*this = ref;
	TheDisplay.CreateSurfaceFromSurface(&mFullImage, ref.mFullImage);
	mFullImage->SetColorKey(0xFF00FF);
	mSurf = mFullImage->GetDDrawSurface();
	mImageAlloc = true;
}
Пример #15
0
//////////////////////////////////////
// IsReadyExist: 是否已经存在
// 如果已经存在则设标记为已存在
// 入口: FindBestMoveFlag()
// 参数:子节点集起始位置指针
//////////////////////////////////////
void CMain::IsReadyExist(List *pList)
{
	POSITION PosSrc = pList->GetHeadPosition();
	while(PosSrc)
	{
	 POSITION CurPos = PosSrc;
	 CDisplay *ItemSrc = (CDisplay *)pList->GetNext(PosSrc);
	 POSITION PosDesc = m_DispList.GetHeadPosition();
	 while(PosDesc)
	 {
	  CDisplay *ItemDesc = (CDisplay *)m_DispList.GetNext(PosDesc);
	  if(ItemSrc->IsEqual(ItemDesc))
	  {//已经存在于第i个结果上
	   ItemSrc->SetNoteType(Cannot);
	   m_DispList.AddTail(ItemSrc);
	   pList->RemoveAt(CurPos);
	   break;
	  }
	 }
	}
}
Пример #16
0
void WebBrowserLauncher::ShowBlockUITip()
{
	CDisplay::CacheDisabler forceDraw;
	if(m_msgBoxTip)
	{
		SafeDeletePointer(m_msgBoxTip);
	}
	m_msgBoxTip = new UIMessageBox(GUISystem::GetInstance()->GetTopFullScreenContainer(), StringManager::GetStringById(WEBBROSER_START), MB_WITHOUTBTN);
	m_msgBoxTip->SetTipText(StringManager::GetStringById(WEBBROSER_START_TIP));
	m_msgBoxTip->SetEnableHookTouch(true);
	UIText* displayText = m_msgBoxTip->GetTextDisplay();
	displayText->SetAlign(ALIGN_CENTER);
	displayText->SetFontSize(GetWindowFontSize(FontSize24Index));

	UIText* tipText = m_msgBoxTip->GetTextTip();
	tipText->SetFontSize(GetWindowFontSize(FontSize16Index));
	tipText->SetAlign(ALIGN_CENTER);
    m_msgBoxTip->Popup();

	CDisplay* display = CDisplay::GetDisplay();
    display->ForceDraw(PAINT_FLAG_FULL);
}
Пример #17
0
bool Sprite::InitializeSpriteCopy(const Sprite* ref)
{
	if(!ref)
		return false;

	if(mImageAlloc)
		delete mFullImage;
	*this = *ref;
	TheDisplay.CreateSurfaceFromSurface(&mFullImage, ref->mFullImage);
	mFullImage->SetColorKey(0xFF00FF);
	mSurf = mFullImage->GetDDrawSurface();
	mImageAlloc = true;
	
	return true;
}
Пример #18
0
void CPanTool::OnLButtonUp(_CVIEW* pView, UINT nFlags, CPoint& point)
{
	CMiniCADDoc* pDoc = pView->GetDocument();
	if (pDoc==NULL)return;
	CADGraphics	*pGraphics = &pDoc->m_Graphics;
	CDisplay *pDisplay = pGraphics->m_pDisplay;
	if (pDisplay == NULL) return;
	double ddx,ddy;
	int dx,dy;
	dx = point.x - c_PtDown.x;
	dy = point.y - c_PtDown.y;
	if (pView->m_curWorkSpace==MODELSPACE)
	{
		ddx = dx/pDoc->m_Graphics.m_ZoomRate;
		ddy = dy/pDoc->m_Graphics.m_ZoomRate;
		pDoc->m_Graphics.m_Bound.Offset(-ddx,-ddy);
		pView->ReDraw();
	}
	else
	{
		CDC* pPaperDC=pDisplay->GetPaperDC();
		ddx = dx/pDoc->m_Graphics.m_ZoomRate;
		ddy = dy/pDoc->m_Graphics.m_ZoomRate;
		pDoc->m_Graphics.m_Bound.Offset(-ddx,-ddy);

		CPoint point1;
		point1 = pDoc->m_Graphics.DocToClient(pView->m_RotatePt);
		pDoc->m_Graphics.RotateAll(pDisplay->GetDC(),point1,-(int)pDoc->m_Graphics.m_RotateAngle);

		//pDoc->m_Graphics.DrawGraphics(m_pDisplay->GetDC());
		pPaperDC->BitBlt(pView->m_ModelRect.left,pView->m_ModelRect.top,pView->m_ModelRect.Width(),pView->m_ModelRect.Height(),pDisplay->GetDC(),0,0,SRCCOPY);	
		pView->Invalidate(false);			
	}
	
	CDrawTool::OnLButtonUp(pView, nFlags, point);
}
Пример #19
0
bool Sprite::Draw(CDisplay& displayref)
{
	if(!mSurf)
		return false;
	POINT pt;
	pt.x = (long)mXOrigin;
	pt.y = (long)mYOrigin;
	RECT copyfromrect = GetCurrentRectToDraw(displayref);
	if(pt.x < 0)
		pt.x = 0;
	if(pt.y < 0)
		pt.y = 0;
	displayref.ColorKeyBlt(pt.x, pt.y, mSurf, &copyfromrect);
	return true;
}
Пример #20
0
void DrawBulletsRemaining(Weapon* DrawMe, int timediff)
{
	Sprite* BulletSprite;
	Sprite* MySprite;
	Bullet* TheBullet;
	char* Name = "INVALID BULLETS";
	RECT Client;
	GetClientRect(TheDisplay.GetHWnd(), &Client);

	
	TheBullet = GetGlobalBulletData(DrawMe->mBulletID);
	if(!TheBullet)
		return;
	Name = TheBullet->mName;
	BulletSprite = GetGlobalSpriteData(TheBullet->mFullBulletSpriteID);
	if(!BulletSprite)
		return;

	MySprite = new Sprite;
	MySprite->InitializeSpriteCopy(BulletSprite);
	POINT FontOrigin;
	FontOrigin.x = Client.right - DrawMe->mMaxRounds * BulletSprite->GetWidth();
	int StrWidth = GetFontBySizeIndex(WEAPONSELECTOR_BULLET_FONT_ID)->GetStringWidth(Name);
	if(FontOrigin.x + StrWidth > Client.right)
		FontOrigin.x -= (FontOrigin.x + StrWidth) - Client.right + 20;
	FontOrigin.y = Client.bottom - BulletSprite->GetHeight() - GetFontBySizeIndex(WEAPONSELECTOR_BULLET_FONT_ID)->GetCharHeight() - 5;
	int FullWidth = DrawMe->mCurrentRounds * BulletSprite->GetWidth();
	if(FullWidth > Client.right - Client.left)
		return;
	GameWeaponSelector.BulletName->SetLoc(FontOrigin);
	GameWeaponSelector.BulletName->SetWidth(Client.right - Client.left);
	int FullHeight = BulletSprite->GetHeight();
	POINT Loc;
	Loc.x = Client.right - FullWidth;
	Loc.y = Client.bottom - FullHeight;
	for(int i = 0; i < DrawMe->mCurrentRounds; i++)
	{
		MySprite->SetLoc(Loc);
		MySprite->Draw(TheDisplay);
		Loc.x += BulletSprite->GetWidth();
	}
	GameWeaponSelector.BulletName->Update(timediff);
	GameWeaponSelector.BulletName->Draw(TheDisplay);
	delete MySprite;
}
Пример #21
0
void BriefingBox::Init()
{
	mBoxSprite.InitializeSpriteCopy(GetGlobalSpriteData(BRIEFINGBOX_SPRITE_NUMBER));
	mBoxSprite.SetDelay(800);
	RECT Client;
	GetClientRect(TheDisplay.GetHWnd(), &Client);
	mCenterToStop = ((Client.right - Client.left) / 2) - (mBoxSprite.GetWidth() / 2);
	int MaxLines = 10;
	Font* TheFont = GetFontBySizeIndex(BRIEFINGBOX_TEXT_FONTNUMBER);
	if(TheFont){
		int Height = (mBoxSprite.GetHeight() - BRIEFINGBOX_TEXT_BOTTOM) - BRIEFINGBOX_TEXT_YOFFSET;
		MaxLines = Height / TheFont->GetCharHeight();
	}
	mCenterToClose = mBoxSprite.GetWidth() * -1;
	mOrigin.y = ((Client.bottom - Client.top) / 2) - (mBoxSprite.GetHeight() / 2);
	mOrigin.x = mCenterToClose;
	mCurrentText.Initialize("TESTING!", mOrigin, 20, mBoxSprite.GetWidth() - (3 * BRIEFINGBOX_TEXT_XOFFSET), BRIEFINGBOX_TEXT_FONTNUMBER,
		BRIEFINGBOX_CURSOR_SPRITE_NUMBER, 80, -1, BRIEFINGBOX_CURSOR_SOUND_NUMBER, BRIEFINGBOX_CURSOR_ENDLINESOUND_NUMBER, MaxLines);
}
Пример #22
0
void CScrollerView::SetFrame(CFrame *frame, CPoint ofs)
{
  if(frame)
  {
    size = mSize;
    size.offset(-ofs.x, -ofs.y);
    // add this view to the frame
    frame->addView(this);
  }
  else
  {
    // remove this view from the current frame
    if(mFrame)
    {
      mFrame->removeView(this);
    }
  }
  mFrame = frame;
  mDisplay->SetFrame(frame,ofs,this);
}
Пример #23
0
bool Sprite::Initialize(CDisplay& displayref, char* BMPFile, int FullWidth, int FullHeight, int FrameWidth, int FrameHeight, int NumStates, int* StateFrames)
{
	if(!BMPFile)
		return false;
	if(FAILED(displayref.CreateSurfaceFromBitmap(&mFullImage, BMPFile, FullWidth, FullHeight)))
		return false;
	mFullHeight = FullHeight;
	mFullWidth = FullWidth;
	mFullImage->SetColorKey(0xFF00FF);
	mSurf = mFullImage->GetDDrawSurface();
	mImageAlloc = true;
	mFrameWidth = FrameWidth;
	mFrameHeight = FrameHeight;
	mNumStates = NumStates;
	if(NumStates > 0 && StateFrames){
		mStateFrames = new int[NumStates];
		for(int i = 0; i < NumStates; i++){
			mStateFrames[i] = StateFrames[i];
		}
	}
	return true;
}
Пример #24
0
void SpawnShellCasing(POINT spawn, Weapon* Weap)
{
	Bullet* TheBullet = GetGlobalBulletData(Weap->mBulletID);
	if(!TheBullet)
		return;
	BounceObject* SC = new BounceObject(*GetGlobalSoundData(TheBullet->mShellCasingBounceSoundID));
	RECT Client;
	GetClientRect(TheDisplay.GetHWnd(), &Client);
	SC->SetBounds(Client);
	SC->SetPhysics(true);
	SC->mGravity = 0.2;
	SC->mXSpeed = 15.5 + rand()%10; 
	SC->mYSpeed = -16.5 - rand()%10;
	SC->SetTimeToLive(rand()%200 + 800);
	SC->GetSprite()->InitializeSpriteCopy(GetGlobalSpriteData(TheBullet->mShellCasingGlobalGraphicsID));
	spawn.x -= SC->GetSprite()->GetWidth() / 2;
	spawn.y -= SC->GetSprite()->GetHeight() / 2;
	SC->GetSprite()->SetLoc(spawn);
	SC->GetSprite()->SetFrame(rand()%SC->GetSprite()->GetNumFramesInCurrentState());
	SC->GetSprite()->SetDelay(rand()%10 + 5);
	BounceObjectList.push_front(SC);
}
Пример #25
0
//////////////////////////////////
//GenerateChild: 生成子节点
// 返回值:生成子节点过程中的错误代码
//////////////////////////////////
UINT CMain::GenerateChild()
{
	List ChildList;
	int m=0;
	for(int k=0; k<4; k++)
	{
		if(m_iMoveFlag[k] == false) continue;
		CDisplay *Tmp;Tmp = new CDisplay;
		for(int i=0; i<MaxItem; i++)
		 for(int j=0; j<MaxItem; j++)
		  Tmp->LoadData(m_CurOpItem);
		 Tmp->SetCurrentG(m_CurrentG);
		 Tmp->SetCurrentCount(m++);
		 Tmp->SetNoteType(NotYet);
		 Tmp->MoveBlank(k);
		 ChildList.AddTail(Tmp);
	}
	return FindBestMoveFlag(&ChildList);
}
Пример #26
0
void UIVMPreviewWindow::sltRecreatePreview()
{
    /* Only do this if we are visible: */
    if (!isVisible())
        return;

    /* Remove preview if any: */
    if (m_pPreviewImg)
    {
        delete m_pPreviewImg;
        m_pPreviewImg = 0;
    }

    /* We are not creating preview for inaccessible VMs: */
    if (m_machineState == KMachineState_Null)
        return;

    if (!m_machine.isNull() && m_vRect.width() > 0 && m_vRect.height() > 0)
    {
        QImage image(size(), QImage::Format_ARGB32);
        image.fill(Qt::transparent);
        QPainter painter(&image);
        bool fDone = false;

        /* Preview enabled? */
        if (m_pUpdateTimer->interval() > 0)
        {
            /* Use the image which may be included in the save state. */
            if (   m_machineState == KMachineState_Saved
                || m_machineState == KMachineState_Restoring)
            {
                ULONG width = 0, height = 0;
                QVector<BYTE> screenData = m_machine.ReadSavedScreenshotPNGToArray(0, width, height);
                if (screenData.size() != 0)
                {
                    QImage shot = QImage::fromData(screenData.data(), screenData.size(), "PNG").scaled(m_vRect.size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
                    dimImage(shot);
                    painter.drawImage(m_vRect.x(), m_vRect.y(), shot);
                    fDone = true;
                }
            }
            /* Use the current VM output. */
            else if (   m_machineState == KMachineState_Running
//                      || m_machineState == KMachineState_Saving /* Not sure if this is valid */
                     || m_machineState == KMachineState_Paused)
            {
                if (m_session.GetState() == KSessionState_Locked)
                {
                    CVirtualBox vbox = vboxGlobal().virtualBox();
                    if (vbox.isOk())
                    {
                        const CConsole& console = m_session.GetConsole();
                        if (!console.isNull())
                        {
                            CDisplay display = console.GetDisplay();
                            /* Todo: correct aspect radio */
//                            ULONG w, h, bpp;
//                            display.GetScreenResolution(0, w, h, bpp);
//                            QImage shot = QImage(w, h, QImage::Format_RGB32);
//                            shot.fill(Qt::black);
//                            display.TakeScreenShot(0, shot.bits(), shot.width(), shot.height());
                            QVector<BYTE> screenData = display.TakeScreenShotToArray(0, m_vRect.width(), m_vRect.height());
                            if (   display.isOk()
                                && screenData.size() != 0)
                            {
                                /* Unfortunately we have to reorder the pixel
                                 * data, cause the VBox API returns RGBA data,
                                 * which is not a format QImage understand.
                                 * Todo: check for 32bit alignment, for both
                                 * the data and the scanlines. Maybe we need to
                                 * copy the data in any case. */
                                uint32_t *d = (uint32_t*)screenData.data();
                                for (int i = 0; i < screenData.size() / 4; ++i)
                                {
                                    uint32_t e = d[i];
                                    d[i] = RT_MAKE_U32_FROM_U8(RT_BYTE3(e), RT_BYTE2(e), RT_BYTE1(e), RT_BYTE4(e));
                                }

                                QImage shot = QImage((uchar*)d, m_vRect.width(), m_vRect.height(), QImage::Format_RGB32);

                                if (m_machineState == KMachineState_Paused)
                                    dimImage(shot);
                                painter.drawImage(m_vRect.x(), m_vRect.y(), shot);
                                fDone = true;
                            }
                        }
                    }
                }
            }
        }
        if (fDone)
            m_pPreviewImg = new QImage(image);
    }
    update();
}
Пример #27
0
void CMainFrame::OnViewDisplaysetup() 
{
	// TODO: Add your command handler code here
	CDisplay* pDisplay = new CDisplay;

	CMCPforNTApp* pApp = (CMCPforNTApp*)AfxGetApp();
	
	pDisplay->m_axisblue		= pApp->GetProfileInt("Display","axisblue",		0);
	pDisplay->m_axisgreen		= pApp->GetProfileInt("Display","axisgreen",	0);
	pDisplay->m_axisred			= pApp->GetProfileInt("Display","axisred",		0);
	pDisplay->m_axislines		= pApp->GetProfileInt("Display","axislines",	4);
	pDisplay->m_axistext		= pApp->GetProfileInt("Display","axistext",		32);
	pDisplay->m_datablue		= pApp->GetProfileInt("Display","datablue",		0);
	pDisplay->m_datared			= pApp->GetProfileInt("Display","datared",		0);
	pDisplay->m_datagreen		= pApp->GetProfileInt("Display","datagreen",	0);
	pDisplay->m_datalines		= pApp->GetProfileInt("Display","datalines",	2);
	pDisplay->m_dataxmax		= pApp->GetProfileInt("Display","dataxmax",		980);
	pDisplay->m_dataxmin		= pApp->GetProfileInt("Display","dataxmin",		100);
	pDisplay->m_dataymax		= pApp->GetProfileInt("Display","dataymax",		900);
	pDisplay->m_dataymin		= pApp->GetProfileInt("Display","dataymin",		20);
	pDisplay->m_errorbars		= pApp->GetProfileInt("Display","errorbars",	5);
	pDisplay->m_fitblue			= pApp->GetProfileInt("Display","fitblue",		250);
	pDisplay->m_fitgreen		= pApp->GetProfileInt("Display","fitgreen",		0);
	pDisplay->m_fitred			= pApp->GetProfileInt("Display","fitred",		0);
	pDisplay->m_fitfunres		= pApp->GetProfileInt("Display","fitfunres",	250);
	pDisplay->m_fitlines		= pApp->GetProfileInt("Display","fitlines",		2);
	pDisplay->m_halfticklenx	= pApp->GetProfileInt("Display","halfticklenx",	8);
	pDisplay->m_numbers			= pApp->GetProfileInt("Display","numbers",		28);
	pDisplay->m_points			= pApp->GetProfileInt("Display","points",		5);
	pDisplay->m_selectblue		= pApp->GetProfileInt("Display","selectblue",	0);
	pDisplay->m_selectgreen		= pApp->GetProfileInt("Display","selectgreen",	0);
	pDisplay->m_halftickleny	= pApp->GetProfileInt("Display","halftickleny",	5);
	pDisplay->m_selectred		= pApp->GetProfileInt("Display","selectred",	250);
	pDisplay->m_textblue		= pApp->GetProfileInt("Display","textblue",		0);
	pDisplay->m_textgreen		= pApp->GetProfileInt("Display","textgreen",	0);
	pDisplay->m_textred			= pApp->GetProfileInt("Display","textred",		0);
	pDisplay->m_ticklabelsx		= pApp->GetProfileInt("Display","ticklabelsx",	905);
	pDisplay->m_ticklabelsy		= pApp->GetProfileInt("Display","ticklabelsy",	95);
	pDisplay->m_ticklenx		= pApp->GetProfileInt("Display","ticklenx",		15);
	pDisplay->m_tickleny		= pApp->GetProfileInt("Display","tickleny",		10);
	pDisplay->m_ticklines		= pApp->GetProfileInt("Display","ticklines",	3);
	pDisplay->m_titleposx		= pApp->GetProfileInt("Display","titleposx",	500);
	pDisplay->m_titleposy		= pApp->GetProfileInt("Display","titleposy",	100);
	pDisplay->m_xaxistitlex		= pApp->GetProfileInt("Display","xaxistitlex",	500);
	pDisplay->m_xaxistitley		= pApp->GetProfileInt("Display","xaxistitley",	970);
	pDisplay->m_yaxistitlex		= pApp->GetProfileInt("Display","yaxistitlex",	30);
	pDisplay->m_yaxistitley		= pApp->GetProfileInt("Display","yaxistitley",	500);

	pDisplay->m_autolsi			= pApp->GetProfileInt("Display","autolsi",		TRUE);
	pDisplay->m_autoplot		= pApp->GetProfileInt("Display","autoplot",		TRUE);
	pDisplay->m_automonitor		= pApp->GetProfileInt("Display","automonitor",	FALSE);
	pDisplay->m_autoscript		= pApp->GetProfileInt("Display","autoscript",	TRUE);
	pDisplay->m_autotemplate	= pApp->GetProfileInt("Display","autotemplate",	TRUE);
	
	pDisplay->m_backblue		= pApp->GetProfileInt("Display","backblue",		255);
	pDisplay->m_backgreen		= pApp->GetProfileInt("Display","backgreen",	255);
	pDisplay->m_backred			= pApp->GetProfileInt("Display","backred",		255);
	
	pDisplay->m_numberblue		= pApp->GetProfileInt("Display","numberblue",	0);
	pDisplay->m_numbergreen		= pApp->GetProfileInt("Display","numbergreen",	0);
	pDisplay->m_numberred		= pApp->GetProfileInt("Display","numberred",	0);

	pDisplay->m_lsidx			= pApp->GetProfileInt("Display","lsidx",		500);
	pDisplay->m_lsidy			= pApp->GetProfileInt("Display","lsidy",		300);
	pDisplay->m_lsix			= pApp->GetProfileInt("Display","lsix",			100);
	pDisplay->m_lsiy			= pApp->GetProfileInt("Display","lsiy",			100);

	pDisplay->m_plotdx			= pApp->GetProfileInt("Display","plotdx",		600);
	pDisplay->m_plotdy			= pApp->GetProfileInt("Display","plotdy",		400);
	pDisplay->m_plotx			= pApp->GetProfileInt("Display","plotx",		300);
	pDisplay->m_ploty			= pApp->GetProfileInt("Display","ploty",		10);

	pDisplay->m_monitordx		= pApp->GetProfileInt("Display","monitordx",	600);
	pDisplay->m_monitordy		= pApp->GetProfileInt("Display","monitordy",	400);
	pDisplay->m_monitorx		= pApp->GetProfileInt("Display","monitorx",		300);
	pDisplay->m_monitory		= pApp->GetProfileInt("Display","monitory",		10);

	pDisplay->m_scriptdx		= pApp->GetProfileInt("Display","scriptdx",		550);
	pDisplay->m_scriptdy		= pApp->GetProfileInt("Display","scriptdy",		500);
	pDisplay->m_scriptx			= pApp->GetProfileInt("Display","scriptx",		300);
	pDisplay->m_scripty			= pApp->GetProfileInt("Display","scripty",		100);

	pDisplay->m_templatedx		= pApp->GetProfileInt("Display","templatedx",	335);
	pDisplay->m_templatedy		= pApp->GetProfileInt("Display","templatedy",	350);
	pDisplay->m_templatex		= pApp->GetProfileInt("Display","templatex",	30);
	pDisplay->m_templatey		= pApp->GetProfileInt("Display","templatey",	30);

	if(IDOK == pDisplay->DoModal())
	{	
		pApp->WriteProfileInt("Display","axisblue",		pDisplay->m_axisblue);
		pApp->AxisBlue		= pDisplay->m_axisblue;
		pApp->WriteProfileInt("Display","axisgreen",	pDisplay->m_axisgreen);
		pApp->AxisGreen		= pDisplay->m_axisgreen;
		pApp->WriteProfileInt("Display","axisred",		pDisplay->m_axisred);
		pApp->AxisRed		= pDisplay->m_axisred;
		pApp->WriteProfileInt("Display","axislines",	pDisplay->m_axislines);
		pApp->AxisLine		= (float)pDisplay->m_axislines/1000;
		pApp->WriteProfileInt("Display","axistext",		pDisplay->m_axistext);
		pApp->AxisTextSize	= (float)pDisplay->m_axistext/1000;
		pApp->WriteProfileInt("Display","datablue",		pDisplay->m_datablue);
		pApp->DataBlue		= pDisplay->m_datablue;
		pApp->WriteProfileInt("Display","datared",		pDisplay->m_datared);
		pApp->DataGreen		= pDisplay->m_datagreen;
		pApp->WriteProfileInt("Display","datagreen",	pDisplay->m_datagreen);
		pApp->DataRed		= pDisplay->m_datared;
		pApp->WriteProfileInt("Display","datalines",	pDisplay->m_datalines);
		pApp->DataLine		= (float)pDisplay->m_datalines/1000;
		pApp->WriteProfileInt("Display","dataxmax",		pDisplay->m_dataxmax);
		pApp->DataxMax		= (float)pDisplay->m_dataxmax/1000;
		pApp->WriteProfileInt("Display","dataxmin",		pDisplay->m_dataxmin);
		pApp->DataxMin		= (float)pDisplay->m_dataxmin/1000;
		pApp->WriteProfileInt("Display","dataymax",		pDisplay->m_dataymax);
		pApp->DatayMax		= (float)pDisplay->m_dataymax/1000;
		pApp->WriteProfileInt("Display","dataymin",		pDisplay->m_dataymin);
		pApp->DatayMin		= (float)pDisplay->m_dataymin/1000;
		pApp->WriteProfileInt("Display","errorbars",	pDisplay->m_errorbars);
		pApp->ErrorBarSize	= (float)pDisplay->m_errorbars/1000;
		pApp->WriteProfileInt("Display","fitblue",		pDisplay->m_fitblue);
		pApp->FitBlue		= pDisplay->m_fitblue;
		pApp->WriteProfileInt("Display","fitgreen",		pDisplay->m_fitgreen);
		pApp->FitGreen		= pDisplay->m_fitgreen;
		pApp->WriteProfileInt("Display","fitred",		pDisplay->m_fitred);
		pApp->FitRed		= pDisplay->m_fitred;
		pApp->WriteProfileInt("Display","fitfunres",	pDisplay->m_fitfunres);
		pApp->FitFunRes		= pDisplay->m_fitfunres;
		pApp->WriteProfileInt("Display","fitlines",		pDisplay->m_fitlines);
		pApp->FitFunc		= (float)pDisplay->m_fitlines/1000;
		pApp->WriteProfileInt("Display","halfticklenx",	pDisplay->m_halfticklenx);
		pApp->HalfTickLenX	= (float)pDisplay->m_halfticklenx/1000;
		pApp->WriteProfileInt("Display","numbers",		pDisplay->m_numbers);
		pApp->NumberSize	= (float)pDisplay->m_numbers/1000;
		pApp->WriteProfileInt("Display","points",		pDisplay->m_points);
		pApp->PointSize		= (float)pDisplay->m_points/1000;
		pApp->WriteProfileInt("Display","selectblue",	pDisplay->m_selectblue);
		pApp->SelectBlue	= pDisplay->m_selectblue;
		pApp->WriteProfileInt("Display","selectgreen",	pDisplay->m_selectgreen);
		pApp->SelectGreen	= pDisplay->m_selectgreen;
		pApp->WriteProfileInt("Display","selectred",	pDisplay->m_selectred);
		pApp->SelectRed		= pDisplay->m_selectred;
		pApp->WriteProfileInt("Display","textblue",		pDisplay->m_textblue);
		pApp->TextBlue		= pDisplay->m_textblue;
		pApp->WriteProfileInt("Display","textgreen",	pDisplay->m_textgreen);
		pApp->TextGreen		= pDisplay->m_textgreen;
		pApp->WriteProfileInt("Display","textred",		pDisplay->m_textred);
		pApp->TextRed		= pDisplay->m_textred;
		pApp->WriteProfileInt("Display","halftickleny",	pDisplay->m_halftickleny);
		pApp->HalfTickLenY	= (float)pDisplay->m_halftickleny/1000;
		pApp->WriteProfileInt("Display","ticklabelsx",	pDisplay->m_ticklabelsx);
		pApp->TickLabelsX	= (float)pDisplay->m_ticklabelsx/1000;
		pApp->WriteProfileInt("Display","ticklabelsy",	pDisplay->m_ticklabelsy);
		pApp->TickLabelsY	= (float)pDisplay->m_ticklabelsy/1000;
		pApp->WriteProfileInt("Display","ticklenx",		pDisplay->m_ticklenx);
		pApp->TickLenX		= (float)pDisplay->m_ticklenx/1000;
		pApp->WriteProfileInt("Display","tickleny",		pDisplay->m_tickleny);
		pApp->TickLenY		= (float)pDisplay->m_tickleny/1000;
		pApp->WriteProfileInt("Display","ticklines",	pDisplay->m_ticklines);
		pApp->TickLine		= (float)pDisplay->m_ticklines/1000;
		pApp->WriteProfileInt("Display","titleposx",	pDisplay->m_titleposx);
		pApp->MainTitleX	= (float)pDisplay->m_titleposx/1000;
		pApp->WriteProfileInt("Display","titleposy",	pDisplay->m_titleposy);
		pApp->MainTitleY	= (float)pDisplay->m_titleposy/1000;
		pApp->WriteProfileInt("Display","xaxistitlex",	pDisplay->m_xaxistitlex);
		pApp->XTitleX		= (float)pDisplay->m_xaxistitlex/1000;
		pApp->WriteProfileInt("Display","xaxistitley",	pDisplay->m_xaxistitley);
		pApp->XTitleY		= (float)pDisplay->m_xaxistitley/1000;
		pApp->WriteProfileInt("Display","yaxistitlex",	pDisplay->m_yaxistitlex);
		pApp->YTitleX		= (float)pDisplay->m_yaxistitlex/1000;
		pApp->WriteProfileInt("Display","yaxistitley",	pDisplay->m_yaxistitley);
		pApp->YTitleY		= (float)pDisplay->m_yaxistitley/1000;

		pApp->WriteProfileInt("Display","autolsi",pDisplay->m_autolsi);
		pApp->WriteProfileInt("Display","autoplot",pDisplay->m_autoplot);
		pApp->WriteProfileInt("Display","automonitor",pDisplay->m_automonitor);
		pApp->WriteProfileInt("Display","autoscript",pDisplay->m_autoscript);
		pApp->WriteProfileInt("Display","autotemplate",pDisplay->m_autotemplate);
	
		pApp->WriteProfileInt("Display","backblue",pDisplay->m_backblue);
		pApp->WriteProfileInt("Display","backgreen",pDisplay->m_backgreen);
		pApp->WriteProfileInt("Display","backred",pDisplay->m_backred);
	
		pApp->WriteProfileInt("Display","numberblue",pDisplay->m_numberblue);
		pApp->WriteProfileInt("Display","numbergreen",pDisplay->m_numbergreen);
		pApp->WriteProfileInt("Display","numberred",pDisplay->m_numberred);

		pApp->WriteProfileInt("Display","lsidx",pDisplay->m_lsidx);	
		pApp->WriteProfileInt("Display","lsidy",	pDisplay->m_lsidy);
		pApp->WriteProfileInt("Display","lsix",pDisplay->m_lsix);
		pApp->WriteProfileInt("Display","lsiy",pDisplay->m_lsiy);

		pApp->WriteProfileInt("Display","plotdx",pDisplay->m_plotdx);
		pApp->WriteProfileInt("Display","plotdy",pDisplay->m_plotdy);
		pApp->WriteProfileInt("Display","plotx",pDisplay->m_plotx	);
		pApp->WriteProfileInt("Display","ploty",	pDisplay->m_ploty);

		pApp->WriteProfileInt("Display","monitordx",pDisplay->m_monitordx);
		pApp->WriteProfileInt("Display","monitordy",pDisplay->m_monitordy);
		pApp->WriteProfileInt("Display","monitorx",pDisplay->m_monitorx	);
		pApp->WriteProfileInt("Display","monitory",	pDisplay->m_monitory);

		pApp->WriteProfileInt("Display","scriptdx",pDisplay->m_scriptdx);
		pApp->WriteProfileInt("Display","scriptdy",pDisplay->m_scriptdy);
		pApp->WriteProfileInt("Display","scriptx",pDisplay->m_scriptx);	
		pApp->WriteProfileInt("Display","scripty",pDisplay->m_scripty);	

		pApp->WriteProfileInt("Display","templatedx",pDisplay->m_templatedx);
		pApp->WriteProfileInt("Display","templatedy",pDisplay->m_templatedy);
		pApp->WriteProfileInt("Display","templatex",pDisplay->m_templatex);	
		pApp->WriteProfileInt("Display","templatey",pDisplay->m_templatey);
		
		pApp->AutoLsi		= pDisplay->m_autolsi;
		pApp->AutoPlot		= pDisplay->m_autoplot;
		pApp->AutoMonitor	= pDisplay->m_automonitor;
		pApp->AutoScript	= pDisplay->m_autoscript;
		pApp->AutoTemplate	= pDisplay->m_autotemplate;
	
		pApp->BackBlue		= pDisplay->m_backblue;
		pApp->BackGreen		= pDisplay->m_backgreen;
		pApp->BackRed		= pDisplay->m_backred;
	
		pApp->NumberBlue	= pDisplay->m_numberblue;
		pApp->NumberGreen	= pDisplay->m_numbergreen;
		pApp->NumberRed		= pDisplay->m_numberred;

		pApp->LsiDx			= pDisplay->m_lsidx;	
		pApp->LsiDy			= pDisplay->m_lsidy;
		pApp->LsiX			= pDisplay->m_lsix;
		pApp->LsiY			= pDisplay->m_lsiy;

		pApp->PlotDx		= pDisplay->m_plotdx;
		pApp->PlotDy		= pDisplay->m_plotdy;
		pApp->PlotX			= pDisplay->m_plotx;
		pApp->PlotY			= pDisplay->m_ploty;

		pApp->MonitorDx		= pDisplay->m_monitordx;
		pApp->MonitorDy		= pDisplay->m_monitordy;
		pApp->MonitorX		= pDisplay->m_monitorx;
		pApp->MonitorY		= pDisplay->m_monitory;

		pApp->ScriptDx		= pDisplay->m_scriptdx;
		pApp->ScriptDy		= pDisplay->m_scriptdy;
		pApp->ScriptX		= pDisplay->m_scriptx;	
		pApp->ScriptY		= pDisplay->m_scripty;	

		pApp->TemplateDx	= pDisplay->m_templatedx;
		pApp->TemplateDy	= pDisplay->m_templatedy;
		pApp->TemplateX		= pDisplay->m_templatex;	
		pApp->TemplateY		= pDisplay->m_templatey;
	}
	delete pDisplay;
	

}
Пример #28
0
void UIMultiScreenLayout::update()
{
    LogRelFlow(("UIMultiScreenLayout::update: Started...\n"));

    /* Clear screen-map initially: */
    m_screenMap.clear();

    /* Make a pool of available host screens: */
    QList<int> availableScreens;
    for (int i = 0; i < m_cHostScreens; ++i)
        availableScreens << i;

    /* Load all combinations stored in the settings file.
     * We have to make sure they are valid, which means there have to be unique combinations
     * and all guests screens need there own host screen. */
    CMachine machine = m_pMachineLogic->session().GetMachine();
    CDisplay display = m_pMachineLogic->session().GetConsole().GetDisplay();
    bool fShouldWeAutoMountGuestScreens = VBoxGlobal::shouldWeAutoMountGuestScreens(machine, false);
    LogRelFlow(("UIMultiScreenLayout::update: GUI/AutomountGuestScreens is %s.\n", fShouldWeAutoMountGuestScreens ? "enabled" : "disabled"));
    QDesktopWidget *pDW = QApplication::desktop();
    foreach (int iGuestScreen, m_guestScreens)
    {
        /* Initialize variables: */
        bool fValid = false;
        int iHostScreen = -1;

        if (!fValid)
        {
            /* If the user ever selected a combination in the view menu, we have the following entry: */
            QString strTest = machine.GetExtraData(QString("%1%2").arg(GUI_VirtualScreenToHostScreen).arg(iGuestScreen));
            bool fOk;
            /* Check is this value can be converted: */
            iHostScreen = strTest.toInt(&fOk);
            /* Revalidate: */
            fValid =    fOk /* Valid data */
                     && iHostScreen >= 0 && iHostScreen < m_cHostScreens /* In the host screen bounds? */
                     && m_screenMap.key(iHostScreen, -1) == -1; /* Not taken already? */
        }

        if (!fValid)
        {
            /* Check the position of the guest window in normal mode.
             * This makes sure that on first use the window opens on the same screen as the normal window was before.
             * This even works with multi-screen. The user just have to move all the normal windows to the target screens
             * and they will magically open there in seamless/fullscreen also. */
            QString strTest1 = machine.GetExtraData(GUI_LastNormalWindowPosition + (iGuestScreen > 0 ? QString::number(iGuestScreen): ""));
            QRegExp posParser("(-?\\d+),(-?\\d+),(-?\\d+),(-?\\d+)");
            if (posParser.exactMatch(strTest1))
            {
                /* If parsing was successfully, convert it to a position: */
                bool fOk1, fOk2;
                QPoint p(posParser.cap(1).toInt(&fOk1), posParser.cap(2).toInt(&fOk2));
                /* Check to which screen the position belongs: */
                iHostScreen = pDW->screenNumber(p);
                /* Revalidate: */
                fValid =    fOk1 && fOk2 /* Valid data */
                         && iHostScreen >= 0 && iHostScreen < m_cHostScreens /* In the host screen bounds? */
                         && m_screenMap.key(iHostScreen, -1) == -1; /* Not taken already? */
            }
        }

        if (!fValid)
        {
            /* If still not valid, pick the next one
             * if there is still available host screen: */
            if (!availableScreens.isEmpty())
            {
                iHostScreen = availableScreens.first();
                fValid = true;
            }
        }

        if (fValid)
        {
            /* Register host screen for the guest screen: */
            m_screenMap.insert(iGuestScreen, iHostScreen);
            /* Remove it from the list of available host screens: */
            availableScreens.removeOne(iHostScreen);
        }
        /* Do we have opinion about what to do with excessive guest-screen? */
        else if (fShouldWeAutoMountGuestScreens)
        {
            /* Then we have to disable excessive guest-screen: */
            LogRelFlow(("UIMultiScreenLayout::update: Disabling excessive guest-screen %d.\n", iGuestScreen));
            display.SetVideoModeHint(iGuestScreen, false, false, 0, 0, 0, 0, 0);
        }
    }
void UIMultiScreenLayout::update()
{
    LogRelFlow(("UIMultiScreenLayout::update: Started...\n"));

    /* Clear screen-map initially: */
    m_screenMap.clear();

    /* Make a pool of available host screens: */
    QList<int> availableScreens;
    for (int i = 0; i < m_cHostScreens; ++i)
        availableScreens << i;

    /* Load all combinations stored in the settings file.
     * We have to make sure they are valid, which means there have to be unique combinations
     * and all guests screens need there own host screen. */
    CDisplay display = m_pMachineLogic->session().GetConsole().GetDisplay();
    bool fShouldWeAutoMountGuestScreens = gEDataManager->autoMountGuestScreensEnabled(vboxGlobal().managedVMUuid());
    LogRel(("GUI: UIMultiScreenLayout::update: GUI/AutomountGuestScreens is %s\n", fShouldWeAutoMountGuestScreens ? "enabled" : "disabled"));
    foreach (int iGuestScreen, m_guestScreens)
    {
        /* Initialize variables: */
        bool fValid = false;
        int iHostScreen = -1;

        if (!fValid)
        {
            /* If the user ever selected a combination in the view menu, we have the following entry: */
            iHostScreen = gEDataManager->hostScreenForPassedGuestScreen(iGuestScreen, vboxGlobal().managedVMUuid());
            /* Revalidate: */
            fValid =    iHostScreen >= 0 && iHostScreen < m_cHostScreens /* In the host screen bounds? */
                     && m_screenMap.key(iHostScreen, -1) == -1; /* Not taken already? */
        }

        if (!fValid)
        {
            /* Check the position of the guest window in normal mode.
             * This makes sure that on first use fullscreen/seamless window opens on the same host-screen as the normal window was before.
             * This even works with multi-screen. The user just have to move all the normal windows to the target host-screens
             * and they will magically open there in fullscreen/seamless also. */
            QRect geo = gEDataManager->machineWindowGeometry(UIVisualStateType_Normal, iGuestScreen, vboxGlobal().managedVMUuid());
            /* If geometry is valid: */
            if (!geo.isNull())
            {
                /* Get top-left corner position: */
                QPoint topLeftPosition(geo.topLeft());
                /* Check which host-screen the position belongs to: */
                iHostScreen = vboxGlobal().screenNumber(topLeftPosition);
                /* Revalidate: */
                fValid =    iHostScreen >= 0 && iHostScreen < m_cHostScreens /* In the host screen bounds? */
                         && m_screenMap.key(iHostScreen, -1) == -1; /* Not taken already? */
            }
        }

        if (!fValid)
        {
            /* If still not valid, pick the next one
             * if there is still available host screen: */
            if (!availableScreens.isEmpty())
            {
                iHostScreen = availableScreens.first();
                fValid = true;
            }
        }

        if (fValid)
        {
            /* Register host screen for the guest screen: */
            m_screenMap.insert(iGuestScreen, iHostScreen);
            /* Remove it from the list of available host screens: */
            availableScreens.removeOne(iHostScreen);
        }
        /* Do we have opinion about what to do with excessive guest-screen? */
        else if (fShouldWeAutoMountGuestScreens)
        {
            /* Then we have to disable excessive guest-screen: */
            LogRel(("GUI: UIMultiScreenLayout::update: Disabling excessive guest-screen %d\n", iGuestScreen));
            display.SetVideoModeHint(iGuestScreen, false, false, 0, 0, 0, 0, 0);
        }
    }
Пример #30
0
void CRectTool::OnLButtonDown(_CVIEW * pView, UINT nFlags, CPoint& point)
{
    CDC* pDC = NULL;
    pDC = pView->GetDC();
    if (pDC == NULL) return;
    CMiniCADDoc* pDoc = pView->GetDocument();
    if (pDoc==NULL)return;
    CADGraphics	*pGraphics = &pDoc->m_Graphics;
    CDisplay *pDisplay = pGraphics->m_pDisplay;
    if (pDisplay == NULL) return;

    if (c_nDown==0)
    {
///		c_PtDown=point;
        CPen Pen;
        if (!Pen.CreatePen(PS_SOLID, 1, RGB(255,255,255)))
            return;
        CPen* pOldPen = pDC->SelectObject(&Pen);
        LOGBRUSH logBrush;
        logBrush.lbColor = 0;
        logBrush.lbHatch = 0;
        logBrush.lbStyle = BS_NULL;
        CBrush NullBrush;
        NullBrush.CreateBrushIndirect(&logBrush);
        CBrush* pOldBrush = pDC->SelectObject(&NullBrush);

        int oldDrawMode = pDC->SetROP2(R2_XORPEN);

        pView->m_pTempEntity=new CADPolyline();
        CADPolyline* pPolyline=(CADPolyline*)pView->m_pTempEntity;
        pView->SetProjectLineWidth(pPolyline);
        pPolyline->m_nLayer=pDoc->m_LayerGroup.indexOf(pDoc->m_curLayer);
        pPolyline->m_Closed=true;
        if(c_bSnap && pDoc->m_Graphics.m_bHaveSnap)
        {
            ADPOINT* pPoint=new ADPOINT();
            *pPoint = pDoc->m_Graphics.m_curSnapP;
            pPolyline->m_Point.Add((CObject*)pPoint);
            c_PtDown = pDoc->m_Graphics.DocToClient(pDoc->m_Graphics.m_curSnapP);
            c_PtOld = point;
        } else
        {
            ADPOINT* pPoint=new ADPOINT();
            *pPoint = pDoc->m_Graphics.ClientToDoc(point);
            pPolyline->m_Point.Add((CObject*)pPoint);
            c_PtDown = point;
            c_PtOld = point;
        }
        pDC->Rectangle(point.x,point.y,point.x,point.y);
        pDC->SetROP2(oldDrawMode);
        pDC->SelectObject(pOldPen);
        pDC->SelectObject(pOldBrush);
        Pen.DeleteObject();
    }
    if (c_nDown<2)
        c_nDown++;
    if (c_nDown==2)
    {
        c_nDown=0;
        ADPOINT adPoint;
        if (c_bSnap && pDoc->m_Graphics.m_bHaveSnap)
        {
            adPoint=pDoc->m_Graphics.m_curSnapP;
        } else
        {

            adPoint=pDoc->m_Graphics.ClientToDoc(point);
        }
        CADPolyline* pPolyline=(CADPolyline*)pView->m_pTempEntity;
        ADPOINT* pPoint1=(ADPOINT*)pPolyline->m_Point.GetAt(0);
        ADPOINT* pPoint=new ADPOINT();
        pPoint->x = adPoint.x;
        pPoint->y = pPoint1->y;
        pPolyline->m_Point.Add((CObject*)pPoint);
        pPoint=new ADPOINT();
        *pPoint = adPoint;
        pPolyline->m_Point.Add((CObject*)pPoint);
        pPoint=new ADPOINT();
        pPoint->x = pPoint1->x;
        pPoint->y = adPoint.y;
        pPolyline->m_Point.Add((CObject*)pPoint);
        pDoc->m_Graphics.m_Entities.Add((CObject*)pPolyline);
        pDoc->m_Graphics.DrawGraphics(pDisplay->GetDC(),pView->m_pTempEntity);
        pView->m_pTempEntity=NULL;
        pView->ReBitBlt();
    }
    DeleteDC(pDC->m_hDC);
    //CDrawTool::OnLButtonDown(pView, nFlags, point);
}