void CManageBookmarksDialog::SetupToolbar()
{
	m_hToolbar = CreateToolbar(m_hDlg,
		WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|
		TBSTYLE_TOOLTIPS|TBSTYLE_LIST|TBSTYLE_TRANSPARENT|
		TBSTYLE_FLAT|CCS_NODIVIDER|CCS_NORESIZE,
		TBSTYLE_EX_MIXEDBUTTONS|TBSTYLE_EX_DRAWDDARROWS|
		TBSTYLE_EX_DOUBLEBUFFER|TBSTYLE_EX_HIDECLIPPEDBUTTONS);

	SendMessage(m_hToolbar,TB_SETBITMAPSIZE,0,MAKELONG(16,16));
	SendMessage(m_hToolbar,TB_BUTTONSTRUCTSIZE,static_cast<WPARAM>(sizeof(TBBUTTON)),0);

	m_himlToolbar = ImageList_Create(16,16,ILC_COLOR32|ILC_MASK,0,48);
	HBITMAP hBitmap = LoadBitmap(GetInstance(),MAKEINTRESOURCE(IDB_SHELLIMAGES));
	ImageList_Add(m_himlToolbar,hBitmap,NULL);
	DeleteObject(hBitmap);
	SendMessage(m_hToolbar,TB_SETIMAGELIST,0,reinterpret_cast<LPARAM>(m_himlToolbar));

	TBBUTTON tbb;
	TCHAR szTemp[64];

	tbb.iBitmap		= SHELLIMAGES_BACK;
	tbb.idCommand	= TOOLBAR_ID_BACK;
	tbb.fsState		= TBSTATE_ENABLED;
	tbb.fsStyle		= BTNS_BUTTON|BTNS_AUTOSIZE;
	tbb.dwData		= 0;
	SendMessage(m_hToolbar,TB_INSERTBUTTON,0,reinterpret_cast<LPARAM>(&tbb));

	tbb.iBitmap		= SHELLIMAGES_FORWARD;
	tbb.idCommand	= TOOLBAR_ID_FORWARD;
	tbb.fsState		= TBSTATE_ENABLED;
	tbb.fsStyle		= BTNS_BUTTON|BTNS_AUTOSIZE;
	tbb.dwData		= 0;
	SendMessage(m_hToolbar,TB_INSERTBUTTON,1,reinterpret_cast<LPARAM>(&tbb));

	LoadString(GetInstance(),IDS_MANAGE_BOOKMARKS_TOOLBAR_ORGANIZE,szTemp,SIZEOF_ARRAY(szTemp));

	tbb.iBitmap		= SHELLIMAGES_COPY;
	tbb.idCommand	= TOOLBAR_ID_ORGANIZE;
	tbb.fsState		= TBSTATE_ENABLED;
	tbb.fsStyle		= BTNS_BUTTON|BTNS_AUTOSIZE|BTNS_SHOWTEXT|BTNS_DROPDOWN;
	tbb.dwData		= 0;
	tbb.iString		= reinterpret_cast<INT_PTR>(szTemp);
	SendMessage(m_hToolbar,TB_INSERTBUTTON,2,reinterpret_cast<LPARAM>(&tbb));

	LoadString(GetInstance(),IDS_MANAGE_BOOKMARKS_TOOLBAR_VIEWS,szTemp,SIZEOF_ARRAY(szTemp));

	tbb.iBitmap		= SHELLIMAGES_VIEWS;
	tbb.idCommand	= TOOLBAR_ID_VIEWS;
	tbb.fsState		= TBSTATE_ENABLED;
	tbb.fsStyle		= BTNS_BUTTON|BTNS_AUTOSIZE|BTNS_SHOWTEXT|BTNS_DROPDOWN;
	tbb.dwData		= 0;
	tbb.iString		= reinterpret_cast<INT_PTR>(szTemp);
	SendMessage(m_hToolbar,TB_INSERTBUTTON,3,reinterpret_cast<LPARAM>(&tbb));

	LoadString(GetInstance(),IDS_MANAGE_BOOKMARKS_TOOLBAR_IMPORTEXPORT,szTemp,SIZEOF_ARRAY(szTemp));

	tbb.iBitmap		= SHELLIMAGES_PROPERTIES;
	tbb.idCommand	= TOOLBAR_ID_IMPORTEXPORT;
	tbb.fsState		= TBSTATE_ENABLED;
	tbb.fsStyle		= BTNS_BUTTON|BTNS_AUTOSIZE|BTNS_SHOWTEXT|BTNS_DROPDOWN;
	tbb.dwData		= 0;
	tbb.iString		= reinterpret_cast<INT_PTR>(szTemp);
	SendMessage(m_hToolbar,TB_INSERTBUTTON,4,reinterpret_cast<LPARAM>(&tbb));

	RECT rcTreeView;
	GetWindowRect(GetDlgItem(m_hDlg,IDC_MANAGEBOOKMARKS_TREEVIEW),&rcTreeView);
	MapWindowPoints(HWND_DESKTOP,m_hDlg,reinterpret_cast<LPPOINT>(&rcTreeView),2);

	RECT rcSearch;
	GetWindowRect(GetDlgItem(m_hDlg,IDC_MANAGEBOOKMARKS_EDITSEARCH),&rcSearch);
	MapWindowPoints(HWND_DESKTOP,m_hDlg,reinterpret_cast<LPPOINT>(&rcSearch),2);

	DWORD dwButtonSize = static_cast<DWORD>(SendMessage(m_hToolbar,TB_GETBUTTONSIZE,0,0));
	SetWindowPos(m_hToolbar,NULL,rcTreeView.left,rcSearch.top - (HIWORD(dwButtonSize) - GetRectHeight(&rcSearch)) / 2,
		rcSearch.left - rcTreeView.left - 10,HIWORD(dwButtonSize),0);
}
Beispiel #2
0
dlgWndBadPIN::dlgWndBadPIN( std::wstring & PINName, unsigned long RemainingTries, HWND Parent )
:Win32Dialog(L"WndBadPIN")
{
	std::wstring tmpTitle = L"";

	if(wcscmp(L"nl",langbad.c_str())==0)
		tmpTitle += (L"Atenção");
	else
		tmpTitle += GETSTRING_DLG(Notification);
	tmpTitle += L": ";
	tmpTitle += GETSTRING_DLG(Bad); 
	tmpTitle += L" ";

	if ( wcsstr(const_cast<wchar_t*>( PINName.c_str()), (L"PIN da Autentica")) != 0)
		tmpTitle += (L"Pin da Autenticação");
	else
		tmpTitle += PINName;

	wchar_t tmpBuf[128];
	std::wstring tmpStr = L"";
	_itow_s( RemainingTries, tmpBuf, 128, 10 ); 
	szHeader = new wchar_t[128];
	szBody = L"";

	tmpStr = GETSTRING_DLG(Bad);
	tmpStr += L" \""; 
	if ( wcsstr(const_cast<wchar_t*>( PINName.c_str()), (L"PIN da Autentica")) != 0)
		tmpStr += (L"Pin da Autenticação");
	else
		tmpStr += PINName;
	tmpStr += L"\": ";
	tmpStr += tmpBuf;
	tmpStr += L" "; 
	tmpStr += GETSTRING_DLG(RemainingAttempts); 
	wcscpy_s( szHeader, 128, tmpStr.c_str() );
	if( RemainingTries == 0 )
	{
		if ( wcsstr(const_cast<wchar_t*>( PINName.c_str()), (L"PIN da Autentica")) != 0)
			tmpTitle += (L"Pin da Autenticação");
		else
			tmpTitle += PINName;
		tmpStr += L" ";
		tmpStr = GETSTRING_DLG(PinBlocked);
		szBody = tmpStr.c_str();
	}
	else
	{
		szBody = GETSTRING_DLG(TryAgainOrCancel);
	}

	if( CreateWnd( tmpTitle.c_str() , 280, 230, 0,  Parent ) )
	{
		RECT clientRect;
		GetClientRect( m_hWnd, &clientRect );

		TextFont = CreateFont( 16, 0, 0, 0, FW_DONTCARE, 0, 0, 0,
				DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
				DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, L"MS Shell Dlg" );

		if( RemainingTries == 0 )
		{
			HWND hOkButton = CreateWindow(
				L"BUTTON", GETSTRING_DLG(Ok), WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_DEFPUSHBUTTON, 
				clientRect.right - 160, clientRect.bottom - 36, 72, 24, 
				m_hWnd, (HMENU)IDB_OK, m_hInstance, NULL );
			SendMessage( hOkButton, WM_SETFONT, (WPARAM)TextFont, 0 );
		}
		else
		{
			HWND hRetryButton = CreateWindow(
				L"BUTTON", GETSTRING_DLG(Retry), WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_DEFPUSHBUTTON, 
				clientRect.right - 160, clientRect.bottom - 36, 72, 24, 
				m_hWnd, (HMENU)IDB_RETRY, m_hInstance, NULL );
			SendMessage( hRetryButton, WM_SETFONT, (WPARAM)TextFont, 0 );

			HWND hCancelButton = CreateWindow(
				L"BUTTON", GETSTRING_DLG(Cancel), WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_TEXT, 
				clientRect.right - 80, clientRect.bottom - 36, 72, 24, 
				m_hWnd, (HMENU)IDB_CANCEL, m_hInstance, NULL );
			SendMessage( hCancelButton, WM_SETFONT, (WPARAM)TextFont, 0 );
		}

		HWND hStaticText = CreateWindow( 
			L"STATIC", szBody, WS_CHILD | WS_VISIBLE | SS_CENTER, 
			0, clientRect.bottom - 76, clientRect.right, 22, 
			m_hWnd, (HMENU)IDC_STATIC, m_hInstance, NULL );
		SendMessage( hStaticText, WM_SETFONT, (WPARAM)TextFont, 0 );

		ImagePIN = LoadBitmap( m_hInstance, MAKEINTRESOURCE(IDB_PIN) );
		CreateBitapMask( ImagePIN, ImagePIN_Mask );
	}
}
int PixelTranspType (short nTexture, short nOrient, short nFrame, fix u, fix v)
{
	CBitmap *bmP;
	int bmx, bmy, w, h, offs;
	ubyte	c;
#if 0
	tBitmapIndex *bmiP;

bmiP = gameData.pig.tex.bmIndexP + (nTexture);
LoadBitmap (*bmiP, gameStates.app.bD1Data);
bmP = BmOverride (gameData.pig.tex.bitmapP + bmiP->index);
#else
bmP = LoadFaceBitmap (nTexture, nFrame);
if (!bmP->Buffer ())
	return 0;
#endif
if (bmP->Flags () & BM_FLAG_RLE)
	bmP = rle_expand_texture (bmP);
w = bmP->Width ();
h = ((bmP->Type () == BM_TYPE_ALT) && bmP->Frames ()) ? w : bmP->Height ();
if (nOrient == 0) {
	bmx = ((unsigned) X2I (u * w)) % w;
	bmy = ((unsigned) X2I (v * h)) % h;
	}
else if (nOrient == 1) {
	bmx = ((unsigned) X2I ((I2X (1) - v) * w)) % w;
	bmy = ((unsigned) X2I (u * h)) % h;
	}
else if (nOrient == 2) {
	bmx = ((unsigned) X2I ((I2X (1) - u) * w)) % w;
	bmy = ((unsigned) X2I ((I2X (1) - v) * h)) % h;
	}
else {
	bmx = ((unsigned) X2I (v * w)) % w;
	bmy = ((unsigned) X2I ((I2X (1) - u) * h)) % h;
	}
offs = bmy * w + bmx;
if (bmP->Flags () & BM_FLAG_TGA) {
	ubyte *p;

	if (bmP->BPP () == 3)	//no alpha -> no transparency
		return 0;
	p = bmP->Buffer () + offs * bmP->BPP ();
	// check super transparency color
#if 1
	if ((p [0] == 120) && (p [1] == 88) && (p [2] == 128))
#else
	if ((gameOpts->ogl.bGlTexMerge) ?
	    (p [3] == 1) : ((p [0] == 120) && (p [1] == 88) && (p [2] == 128)))
#endif
		return -1;
	// check alpha
	if (!p [3])
		return 1;
	}
else {
	c = bmP->Buffer () [offs];
	if (c == SUPER_TRANSP_COLOR)
		return -1;
	if (c == TRANSPARENCY_COLOR)
		return 1;
	}
return 0;
}
Beispiel #4
0
static int lcd_init (void)
{
	DWORD ret;
	lgLcdOpenContext octx;
	HBITMAP bmp;
	BITMAP binfo;
	HDC dc;
	int x, y;

	old_pri = 0;
	ret = lgLcdInit ();
	if (ret != ERROR_SUCCESS) {
		if (ret == RPC_S_SERVER_UNAVAILABLE || ret == ERROR_OLD_WIN_VERSION) {
			write_log (_T("LCD: Logitech LCD system not detected\n"));
			return 0;
		}
		write_log (_T("LCD: lgLcdInit() returned %d\n"), ret);
		return 0;
	}
	memset (&cctx, 0, sizeof (cctx));
	cctx.appFriendlyName = _T("WinUAE");
	cctx.isPersistent = TRUE;
	cctx.isAutostartable = FALSE;
	ret = lgLcdConnect (&cctx);
	if (ret != ERROR_SUCCESS) {
		write_log (_T("LCD: lgLcdConnect() returned %d\n"), ret);
		lcd_close ();
		return 0;
	}
	ret = lgLcdEnumerateEx (cctx.connection, 0, &desc);
	if (ret != ERROR_SUCCESS) {
		write_log (_T("LCD: lgLcdEnumerateEx() returned %d\n"), ret);
		lcd_close ();
		return 0;
	}
	lbh = (lgLcdBitmapHeader*)xcalloc (uae_u8, sizeof (lgLcdBitmapHeader) + desc.Width * (desc.Height + 20));
	lbh->Format = LGLCD_BMP_FORMAT_160x43x1;
	bitmap = (uae_u8*)lbh + sizeof (lgLcdBitmapHeader);
	origbitmap = xcalloc (uae_u8, desc.Width * desc.Height);
	memset (&octx, 0, sizeof (octx));
	octx.connection = cctx.connection;
	octx.index = 0;
	ret = lgLcdOpen (&octx);
	if (ret != ERROR_SUCCESS) {
		write_log (_T("LCD: lgLcdOpen() returned %d\n"), ret);
		lcd_close ();
		return 0;
	}
	device = octx.device;

	bmp = LoadBitmap (hInst, MAKEINTRESOURCE(IDB_LCD160X43));
	dc = CreateCompatibleDC (NULL);
	SelectObject (dc, bmp);
	GetObject (bmp, sizeof (binfo), &binfo);
	for (y = 0; y < binfo.bmHeight; y++) {
		for (x = 0; x < binfo.bmWidth; x++) {
			bitmap[y * binfo.bmWidth + x] = GetPixel (dc, x, y) == 0 ? 0xff : 0;
		}
	}
	numbers = bitmap + desc.Width * desc.Height;
	memcpy (origbitmap, bitmap, desc.Width * desc.Height);
	DeleteDC (dc);

	write_log (_T("LCD: '%s' enabled\n"), desc.deviceDisplayName);
	return 1;
}
INT_PTR CSearchDialog::OnInitDialog()
{
	HIMAGELIST himl = ImageList_Create(16,16,ILC_COLOR32|ILC_MASK,0,48);
	HBITMAP hBitmap = LoadBitmap(GetModuleHandle(0),MAKEINTRESOURCE(IDB_SHELLIMAGES));
	ImageList_Add(himl,hBitmap,NULL);

	m_hDirectoryIcon = ImageList_GetIcon(himl,SHELLIMAGES_NEWTAB,ILD_NORMAL);
	m_hDialogIcon = ImageList_GetIcon(himl,SHELLIMAGES_SEARCH,ILD_NORMAL);

	SendMessage(GetDlgItem(m_hDlg,IDC_BUTTON_DIRECTORY),BM_SETIMAGE,
		IMAGE_ICON,reinterpret_cast<LPARAM>(m_hDirectoryIcon));

	SetClassLongPtr(m_hDlg,GCLP_HICONSM,reinterpret_cast<LONG_PTR>(m_hDialogIcon));

	DeleteObject(hBitmap);
	ImageList_Destroy(himl);

	HWND hListView = GetDlgItem(m_hDlg,IDC_LISTVIEW_SEARCHRESULTS);

	ListView_SetExtendedListViewStyleEx(hListView,LVS_EX_GRIDLINES|LVS_EX_DOUBLEBUFFER,
		LVS_EX_GRIDLINES|LVS_EX_DOUBLEBUFFER);

	HIMAGELIST himlSmall;
	Shell_GetImageLists(NULL,&himlSmall);
	ListView_SetImageList(hListView,himlSmall,LVSIL_SMALL);

	SetWindowTheme(hListView,L"Explorer",NULL);

	int i = 0;

	for each(auto ci in m_sdps->m_Columns)
	{
		TCHAR szTemp[128];
		LoadString(GetInstance(),ci.uStringID,szTemp,SIZEOF_ARRAY(szTemp));

		LVCOLUMN lvColumn;
		lvColumn.mask		= LVCF_TEXT;
		lvColumn.pszText	= szTemp;
		ListView_InsertColumn(hListView,i,&lvColumn);

		i++;
	}

	RECT rc;
	GetClientRect(hListView,&rc);

	ListView_SetColumnWidth(hListView,0,(1.0/3.0) * GetRectWidth(&rc));
	ListView_SetColumnWidth(hListView,1,(1.80/3.0) * GetRectWidth(&rc));

	UpdateListViewHeader();

	lCheckDlgButton(m_hDlg,IDC_CHECK_ARCHIVE,m_sdps->m_bArchive);
	lCheckDlgButton(m_hDlg,IDC_CHECK_HIDDEN,m_sdps->m_bHidden);
	lCheckDlgButton(m_hDlg,IDC_CHECK_READONLY,m_sdps->m_bReadOnly);
	lCheckDlgButton(m_hDlg,IDC_CHECK_SYSTEM,m_sdps->m_bSystem);
	lCheckDlgButton(m_hDlg,IDC_CHECK_SEARCHSUBFOLDERS,m_sdps->m_bSearchSubFolders);
	lCheckDlgButton(m_hDlg,IDC_CHECK_CASEINSENSITIVE,m_sdps->m_bCaseInsensitive);
	lCheckDlgButton(m_hDlg,IDC_CHECK_USEREGULAREXPRESSIONS,m_sdps->m_bUseRegularExpressions);

	for each(auto strDirectory in *m_sdps->m_pSearchDirectories)
	{
		SendDlgItemMessage(m_hDlg,IDC_COMBO_DIRECTORY,CB_INSERTSTRING,static_cast<WPARAM>(-1),
			reinterpret_cast<LPARAM>(strDirectory.c_str()));
	}

	for each(auto strPattern in *m_sdps->m_pSearchPatterns)
	{
		SendDlgItemMessage(m_hDlg,IDC_COMBO_NAME,CB_INSERTSTRING,static_cast<WPARAM>(-1),
			reinterpret_cast<LPARAM>(strPattern.c_str()));
	}

	SetDlgItemText(m_hDlg,IDC_COMBO_NAME,m_sdps->m_szSearchPattern);
	SetDlgItemText(m_hDlg,IDC_COMBO_DIRECTORY,m_szSearchDirectory);

	CComboBox::CreateNew(GetDlgItem(m_hDlg,IDC_COMBO_NAME));
	CComboBox::CreateNew(GetDlgItem(m_hDlg,IDC_COMBO_DIRECTORY));

	if(m_sdps->m_bStateSaved)
	{
		/* These dummy values will be in use if these values
		have not previously been saved. */
		if(m_sdps->m_iColumnWidth1 != -1 && m_sdps->m_iColumnWidth2 != -1)
		{
			ListView_SetColumnWidth(hListView,0,m_sdps->m_iColumnWidth1);
			ListView_SetColumnWidth(hListView,1,m_sdps->m_iColumnWidth2);
		}
	}

	m_sdps->RestoreDialogPosition(m_hDlg,true);

	SetFocus(GetDlgItem(m_hDlg,IDC_COMBO_NAME));

	return FALSE;
}
Beispiel #6
0
ResBitmap::ResBitmap(UINT nid)
{
    _hBmp = LoadBitmap(g_Globals._hInstance, MAKEINTRESOURCE(nid));
}
Beispiel #7
0
static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
  static HTREEITEM *hTreeItems;
  static HIMAGELIST hImageList;
  HWND hwndCombo1 = GetUIItem(IDC_COMBO1);
  HWND hwndTree1 = GetUIItem(IDC_TREE1);
  extern HWND g_SectionHack;
  section *sections=g_sections;
  if (uMsg == WM_INITDIALOG)
  {
    int doLines=0;
    HTREEITEM Par;
    HBITMAP hBMcheck1;
    int x, lastGoodX, i, noCombo=2;

    g_SectionHack=hwndDlg;

    if (hTreeItems) GlobalFree(hTreeItems);
    hTreeItems=(HTREEITEM*)my_GlobalAlloc(sizeof(HTREEITEM)*num_sections);

    hBMcheck1=LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_BITMAP1));

    oldTreeWndProc=SetWindowLong(hwndTree1,GWL_WNDPROC,(DWORD)newTreeWndProc);

    if (hImageList) ImageList_Destroy(hImageList);

    hImageList = ImageList_Create(16,16, ILC_COLOR32|ILC_MASK, 6, 0);
    ImageList_AddMasked(hImageList,hBMcheck1,RGB(255,0,255));

    TreeView_SetImageList(hwndTree1, hImageList, TVSIL_STATE);

