Ejemplo n.º 1
0
void CQuickScripts::_PrepareViewCommands(int iIndex, const ViewResource &view, int nLoop, int nCel)
{
    ASSERT(iIndex < 10);
    UINT nID = ID_GOTOVIEW1 + iIndex;
    _viewNumbers[iIndex] = view.GetResourceNumber();
    // Ensure we have a command entry for this.
    CExtCmdItem *pCmdItem;
	pCmdItem = g_CmdManager->CmdGetPtr(theApp._pszCommandProfile, nID);
    if (pCmdItem == NULL)
    {
        pCmdItem = g_CmdManager->CmdAllocPtr(theApp._pszCommandProfile, nID);
    }
    // Update the command entry with an icon and text
    if (pCmdItem)
    {
        CBitmap bitmap;
        // Note: if the index is out of bounds, it will return a NULL HBITMAP
        bitmap.Attach(view.GetBitmap(MAKE_INDEX(nLoop, nCel), 24, 24));
        if ((HBITMAP)bitmap == NULL)
        {
            // Load an all black bitmap, to indicate the loop/cel are invalid.
            bitmap.LoadBitmap(IDB_BITMAPNULL);
        }
        CExtBitmap extBitmap;
        extBitmap.FromBitmap((HBITMAP)bitmap);
        g_CmdManager->CmdSetIcon(theApp._pszCommandProfile, nID, extBitmap, RGB(255, 255, 255), CRect(0, 0, 24, 24));
        std::string name = theApp.GetResourceMap().FigureOutName(RS_VIEW, view.GetResourceNumber());
        pCmdItem->m_sMenuText = name.c_str();
        pCmdItem->m_sTipTool = pCmdItem->m_sMenuText;
    }
}
Ejemplo n.º 2
0
CColorPickerButton::CColorPickerButton()
{
    _pFactory = NULL;
    if (g_bitmapHighlight.IsEmpty())
    {
        g_bitmapHighlight.LoadBMP_Resource(MAKEINTRESOURCE(IDB_VPCHIGHLIGHT));
        g_bitmapHighlightX.LoadBMP_Resource(MAKEINTRESOURCE(IDB_VPCHIGHLIGHTX));
    }
}
Ejemplo n.º 3
0
BOOL CControlsDlg::OnInitDialog()
{
	CExtNCW<CExtResizableDialog>::OnInitDialog();

	m_Ctrls.InsertColumn(0, "Control name", 0, 150);
	m_Ctrls.InsertColumn(1, "Key",			0, 150);
	m_Ctrls.InsertColumn(2, "Player",		0, 100);

	RefreshControls();

	CExtBitmap Bitmap;
	Bitmap.LoadBMP_Resource(MAKEINTRESOURCE(IDB_ICONADD));
	m_Add.SetIcon(Bitmap.CreateHICON());

	Bitmap.LoadBMP_Resource(MAKEINTRESOURCE(IDB_ICONEDIT));
	m_Edit.SetIcon(Bitmap.CreateHICON());

	Bitmap.LoadBMP_Resource(MAKEINTRESOURCE(IDB_ICONDELETE));
	m_Remove.SetIcon(Bitmap.CreateHICON());
	
	m_Ctrls.SetExtendedStyle(LVS_EX_FULLROWSELECT);

	// Resizing
	dlgMan.Load(this->m_hWnd, "Software\\Construct\\ControlsDlg");
    dlgAnchor.Init(this->m_hWnd);

	dlgAnchor.Add(IDC_CONTROLSLIST, ANCHOR_TOPLEFT | ANCHOR_BOTTOMRIGHT);
	dlgAnchor.Add(IDC_ADD, ANCHOR_LEFT | ANCHOR_BOTTOM);
	dlgAnchor.Add(IDC_REMOVE, ANCHOR_LEFT | ANCHOR_BOTTOM);
	dlgAnchor.Add(IDC_RENAME, ANCHOR_LEFT | ANCHOR_BOTTOM);
	dlgAnchor.Add(IDOK, ANCHOR_RIGHT | ANCHOR_BOTTOM);

	return TRUE;
}
Ejemplo n.º 4
0
BOOL CAddNewTraitDlg::OnInitDialog()
{
	CExtNCW<CExtResizableDialog>::OnInitDialog();

	m_Name.SetWindowText("My Attribute");

	ASSERT(application != NULL);

	m_List.InsertColumn(1, "Attribute name", 0, 197);
	m_List.SetExtendedStyle(LVS_EX_FULLROWSELECT);

	RefreshTraitList();

	CExtBitmap Bitmap;
	Bitmap.LoadBMP_Resource(MAKEINTRESOURCE(IDB_ICONADD));
	m_Add.SetIcon(Bitmap.CreateHICON());
	m_Add.SetTooltipText(AM_ADD);

	Bitmap.LoadBMP_Resource(MAKEINTRESOURCE(IDB_ICONEDIT));
	m_Edit.SetIcon(Bitmap.CreateHICON());
	m_Edit.SetTooltipText(AM_EDIT);

	Bitmap.LoadBMP_Resource(MAKEINTRESOURCE(IDB_ICONDELETE));
	m_Remove.SetIcon(Bitmap.CreateHICON());
	m_Remove.SetTooltipText(AM_REMOVE);

	m_Close.SetWindowTextA(CLOSE);

	// Set dialog title
	CString Title;
	Title.Format("Construct : %s", AM_TITLE);
	SetWindowText(Title);

	// Resizing
	dlgMan.Load(this->m_hWnd, "Software\\Construct\\AttributesMgr");
    dlgAnchor.Init(this->m_hWnd);

	dlgAnchor.Add(IDC_LIST1, ANCHOR_TOPLEFT | ANCHOR_BOTTOMRIGHT);
	dlgAnchor.Add(IDC_NAME, ANCHOR_LEFT | ANCHOR_RIGHT | ANCHOR_BOTTOM);
	dlgAnchor.Add(IDC_ADD, ANCHOR_RIGHT | ANCHOR_BOTTOM);
	dlgAnchor.Add(IDC_REMOVE, ANCHOR_RIGHT | ANCHOR_BOTTOM);
	dlgAnchor.Add(IDC_RENAME, ANCHOR_RIGHT | ANCHOR_BOTTOM);
	dlgAnchor.Add(IDOK, ANCHOR_RIGHT | ANCHOR_BOTTOM);

	return true;
}
Ejemplo n.º 5
0
BOOL CManageVariableDlg::OnInitDialog()
{
	CExtNCW<CExtResizableDialog>::OnInitDialog();

	CExtBitmap Bitmap;
	Bitmap.LoadBMP_Resource(MAKEINTRESOURCE(IDB_ICONADD));
	m_Add.SetIcon(Bitmap.CreateHICON());
	m_Add.SetDrawBorder(FALSE);
	m_Add.SetFlat();

	Bitmap.LoadBMP_Resource(MAKEINTRESOURCE(IDB_ICONDELETE));
	m_Remove.SetIcon(Bitmap.CreateHICON());
	m_Remove.SetDrawBorder(FALSE);
	m_Remove.SetFlat();

	Bitmap.LoadBMP_Resource(MAKEINTRESOURCE(IDB_ICONEDIT));
	m_Edit.SetIcon(Bitmap.CreateHICON());
	m_Edit.SetDrawBorder(FALSE);
	m_Edit.SetFlat();

	Bitmap.LoadBMP_Resource(MAKEINTRESOURCE(IDB_UPARROW));
	m_MoveUp.SetIcon(Bitmap.CreateHICON());
	m_MoveUp.SetDrawBorder(FALSE);
	m_MoveUp.SetFlat();

	Bitmap.LoadBMP_Resource(MAKEINTRESOURCE(IDB_DOWNARROW));
	m_MoveDown.SetIcon(Bitmap.CreateHICON());
	m_MoveDown.SetDrawBorder(FALSE);
	m_MoveDown.SetFlat();

	m_List.InsertColumn(0, "Name", LVCFMT_LEFT, 150);
	m_List.InsertColumn(1, "Type", LVCFMT_LEFT, 50);
	m_List.InsertColumn(2, "Initial Value", LVCFMT_LEFT, 150);

	SetWindowText("Construct : Manage Private Variables");
	
	RefreshVariablesList();

	// Resizing
	dlgMan.Load(this->m_hWnd, "Software\\Construct\\ManageVariableDlg");
    dlgAnchor.Init(this->m_hWnd);

	dlgAnchor.Add(IDC_LIST, ANCHOR_TOPLEFT | ANCHOR_BOTTOMRIGHT);
	dlgAnchor.Add(IDOK, ANCHOR_RIGHT | ANCHOR_BOTTOM);
	dlgAnchor.Add(IDC_ADD, ANCHOR_LEFT | ANCHOR_BOTTOM);
	dlgAnchor.Add(IDC_REMOVE, ANCHOR_LEFT | ANCHOR_BOTTOM);
	dlgAnchor.Add(IDC_RENAME, ANCHOR_LEFT | ANCHOR_BOTTOM);
	dlgAnchor.Add(IDC_MOVEUP, ANCHOR_LEFT | ANCHOR_BOTTOM);
	dlgAnchor.Add(IDC_MOVEDOWN, ANCHOR_LEFT | ANCHOR_BOTTOM);

	m_List.SetExtendedStyle(LVS_EX_FULLROWSELECT);

	return true;
}
Ejemplo n.º 6
0
void CColorPickerButton::_OnDraw(HDC hdc, RECT *prc, EGACOLOR color)
{
    CDC *pDC = CDC::FromHandle(hdc);
    if (pDC)
    {
        // Figure out the right color - do color 1 for now.
        RGBQUAD color1 = EGA_TO_RGBQUAD(color.color1);
        RGBQUAD color2 = EGA_TO_RGBQUAD(color.color2);

        CBitmap bm;
        if (CreateDCCompatiblePattern(color1, color2, pDC, &bm))
        {
            CBrush brushPat;
            if (brushPat.CreatePatternBrush(&bm))
            {
                CRect rcShrunk(prc->left + 1, prc->top + 1, prc->right - 1, prc->bottom - 1);
                pDC->FillRect(&rcShrunk, &brushPat);
            }
        }
       
        //int cx = RECTWIDTH(*prc) / 2;
        //int cy = RECTHEIGHT(*prc) / 2;
        //RECT rectOverlay = { prc->left + cx, prc->top + cy, prc->right, prc->bottom };
        int iModePrev = pDC->SetBkMode(TRANSPARENT);
        RGBQUAD colorCombine = _Combine(color1, color2);
        RGBQUAD colorTL = _Lighter(colorCombine);
        RGBQUAD colorBR = _Darker(colorCombine);

        // Draw an x maybe
        if (!_bOn)
        {
            /*
            RGBQUAD colorRedder = _Redden(colorCombine);
            CPen penX(PS_SOLID, 1, RGB_TO_COLORREF(colorRedder));
            HGDIOBJ hgdiObjOld = pDC->SelectObject(&penX);
            pDC->MoveTo(prc->left, prc->bottom);
            pDC->LineTo(prc->right, prc->top);
            pDC->MoveTo(prc->left, prc->top);
            pDC->LineTo(prc->right, prc->bottom);
            pDC->SelectObject(hgdiObjOld);*/
        }

        /*
        // Do highlights.
        CPen penTL(PS_SOLID, 2, RGB_TO_COLORREF(colorTL));
        HGDIOBJ hgdiObj = pDC->SelectObject(&penTL);
        pDC->MoveTo(prc->left + 1, prc->bottom - 1);
        pDC->LineTo(prc->left + 1, prc->top + 1);
        pDC->LineTo(prc->right - 1, prc->top + 1);
        CPen penBR(PS_SOLID, 2, RGB_TO_COLORREF(colorBR));
        pDC->SelectObject(&penBR);
        pDC->LineTo(prc->right -1 , prc->bottom - 1);
        pDC->LineTo(prc->left + 1, prc->bottom - 1);
        pDC->SelectObject(hgdiObj);*/

        // Draw some text.
        int iColorPrev = pDC->SetTextColor(_GetTextColor(colorCombine));
        CString text;
        GetWindowText(text);
        pDC->DrawText(text, prc, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
        pDC->SetTextColor(iColorPrev);

        CRect rcPadding(0, 0, 0, 0);
        if (_bOn)
        {
            CRect rcSrc(CPoint(0, 0), g_bitmapHighlight.GetSize());
            g_bitmapHighlight.AlphaBlendSkinParts(hdc, *prc, rcSrc, rcPadding, /*__EXT_BMP_FLAG_PREMULTIPLIED_RGB_CHANNELS |*/ CExtBitmap::__EDM_STRETCH, true, true, 0xFF);
        }
        else
        {
            CRect rcSrc(CPoint(0, 0), g_bitmapHighlightX.GetSize());
            g_bitmapHighlightX.AlphaBlendSkinParts(hdc, *prc, rcSrc, rcPadding, /*__EXT_BMP_FLAG_PREMULTIPLIED_RGB_CHANNELS |*/ CExtBitmap::__EDM_STRETCH, true, true, 0xFF);
        }

        pDC->SetBkMode(iModePrev);
    }
}