Example #1
0
CEGPaneBar::CEGPaneBar(void)
{
	m_curHorzDrag = AfxGetApp()->LoadCursor(AFX_IDC_HSPLITBAR); // sometime fails .. 
	m_curVertDrag = AfxGetApp()->LoadCursor(AFX_IDC_VSPLITBAR); // sometime fails .. 
	m_hPane = NULL;
	m_bDragging = FALSE;
	m_pszCaption = NULL;

	m_fntCaption = NULL;
	HFONT hFont = (HFONT) GetStockObject( DEFAULT_GUI_FONT );
	if ( NULL != hFont ) {
		LOGFONT lf;
		if ( GetObject( hFont, sizeof( LOGFONT), &lf ) ) {
//			lf.lfWeight = FW_BOLD;
			m_fntCaption = ::CreateFontIndirect( &lf );
		}
	}
    
    CFont font;
	HDC hdc = ::GetDC( NULL );
	int ppi = ::GetDeviceCaps( hdc, LOGPIXELSX);
	::ReleaseDC ( NULL, hdc );
	int pointsize = MulDiv(  80 , 96, ppi); // 6 points at 96 ppi
    font.CreatePointFont( pointsize , _T("Marlett"));
	m_fntXButton = (HFONT) font.Detach();

	m_bClosePressed = FALSE;
	m_bCloseHover = FALSE;
	
	m_bActive = FALSE;

}
Example #2
0
void CCaptionView::OnDraw(CDC* pDC)
{
	CDocument* pDoc = GetDocument();
	// TODO: add draw code here	
	CRect rect;
	GetClientRect(rect);	
	// Andere Backroundfarbe einstellen
	CBrush Brush(GetSysColor(COLOR_BTNFACE));
	CBrush *poldBrush = pDC -> SelectObject(&Brush);
	// Anderen Font einstellen
	CFont Font;	Font.Attach ((HFONT)GetStockObject (ANSI_VAR_FONT));
	CFont* pFontOld = pDC -> SelectObject(&Font);
	Font.Detach();

	// WindowRect füllen	
	pDC -> FillRect(rect, &Brush);						
	// Backroundfarbe für Text setzen
	pDC -> SetBkColor(GetSysColor(COLOR_BTNFACE));		
	// Text setzen
	pDC	-> DrawText	(m_strCaption, -1, rect, 
				DT_LEFT | DT_VCENTER | DT_SINGLELINE);		
	// Rücksetzen der alten Objekte
	pDC -> SelectObject(&poldBrush);
	pDC -> SelectObject(&pFontOld);
}
void CGumpListView::OnInitialUpdate()
{
	CListView::OnInitialUpdate();
	if (m_bInit) return;
	m_bInit = true;

	LoadGumpDesc(GUMP_DESC_FILE);

	CListCtrl& ctrl = GetListCtrl();

	ctrl.ModifyStyle(0, LVS_REPORT|LVS_SINGLESEL|LVS_SHOWSELALWAYS);
	ctrl.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);

	LOGFONT lf;
	memset(&lf, 0, sizeof(lf));
	HGDIOBJ hFont = ::GetStockObject(OEM_FIXED_FONT);
	::GetObject(hFont, sizeof(lf), &lf);

	lf.lfHeight = 100;
	lf.lfPitchAndFamily = FIXED_PITCH;

	CFont font;

	font.CreatePointFontIndirect(&lf);

	ctrl.SetFont(&font);
	font.Detach();

	ctrl.InsertColumn(0, "Gump ID", LVCFMT_RIGHT,60);
	ctrl.InsertColumn(1, "Size",	LVCFMT_RIGHT,60);
	ctrl.InsertColumn(2, "Desc",	LVCFMT_LEFT,100);

	CString strText;
	cGumpLoader* pGumpLoader = GetDocument()->GetGumpLoader(); ASSERT(pGumpLoader);

	int w=0,h=0,iItem=0;
	for (int i = 0; i < pGumpLoader->GetGumpCount(); i++)
	{
		pGumpLoader->GetGumpSize(i, w, h);
		if (w==0 || h==0) continue;
		
		strText.Format("0x%04X", i);
		iItem = ctrl.InsertItem(i, strText);
		strText.Format("%dx%d", w,h);
		ctrl.SetItemText(iItem, 1, strText);
		ctrl.SetItemData(iItem, i);

		LPCTSTR desc = GetGumpDesc(i);
		if (desc)
			ctrl.SetItemText(iItem, 2, desc);

		//if (i > 100) break;
	}
	
}
Example #4
0
void CRaster::setNewFont()
    {
     if(!initialized)
        return;

     CString newname;

     c_Fonts.GetWindowText(newname);  // get new font name

     CFont * font = c_Sample.GetFont();

     if(font == NULL)                                               // REQ #052
         font = CFont::FromHandle((HFONT)::GetStockObject(SYSTEM_FONT));// REQ #052
                                                                    // REQ #052
     LOGFONT lf;                                                    // REQ #052
     font->GetLogFont(&lf);                                         // REQ #052
     lf.lfWidth = 0;                                                // REQ #052

     int size;
     if(c_Raster.GetCheck() == BST_CHECKED)                         // REQ #052
        { /* raster */                                              // REQ #052
         size = (int)c_FontSize.GetItemData(c_FontSize.GetCurSel());// REQ #006// REQ #052
        } /* raster */                                              // REQ #052
     else                                                           // REQ #052
        { /* scaled */                                              // REQ #052
         size = (int)c_SpinScaledHeight.GetPos32();                 // REQ #052
        } /* scaled */                                              // REQ #052

     BYTE newquality = (BYTE)c_Quality.GetItemData(c_Quality.GetCurSel());// REQ #071

     if(lstrcmp(lf.lfFaceName, newname) != 0 || size != lf.lfHeight ||
        lf.lfQuality != newquality)                                 // REQ #071
        { /* need new font */
         lf.lfHeight = size;
         lstrcpy(lf.lfFaceName, newname);

         lf.lfQuality = newquality;                                 // REQ #071

         CFont newfont;
         if(newfont.CreateFontIndirect(&lf))
            { /* success */
             c_Sample.SetFont(&newfont);
             c_Unmagnified.SetFont(&newfont);                       // REQ #052
             c_Sample.Invalidate();                                 // REQ #071
             c_Unmagnified.Invalidate();                            // REQ #071
             TRACE(_T(__FUNCTION__) _T(": DeleteObject(font=%p)\n"), font->m_hObject);// REQ #021
             font->DeleteObject();
             newfont.Detach();

             CRect client;                                          // REQ #050
             GetClientRect(&client);                                // REQ #050
             AdjustWindowSize(client.Width(), client.Height());     // REQ #050
            } /* success */
        } /* need new font */
    }