#ifndef TVM_SETITEMHEIGHT
#define TVM_SETITEMHEIGHT (TV_FIRST + 27)
#endif
#ifndef TVM_GETITEMHEIGHT
#define TVM_GETITEMHEIGHT (TV_FIRST + 28)
#endif

    if (SendMessage(hwndTree1, TVM_GETITEMHEIGHT, 0, 0) < 16)
      SendMessage(hwndTree1, TVM_SETITEMHEIGHT, 16, 0);

    DeleteObject(hBMcheck1);

    for (i = 0; i < NSIS_MAX_INST_TYPES+1; i++)
    {
      if (g_header->install_types[i])
      {
        int j;
        if (i != NSIS_MAX_INST_TYPES) noCombo = 0;
        GetNSISString(g_tmp,g_header->install_types[i]);
        j=SendMessage(hwndCombo1,CB_ADDSTRING,0,(LPARAM)g_tmp);
        SendMessage(hwndCombo1,CB_SETITEMDATA,j,i);
        if (i == g_exec_flags.cur_insttype)
          SendMessage(hwndCombo1, CB_SETCURSEL, j, 0);
      }
    }

    if (!noCombo)
      ShowWindow(hwndCombo1,SW_SHOW);

    SetUITextFromLang(IDC_TEXT1,this_page->parms[1+noCombo]);
    SetUITextFromLang(IDC_TEXT2,this_page->parms[2+noCombo]);

    Par=NULL;

    for (lastGoodX = x = 0; x < num_sections; x ++)
    {
      section *sec=sections+x;

      if (sec->name_ptr)
      {
        TVINSERTSTRUCT tv;
        tv.hParent=Par;
        tv.hInsertAfter=TVI_LAST;
        tv.item.mask=TVIF_PARAM|TVIF_TEXT|TVIF_STATE;
        tv.item.lParam=x;
        tv.item.pszText=GetNSISStringTT(sec->name_ptr);
        tv.item.stateMask=TVIS_STATEIMAGEMASK|TVIS_EXPANDED|TVIS_BOLD;

        {
          int l=1;
          // Sf_SELECTED == 1
          l += sec->flags & SF_SELECTED;
          //if (sec->flags & SF_SELECTED) l++;
          if (sec->flags & SF_RO) l+=3;

          tv.item.state=INDEXTOSTATEIMAGEMASK(l);
        }

        //if (sec->flags&SF_BOLD)
        {
          // SF_BOLD << 1 == 16 == TVIS_BOLD
          tv.item.state|=(sec->flags&SF_BOLD)<<1;
        }

        if (sec->flags&SF_SUBSEC)
        {
          tv.item.mask|=TVIF_CHILDREN;
          tv.item.cChildren=1;
          //if (sec->flags&SF_EXPAND)
            // TVIS_EXPANDED == SF_EXPAND
            tv.item.state|=sec->flags&SF_EXPAND;
          Par = hTreeItems[x] = TreeView_InsertItem(hwndTree1,&tv);
          doLines=1;
        }
        else if (sec->flags&SF_SUBSECEND)
        {
          SetParentState(hwndTree1,hTreeItems[lastGoodX]);
          Par=TreeView_GetParent(hwndTree1,Par);
        }
        else
        {
          lastGoodX = x;
          hTreeItems[x] = TreeView_InsertItem(hwndTree1,&tv);
        }
      }
    }
    if (!doLines)
    {
      SetWindowLong(hwndTree1,GWL_STYLE,GetWindowLong(hwndTree1,GWL_STYLE)&~(TVS_LINESATROOT));
    }
    SendMessage(hwndTree1,WM_VSCROLL,SB_TOP,0);

    uMsg = g_exec_flags.insttype_changed ? WM_NOTIFY_INSTTYPE_CHANGE : WM_IN_UPDATEMSG;
  }
  if (uMsg == WM_NOTIFY_SECTEXT) // update text
  {
    int x=wParam;
    int ns=lParam;
    TVITEM tv;

    if (tv.hItem=hTreeItems[x])
    {
      tv.mask=TVIF_TEXT;
      tv.pszText=GetNSISStringTT(ns);
      TreeView_SetItem(hwndTree1,&tv);
    }
  }
  if (uMsg == WM_NOTIFY_SECFLAGS) // change flags
  {
    int flags = sections[wParam].flags;
    TVITEM tvItem;

    if (!(tvItem.hItem = hTreeItems[wParam])) return 0;
    tvItem.mask = TVIF_STATE;
    tvItem.stateMask = TVIS_BOLD;
    tvItem.state = 0;
    //if (flags&SF_BOLD) tvItem.state |= TVIS_BOLD;
    // SF_BOLD << 1 == 16 == TVIS_BOLD
    tvItem.state|=(flags&SF_BOLD)<<1;
    TreeView_SetItem(hwndTree1, &tvItem);

    TreeView_Expand(hwndTree1, tvItem.hItem, flags & SF_EXPAND ? TVE_EXPAND : TVE_COLLAPSE);

    if ((flags & (SF_PSELECTED | SF_SELECTED)) != SF_PSELECTED)
    {
      CheckTreeItem(hwndTree1, tvItem.hItem, flags & SF_SELECTED);
    }
  }
  if (uMsg == WM_NOTIFY || uMsg == WM_TREEVIEW_KEYHACK)
  {
    LPNMHDR lpnmh = (LPNMHDR) lParam;
    if (uMsg == WM_TREEVIEW_KEYHACK || lpnmh->idFrom == IDC_TREE1)
    {
      if (!(g_flags&CH_FLAGS_NO_CUSTOM) && (uMsg == WM_TREEVIEW_KEYHACK || lpnmh->code == NM_CLICK))
      {
        TVITEM tvItem;

        if (uMsg != WM_TREEVIEW_KEYHACK)
          tvItem.hItem=TreeHitTest(hwndTree1);
        else
          tvItem.hItem=TreeView_GetSelection(hwndTree1);

        if (tvItem.hItem)
        {
          int iState;

          tvItem.mask = TVIF_STATE|TVIF_PARAM;
          TreeView_GetItem(hwndTree1, &tvItem);

          iState = tvItem.state >> 12;

          if (iState < 4) // not RO
          {
            if (iState == 2) // already checked
            {
              sections[tvItem.lParam].flags&=~SF_SELECTED;
              CheckTreeItem(hwndTree1,tvItem.hItem,0);
            }
            else
            {
              sections[tvItem.lParam].flags|=SF_SELECTED;
              CheckTreeItem(hwndTree1,tvItem.hItem,1);
            }
            lParam = 0;
            wParam = 1;
            uMsg = WM_IN_UPDATEMSG;
          } // not ro
        } // was valid click
      } // was click or hack
Beispiel #8
0
static void initAudioDeviceTree(HWND hDlg)
{
    const AUDIO_DRIVER *pAudioDrv = NULL;
    int i, j;
    TVINSERTSTRUCTW insert;
    HTREEITEM root, driver[10];
    HWND tree = NULL;
    HIMAGELIST hImageList;
    HBITMAP hBitMap;
    HCURSOR old_cursor;
    WCHAR driver_type[64], dev_type[64];

    tree = GetDlgItem(hDlg, IDC_AUDIO_TREE);

    if (!tree)
        return;

    /* set tree view style */
    SetWindowLong(tree, GWL_STYLE, GetWindowLong(tree, GWL_STYLE) | TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT);

    /* state checkbox */
    hImageList = ImageList_Create(16, 16, FALSE, 3, 0);
    hBitMap = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_CHECKBOX));
    ImageList_Add(hImageList, hBitMap, NULL);
    DeleteObject(hBitMap);
    SendMessageW( tree, TVM_SETIMAGELIST, TVSIL_STATE, (LPARAM)hImageList );

    /* root item */
    LoadStringW (GetModuleHandle (NULL), IDS_SOUNDDRIVERS, driver_type,
        sizeof(driver_type)/sizeof(driver_type[0]));
    insert.hParent = TVI_ROOT;
    insert.hInsertAfter = TVI_LAST;
    insert.u.item.mask = TVIF_TEXT | TVIF_CHILDREN;
    insert.u.item.pszText = driver_type;
    insert.u.item.cChildren = 1;
    root = (HTREEITEM)SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);

    /* change to the wait cursor because this can take a while if there is a
     * misbehaving driver that takes a long time to open
     */
    old_cursor = SetCursor(LoadCursor(0, IDC_WAIT));

    /* iterate over list of loaded drivers */
    for (pAudioDrv = loadedAudioDrv, i = 0; pAudioDrv->nameID; i++, pAudioDrv++) {
        HDRVR hdrv;
        char name[MAX_PATH];
        WCHAR text[MAX_PATH];

        sprintf(name, "wine%s.drv", pAudioDrv->szDriver);
        LoadStringW (GetModuleHandle (NULL), pAudioDrv->nameID, text,
            sizeof(text)/sizeof(text[0]));

        if ((hdrv = OpenDriverA(name, 0, 0)))
        {
            HMODULE lib;
            if ((lib = GetDriverModuleHandle(hdrv)))
            {
                int num_wod = 0, num_wid = 0, num_mod = 0, num_mid = 0, num_aux = 0, num_mxd = 0;
                MessagePtr wodMessagePtr = (MessagePtr)GetProcAddress(lib, "wodMessage");
                MessagePtr widMessagePtr = (MessagePtr)GetProcAddress(lib, "widMessage");
                MessagePtr modMessagePtr = (MessagePtr)GetProcAddress(lib, "modMessage");
                MessagePtr midMessagePtr = (MessagePtr)GetProcAddress(lib, "midMessage");
                MessagePtr auxMessagePtr = (MessagePtr)GetProcAddress(lib, "auxMessage");
                MessagePtr mxdMessagePtr = (MessagePtr)GetProcAddress(lib, "mxdMessage");

                if (wodMessagePtr)
                    num_wod = wodMessagePtr(0, WODM_GETNUMDEVS, 0, 0, 0);

                if (widMessagePtr)
                    num_wid = widMessagePtr(0, WIDM_GETNUMDEVS, 0, 0, 0);

                if (modMessagePtr)
                    num_mod = modMessagePtr(0, MODM_GETNUMDEVS, 0, 0, 0);

                if (midMessagePtr)
                    num_mid = midMessagePtr(0, MIDM_GETNUMDEVS, 0, 0, 0);

                if (auxMessagePtr)
                    num_aux = auxMessagePtr(0, AUXDM_GETNUMDEVS, 0, 0, 0);

                if (mxdMessagePtr)
                    num_mxd = mxdMessagePtr(0, MXDM_GETNUMDEVS, 0, 0, 0);

                if (num_wod == 0 && num_wid == 0 && num_mod == 0 && num_mid == 0 && num_aux == 0 && num_mxd == 0)
                {
                    insert.hParent = root;
                    insert.u.item.mask = TVIF_TEXT | TVIF_STATE | TVIF_PARAM;
                    insert.u.item.pszText = text;
                    insert.u.item.stateMask = TVIS_STATEIMAGEMASK;
                    insert.u.item.lParam =  i + DRIVER_MASK;
                    if (isDriverSet(pAudioDrv->szDriver))
                        insert.u.item.state = INDEXTOSTATEIMAGEMASK(2);
                    else
                        insert.u.item.state = INDEXTOSTATEIMAGEMASK(1);

                    driver[i] = (HTREEITEM)SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);
                }
                else
                {
                    HTREEITEM type;

                    insert.hParent = root;
                    insert.u.item.mask = TVIF_TEXT | TVIF_CHILDREN | TVIF_STATE | TVIF_PARAM;
                    insert.u.item.pszText = text;
                    insert.u.item.cChildren = 1;
                    insert.u.item.stateMask = TVIS_STATEIMAGEMASK;
                    insert.u.item.lParam =  i + DRIVER_MASK;

                    if (isDriverSet(pAudioDrv->szDriver))
                        insert.u.item.state = INDEXTOSTATEIMAGEMASK(2);
                    else
                        insert.u.item.state = INDEXTOSTATEIMAGEMASK(1);

                    driver[i] = (HTREEITEM)SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);

                    if (num_wod)
                    {
                        LoadStringW (GetModuleHandle (NULL), IDS_DEVICES_WAVEOUT, dev_type,
                            sizeof(dev_type)/sizeof(dev_type[0]));

                        insert.hParent = driver[i];
                        insert.u.item.mask = TVIF_TEXT | TVIF_CHILDREN;
                        insert.u.item.pszText = dev_type;
                        insert.u.item.cChildren = 1;

                        type = (HTREEITEM)SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);

                        for (j = 0; j < num_wod; j++)
                        {
                            WAVEOUTCAPSW caps;

                            wodMessagePtr(j, WODM_GETDEVCAPS, 0, (DWORD_PTR)&caps, sizeof(caps));

                            insert.hParent = type;
                            insert.u.item.mask = TVIF_TEXT | TVIF_PARAM;
                            insert.u.item.pszText = caps.szPname;
                            insert.u.item.lParam = j + DEVICE_MASK;

                            SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);
                        }
                    }

                    if (num_wid)
                    {
                        LoadStringW (GetModuleHandle (NULL), IDS_DEVICES_WAVEIN, dev_type,
                            sizeof(dev_type)/sizeof(dev_type[0]));

                        insert.hParent = driver[i];
                        insert.u.item.mask = TVIF_TEXT | TVIF_CHILDREN;
                        insert.u.item.pszText = dev_type;
                        insert.u.item.cChildren = 1;

                        type = (HTREEITEM)SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);

                        for (j = 0; j < num_wid; j++)
                        {
                            WAVEINCAPSW caps;

                            widMessagePtr(j, WIDM_GETDEVCAPS, 0, (DWORD_PTR)&caps, sizeof(caps));

                            insert.hParent = type;
                            insert.u.item.mask = TVIF_TEXT | TVIF_PARAM;
                            insert.u.item.pszText = caps.szPname;
                            insert.u.item.lParam = j + DEVICE_MASK;

                            SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);
                        }
                    }

                    if (num_mod)
                    {
                        LoadStringW (GetModuleHandle (NULL), IDS_DEVICES_MIDIOUT, dev_type,
                            sizeof(dev_type)/sizeof(dev_type[0]));

                        insert.hParent = driver[i];
                        insert.u.item.mask = TVIF_TEXT | TVIF_CHILDREN;
                        insert.u.item.pszText = dev_type;
                        insert.u.item.cChildren = 1;

                        type = (HTREEITEM)SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);

                        for (j = 0; j < num_mod; j++)
                        {
                            MIDIOUTCAPSW caps;

                            modMessagePtr(j, MODM_GETDEVCAPS, 0, (DWORD_PTR)&caps, sizeof(caps));

                            insert.hParent = type;
                            insert.u.item.mask = TVIF_TEXT | TVIF_PARAM;
                            insert.u.item.pszText = caps.szPname;
                            insert.u.item.lParam = j + DEVICE_MASK;

                            SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);
                        }
                    }

                    if (num_mid)
                    {
                        LoadStringW (GetModuleHandle (NULL), IDS_DEVICES_MIDIIN, dev_type,
                            sizeof(dev_type)/sizeof(dev_type[0]));

                        insert.hParent = driver[i];
                        insert.u.item.mask = TVIF_TEXT | TVIF_CHILDREN;
                        insert.u.item.pszText = dev_type;
                        insert.u.item.cChildren = 1;

                        type = (HTREEITEM)SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);

                        for (j = 0; j < num_mid; j++)
                        {
                            MIDIINCAPSW caps;

                            midMessagePtr(j, MIDM_GETDEVCAPS, 0, (DWORD_PTR)&caps, sizeof(caps));

                            insert.hParent = type;
                            insert.u.item.mask = TVIF_TEXT | TVIF_PARAM;
                            insert.u.item.pszText = caps.szPname;
                            insert.u.item.lParam = j + DEVICE_MASK;

                            SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);
                        }
                    }

                    if (num_aux)
                    {
                        LoadStringW (GetModuleHandle (NULL), IDS_DEVICES_AUX, dev_type,
                            sizeof(dev_type)/sizeof(dev_type[0]));

                        insert.hParent = driver[i];
                        insert.u.item.mask = TVIF_TEXT | TVIF_CHILDREN;
                        insert.u.item.pszText = dev_type;
                        insert.u.item.cChildren = 1;

                        type = (HTREEITEM)SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);

                        for (j = 0; j < num_aux; j++)
                        {
                            AUXCAPSW caps;

                            auxMessagePtr(j, AUXDM_GETDEVCAPS, 0, (DWORD_PTR)&caps, sizeof(caps));

                            insert.hParent = type;
                            insert.u.item.mask = TVIF_TEXT | TVIF_PARAM;
                            insert.u.item.pszText = caps.szPname;
                            insert.u.item.lParam = j + DEVICE_MASK;

                            SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);
                        }
                    }

                    if (num_mxd)
                    {
                        LoadStringW (GetModuleHandle (NULL), IDS_DEVICES_MIXER, dev_type,
                            sizeof(dev_type)/sizeof(dev_type[0]));

                        insert.hParent = driver[i];
                        insert.u.item.mask = TVIF_TEXT | TVIF_CHILDREN;
                        insert.u.item.pszText = dev_type;
                        insert.u.item.cChildren = 1;

                        type = (HTREEITEM)SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);

                        for (j = 0; j < num_mxd; j++)
                        {
                            MIXERCAPSW caps;

                            mxdMessagePtr(j, MXDM_GETDEVCAPS, 0, (DWORD_PTR)&caps, sizeof(caps));

                            insert.hParent = type;
                            insert.u.item.mask = TVIF_TEXT | TVIF_PARAM;
                            insert.u.item.pszText = caps.szPname;
                            insert.u.item.lParam = j + DEVICE_MASK;

                            SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);
                        }
                    }
                }
            }
            CloseDriver(hdrv, 0, 0);
        }
    }

    /* restore the original cursor */
    SetCursor(old_cursor);

    SendDlgItemMessage(hDlg, IDC_AUDIO_TREE, TVM_SELECTITEM, 0, 0);
    SendDlgItemMessage(hDlg, IDC_AUDIO_TREE, TVM_EXPAND, TVE_EXPAND, (LPARAM)root);
    for (j = 0; j < i; j++)
        SendDlgItemMessage(hDlg, IDC_AUDIO_TREE, TVM_EXPAND, TVE_EXPAND, (LPARAM)driver[j]);
}
Beispiel #9
0
void ScreenRecoveryUI::Init()
{
    gr_init();

    gr_font_size(&char_width, &char_height);

    text_col = text_row = 0;
    text_rows = gr_fb_height() / char_height;
    if (text_rows > kMaxRows) text_rows = kMaxRows;
    text_top = 1;

    text_cols = gr_fb_width() / char_width;
    if (text_cols > kMaxCols - 1) text_cols = kMaxCols - 1;

    backgroundIcon[NONE] = NULL;
    LoadBitmapArray("icon_installing", &installing_frames, &installation);
    backgroundIcon[INSTALLING_UPDATE] = installing_frames ? installation[0] : NULL;
    backgroundIcon[ERASING] = backgroundIcon[INSTALLING_UPDATE];
    LoadBitmap("icon_error", &backgroundIcon[ERROR]);
    backgroundIcon[NO_COMMAND] = backgroundIcon[ERROR];

    LoadBitmap("progress_empty", &progressBarEmpty);
    LoadBitmap("progress_fill", &progressBarFill);
    LoadBitmap("stage_empty", &stageMarkerEmpty);
    LoadBitmap("stage_fill", &stageMarkerFill);

    LoadLocalizedBitmap("installing_text", &backgroundText[INSTALLING_UPDATE]);
    LoadLocalizedBitmap("erasing_text", &backgroundText[ERASING]);
    LoadLocalizedBitmap("no_command_text", &backgroundText[NO_COMMAND]);
    LoadLocalizedBitmap("error_text", &backgroundText[ERROR]);

    // MStar Android Patch Begin
    //load title/tip bitmaps ,added by mstar semiconductor
    LoadBitmap("title_not_power_off",&titleNotPowerOff);
    LoadBitmap("title_not_unplug",&titleNotUnplug);
    LoadBitmap("tip_error", &tipTitle[TIP_TITLE_ERROR]);
    LoadBitmap("tip_ready", &tipTitle[TIP_TITLE_READY]);
    LoadBitmap("tip_success", &tipTitle[TIP_TITLE_SUCCESS]);
    LoadBitmap("tip_wipe_cache", &tipTitle[TIP_TITLE_WIPE_CACHE]);
    LoadBitmap("tip_wipe_data", &tipTitle[TIP_TITLE_WIPE_DATA]);
    LoadBitmap("tip_install_package", &tipTitle[TIP_TITLE_INSTALL_PACKAGE]);
    LoadBitmap("tip_backup_system", &tipTitle[TIP_TITLE_BACKUP_SYSTEM]);
    LoadBitmap("tip_restore_system", &tipTitle[TIP_TITLE_RESTORE_SYSTEM]);
    LoadBitmap("tip_blank_screen", &tipTitle[TIP_TITLE_BLANK_SCREEN]);

    // init exit recovery tip picture
    int j=0;
    char tipFileNmae[40];
    exitRecoveryTipTitle = (gr_surface*)malloc(exitRecoveryTipTitleNum *
                                                   sizeof(gr_surface));
    for (j = 0;j < exitRecoveryTipTitleNum;++j) {
        // "tip_exit_recovery_1.png", "tip_exit_recovery_2.png", ...
        sprintf(tipFileNmae, "tip_exit_recovery_%d", j+1);
        LoadBitmap(tipFileNmae, exitRecoveryTipTitle+j);
    }
    // MStar Android Patch End

    pthread_create(&progress_t, NULL, progress_thread, NULL);

    RecoveryUI::Init();
}
Beispiel #10
0
void TLDisplay::createStaticResources(HINSTANCE hInstance)
{
    //
	//----> Cursors
	//
	TLDisplay::hcursor_arrow = LoadCursor(NULL, (char *)IDC_ARROW);
	TLDisplay::hcursor_hand = LoadCursor(hInstance, (char *)IDC_HAND);
	TLDisplay::hcursor_handdn = LoadCursor(hInstance, (char *)IDC_HANDDN);
	TLDisplay::hcursor_handzoom = LoadCursor(hInstance, (char *)IDC_HANDZOOM);
	//
	//----> Bitmaps...
	//
	TLDisplay::hbmpfilmholes = LoadBitmap(hInstance, (char*)IDB_FILMHOLES);
	//
	//----> Brushes
	//
	TLDisplay::hbrush_filmholes = CreatePatternBrush(TLDisplay::hbmpfilmholes);
	COLORREF color;
	color = RGB(200,200,200);
	TLDisplay::hbrush_bgnd = CreateSolidBrush(color);
	color = RGB(0,0,0);
	TLDisplay::hbrush_middlesepare = CreateSolidBrush(color);
	color = RGB(0,0,0);
	TLDisplay::hbrush_frametxt = CreateSolidBrush(color);
	color = RGB(128,100,100);
	TLDisplay::hbrush_fov = CreateSolidBrush(color);
	color = RGB(180,180,200);
	TLDisplay::hbrush_blocs = CreateSolidBrush(color);
	color = RGB(200,180,180);
	TLDisplay::hbrush_frames = CreateSolidBrush(color);
	color = RGB(14,103,146);
	TLDisplay::hbrush_blocs_hightlight = CreateSolidBrush(color);
	color = RGB(0,0,0);
	TLDisplay::hbrush_filmsepare = CreateSolidBrush(color);
	color = RGB(200,210,200);
	TLDisplay::hbrush_annot = CreateSolidBrush(color);
	color = RGB(220,220,210);
	TLDisplay::hbrush_annot_selected = CreateSolidBrush(color);
	//
	//----> Pens
	//
	color = RGB(1,10,20);
	TLDisplay::hpen_tline = CreatePen(PS_SOLID, 0, color);
	color = RGB(25,25,0);
	TLDisplay::hpen_arrows = CreatePen(PS_SOLID, 1, color);
	color = RGB(180,180,180);
	TLDisplay::hpen_grid = CreatePen(PS_SOLID, 1, color);
	color = RGB(255,255,50);
	TLDisplay::hpen_arrows_sel[0] = CreatePen(PS_SOLID, 0, color);
	color = RGB(100,255,100);
	TLDisplay::hpen_arrows_sel[1] = CreatePen(PS_SOLID, 0, color);
	color = RGB(100,100,255);
	TLDisplay::hpen_arrows_sel[2] = CreatePen(PS_SOLID, 0, color);
	color = RGB(200,60,200);
	TLDisplay::hpen_arrows_sel[3] = CreatePen(PS_SOLID, 0, color);

    //
    // Brush/Pens in misc colors
	// Let's split them in color trends
    //
	COLORREF colors[] = {
	RGB(80,200,80),		//green
	RGB(200,70,80),		// red
	RGB(247,107,4),		// orange
	RGB(80,140,190),	//blue
	RGB(0,160,160),		//blue2
	RGB(160,160,0),		// yellow
	RGB(140,140,140),	// gray
	RGB(0,0,200),		// blue
	RGB(118,199,120),	//green2
	RGB(21,183,33),		//green3
	RGB(162,182,22)	//green4
	};

	for(int i=0; i< NUM_COLORS; i++)
	{
		TLDisplay::hbrush_colors[i] = CreateSolidBrush(colors[i]);
		TLDisplay::hpen_colors[i] = CreatePen(PS_SOLID, 0, colors[i]);
	}
	//
	//----> Icons
	//
	TLDisplay::hicon = LoadIcon(hInstance, (char*)IDI_ANNOT1);
}
Beispiel #11
0
// ----------------------------------------------------------------------------------------
// NOTE: Resource type of rgnName must be of type ABOUT_STC_RGN_RESOURCE_TYPE
// ----------------------------------------------------------------------------------------
void AboutStc(CWnd* i_pParent, HINSTANCE i_hInstance,LPCTSTR bmpName,LPCTSTR rgnName,LPCTSTR product, LPCTSTR description, bool splashScreen, int timeToShow)
{
 static WNDCLASSEX wcex;
 TCHAR  szWindowClass[100];
 static HWND       hWnd;
 static BITMAP     bm;
 static HBITMAP    hWindowBitmap = NULL;
 int sx,sy;

 if (is_instance)
  return;  //only one instance allowed!

 d_about.d_lprgnname = rgnName;
 d_about.hInstance = i_hInstance;

 //following parameters depends on splash screen mode
 d_about.showCloseButton = splashScreen ? false : true;
 d_about.modal = splashScreen ? false : true;
 d_about.autoClose = splashScreen ? timeToShow : -1;

 hWindowBitmap = LoadBitmap(i_hInstance,bmpName);
 if (NULL==hWindowBitmap)
 {
  AfxMessageBox(_T("Can't load bitmap"),MB_OK|MB_ICONSTOP);
  return;
 }

 wsprintf(szWindowClass,_T("%s%d"),_T("STC_about"),i_pParent);

 _tcscpy(d_about.about_product,product);
 _tcscpy(d_about.about_description,description);

 GetObject(hWindowBitmap,sizeof(BITMAP),&bm);

 wcex.cbSize        = sizeof(WNDCLASSEX);
 wcex.style         = CS_HREDRAW|CS_VREDRAW|CS_BYTEALIGNWINDOW;
 wcex.lpfnWndProc   = (WNDPROC)WndProc;
 wcex.cbClsExtra    = 0;
 wcex.cbWndExtra    = 0;
 wcex.hInstance     = i_hInstance;
 wcex.hIcon         = NULL;
 wcex.hCursor       = ::LoadCursor(NULL, IDC_CROSS);
 wcex.hbrBackground = CreatePatternBrush((HBITMAP)hWindowBitmap);
 wcex.lpszMenuName  = NULL;
 wcex.lpszClassName = szWindowClass;
 wcex.hIconSm       = NULL;
 RegisterClassEx(&wcex);

 sx = GetSystemMetrics(SM_CXSCREEN);
 sy = GetSystemMetrics(SM_CYSCREEN);
 sx = (sx / 2) - bm.bmWidth / 2;
 sy = (sy / 2) - bm.bmHeight / 2;

 hWnd = CreateWindowEx(WS_EX_LEFT | WS_EX_TOPMOST,
	          szWindowClass,
	          _T("About"),
			  WS_POPUP,
              sx,
			  sy,
			  bm.bmWidth,
			  bm.bmHeight,
			  i_pParent->m_hWnd,
			  NULL,
			  i_hInstance,
			  NULL);
	  
 if (hWnd == NULL)
 {
  AfxMessageBox(_T("Can't create window"),MB_OK | MB_ICONSTOP);
  return;
 }

 ShowWindow(hWnd,SW_SHOWNORMAL);
 UpdateWindow(hWnd);

 //set flag wich indicates that instance has been created!
 is_instance = true;
}
Beispiel #12
0
bool WInitRibbons( HINSTANCE inst )
{
    int i;

    WRibbonInfo = WAllocToolBarInfo( NUM_TOOLS );
    WSORibbonInfo = WAllocToolBarInfo( NUM_SOTOOLS );

    if( WRibbonInfo == NULL || WSORibbonInfo == NULL ) {
        return( false );
    }

    for( i = 0; i < NUM_TOOLS; i++ ) {
        if( WRibbonNames[i].up != NULL ) {
            WRibbonInfo->items[i].u.bmp = LoadBitmap( inst, WRibbonNames[i].up );
            WRibbonInfo->items[i].id = WRibbonNames[i].menu_id;
            WRibbonInfo->items[i].flags = ITEM_DOWNBMP;
            if( WRibbonNames[i].down != NULL ) {
                WRibbonInfo->items[i].depressed = LoadBitmap( inst, WRibbonNames[i].down );
            } else {
                WRibbonInfo->items[i].depressed = WRibbonInfo->items[i].u.bmp;
            }
            if( WRibbonNames[i].tip_id >= 0 ) {
                LoadString( inst, WRibbonNames[i].tip_id, WRibbonInfo->items[i].tip, MAX_TIP );
            } else {
                WRibbonInfo->items[i].tip[0] = '\0';
            }
        } else {
            WRibbonInfo->items[i].flags = ITEM_BLANK;
            WRibbonInfo->items[i].u.blank_space = WRibbonNames[i].menu_id;
        }
    }

    for( i = 0; i < NUM_SOTOOLS; i++ ) {
        if( WSORibbonNames[i].up != NULL ) {
            WSORibbonInfo->items[i].u.bmp = LoadBitmap( inst, WSORibbonNames[i].up );
            WSORibbonInfo->items[i].id = WSORibbonNames[i].menu_id;
            WSORibbonInfo->items[i].flags = ITEM_DOWNBMP;
            if( WSORibbonNames[i].down != NULL ) {
                WSORibbonInfo->items[i].depressed =
                    LoadBitmap( inst, WSORibbonNames[i].down );
            } else {
                WSORibbonInfo->items[i].depressed = WSORibbonInfo->items[i].u.bmp;
            }
            if( WSORibbonNames[i].tip_id >= 0 ) {
                LoadString( inst, WSORibbonNames[i].tip_id, WSORibbonInfo->items[i].tip, MAX_TIP );
            } else {
                WSORibbonInfo->items[i].tip[0] = '\0';
            }
        } else {
            WSORibbonInfo->items[i].flags = ITEM_BLANK;
            WSORibbonInfo->items[i].u.blank_space = WSORibbonNames[i].menu_id;
        }
    }

    WRibbonInfo->dinfo.button_size.x = BUTTONX + BUTTON_PAD;
    WRibbonInfo->dinfo.button_size.y = BUTTONY + BUTTON_PAD;
    WRibbonInfo->dinfo.border_size.x = TOOL_BORDERX;
    WRibbonInfo->dinfo.border_size.y = TOOL_BORDERY;
    WRibbonInfo->dinfo.style = TOOLBAR_FIXED_STYLE;
    WRibbonInfo->dinfo.hook = WRibbonHook;
    WRibbonInfo->dinfo.helphook = WRibbonHelpHook;
    WRibbonInfo->dinfo.foreground = NULL;
    WRibbonInfo->dinfo.background = NULL;
    WRibbonInfo->dinfo.is_fixed = TRUE;
    WRibbonInfo->dinfo.use_tips = TRUE;

    WSORibbonInfo->dinfo.button_size.x = BUTTONX + BUTTON_PAD;
    WSORibbonInfo->dinfo.button_size.y = BUTTONY + BUTTON_PAD;
    WSORibbonInfo->dinfo.border_size.x = TOOL_BORDERX;
    WSORibbonInfo->dinfo.border_size.y = TOOL_BORDERY;
    WSORibbonInfo->dinfo.style = TOOLBAR_FIXED_STYLE;
    WSORibbonInfo->dinfo.hook = WRibbonHook;
    WSORibbonInfo->dinfo.helphook = WRibbonHelpHook;
    WSORibbonInfo->dinfo.foreground = NULL;
    WSORibbonInfo->dinfo.background = NULL;
    WSORibbonInfo->dinfo.is_fixed = TRUE;
    WSORibbonInfo->dinfo.use_tips = TRUE;

    WRibbonHeight = 2 * WRibbonInfo->dinfo.border_size.y +
                    WRibbonInfo->dinfo.button_size.y +
                    2 * GetSystemMetrics( SM_CYBORDER );

    WRibbonInfo->dinfo.area.bottom = WRibbonHeight;
    WSORibbonInfo->dinfo.area.bottom = WRibbonHeight;

    return( true );
}
Beispiel #13
0
int CALLBACK DlgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
	HDC hdc,khdc;
	HBITMAP oldbmp,newbmp;
	PAINTSTRUCT paint;
	RECT rect;
	char s[32];
	LPDRAWITEMSTRUCT dw;
	int i=0;
	HBRUSH hb;

	switch(msg)
	{
	case WM_INITDIALOG:

		ShowWindow(hWnd,SW_SHOW);
		OldListProc = (WNDPROC)SetWindowLong(GetDlgItem(hWnd,IDC_LIST1),GWL_WNDPROC,(long)NewWindowProc);
//		for(i=0;i<50;i++)
//			SendMessage(GetDlgItem(hWnd,IDC_LIST1),LB_ADDSTRING,0,(LPARAM)s);
//		GetWindowRect(GetDlgItem(hWnd,IDC_LIST1),&rect);
//		InvalidateRect(GetDlgItem(hWnd,IDC_LIST1),&rect,TRUE);
		GetCallAddress(GetDlgItem(hWnd,IDC_LIST1));
		if(SendMessage(GetDlgItem(hWnd,IDC_LIST1),LB_GETCOUNT,wParam,lParam)>0)
			SendMessage(GetDlgItem(hWnd,IDC_LIST1),LB_SETCURSEL,0,0);

		
		break;

	case WM_CLOSE:
		
		EndDialog(hWnd,0);
		break;
	case WM_PAINT:
		hdc=BeginPaint(hWnd,&paint);
		newbmp = LoadBitmap(hin,MAKEINTRESOURCE(IDB_BITMAP1));		
		GetClientRect(hWnd,&rect);
		khdc = CreateCompatibleDC( hdc );
		oldbmp = (HBITMAP)SelectObject(khdc,(HGDIOBJ)newbmp);
		BitBlt(hdc,0,0,rect.right-rect.left,rect.bottom-rect.top,khdc,0,0,SRCCOPY);
		SelectObject(khdc,(HGDIOBJ)oldbmp);
		DeleteObject(khdc);
		DeleteObject((HGDIOBJ)newbmp);
		EndPaint(hWnd,&paint);
		
		break;
	case WM_DRAWITEM:
		if(wParam == IDC_LIST1)
		{
			dw = (LPDRAWITEMSTRUCT) lParam;
			SendMessage(dw->hwndItem,LB_GETITEMRECT,dw->itemID,(WPARAM)&rect);
			if(dw->itemState & ODS_SELECTED||dw->itemState)
			{
				hb = CreateSolidBrush(RGB(0xff,0xff,0xff));
				FillRect(dw->hDC,&rect,hb);
				DeleteObject(hb);
			}

//			SendMessage(hWnd,LB_GETITEMDATA,dw->itemID,(LPARAM)s);
			wsprintf(s,"0x%08x",(dw->itemData)&0x7fffffff);
			if((dw->itemData&0x80000000)==0)
				SetTextColor(dw->hDC,RGB(0,0,0));
			else
				SetTextColor(dw->hDC,RGB(0xff,0,0));
			TextOut(dw->hDC,rect.left+2,rect.top+2,s,lstrlen(s));

		}

		else		return DefWindowProc(hWnd,msg,wParam,lParam);
		break;
	case WM_CTLCOLORLISTBOX:
		hdc=(HDC)wParam;
		::SetBkMode(hdc,TRANSPARENT);
		SetTextColor(hdc,RGB(64,32,0));
		return (int)GetStockObject(HOLLOW_BRUSH);
		break;
	}
	return 0;
}
Beispiel #14
0
int CALLBACK NewWindowProc(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam )
{
	HDC hdc,khdc;
	HBITMAP oldbmp,newbmp;
	RECT rect;
	POINT p;
	HMENU hmenu;
	DWORD addr,index,i,count;
	switch(Msg)
	{
	case WM_ERASEBKGND:
		hdc=(HDC)wParam;
		newbmp = LoadBitmap(hin,MAKEINTRESOURCE(IDB_BITMAP1));	
		GetClientRect(hWnd,&rect);
		khdc = CreateCompatibleDC( hdc );
		oldbmp = (HBITMAP)SelectObject(khdc,(HGDIOBJ)newbmp);
		BitBlt(hdc,rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top,khdc,rect.left,rect.top,SRCCOPY);
		SelectObject(khdc,(HGDIOBJ)oldbmp);
		DeleteObject(khdc);
		DeleteObject((HGDIOBJ)newbmp);
		FlashListBox(hWnd);
		return TRUE;
	case WM_KEYDOWN:
		if(wParam == VK_RETURN)
			ShowDisasmAddr(hWnd);
		else if(wParam == VK_F2)
		{
			index = SendMessage(hWnd,LB_GETCURSEL,0,0);
			addr = SendMessage(hWnd,LB_GETITEMDATA,index,0);
			addr ^= 0x80000000;
			SendMessage(hWnd,LB_SETITEMDATA,index,addr);
			Manualbreakpoint(addr&0x7fffffff,VK_F2,0,0,FIXEDFONT);
		}
		break;
	case WM_RBUTTONDOWN:
		p.x = lParam&0x0000ffff;
		p.y = lParam>>16;
		ClientToScreen(hWnd,&p);
		hmenu = MyCreatMenu();
		TrackPopupMenu(hmenu,TPM_RIGHTBUTTON,p.x,p.y,0,hWnd,NULL);
		DestroyMenu(hmenu);
		break;
	case WM_LBUTTONDBLCLK:
		ShowDisasmAddr(hWnd);
		break;
	case WM_COMMAND:
		switch(LOWORD(wParam))
		{
		case 200:
			ShowOriAddr(hWnd);
			break;
		case 201:
			ShowDisasmAddr(hWnd);
			break;
		case 203:
			MySetBreakpoint(hWnd,TRUE);
			break;
		case 204:
			index = SendMessage(hWnd,LB_GETCURSEL,0,0);
			addr = SendMessage(hWnd,LB_GETITEMDATA,index,0);
			if(DialogBox(hin,MAKEINTRESOURCE(IDD_DIALOG4),NULL,NameDlgProc)==1)
			{
				Insertname(addr&0x7fffffff,NM_COMMENT,note);
			}
			break;
		case 205:
			MyDeleteBreakpoint(hWnd,TRUE);
			break;
		case 206:
			index = SendMessage(hWnd,LB_GETCURSEL,0,0);
			addr = SendMessage(hWnd,LB_GETITEMDATA,index,0);
			Zero_Memory(note, 64);
			Insertname(addr&0x7fffffff,NM_COMMENT,note);
			break;
		case 207:
			MySetBreakpoint(hWnd,FALSE);
			break;
		case 208:
			count = SendMessage(hWnd,LB_GETCOUNT,0,0);
			if(DialogBox(hin,MAKEINTRESOURCE(IDD_DIALOG4),NULL,NameDlgProc)==1)
			{
				for(i=0;i<count;i++)
				{
					addr = SendMessage(hWnd,LB_GETITEMDATA,i,0);
					Insertname(addr&0x7fffffff,NM_COMMENT,note);
				}
			}
			break;
		case 209:
			MyDeleteBreakpoint(hWnd,FALSE);
			break;
		case 210:
			count = SendMessage(hWnd,LB_GETCOUNT,0,0);
			Zero_Memory(note, 64);
			for(i=0;i<count;i++)
			{
				addr = SendMessage(hWnd,LB_GETITEMDATA,i,0);
				Insertname(addr&0x7fffffff,NM_COMMENT,note);
			}
			break;
		}
	case WM_LBUTTONUP:
	case WM_VSCROLL:
	case WM_MOUSEWHEEL:
		InvalidateRect(hWnd,NULL,TRUE);
	}
	return CallWindowProc(OldListProc,hWnd,Msg,wParam,lParam);
}
Beispiel #15
0
static HICON TrayIcon_GetProcessorUsageIcon(void)
{
    HICON        hTrayIcon = NULL;
    HDC            hScreenDC = NULL;
    HDC            hDC = NULL;
    HBITMAP        hBitmap = NULL;
    HBITMAP        hOldBitmap;
    HBITMAP        hBitmapMask = NULL;
    ICONINFO    iconInfo;
    ULONG        ProcessorUsage;
    int            nLinesToDraw;
    HBRUSH        hBitmapBrush = NULL;
    RECT        rc;

    /*
     * Get a handle to the screen DC
     */
    hScreenDC = GetDC(NULL);
    if (!hScreenDC)
        goto done;
    
    /*
     * Create our own DC from it
     */
    hDC = CreateCompatibleDC(hScreenDC);
    if (!hDC)
        goto done;

    /*
     * Load the bitmaps
     */
    hBitmap = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_TRAYICON));
    hBitmapMask = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_TRAYMASK));
    if (!hBitmap || !hBitmapMask)
        goto done;

    hBitmapBrush = CreateSolidBrush(RGB(0, 255, 0));
    if (!hBitmapBrush)
        goto done;
    
    /*
     * Select the bitmap into our device context
     * so we can draw on it.
     */
    hOldBitmap = SelectObject(hDC, hBitmap);

    /*
     * Get the cpu usage
     */
    ProcessorUsage = PerfDataGetProcessorUsage();

    /*
     * Calculate how many lines to draw
     * since we have 11 rows of space
     * to draw the cpu usage instead of
     * just having 10.
     */
    nLinesToDraw = (ProcessorUsage + (ProcessorUsage / 10)) / 11;
    rc.left = 3;
    rc.top = 12 - nLinesToDraw;
    rc.right = 13;
    rc.bottom = 13;

    /*
     * Now draw the cpu usage
     */
    if (nLinesToDraw)
        FillRect(hDC, &rc, hBitmapBrush);

    /*
     * Now that we are done drawing put the
     * old bitmap back.
     */
    SelectObject(hDC, hOldBitmap);

    iconInfo.fIcon = TRUE;
    iconInfo.xHotspot = 0;
    iconInfo.yHotspot = 0;
    iconInfo.hbmMask = hBitmapMask;
    iconInfo.hbmColor = hBitmap;

    hTrayIcon = CreateIconIndirect(&iconInfo);

done:
    /*
     * Cleanup
     */
    if (hScreenDC)
        ReleaseDC(NULL, hScreenDC);
    if (hDC)
        DeleteDC(hDC);
    if (hBitmapBrush)
        DeleteObject(hBitmapBrush);
    if (hBitmap)
        DeleteObject(hBitmap);
    if (hBitmapMask)
        DeleteObject(hBitmapMask);
    
    /*
     * Return the newly created tray icon (if successful)
     */
    return hTrayIcon;
}
Beispiel #16
0
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
     static HINSTANCE hLibrary ;
     static int       iCurrent = 1 ;
     HBITMAP          hBitmap ;
     HDC              hdc ;
     PAINTSTRUCT      ps ;

     switch (message)
     {
     case WM_CREATE:
    	  // Load a pure resource dll here and get HINSTANCE variable.
    	  // More about LoadLibrary function:
    	  // Because of GDI32.LIB import lib file has been linked to our exe, so we can use Rectangle(hdc, xLeft, yTop, xRight, yBottom) function directly,
    	  // if you do not have .lib file, you can load dll at runtime, or the .lib file you have is older one but you need new functions in current dll. this is why we need this technology.
    	  // Below are the steps about this technology.
//    	 typedef BOOL (WINAPI * PFNRECT) (HDC, int, int, int, int) ;
//
//    	 You then define two variables: 
//
//    	 HANDLE  hLibrary ;
//    	 PFNRECT pfnRectangle ;
//
//    	 Now you set hLibrary to the handle of the library and lpfnRectangle to the address of the Rectangle function: 
//
//    	 hLibrary = LoadLibrary (TEXT ("GDI32.DLL"))
//    	 pfnRectangle = (PFNPRECT) GetProcAddress (hLibrary, TEXT ("Rectangle"))
//
//    	 The LoadLibrary function returns NULL if the library file can't be found or if some other error occurs. Now you can call the function and then free the library: 
//
//    	 pfnRectangle (hdc, xLeft, yTop, xRight, yBottom) ;
//    	 FreeLibrary (hLibrary) ;

          if ((hLibrary = LoadLibrary (TEXT ("BITLIB.DLL"))) == NULL)
          {
               MessageBox (hwnd, TEXT ("Can't load BITLIB.DLL."),
                           szAppName, 0) ;
               return -1 ;
          }
          return 0 ;
          
     case WM_CHAR:
          if (hLibrary)
          {
               iCurrent ++ ;
               InvalidateRect (hwnd, NULL, TRUE) ;
          }
          return 0 ;
          
     case WM_PAINT:
          hdc = BeginPaint (hwnd, &ps) ;
          
          if (hLibrary)
          {
        	   // Load resource from pure resource dll with hinstance and id here.
        	   // MAKEINTRESOURCE here means we are using id in bitlib.rc file just as one line I picked up in bitlib.rc file below:
        	   // 1                       BITMAP  DISCARDABLE     "src/bitmap1.bmp"
        	   // See more about MAKEINTRESOURCE in the book windows programming Figure 10-4.
               hBitmap = LoadBitmap (hLibrary, MAKEINTRESOURCE (iCurrent)) ;

               if (!hBitmap) 
               {
                    iCurrent = 1 ;
                    hBitmap = LoadBitmap (hLibrary, 
                                          MAKEINTRESOURCE (iCurrent)) ;
               }
               if (hBitmap)
               {
                    DrawBitmap (hdc, 0, 0, hBitmap) ;
                    DeleteObject (hBitmap) ;
               }
          }
          EndPaint (hwnd, &ps) ;
          return 0 ;
          
     case WM_DESTROY:
    	  // free the loaded hinstance.
          if (hLibrary)
               FreeLibrary (hLibrary) ;

          PostQuitMessage (0) ;
          return 0 ;
     }
     return DefWindowProc (hwnd, message, wParam, lParam) ;
}
Beispiel #17
0
static void CreateFileList() {



#ifdef USE_MASKS

    int i;

#endif



    GetRegistryString(TEXT("InstallDir"), installDir, BUF_SIZE-1);



    //  wsprintf(installDir, TEXT("\\Program Files\\XCSoar"));



    lstrcpy(FileList[0].Name, TEXT("XCSoar"));



    wsprintf(FileList[0].FileName, TEXT("%s\\XCSoar.exe"), installDir);

    wsprintf(FileList[0].CommandLine, TEXT("%s\\XCSoar.exe"), installDir);

    lstrcpy(FileList[0].Description, TEXT("Start XCSoar in flight mode"));



    if (FileList[0].bitmap==NULL) {

        FileList[0].bitmap = LoadBitmap(hInst,

                                        MAKEINTRESOURCE(IDB_XCSOARLSWIFT));

    }



    FileList[0].Index = 0;



    lstrcpy(FileList[1].Name, TEXT("XCSoar Sim"));



    wsprintf(FileList[1].FileName, TEXT("%s\\XCSoarSimulator.exe"), installDir);

    wsprintf(FileList[1].CommandLine, TEXT("%s\\XCSoarSimulator.exe"), installDir);



    lstrcpy(FileList[1].Description, TEXT("Start XCSoar in simulator mode"));



    FileList[1].Index = 1;



    if (FileList[1].bitmap==NULL) {

        FileList[1].bitmap = LoadBitmap(hInst,

                                        MAKEINTRESOURCE(IDB_XCSOARLSWIFTSIM));

    }





// Create Mask bitmaps if required

#ifdef USE_MASKS



    for (i=0; i<FileListCnt; ++i) {

        if (FileList[i].mask==NULL) {

            FileList[i].mask = CreateMaskBMP(FileList[i].bitmap, RGB(0,0,255));

        }

    }



#endif



}
Beispiel #18
0
void DrawObjectBlob (CObject *objP, int bmi0, int bmi, int iFrame, tRgbaColorf *colorP, float fAlpha)
{
	CBitmap*		bmP;
	tRgbaColorf	color;
	int			nType = objP->info.nType;
	int			nId = objP->info.nId;
#if 0
	int			bMuzzleFlash = 0;
#endif
	int			bAdditive = 0, bEnergy = 0, nTransp = (nType == OBJ_POWERUP) ? 3 : 2;
	fix			xSize;
	float			fScale;

if ((nType == OBJ_WEAPON) && (objP->info.nId == OMEGA_ID) && omegaLightnings.Exist ())
	return;
#if DBG
if ((nType == nDbgObjType) && ((nDbgObjId < 0) || (objP->info.nId == nDbgObjId)))
	nDbgObjType = nDbgObjType;
#endif
if (gameOpts->render.textures.bUseHires [0] || gameOpts->render.effects.bTransparent) {
	if (fAlpha) {
		bAdditive = (nType == OBJ_FIREBALL) || (nType == OBJ_EXPLOSION) || ((nType == OBJ_WEAPON) && (objP->info.nId == OMEGA_ID));
#if 0
		bMuzzleFlash = (nType == OBJ_FIREBALL) && ((nId == 11) || (nId == 12) || (nId == 15) || (nId == 22) || (nId == 86));
#endif
		}
	else {
		if (nType == OBJ_POWERUP) {
			if (IsEnergyPowerup (nId)) {
				fAlpha = 2.0f / 3.0f;
				bEnergy = 1;
				}
			else
				fAlpha = 1.0f;
			}
		else if ((nType != OBJ_FIREBALL) && (nType != OBJ_EXPLOSION))
			fAlpha = 1.0f;
		else {
			fAlpha = 2.0f / 3.0f;
			bAdditive = 1;
			}
		}
	}
else {
	nTransp = 3;
	fAlpha = 1.0f;
	}

#if 0
if (bmi < 0) {
	PageInAddonBitmap (bmi);
	bmP = gameData.pig.tex.addonBitmaps - bmi - 1;
#if DBG
	if ((objP->rType.vClipInfo.nCurFrame < 0) || (objP->rType.vClipInfo.nCurFrame >= bmP->FrameCount ())) {
		objP->rType.vClipInfo.nCurFrame = 0;
		return;
		}
#endif
	}
else {
	LoadBitmap (bmi, 0);
	bmP = gameData.pig.tex.bitmaps [0] + bmi;
	}
#else
if (bmi < 0) {
	bmP = gameData.pig.tex.addonBitmaps - bmi - 1;
	bmP = bmP->SetCurFrame (iFrame);
	}
else {
	CBitmap* bmoP;

	bmP = gameData.pig.tex.bitmaps [0] + bmi;
	if ((bmP->Type () == BM_TYPE_STD) && (bmoP = bmP->Override ()))
		bmP = bmoP->SetCurFrame (iFrame);
	}
#endif

//bmP->SetupTexture (1, 1);
if (!bmP)
	return;
#if 0
if (!bmP->Prepared () && bmP->PrepareTexture (1, 0))
	return;
#endif
fScale = ObjectBlobColor (objP, bmP, &color);
if (colorP /*&& (bmi >= 0)*/)
	*colorP = color;
	//memcpy (colorP, gameData.pig.tex.bitmapColors + bmi, sizeof (tRgbaColorf));

xSize = objP->info.xSize;

if (nType == OBJ_POWERUP) {
	if ((bEnergy && gameOpts->render.coronas.bPowerups) || (!bEnergy && gameOpts->render.coronas.bWeapons))
		RenderPowerupCorona (objP, color.red, color.green, color.blue,
									coronaIntensities [gameOpts->render.coronas.nObjIntensity]);
	}
if ((objP->info.nType == OBJ_POWERUP) && (objP->info.nId == POW_SHIELD_BOOST) &&
	 !gameStates.app.bNostalgia && gameOpts->render.powerups.b3D && gameOpts->render.powerups.b3DShields) {
	if ((objP->mType.physInfo.velocity.IsZero ()) && (objP->info.movementType != MT_SPINNING)) {
		objP->info.movementType = MT_SPINNING;
		objP->mType.spinRate = objP->info.position.mOrient.UVec () * (I2X (1) / 8);
		}
	//the actual shield in the sprite texture has 3/4 of the textures size
	DrawShieldSphere (objP, 3 * color.red / 2, 3 * color.green / 2, 3 * color.blue / 2, 1.0f, 3 * objP->info.xSize / 4);
	}
else if ((gameOpts->render.bDepthSort > 0) && (fAlpha < 1)) {
	if (bAdditive) {
#if 1
		color.red =
		color.green =
		color.blue = 0.5f;
#else
		if ((nType == OBJ_FIREBALL) && (fScale > 0)) {
			fScale = 1.0f - fScale / 6.0f;
			color.red *= fScale;
			color.green *= fScale;
			color.blue *= fScale;
			}
#endif
		}
	else
		color.red =
		color.green =
		color.blue = 1;
	color.alpha = fAlpha;
	if (bmP->Width () > bmP->Height ())
		transparencyRenderer.AddSprite (bmP, objP->info.position.vPos, &color, xSize, FixMulDiv (xSize, bmP->Height (), bmP->Width ()),
												  iFrame, bAdditive, (nType == OBJ_FIREBALL) ? 10.0f : 0.0f);
	else
		transparencyRenderer.AddSprite (bmP, objP->info.position.vPos, &color, FixMulDiv (xSize, bmP->Width (), bmP->Height ()), xSize,
												  iFrame, bAdditive, (nType == OBJ_FIREBALL) ? 10.0f : 0.0f);
	}
else {
	if (bmP->Width () > bmP->Height ())
		G3DrawBitmap (objP->info.position.vPos, xSize, FixMulDiv (xSize, bmP->Height (), bmP->Width ()), bmP, NULL, fAlpha, nTransp);
	else
		G3DrawBitmap (objP->info.position.vPos, FixMulDiv (xSize, bmP->Width (), bmP->Height ()), xSize, bmP, NULL, fAlpha, nTransp);
	}
gameData.render.nTotalSprites++;
}
Beispiel #19
0
void Demo_AreaFill(HDC hDC, const RECT * rcPaint, int width, int height)
{
	const COLORREF c0 = RGB(0x20, 0x20, 0x20);
	const COLORREF c1 = RGB(0xF0, 0xF0, 0x20);

	for (int i=0; i<4; i++)
		GradientRectangle(hDC, 1000+1100*i, 500, 2000+1100*i, 1500, c0, c1, i*450);

	for (i=0; i<4; i++)
		SymGradientRectangle(hDC, 1000+1100*i, 1600, 2000+1100*i, 2600, c0, c1, i*450);

	for (i=0; i<4; i++)
		CornerGradientRectangle(hDC, 1000+1100*i, 2700, 2000+1100*i, 3700, c0, c1, i);

	CenterGradientRectangle(hDC, 5600, 1500, 6600, 2500, c0, c1);
	CenterGradientRectangle(hDC, 5600, 2600, 6600, 3600, c1, c0);

	//  Buttons
	RoundRectButton(hDC, 0,    4000,  800, 4800,   0, 100, RGB(0x20, 0x20, 0x20), RGB(0xF0, 0xF0, 0x20));
	RoundRectButton(hDC, 1000, 4000, 1800, 4800, 400, 100, RGB(0xF0, 0x20, 0x20), RGB(0x20, 0xF0, 0x20));
	RoundRectButton(hDC, 2000, 4000, 2800, 4800, 800, 100, RGB(0xFF, 0xFF, 0x20), RGB(0x20, 0x20, 0xF0));
	
	   GradientRectangle(hDC, 0, 5000, 2000, 6000, RGB(0xFF, 0x0, 0), RGB(0, 0, 0xFF), 0);
	HLSGradientRectangle(hDC, 0, 6200, 2000, 7200, RGB(0xFF, 0x0, 0), RGB(0, 0, 0xFF), 200);

	RadialGradientFill(hDC, 3200, 6300, 3200    , 6300   ,  1000, RGB(0xFF, 0xFF, 0xFF), RGB(0, 0, 0xFF), 8);
	RadialGradientFill(hDC, 5300, 6300, 5300-300, 6300-600, 1000, RGB(0xFF, 0xFF, 0xFF), RGB(0, 0, 0xFF), 16);
	RadialGradientFill(hDC, 7400, 6300, 7400-300, 6300+300, 1000, RGB(0xFF, 0xFF, 0xFF), RGB(0, 0, 0xFF), 256);

	{
		RECT r = { 7000, 500, 8500, 500+1500 };

		KGDIObject blue(hDC, CreatePen(PS_SOLID, 1 * ONEINCH/72, RGB(0, 0, 0xFF)));
		KGDIObject yellow(hDC, CreateSolidBrush(RGB(0xFF, 0xFF, 0)));
	
		Rectangle(hDC, 7000, 500, 8500, 500+1500);
		
		BrickPatternFill(hDC, 7000,  500, 8500,	 500+1500, 150, 150);
		BrickPatternFill(hDC, 7000, 2100, 8500, 2100+1500, 100, 100);
	}

	KLogFont logfont(- 8 * ONEINCH / 72, "Tahoma");
	KGDIObject font(hDC, logfont.CreateFont());

	{
		SelectObject(hDC, GetStockObject(NULL_PEN));
	
		typedef enum { GAP = 1200 };

		for (int hs= HS_HORIZONTAL; hs<=HS_DIAGCROSS; hs++)
		{
			HBRUSH hBrush = CreateHatchBrush(hs, RGB(0, 0, 0xFF));
			HGDIOBJ hOld  = SelectObject(hDC, hBrush);

			SetBkColor(hDC, RGB(0xFF, 0xFF, 0));
			Rectangle(hDC, hs*GAP, 8000, hs*GAP+890, 8890);

			SetBkColor(hDC, RGB(0xFF, 0xFF, 0xFF));
		
			SetTextAlign(hDC, TA_CENTER);
			TextOut(hDC, hs*GAP+880/2, 8980, HS_Names[hs-HS_HORIZONTAL], _tcslen(HS_Names[hs-HS_HORIZONTAL]));

			SelectObject(hDC, hOld);
			DeleteObject(hBrush);
		}
	}

	{
		HINSTANCE hCards = LoadLibrary("cards.dll");

		for (int i=0; i<3; i++)
	{
		HBRUSH hBrush;
		int    width, height;

		switch ( i )
		{
			case 0:
				{
					HBITMAP hBitmap = LoadBitmap(hCards, MAKEINTRESOURCE(52));
					BITMAP  bmp;

					GetObject(hBitmap, sizeof(bmp), & bmp);
					width = bmp.bmWidth; height = bmp.bmHeight;

					hBrush = CreatePatternBrush(hBitmap);
					DeleteObject(hBitmap);
				}
				break;

			case 1:
				{
					HRSRC hResource = FindResource(hCards, MAKEINTRESOURCE(52-14), RT_BITMAP);
					HGLOBAL hGlobal = LoadResource(hCards, hResource);
	
					hBrush  = CreateDIBPatternBrushPt(LockResource(hGlobal), DIB_RGB_COLORS);
					width   = ((BITMAPCOREHEADER *) hGlobal)->bcWidth; // old DIB format
					height  = ((BITMAPCOREHEADER *) hGlobal)->bcHeight;// old DIB format
				}
				break;

			case 2:
				{
					HRSRC hResource = FindResource(hCards, MAKEINTRESOURCE(52-28), RT_BITMAP);
					HGLOBAL hGlobal = LoadResource(hCards, hResource);

					hBrush  = CreateDIBPatternBrush(hGlobal, DIB_RGB_COLORS);
					width   = ((BITMAPCOREHEADER *) hGlobal)->bcWidth;  // old DIB format
					height  = ((BITMAPCOREHEADER *) hGlobal)->bcHeight; // old DIB format
				}
		}
		
		HGDIOBJ hOld  = SelectObject(hDC, hBrush);

		POINT P = { i*1400+200 + width*10*i/4, 10000 + height*10*i/4 };
		LPtoDP(hDC, &P, 1);
		SetBrushOrgEx(hDC, P.x, P.y, NULL); // make sure cards aligned with rectangle
	
		Rectangle(hDC, i*1400+200, 10000, i*1400+200+width*30/2+1, 10000+height*30/2+1);
	
		SelectObject(hDC, hOld);
		DeleteObject(hBrush);

	}
	}

}
Beispiel #20
0
BOOL MR_ResBitmapBuilder::BuildFromFile(const char *pFile, int pAntiAliasScheme)
{
	BOOL lReturnValue = TRUE;

	MR_UInt8 *lBuffer;

	lBuffer = LoadBitmap(pFile, mXRes, mYRes, TRUE);

	if(lBuffer == NULL) {
		lReturnValue = FALSE;
	}
	else {

		// Compute the number of required SubBitmap
		if(pAntiAliasScheme == 0) {
			mSubBitmapCount = 1;
		}
		else {
			mSubBitmapCount = 0;

			int lXRes = mXRes;
			int lYRes = mYRes;

			while((lXRes > 2) && (lYRes > 2)) {
				mSubBitmapCount++;

				lXRes /= 2;
				lYRes /= 2;
			}
		}

		// Alloc all the required memory
		mSubBitmapList = new SubBitmap[mSubBitmapCount];

		int lXRes = mXRes;
		int lYRes = mYRes;
		int lCounter = 0;

		while(lCounter < mSubBitmapCount) {
			mSubBitmapList[lCounter].mXRes = lXRes;
			mSubBitmapList[lCounter].mYRes = lYRes;
			mSubBitmapList[lCounter].mXResShiftFactor = lCounter;
			mSubBitmapList[lCounter].mYResShiftFactor = lCounter;
			mSubBitmapList[lCounter].mHaveTransparent = FALSE;

			mSubBitmapList[lCounter].mBuffer = new MR_UInt8[lXRes * lYRes];

			mSubBitmapList[lCounter].mColumnPtr = new MR_UInt8 *[mSubBitmapList[lCounter].mXRes];

			MR_UInt8 *lPtr = mSubBitmapList[lCounter].mBuffer;

			for(int lColumn = 0; lColumn < mSubBitmapList[lCounter].mXRes; lColumn++) {
				mSubBitmapList[lCounter].mColumnPtr[lColumn] = lPtr;
				lPtr += mSubBitmapList[lCounter].mYRes;
			}

			lXRes /= 2;
			lYRes /= 2;
			lCounter++;
		}

		ComputeIntermediateImages(lBuffer);
	}

	delete[]lBuffer;

	return lReturnValue;
}
Beispiel #21
0
/*
 * AnyInstance - do work required for every instance of the application:
 *                create the window, initialize data
 */