Example #5
0
BOOL CPOwnerDrawMenu::SetFont (HFONT hFont)
{
    BOOL  b;
    CFont Font;
    if (Font.Attach (hFont) != FALSE)
    {
        b = SetFont (Font);
        Font.Detach ();
        return b;
    }
    return FALSE;
}
Example #6
0
void CFontStatic::OnPaint() 
{
	CFont fFont;
	CFont *fOldFont;
	int nWeight;
	CPaintDC dc(this);
	DWORD dwQuality;
	CRect rect;
	UINT unFormat=0;

	// Get the window text
	CString szText;
	this->GetWindowText(szText);

	// Get the client rect
	this->GetClientRect(rect);

	// Set the background
	if(m_bBgColor)
		dc.FillSolidRect(rect,m_dwBgColor);
	else
		dc.FillSolidRect(rect,GetSysColor(COLOR_3DFACE));

	// Set the text-color and background
	dc.SetTextColor(m_dwColor);
	dc.SetBkMode(TRANSPARENT);

	// Determine the weight of the font
	if(m_bBold)
		nWeight = FW_BLACK;
	else
		nWeight = FW_NORMAL;

	// Set the quality of the font
	if(m_bAntialias)
		dwQuality = ANTIALIASED_QUALITY;
	else
		dwQuality = DEFAULT_QUALITY;

	// Set the horizontal alignment
	if(m_bCenter)
		unFormat|=DT_CENTER;
	else if(m_bRight)
		unFormat|=DT_RIGHT;
	else if(m_bLeft)
		unFormat|=DT_LEFT;
	if(m_bvCenter)
		unFormat|=DT_VCENTER|DT_SINGLELINE;

	// Set no prefix and wordwrapping
	unFormat|=DT_NOPREFIX;
	unFormat|=DT_WORDBREAK;

	// Create the font
	fFont.Detach();
	if(fFont.CreateFont(m_nSize,0,0,0, nWeight ,m_bItalic, m_bUnderlined, m_bStrikethrough, DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS, dwQuality, DEFAULT_PITCH | FF_DONTCARE, m_szFont)!=NULL)
	{
		fOldFont = dc.SelectObject(&fFont);
		dc.DrawText(szText,rect,unFormat);
	}

}
Example #7
0
BOOL CMFCControlsDlg::OnInitDialog()
{
	CFont* pFont = GetFont();

	LOGFONT logfont;

	pFont->GetLogFont(&logfont);

	logfont.lfWeight = 700;

	CFont myFont;
	myFont.CreateFontIndirect(&logfont);

	SetFont(&myFont,TRUE);

	myFont.Detach();

	CDialog::OnInitDialog();
	
	// Add "About..." menu item to system menu.
	
	// IDM_ABOUTBOX must be in the system command range.
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);
	
	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != NULL)
	{
		CString strAboutMenu;
		strAboutMenu.LoadString(IDS_ABOUTBOX);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}
	
	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	// Setup demo controls - no more skinning-specific code in this method
    for (int i = 0; i < 5; i ++)
    {
        TCHAR szTab[20] = {0};
        _stprintf(szTab, _T("Tab %d"), (i+1));
        m_Tab.InsertItem(i, szTab); 
    }
	
    for (int j = 0; j < 10; j++) {
        m_List.InsertString(j, _T("SkinMagic Toolkit!"));
    }
	
    m_bPlaying = TRUE;
    
    m_Progress.SetRange(0, 1000);
    m_Progress.SetPos(0);
    m_VertScroll.SetScrollRange(0, 1000, TRUE);
    m_HorzScroll.SetScrollRange(0, 1000, TRUE);
    SendDlgItemMessage(IDC_RADIO3, BM_SETCHECK, 1, 0);
    SendDlgItemMessage(IDC_CHECK3, BM_SETCHECK, 1, 0);
	
    m_Slider1.SetRange(0,100,0);
    m_Slider2.SetRange(0,100,0);
    m_Slider3.SetRange(0,100,0);
    m_Slider4.SetRange(0,100,0);
    m_Slider5.SetRange(0,100,0);
    m_Slider6.SetRange(0,100,0);
	
    m_Slider1.SetPos(0);
    m_Slider2.SetPos(50);
    m_Slider3.SetPos(100);
    m_Slider4.SetPos(0);
    m_Slider5.SetPos(50);
    m_Slider6.SetPos(100);
	
    // Set a timer to update
    //SetTimer(1000, 250, NULL);


	
	return TRUE;  // return TRUE  unless you set the focus to a control
}
void CNewGameView::OnInitialUpdate()
{
	CFormView::OnInitialUpdate();

	// TODO: Fügen Sie hier Ihren spezialisierten Code ein, und/oder rufen Sie die Basisklasse auf.
	CBotEDoc* pDoc = resources::pDoc;
	ASSERT(pDoc);

	m_pBkgndImg = pDoc->GetGraphicPool()->GetGDIGraphic("Events\\Startmenu.boj");
	m_TotalSize = CSize(1280, 1024);

	CRect clientRect;
	GetDesktopWindow()->GetClientRect(clientRect);

	//double nButtonSizeX = 300.0;
	//double nButtonSizeY = 40.0;

	//double nXPos = clientRect.Width() / 2.0 - nButtonSizeX / 2.0;
	double nYPos = clientRect.Height() / 2.0 - 175.0;

	//double nGab = 10.0;

	// Structure containing Style
	tButtonStyle tStyle;
	//////////////////////////////////////////////////////////////////////////

	// Get default Style
	m_tButtonStyle.GetButtonStyle(&tStyle);
	// Change Radius of Button
	tStyle.m_dRadius = 1.0;

	// Change Color Schema of Button
	tStyle.m_tColorFace.m_tEnabled		= RGB(100, 100, 100);
	tStyle.m_tColorBorder.m_tEnabled	= RGB(220, 220, 220);

	tStyle.m_tColorFace.m_tClicked		= RGB(75, 75, 75);
	tStyle.m_tColorBorder.m_tClicked	= RGB(25, 25, 25);

	tStyle.m_tColorFace.m_tPressed		= RGB(75, 75, 75);
	tStyle.m_tColorBorder.m_tPressed	= RGB(25, 25, 25);

	tStyle.m_tColorFace.m_tHot			= RGB(0x80, 0x80, 0xFF);
	tStyle.m_tColorBorder.m_tHot		= RGB(0x40, 0x40, 0xFF);

	// Set Style again
	m_tButtonStyle.SetButtonStyle(&tStyle);

	// auflösungsabhängige Font erstellen
	CFont fnt;
	fnt.CreateFont(17, 0, 0, 0, FW_BLACK, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS,
		CLIP_DEFAULT_PRECIS, CLEARTYPE_QUALITY, DEFAULT_PITCH, "Calibri");

	// Set control positions
	m_username.SetWindowPos(NULL, clientRect.Width() / 2.0 - 100, nYPos, 200, 25, SWP_FRAMECHANGED);
	m_username.SetFont(&fnt);

	// Controls nur für Server
	m_description.SetWindowPos(NULL, clientRect.Width() / 2.0 - 100, nYPos + 35, 200, 25, SWP_FRAMECHANGED);
	m_description.SetFont(&fnt);

	m_serverPort.SetWindowPos(NULL, clientRect.Width() / 2.0 - 100, nYPos + 70, 200, 25, SWP_FRAMECHANGED);
	m_serverPort.SetFont(&fnt);

	m_btPublish.SetWindowPos(NULL, clientRect.Width() / 2.0 - 100, nYPos + 105, 14, 14, SWP_FRAMECHANGED);
	m_btPublish.SetFont(&fnt);

	// Controls nur für Clients
	m_hostIP.SetWindowPos(NULL, clientRect.Width() / 2.0 - 100, nYPos + 35, 200, 25, SWP_FRAMECHANGED);
	m_hostIP.SetFont(&fnt);

	m_btSearchServers.SetWindowPos(NULL, clientRect.Width() / 2.0 + 110, nYPos + 35, 175, 25, SWP_FRAMECHANGED);
	SetButtonStyle(&m_btSearchServers);
	m_btSearchServers.SetWindowText(CLoc::GetString("SEARCHLANSERVER"));

	m_hostPort.SetWindowPos(NULL, clientRect.Width() / 2.0 - 100, nYPos + 70, 200, 25, SWP_FRAMECHANGED);
	m_hostPort.SetFont(&fnt);

	// Create push buttons
	m_btBack.Create(_T(CLoc::GetString("BTN_BACK")), WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, CRect(), this, BTN_BACK);
	m_btBack.SetWindowPos(NULL, clientRect.Width() / 2.0 - 160, nYPos + 175, 150, 30, SWP_FRAMECHANGED);
	SetButtonStyle(&m_btBack);

	m_btNext.Create(_T(CLoc::GetString("BTN_FURTHER")), WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, CRect(), this, BTN_NEXT);
	m_btNext.SetWindowPos(NULL, clientRect.Width() / 2.0 + 10, nYPos + 175, 150, 30, SWP_FRAMECHANGED);
	SetButtonStyle(&m_btNext);

	// Handle auf Font freigeben
	fnt.Detach();

	// Anfangswerte setzen
	m_btPublish.SetCheck(TRUE);

	CString userName = "";
	CIniLoader::GetInstance()->ReadValue("General", "USERNAME", userName);
	if (!userName.IsEmpty())
		SetDlgItemText(IDC_USERNAME, userName);
	else
	{
		TCHAR userName[UNLEN + 1];
		DWORD nLen = UNLEN + 1;
		VERIFY(GetUserName(userName, &nLen));
		SetDlgItemText(IDC_USERNAME, userName);
	}
	GetDlgItemText(IDC_USERNAME, userName);
	CIniLoader::GetInstance()->WriteValue("General", "USERNAME", userName);

	m_hostIP.SetAddress(INADDR_LOOPBACK);
	m_hostPort.SetWindowText("7777");
	m_serverPort.SetWindowText("7777");
	CString strDesc;
	strDesc.Format("%ss BotE-Server", userName);
	m_description.SetWindowText(strDesc);

	SetMode(MODE_SERVER);

	EnableNextButton();

	// TEST-OPTION (only for Debug)
// Automatisch bis zu einer gewissen Runde durchzuklicken falls per Startparamter aktiviert
// Eventscreen gleich wieder schließen
if (const CCommandLineParameters* const clp = resources::pClp)
{
    int nAutoTurns = clp->GetAutoTurns();
		CBotEDoc* pDoc = resources::pDoc;
	ASSERT(pDoc);
	if (!pDoc)
		return;
    //if (!pDoc->m_bRoundEndPressed && pDoc->GetCurrentRound() < nAutoTurns)
    //{
	using namespace network;

	// Wechsel zur nächsten Seite nur möglich, wenn der Server läuft
	//if (!m_bIsServer)
	//	return;


	StartServer(m_btPublish.GetCheck() == BST_CHECKED);
	client.RequestRace((network::RACE)(clp->GetAutoTurns()));

	//m_bStopDrawing = true;

	//SetCursor(::LoadCursor(NULL, IDC_WAIT));

	// evtl. laufende Veröffentlichung des Spiels stoppen
	//serverPublisher.StopPublishing();

	// die nicht ausgewählten Völker vom Server spielen lassen
	/*for (int i = 0; i < RACE_COUNT; i++)
	{
		RACE race = (RACE)(RACE_FIRST + i);
		if (!server.IsPlayedByClient(race))
			server.SetPlayByServer(race,TRUE,FALSE);
	}*/

	// Spiel starten; veranlasst die Clients, auf die nächste Seite zu wechseln
	pDoc->PrepareData();
	server.BeginGame(pDoc);

	SetCursor(::LoadCursor(NULL, IDC_ARROW));
}
}