static BOOL AnyInstance( HINSTANCE this_inst, int cmdshow )
/******************************************************/
{
    HWND        window_handle;
    BITMAP      bitmapbuff;
    extra_data  *edata_ptr;

    /*
     * create main window
     */
    window_handle = CreateWindow(
        ShootGalClass,           /* class */
        "Open WATCOM Shooting Gallery - Sample Application",   /* caption */
        WS_OVERLAPPEDWINDOW | WS_VSCROLL | WS_HSCROLL,    /* style */
        CW_USEDEFAULT,          /* init. x pos */
        CW_USEDEFAULT,          /* init. y pos */
        CW_USEDEFAULT,          /* init. x size */
        CW_USEDEFAULT,          /* init. y size */
        NULL,                   /* parent window */
        NULL,                   /* menu handle */
        this_inst,              /* program handle */
        NULL                    /* create parms */
        );

    if( !window_handle ) return( FALSE );

    /*
     * get a timer
     */
    while( !SetTimer( window_handle, TARGET_TIMER, STD_TARGET_SPEED,
                                                 ( FARPROC ) NULL ) ) {
        if( MessageBox( window_handle, "Too many timers in use!", NULL,
                        MB_ICONEXCLAMATION | MB_RETRYCANCEL ) == IDCANCEL ) {
            return( FALSE );
        }
    }

    /*
     * initialize data
     */
    edata_ptr = calloc( 1, sizeof( extra_data ) );
    if( edata_ptr == NULL ) return( FALSE );

    edata_ptr->target_bmp = LoadBitmap( this_inst, "target" );
    GetObject( edata_ptr->target_bmp, sizeof( BITMAP ), (LPSTR) &bitmapbuff);

    edata_ptr->sound_on = FALSE;
    edata_ptr->score_on = FALSE;
    edata_ptr->target.x = 0;
    edata_ptr->target.y = 0;
    edata_ptr->size.x = bitmapbuff.bmWidth;
    edata_ptr->size.y = bitmapbuff.bmHeight;
    edata_ptr->aim = edata_ptr->target;
    edata_ptr->bolt = edata_ptr->aim;
    edata_ptr->target_speed = STD_TARGET_SPEED;
    edata_ptr->bolt_speed = STD_BOLT_SPEED;
    GetClientRect( window_handle, &edata_ptr->client_rect );
    edata_ptr->message_window_proc =
             MakeProcInstance( (FARPROC)MessageWindowProc, this_inst );
    edata_ptr->score_window_proc =
             MakeProcInstance( (FARPROC)ScoreProc, this_inst );
    edata_ptr->bolt_icon = LoadIcon( this_inst, "Bolt" );

    /*
     * put a pointer to the above structure in the main window structure
     */
    SetWindowLong( window_handle, EXTRA_DATA_OFFSET, (DWORD) edata_ptr );

    /*
     * display window
     */
    ShowWindow( window_handle, cmdshow );
    UpdateWindow( window_handle );

    return( TRUE );

} /* AnyInstance */
Beispiel #22
0
LRESULT CFunctionPage::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	bHandled = TRUE;
	START_PROFILE(FuncInit);
	m_MessageMaps.Attach(GetDlgItem(IDC_COMBO_MESSAGEMAP));
	m_MessageManager.Init(m_hWnd, m_pResManager, &m_GeneralResources);
	m_FunctionManager.Init(m_hWnd);

	CreateControls();

	CImageList ImageList;
	ImageList.Create(16, 16, ILC_COLOR24 | ILC_MASK, 3, 2);
	ImageList.AddIcon(LoadIcon(_AtlModule.GetResourceInstance(), MAKEINTRESOURCE(IDI_ICON_CLOSE)));
	ImageList.AddIcon(LoadIcon(_AtlModule.GetResourceInstance(), MAKEINTRESOURCE(IDI_ICON_OPEN)));
	ImageList.AddIcon(LoadIcon(_AtlModule.GetResourceInstance(), MAKEINTRESOURCE(IDI_ICON_MESSAGE)));
	ImageList.Add(LoadBitmap(_AtlModule.GetResourceInstance(), MAKEINTRESOURCE(IDB_BITMAP_ICONS)), 0x7C00FF);

	m_Messages.SetImageList(ImageList.Detach(), TVSIL_NORMAL);
	FillTreeView();

	//построение дерева
	HTREEITEM hRoot = m_Messages.GetRootItem();
	m_Messages.Expand(hRoot);
	HTREEITEM hRootChild = m_Messages.GetChildItem(hRoot);
	while(hRootChild)
	{
		m_Messages.Expand(hRootChild);
		hRootChild = m_Messages.GetNextSiblingItem(hRootChild);
	}

	CRect r;
	m_Handlers.GetWindowRect(r);
	int width = m_WindowSettings.m_HandlerHeaderWidth; //(r.Width() * 5) / 11;
	m_Handlers.InsertColumn(0, _T("Handler"), LVCFMT_LEFT, width, 0);
	m_Handlers.InsertColumn(1, _T("Message"), LVCFMT_LEFT, r.Width() - width-5, 1);
	m_Handlers.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);

	if (m_pClassVector->GetCount())
	{
		int iCurClass = 0;
		for (size_t i = 0; i < m_pClassVector->GetCount(); i++)
		{
			int iPos = m_ClassCombo.AddString((*m_pClassVector)[i]->Name);
			m_ClassCombo.SetItemData(iPos, i);
			if (i == *m_piCurrentClass)
				iCurClass = iPos;
		}
		m_ClassCombo.SetCurSel(iCurClass);
		UpdateClass();
	}

	LoadGeneralResources();
	m_ToolbarImgList.CreateFromImage(IDB_BITMAP_MESSAGE, 18, 6, RGB(197, 200,201), IMAGE_BITMAP, LR_CREATEDIBSECTION);
	InitToolTip();
	m_ToolTip.SetMaxTipWidth(400);
	if ((int)_AtlModule.m_eWTLVersion < eWTL75)
	{
		GetDlgItem(IDC_CHECK_REFLECT_EX).ShowWindow(SW_HIDE);
	}

	m_SplitMessages.SetFocus();
	END_PROFILE(FuncInit, _T("CFunctionPage::OnInitDialog"));
	return 0;
}
Beispiel #23
0
/*
==============
ConWndProc
==============
*/
static LONG WINAPI ConWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	char            *cmdString;
	static qboolean s_timePolarity;

	switch (uMsg)
	{
	case WM_SIZE:
		CON_ResizeWindowsCon(LOWORD(lParam), HIWORD(lParam));
		break;
	case WM_ACTIVATE:
		if (LOWORD(wParam) != WA_INACTIVE)
		{
			SetFocus(s_wcd.hwndInputLine);
		}

		if (com_viewlog && (com_dedicated && !com_dedicated->integer))
		{
			// if the viewlog is open, check to see if it's being minimized
			if (com_viewlog->integer == 1)
			{
				if (HIWORD(wParam))         // minimized flag
				{
					Cvar_Set("viewlog", "2");
				}
			}
			else if (com_viewlog->integer == 2)
			{
				if (!HIWORD(wParam))            // minimized flag
				{
					Cvar_Set("viewlog", "1");
				}
			}
		}
		break;

	case WM_CLOSE:
		if ((com_dedicated && com_dedicated->integer))
		{
			cmdString = CopyString("quit");
			Com_QueueEvent(0, SE_CONSOLE, 0, 0, strlen(cmdString) + 1, cmdString);
		}
		else if (s_wcd.quitOnClose)
		{
			PostQuitMessage(0);
		}
		else
		{
			Sys_ShowConsole(0, qfalse);
			Cvar_Set("viewlog", "0");
		}
		return 0;
	case WM_CTLCOLORSTATIC:
		if ((HWND)lParam == s_wcd.hwndBuffer)
		{
			SetBkColor((HDC)wParam, COLOR_BCK_NORMAL);
			SetTextColor((HDC)wParam, COLOR_TEXT_NORMAL);
			return (long)s_wcd.hbrEditBackground;
		}
		else if ((HWND)lParam == s_wcd.hwndErrorBox)
		{
			SetBkColor((HDC)wParam, COLOR_BCK_ERROR);
			if (s_timePolarity & 1)
			{
				SetTextColor((HDC)wParam, COLOR_TEXT_ERROR1);
			}
			else
			{
				SetTextColor((HDC)wParam, COLOR_TEXT_ERROR2);
			}

			return (long)s_wcd.hbrErrorBackground;
		}
		break;
	case WM_CTLCOLOREDIT:
		if ((HWND)lParam == s_wcd.hwndInputLine)
		{
			SetBkColor((HDC)wParam, COLOR_BCK_NORMAL);
			SetTextColor((HDC)wParam, COLOR_TEXT_EDIT);

			return (long)s_wcd.hbrEditBackground;
		}
	case WM_COMMAND:
		if (wParam == COPY_ID)
		{
			SendMessage(s_wcd.hwndBuffer, EM_SETSEL, 0, -1);
			SendMessage(s_wcd.hwndBuffer, WM_COPY, 0, 0);
		}
		else if (wParam == QUIT_ID)
		{
			if (s_wcd.quitOnClose)
			{
				PostQuitMessage(0);
			}
			else
			{
				cmdString = CopyString("quit");
				Com_QueueEvent(0, SE_CONSOLE, 0, 0, strlen(cmdString) + 1, cmdString);
			}
		}
		else if (wParam == CLEAR_ID)
		{
			SendMessage(s_wcd.hwndBuffer, EM_SETSEL, 0, -1);
			SendMessage(s_wcd.hwndBuffer, EM_REPLACESEL, FALSE, ( LPARAM ) "");
			UpdateWindow(s_wcd.hwndBuffer);
		}
		break;
	case WM_CREATE:
		s_wcd.hbmLogo            = LoadBitmap(g_wv.hInstance, MAKEINTRESOURCE(IDB_BITMAP1));
		s_wcd.hbmClearBitmap     = LoadBitmap(g_wv.hInstance, MAKEINTRESOURCE(IDB_BITMAP2));
		s_wcd.hbrEditBackground  = CreateSolidBrush(COLOR_BCK_NORMAL);
		s_wcd.hbrErrorBackground = CreateSolidBrush(COLOR_BCK_ERROR);
		SetTimer(hWnd, 1, 1000, NULL);
		break;
	case WM_ERASEBKGND:
		return DefWindowProc(hWnd, uMsg, wParam, lParam);
	case WM_TIMER:
		if (wParam == 1)
		{
			s_timePolarity = (qboolean) !s_timePolarity;
			if (s_wcd.hwndErrorBox)
			{
				InvalidateRect(s_wcd.hwndErrorBox, NULL, FALSE);
			}
		}

		break;
	}

	return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
BOOL RWindowsImageList::LoadBitmap( UINT nID, COLORREF crMask )
{
	return LoadBitmap( MAKEINTRESOURCE (nID), crMask ) ;
}
Beispiel #25
0
void Topology::loadBitmap(const int xx) {
    hBitmap = LoadBitmap(hInst, MAKEINTRESOURCE(xx));
}
Beispiel #26
0
INT_PTR
CALLBACK
stAboutDlgProc(
    HWND hDlg,
    UINT msg,
    WPARAM wParam,
    LPARAM lParam)
/*++

Routine Description:
    
    dialog box to show information about StraceNT

Returns:

    TRUE - Message handled by the dialog proc
    FALSE - Message not handled

--*/
{
    int result = 0;

    switch(msg)
    {
        case WM_INITDIALOG:
        {
            HICON hIcon = LoadIcon(ghInstance, MAKEINTRESOURCE(IDI_APP_ICON));
            SendMessage (hDlg, WM_SETICON, (WPARAM)ICON_SMALL, (LPARAM)hIcon);
            SendMessage (hDlg, WM_SETICON, (WPARAM)ICON_BIG, (LPARAM)hIcon);

            SendMessage(
                GetDlgItem(hDlg,IDOK),
                BM_SETIMAGE,
                IMAGE_BITMAP,
                (LPARAM)LoadBitmap(ghInstance, MAKEINTRESOURCE(IDB_ABOUT_BTN)));

            CenterDialog(hDlg);

            break;
        }
        case WM_CTLCOLORDLG:
        {
            HDC hdc = (HDC)wParam;
            SetBkColor(hdc, RGB(0, 0, 0));
            return (INT_PTR)GetStockObject(BLACK_BRUSH);
        }
        case WM_CTLCOLORSTATIC:
        {   
            HDC hdc = (HDC)wParam;

            SetBkColor(hdc, RGB(0, 0, 0));

            if (GetDlgItem(hDlg, IDC_STATIC_LINK) == (HWND)lParam)
            {   
                SetTextColor(hdc, RGB(128, 128, 192));
            }
            else
            {
                SetTextColor(hdc, RGB(128, 255, 0));
            }

            return (INT_PTR)GetStockObject(BLACK_BRUSH);
        }
        case WM_COMMAND:
        {
            switch(wParam)
            {
                case IDC_STATIC_LINK:
                {
                    ShellExecute(
                            NULL,
                            NULL,
                            L"http://www.intellectualheaven.com",
                            NULL,
                            NULL,
                            SW_SHOW | SW_MAXIMIZE);

                    return TRUE;
                }
                case IDOK:
                {
                    EndDialog(hDlg, IDOK);
                    return TRUE;
                }
                case IDCANCEL:
                {
                    EndDialog(hDlg, IDCANCEL);
                    return TRUE;
                }
            }

            break;
        }
    }

    return FALSE;
}
BOOL FileBrowser::setImageList(int root_clean_id, int root_dirty_id, int project_id, int open_node_id, int closed_node_id, int leaf_id, int ivalid_leaf_id) 
{
	HBITMAP hbmp;
	COLORREF maskColour = RGB(192, 192, 192);
	const int nbBitmaps = 7;

	// Creation of image list
	if ((_hImaLst = ImageList_Create(CX_BITMAP, CY_BITMAP, ILC_COLOR32 | ILC_MASK, nbBitmaps, 0)) == NULL) 
		return FALSE;

	// Add the bmp in the list
	hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(root_clean_id));
	if (hbmp == NULL)
		return FALSE;
	ImageList_AddMasked(_hImaLst, hbmp, maskColour);
	DeleteObject(hbmp);

	hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(root_dirty_id));
	if (hbmp == NULL)
		return FALSE;
	ImageList_AddMasked(_hImaLst, hbmp, maskColour);
	DeleteObject(hbmp);

	hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(project_id));
	if (hbmp == NULL)
		return FALSE;
	ImageList_AddMasked(_hImaLst, hbmp, maskColour);
	DeleteObject(hbmp);

	hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(open_node_id));
	if (hbmp == NULL)
		return FALSE;
	ImageList_AddMasked(_hImaLst, hbmp, maskColour);
	DeleteObject(hbmp);

	hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(closed_node_id));
	if (hbmp == NULL)
		return FALSE;
	ImageList_AddMasked(_hImaLst, hbmp, maskColour);
	DeleteObject(hbmp);

	hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(leaf_id));
	if (hbmp == NULL)
		return FALSE;
	ImageList_AddMasked(_hImaLst, hbmp, maskColour);
	DeleteObject(hbmp);

	hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(ivalid_leaf_id));
	if (hbmp == NULL)
		return FALSE;
	ImageList_AddMasked(_hImaLst, hbmp, maskColour);
	DeleteObject(hbmp);

	if (ImageList_GetImageCount(_hImaLst) < nbBitmaps)
		return FALSE;

	// Set image list to the tree view
	TreeView_SetImageList(_treeView.getHSelf(), _hImaLst, TVSIL_NORMAL);

	return TRUE;
}
Beispiel #28
0
HWND
CLCreateKeyserverTreeList (
		PGPPrefRef		PrefRef, 
		PGPContextRef	context, 
		HWND			hWndParent,
		PGPKeySetRef	keysetMain) 
{
	HBITMAP hBmp;      // handle to a bitmap
	HDC hDC;
	HWND hWndTree;
	RECT rc;
	INT iwidth, iheight, itop, iNumBits;
	POINT pt;

	// Ensure that the common control DLL is loaded.
	InitCommonControls ();

	// Ensure that the custom control DLL is loaded.
	InitTreeListControl ();

	// initialize flags
	iSelectedType	= IDX_NONE;
	bSelectedRoot	= FALSE;
	bLastInList		= TRUE;
	bFirstInList	= TRUE;

	// create tree view window
	GetWindowRect (GetDlgItem (hWndParent, IDC_NEWKEYSERVER), &rc);
	pt.x = rc.left;
	pt.y = rc.top;
	ScreenToClient (hWndParent, &pt);
	itop = pt.y;
	iwidth = pt.x - BUTTONOFFSETX - TREEOFFSETLEFT;

	GetWindowRect (GetDlgItem (hWndParent, IDC_SYNCONSTATICTEXT), &rc);
	pt.x = rc.left;
	pt.y = rc.top;
	ScreenToClient (hWndParent, &pt);
	iheight = pt.y - BUTTONOFFSETY - itop;

	GetClientRect (hWndParent, &rc);

	hWndTree = CreateWindowEx (WS_EX_CLIENTEDGE, WC_TREELIST, "",
			WS_VISIBLE | WS_CHILD | WS_BORDER | WS_TABSTOP | WS_GROUP |
			TLS_AUTOSCROLL | TLS_SINGLESELECT | TLS_SHOWSELECTIONALWAYS,
			TREEOFFSETLEFT, itop, iwidth, iheight,
			hWndParent, (HMENU)IDC_KSTREELIST, g_hInst, NULL);

	if (hWndTree == NULL) return NULL;

	// Initialize the tree view window.
	// First create imagelist and load the appropriate bitmaps based on 
	// current display capabilities.
	hDC = GetDC (NULL);		// DC for desktop
	iNumBits = GetDeviceCaps (hDC, BITSPIXEL) * GetDeviceCaps (hDC, PLANES);
	ReleaseDC (NULL, hDC);

	if (iNumBits <= 8) {
		hIml =	ImageList_Create (16, 16, ILC_COLOR|ILC_MASK, 
										NUM_BITMAPS, 0); 
		hBmp = LoadBitmap (g_hInst, MAKEINTRESOURCE (IDB_IMAGES4));
		ImageList_AddMasked (hIml, hBmp, RGB(255, 0, 255));
		DeleteObject (hBmp);
	}
	else {
		hIml =	ImageList_Create (16, 16, ILC_COLOR24|ILC_MASK, 
										NUM_BITMAPS, 0); 
		hBmp = LoadBitmap (g_hInst, MAKEINTRESOURCE (IDB_IMAGES24));
		ImageList_AddMasked (hIml, hBmp, RGB(255, 0, 255));
		DeleteObject (hBmp);
	}

	// Associate the image list with the tree view control.
	TreeList_SetImageList (hWndTree, hIml);
	sAddColumns (hWndTree, iwidth);
	sFillTreeList (PrefRef, context, hWndTree, keysetMain);

	return hWndTree;
}
Beispiel #29
0
//---------------------------------------------------------------------------
// InitializeInstance
//
// Performs a per-instance initialization of WTD.  The WTD Command Line
// parser is first called - if a valid command line was given, it does NOT
// RETURN from that call, since the WTD BASIC engine is invoked straight
// from there, and then the program exits.
//
// However, if an invalid command line (or none at all) is given, we come
// back here and create the frame window, and an MDI child.
//
// RETURNS:     TRUE if successful, or FALSE if not
//---------------------------------------------------------------------------
BOOL  APIENTRY InitializeInstance(LPSTR lpCmdLine, INT nCmdShow)
{
    extern HWND  hwndMDIClient;
    CHAR         sz[320];
    CHAR         *def = "",
                 *szCreate = "-2147450880"; /* this is really 0x80008000 */
    INT          i, j, FrameState, VPstate, flags, len;
    INT          actions[3] = {IDD_NEVER, IDD_ALWAYS, IDD_QUERY};
    HANDLE       *hScr;

#ifdef DEBUG
    auxport = 0;
#endif

    // Set up the helpfile name and the INI file name
    //-----------------------------------------------------------------------
    SetHelpFileName ();
    len = GetModuleFileName (GetModuleHandle (szModName), szIni,
                             sizeof(szIni));
    while (szIni[len] != '\\')
        len--;
    szIni[len+1] = 0;
    strcat (szIni, szIniName);
    UseIniInclude ("INCLUDE", szDrvr, szIni);

    // Initialize the pre-defined symbol space.
    //-----------------------------------------------------------------------
    for (i=0; i<16; i++)
        DefPtrs[i] = DefSym[i];

    // Get Window state information (max'd, hidden, etc)
    //-----------------------------------------------------------------------
    FrameState = GetPrivateProfileInt (szDrvr, "FrameState", 0, szIni);
    VPstate = GetPrivateProfileInt (szDrvr, "VPState", 0, szIni);
    ChildState = GetPrivateProfileInt (szDrvr, "MDIState", 0, szIni);

    GetPrivateProfileString (szDrvr, "FramePos", szCreate, sz, 80, szIni);
    Frx = LOWORD(atol (sz));
    Fry = HIWORD(atol (sz));

    GetPrivateProfileString (szDrvr, "FrameSize", szCreate, sz, 80, szIni);
    Frh = LOWORD(atol (sz));
    Frw = HIWORD(atol (sz));

    GetPrivateProfileString (szDrvr, "VPPos", szCreate, sz, 80, szIni);
    VPx = LOWORD(atol (sz));
    VPy = HIWORD(atol (sz));

    GetPrivateProfileString (szDrvr, "VPSize", szCreate, sz, 80, szIni);
    VPh = LOWORD(atol (sz));
    VPw = HIWORD(atol (sz));

    // Read the "Get XY-Coords" dialog settings
    //-----------------------------------------------------------------------
    flags = GetPrivateProfileInt (szXY, "Opts", XY_VIEWPORT |
                                                XY_STATBAR,
                                                szIni);
    fInsEdit = flags & XY_INSEDIT;
    fInsClip = flags & XY_INSCLIP;
    fVP      = flags & XY_VIEWPORT;
    fStatbar = flags & XY_STATBAR;
    iFmtIndex = GetPrivateProfileInt (szXY, "Format", 0, szIni);

    // Read the search/replace vars
    //-----------------------------------------------------------------------
    GetPrivateProfileString (szDrvr, "SR", def, sz, 80, szIni);
    SRx = LOWORD(atol (sz));
    SRy = HIWORD(atol (sz));

    GetPrivateProfileString (szDrvr, "Srch", def, szSrchbuf,
                             sizeof(szSrchbuf), szIni);
    GetPrivateProfileString (szDrvr, "Repl", def, szReplbuf,
                             sizeof(szSrchbuf), szIni);

    // Get the environment dialog options
    //-----------------------------------------------------------------------
    flags = GetPrivateProfileInt (szDrvr, "EnvFlags", ENV_SAVEASK |
                                                   ENV_CMPDLG |
                                                   ENV_BACKUP,
                                                   szIni);
    SaveAction  = actions[flags & ENV_SAVEACTION];
    AutoMini    = flags & ENV_AUTOMINI;
    AutoRest    = flags & ENV_AUTOREST;
    qsave       = flags & ENV_QUERYSAVE;
    ChgArgs     = flags & ENV_RTARGS;
    fBackup     = flags & ENV_BACKUP;
    fDoCmpDlg   = flags & ENV_CMPDLG;
    TabStops = GetPrivateProfileInt (szDrvr, "TabStops", 4, szIni);

    // Find and Search/Replace options
    //-----------------------------------------------------------------------
    flags = GetPrivateProfileInt (szDrvr, "SearchFlags", 0, szIni);
    fSrchCase   = flags & SRCH_SRCHCASE;
    WholeWord   = flags & SRCH_WHOLEWORD;

    // Recorder options -- the 0x3C is 60 decimal, which is the default
    // string length
    //-----------------------------------------------------------------------
    iRecPause = GetPrivateProfileInt (szRecorder, "Pause", 2000, szIni);
    flags = GetPrivateProfileInt (szRecorder, "Flags", 0x3C00 |
                                                       REC_KEYS |
                                                       REC_CLICKS |
                                                       REC_INCDECL |
                                                       REC_BALANCE,
                                                       szIni);
    iRecInsert  = flags & REC_INSERT;
    fRecKeys    = flags & REC_KEYS;
    fRecClicks  = flags & REC_CLICKS;
    fRecMoves   = flags & REC_MOVES;
    fRecRelWnd  = flags & REC_RELWND;
    fRecIncDecl = flags & REC_INCDECL;
    fRecBalance = flags & REC_BALANCE;
    iRecLen     = HIBYTE (flags);

    // Runtime options
    //-----------------------------------------------------------------------
    flags = GetPrivateProfileInt (szDrvr, "RTFlags", RF_SAVERTA |
#ifdef WIN32
                                                  RF_CDECL |
#endif
                                                  RF_ARRAYCHECK,
                                                  szIni);
    SaveRTA      = flags & RF_SAVERTA;
    ArrayCheck   = flags & RF_ARRAYCHECK;
    PointerCheck = flags & RF_PTRCHECK;
    CdeclCalls   = flags & RF_CDECL;
    ExpDeclare   = flags & RF_EXPDECL;

    GetPrivateProfileString (szDrvr, "Cmd", def, cmdbuf, sizeof (cmdbuf), szIni);
    GetPrivateProfileString (szDrvr, "Tm", def, tmbuf, sizeof (tmbuf), szIni);

    GetPrivateProfileString (szDrvr, "Defc", def, sz, 80, szIni);
    SymCount = min (atoi (sz), 16);
    GetPrivateProfileString (szDrvr, "Defs", def, sz, 320, szIni);
    def = sz;
    while (*def == ' ')
        def++;
    j = 0;
    for (i=0; i<SymCount; i++)
        {
        while ((*def) && (*def != ' '))
            DefSym[i][j++] = *def++;
        DefSym[i][j] = 0;
        def++;
        j = 0;
        }

    // Create the ViewPort window first
    //-----------------------------------------------------------------------
    hwndViewPort = SetupViewport ();

    if (!hwndViewPort)
        return (FALSE);

    if ((VPstate & 3) == 1)
        ShowWindow (hwndViewPort, SW_SHOWMAXIMIZED);
    else if ((VPstate & 3) == 2)
        ShowWindow (hwndViewPort, SW_SHOWMINIMIZED);

    // Parse the command line - if this function returns NULL, then we're
    // done -- no need to continue
    //-----------------------------------------------------------------------
    if (!(hScr = ParseCommandLine (lpCmdLine)))
        {
        DestroyWindow (hwndViewPort);
        return (FALSE);
        }

    // Get the names of the last four files opened and store them in the
    // list
    //-----------------------------------------------------------------------
    iFileCount = GetPrivateProfileInt (szDrvr, "fCount", 0, szIni);
    for (i=0; i<iFileCount; i++)
        {
        CHAR    buf[10];

        wsprintf (buf, "File%d", i+1);
        GetPrivateProfileString (szDrvr, buf, def, sz, 128, szIni);
        pFileOpened[i] = (PSTR)LptrAlloc (lstrlen(sz)+1);
        if (!pFileOpened[i])
            {
            MPError (NULL, MB_OK | MB_ICONSTOP, IDS_OUTOFMEM);
            DestroyWindow (hwndViewPort);
            return (FALSE);
            }
        lstrcpy (pFileOpened[i], sz);
        }

    // Get the base window title
    //-----------------------------------------------------------------------
    LoadString (hInst, IDS_APPNAME, sz, sizeof(sz));

    // Create the frame
    //-----------------------------------------------------------------------
    hwndFrame = CreateWindow (szFrame,
			      sz,
			      WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
                              Frx,
                              Fry,
                              Frw,
                              Frh,
			      NULL,
			      NULL,
			      hInst,
			      NULL);

    if ((!hwndFrame) || (!hwndMDIClient) || (!hwndViewPort))
        return (FALSE);

    // Display the frame window
    //-----------------------------------------------------------------------
    if (nCmdShow != SW_SHOWNORMAL)
        ShowWindow (hwndFrame, nCmdShow);
    else if (FrameState == 1)
        ShowWindow (hwndFrame, SW_SHOWMAXIMIZED);
    else if (FrameState == 2)
        ShowWindow (hwndFrame, SW_SHOWMINIMIZED);
    else
        ShowWindow (hwndFrame, SW_SHOWNORMAL);

    // Show the viewport if we're supposed to (sending it a WM_COMMAND msg
    // with the IDM_WINDOWSHOW parm...
    //-----------------------------------------------------------------------
    if (!(VPstate & 4))
        SendMessage (hwndFrame, WM_COMMAND, IDM_WINDOWSHOW, 0L);

    // Load main menu accelerators
    //-----------------------------------------------------------------------
    if (!(hAccel = LoadAccelerators (hInst, IDMULTIPAD)))
        return (FALSE);

    UpdateWindow (hwndFrame);

    // Load the scripts given on the command line.
    //-----------------------------------------------------------------------
    NextFile = 0;

    for (i=0; hScr[i]; i++)
        {
        CHAR    *scr;

        // If this is the first file and it has nothing in it, we add an
        // untitled script and we're done.
        //-------------------------------------------------------------------
        scr = LocalLock (hScr[i]);
        if ((!i) && (!*scr))
            {
            AddFile (NULL);
            break;
            }

        // Check for an extension -- if not there, append default.  Then,
        // load the file if it isn't already loaded.
        //---------------------------------------------------------------
        EnsureExt (scr, 80);
        if (!AlreadyOpen (scr))
            AddFile (scr);
        LocalUnlock (hScr[i]);
        LocalFree (hScr[i]);
        }

    for (i = 0 ; i < 4 ; i++)
    {
        wsprintf (sz, "wattrec%d", i + 1);
        hBitmap [i] = LoadBitmap (hInst, (LPSTR) sz);
        if (!hBitmap [i])
            return FALSE;
    }


    // We're done.
    //-----------------------------------------------------------------------
    return (TRUE);
}
Beispiel #30
0
/*
==============
ConWndProc
==============
*/
static LONG WINAPI ConWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) {
	char *cmdString;
	static bool s_timePolarity;
	int cx, cy;
	float sx, sy, x, y, w, h;

	switch ( uMsg )
	{
	case WM_SIZE:
		// NERVE - SMF
		cx = LOWORD( lParam );
		cy = HIWORD( lParam );

		if ( cx < SYSCON_DEFAULT_WIDTH )
			cx = SYSCON_DEFAULT_WIDTH;
		if ( cy < SYSCON_DEFAULT_HEIGHT )
			cy = SYSCON_DEFAULT_HEIGHT;

		sx = (float)cx / SYSCON_DEFAULT_WIDTH;
		sy = (float)cy / SYSCON_DEFAULT_HEIGHT;

		x = 5;
		y = 40;
		w = cx - 15;
		h = cy - 100;
		SetWindowPos( s_wcd.hwndBuffer, NULL, x, y, w, h, 0 );

		y = y + h + 8;
		h = 20;
		SetWindowPos( s_wcd.hwndInputLine, NULL, x, y, w, h, 0 );

		y = y + h + 4;
		w = 72 * sx;
		h = 24;
		SetWindowPos( s_wcd.hwndButtonCopy, NULL, x, y, w, h, 0 );

		x = x + w + 2;
		SetWindowPos( s_wcd.hwndButtonClear, NULL, x, y, w, h, 0 );

		x = cx - 15 - w;
		SetWindowPos( s_wcd.hwndButtonQuit, NULL, x, y, w, h, 0 );

		s_wcd.windowWidth = cx;
		s_wcd.windowHeight = cy;
		// -NERVE - SMF
		break;
	case WM_ACTIVATE:
		if ( LOWORD( wParam ) != WA_INACTIVE ) {
			SetFocus( s_wcd.hwndInputLine );
		}

		if ( com_viewlog && ( com_dedicated && !com_dedicated->integer ) ) {
			// if the viewlog is open, check to see if it's being minimized
			if ( com_viewlog->integer == 1 ) {
				if ( HIWORD( wParam ) ) {   // minimized flag
					Cvar_Set( "viewlog", "2" );
				}
			} else if ( com_viewlog->integer == 2 )   {
				if ( !HIWORD( wParam ) ) {      // minimized flag
					Cvar_Set( "viewlog", "1" );
				}
			}
		}
		break;

	case WM_CLOSE:
		if ( ( com_dedicated && com_dedicated->integer ) ) {
			cmdString = CopyString( "quit" );
			Com_QueueEvent( 0, SE_CONSOLE, 0, 0, strlen( cmdString ) + 1, cmdString );
		} else if ( s_wcd.quitOnClose )   {
			PostQuitMessage( 0 );
		} else
		{
			Sys_ShowConsole( 0, false );
			Cvar_Set( "viewlog", "0" );
		}
		return 0;
	case WM_CTLCOLORSTATIC:
		if ( ( HWND ) lParam == s_wcd.hwndBuffer ) {
			SetBkColor( ( HDC ) wParam, RGB( 204, 204, 204 ) );
			SetTextColor( ( HDC ) wParam, RGB( 0, 0, 0 ) );

#if 0   // this draws a background in the edit box, but there are issues with this
			if ( ( hdcScaled = CreateCompatibleDC( ( HDC ) wParam ) ) != 0 ) {
				if ( SelectObject( ( HDC ) hdcScaled, s_wcd.hbmLogo ) ) {
					StretchBlt( ( HDC ) wParam, 0, 0, 512, 384,
								hdcScaled, 0, 0, 512, 384,
								SRCCOPY );
				}
				DeleteDC( hdcScaled );
			}
#endif
			return ( long ) s_wcd.hbrEditBackground;
		} else if ( ( HWND ) lParam == s_wcd.hwndErrorBox ) {
			if ( s_timePolarity & 1 ) {
				SetBkColor( ( HDC ) wParam, RGB( 0x80, 0x80, 0x80 ) );
				SetTextColor( ( HDC ) wParam, RGB( 0xff, 0x0, 0x00 ) );
			} else {
				SetBkColor( ( HDC ) wParam, RGB( 0x80, 0x80, 0x80 ) );
				SetTextColor( ( HDC ) wParam, RGB( 0x00, 0x0, 0x00 ) );
			}
			return ( long ) s_wcd.hbrErrorBackground;
		}
		break;

	case WM_COMMAND:
		if ( wParam == COPY_ID ) {
			SendMessage( s_wcd.hwndBuffer, EM_SETSEL, 0, -1 );
			SendMessage( s_wcd.hwndBuffer, WM_COPY, 0, 0 );
		} else if ( wParam == QUIT_ID )   {
			if ( s_wcd.quitOnClose ) {
				PostQuitMessage( 0 );
			} else {
				cmdString = CopyString( "quit" );
				Com_QueueEvent( 0, SE_CONSOLE, 0, 0, strlen( cmdString ) + 1, cmdString );
			}
		} else if ( wParam == CLEAR_ID )   {
			SendMessage( s_wcd.hwndBuffer, EM_SETSEL, 0, -1 );
			SendMessage( s_wcd.hwndBuffer, EM_REPLACESEL, FALSE, ( LPARAM ) "" );
			UpdateWindow( s_wcd.hwndBuffer );
		}
		break;
	case WM_CREATE:
		s_wcd.hbmLogo = LoadBitmap( g_wv.hInstance, MAKEINTRESOURCE( IDB_BITMAP1 ) );
		s_wcd.hbmClearBitmap = LoadBitmap( g_wv.hInstance, MAKEINTRESOURCE( IDB_BITMAP2 ) );
		s_wcd.hbrEditBackground = CreateSolidBrush( RGB( 204, 204, 204 ) );
		s_wcd.hbrErrorBackground = CreateSolidBrush( RGB( 0x80, 0x80, 0x80 ) );
		SetTimer( hWnd, 1, 1000, NULL );
		break;
	case WM_ERASEBKGND:
#if 0
		HDC hdcScaled;
		HGDIOBJ oldObject;

#if 0   // a single, large image
		hdcScaled = CreateCompatibleDC( ( HDC ) wParam );
		assert( hdcScaled != 0 );

		if ( hdcScaled ) {
			oldObject = SelectObject( ( HDC ) hdcScaled, s_wcd.hbmLogo );
			assert( oldObject != 0 );
			if ( oldObject ) {
				StretchBlt( ( HDC ) wParam, 0, 0, s_wcd.windowWidth, s_wcd.windowHeight,
							hdcScaled, 0, 0, 512, 384,
							SRCCOPY );
			}
			DeleteDC( hdcScaled );
			hdcScaled = 0;
		}
#else   // a repeating brush
		{
			HBRUSH hbrClearBrush;
			RECT r;

			GetWindowRect( hWnd, &r );

			r.bottom = r.bottom - r.top + 1;
			r.right = r.right - r.left + 1;
			r.top = 0;
			r.left = 0;

			hbrClearBrush = CreatePatternBrush( s_wcd.hbmClearBitmap );

			assert( hbrClearBrush != 0 );

			if ( hbrClearBrush ) {
				FillRect( ( HDC ) wParam, &r, hbrClearBrush );
				DeleteObject( hbrClearBrush );
			}
		}
#endif
		return 1;
#endif
		return DefWindowProc( hWnd, uMsg, wParam, lParam );
	case WM_TIMER:
		if ( wParam == 1 ) {
			s_timePolarity = (bool)!s_timePolarity;
			if ( s_wcd.hwndErrorBox ) {
				InvalidateRect( s_wcd.hwndErrorBox, NULL, FALSE );
			}
		}
		break;
	}

	return DefWindowProc( hWnd, uMsg, wParam, lParam );
}