コード例 #1
1
ファイル: CImage.cpp プロジェクト: tsupo/bookey
HBITMAP CImage::LoadBmpFile( CString csFileName )
{
    // ネタ元: http://hp.vector.co.jp/authors/VA007941/program/no2124.html
    // bmp, jpg, gif には対応しているが png や tif には対応していない
	LPDISPATCH	    pDispatch;
	COleVariant	    oleFileName(csFileName);	
	OLE_HANDLE	    holeHandle;
	short		    type;
	CPictureHolder	PictureHolder;
    HBITMAP         hBmp = NULL;

	// 画像ファイルをロード
	if ( OleLoadPictureFile( oleFileName, &pDispatch ) >= 0 ) {		
		PictureHolder.SetPictureDispatch( (LPPICTUREDISP)pDispatch );	
		if ( PictureHolder.m_pPict != NULL ) {
			PictureHolder.m_pPict->get_Type( &type );
			if ((type == PICTYPE_BITMAP)                                &&
                (PictureHolder.m_pPict->get_Handle( &holeHandle ) >= 0)   ) {
                hBmp = (HBITMAP)holeHandle;
			}
		}
	}

	return ( hBmp );
}
コード例 #2
1
ファイル: pushctl.cpp プロジェクト: jetlive/skiaming
void CPushCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
	CDC *pdc;
	int bmpId;
	CBitmap bitmap;
	BITMAP  bmp;
	CPictureHolder picHolder;
	CRect rcSrcBounds;

	CPen* pOldPen;
	RECT    rect;
	SHORT   inflate;

	pdc = CDC::FromHandle(lpDrawItemStruct->hDC);

	switch (lpDrawItemStruct->itemAction)
	{
		case ODA_DRAWENTIRE:
		case ODA_SELECT:
			// Load "up" or "down" bitmap depending on selection state
			bmpId = (lpDrawItemStruct->itemState & ODS_SELECTED) ? IDB_DOWNBITMAP
				: IDB_UPBITMAP;
			bitmap.LoadBitmap(bmpId);
			bitmap.GetObject(sizeof(BITMAP), &bmp);
			rcSrcBounds.right = bmp.bmWidth;
			rcSrcBounds.bottom = bmp.bmHeight;

			// Create picture and render
			picHolder.CreateFromBitmap((HBITMAP)bitmap.m_hObject, NULL, FALSE);
			picHolder.Render(pdc, lpDrawItemStruct->rcItem, rcSrcBounds);

			break;

		case ODA_FOCUS:
			// Just draw focus rect
			pOldPen = (CPen*)pdc->SelectStockObject(BLACK_PEN);
			if (lpDrawItemStruct->itemState & ODS_FOCUS)
			{
				CopyRect((LPRECT)&rect, (LPRECT)&lpDrawItemStruct->rcItem);
				inflate = (SHORT)min(3,min(rect.right  - rect.left + 1,
					rect.bottom - rect.top  + 1) / 5);
				InflateRect(&rect, -inflate, -inflate);
				pdc->DrawFocusRect(&rect);
			}
			pdc->SelectObject(pOldPen);
			break;
	}
}
コード例 #3
0
BOOL CAboutDlg::OnInitDialog()
{
	CDialog::OnInitDialog();
	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon

	//set the version string
	CString temp, boxtitle;
	boxtitle.Format(IDS_ABOUTVERSIONBOX, TGIT_VERMAJOR, TGIT_VERMINOR, TGIT_VERMICRO, TGIT_VERBUILD, _T(TGIT_PLATFORM), _T(TGIT_VERDATE));
	SetDlgItemText(IDC_VERSIONBOX, boxtitle);
	const svn_version_t * diffver = svn_diff_version();
	temp.Format(IDS_ABOUTVERSION, TGIT_VERMAJOR, TGIT_VERMINOR, TGIT_VERMICRO, TGIT_VERBUILD, _T(TGIT_PLATFORM), _T(TGIT_VERDATE),
		diffver->major, diffver->minor, diffver->patch, CString(diffver->tag), 
		APR_MAJOR_VERSION, APR_MINOR_VERSION, APR_PATCH_VERSION,
		APU_MAJOR_VERSION, APU_MINOR_VERSION, APU_PATCH_VERSION);
	SetDlgItemText(IDC_VERSIONABOUT, temp);
	this->SetWindowText(_T("TortoiseMerge"));

	CPictureHolder tmpPic;
	tmpPic.CreateFromBitmap(IDB_LOGOFLIPPED);
	m_renderSrc.Create32BitFromPicture(&tmpPic,468,64);
	m_renderDest.Create32BitFromPicture(&tmpPic,468,64);

	m_waterEffect.Create(468,64);
	SetTimer(ID_EFFECTTIMER, 40, NULL);
	SetTimer(ID_DROPTIMER, 300, NULL);

	m_cWebLink.SetURL(_T("http://tortoisesvn.net"));
	m_cSupportLink.SetURL(_T("http://tortoisesvn.tigris.org/contributors.html"));

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
コード例 #4
0
BOOL CAboutDlg::OnInitDialog()
{
	CStandAloneDialog::OnInitDialog();
	CAppUtils::MarkWindowAsUnpinnable(m_hWnd);

	// set the version string
	CString temp;

	CString out, err;
	if (g_Git.Run(L"git.exe --version", &out, &err, CP_UTF8))
		out = L"git not found (" + err + L')';
	out.Trim();

	if (!CGit::ms_LastMsysGitDir.IsEmpty())
	{
		out += L" (" + CGit::ms_LastMsysGitDir;
		out += L"; " + CGit::ms_MsysGitRootDir;
		out += L"; " + g_Git.GetGitSystemConfig();
		if (CGit::ms_bMsys2Git)
			out += L"; with msys2 hack";
		else if (CGit::ms_bCygwinGit)
			out += L"; with cygwin hack";
		else
			out += L"; " + g_Git.GetGitProgramDataConfig();
		out += L')';
	}

	CString tortoisegitprocpath;
	tortoisegitprocpath.Format(L"(%s)", (LPCTSTR)CPathUtils::GetAppDirectory().TrimRight(L'\\'));
	temp.Format(IDS_ABOUTVERSION, TGIT_VERMAJOR, TGIT_VERMINOR, TGIT_VERMICRO, TGIT_VERBUILD, (LPCTSTR)tortoisegitprocpath, (LPCTSTR)out);
	SetDlgItemText(IDC_VERSIONABOUT, Lf2Crlf(temp));

	this->SetWindowText(L"TortoiseGit");

	// we can only put up to 256 chars into the resource file, so fill it here with the full list
	SetDlgItemText(IDC_STATIC_AUTHORS, L"Sven Strickroth <*****@*****.**> (Current Maintainer), Sup Yut Sum <*****@*****.**>, Frank Li <*****@*****.**> (Founder), Yue Lin Ho <*****@*****.**>, Colin Law <*****@*****.**>, Myagi <*****@*****.**>, Johan 't Hart <*****@*****.**>, Laszlo Papp <*****@*****.**>");

	CPictureHolder tmpPic;
	tmpPic.CreateFromBitmap(IDB_LOGOFLIPPED);
	m_renderSrc.Create32BitFromPicture(&tmpPic,468,64);
	m_renderDest.Create32BitFromPicture(&tmpPic,468,64);

	m_waterEffect.Create(468,64);
	SetTimer(ID_EFFECTTIMER, 40, nullptr);
	SetTimer(ID_DROPTIMER, 1500, nullptr);

	m_cWebLink.SetURL(L"https://tortoisegit.org/");
	m_cSupportLink.SetURL(L"https://tortoisegit.org/donate");

	CenterWindow(CWnd::FromHandle(hWndExplorer));
	GetDlgItem(IDOK)->SetFocus();
	return FALSE;
}
コード例 #5
0
ファイル: AboutDlg.cpp プロジェクト: wuge1513/TortoiseGit
BOOL CAboutDlg::OnInitDialog()
{
	CStandAloneDialog::OnInitDialog();
	CAppUtils::MarkWindowAsUnpinnable(m_hWnd);

	// set the version string
	CString temp;

	CString cmd, out, err;
	cmd=_T("git.exe --version");
	if (g_Git.Run(cmd, &out, &err, CP_UTF8))
		out = _T("git not found (") + err + _T(")");;
	int start =0;
	out=out.Tokenize(_T("\n"),start);

	CAppUtils::GetMsysgitVersion(&out);
	if (!CGit::ms_LastMsysGitDir.IsEmpty())
		out += _T(" (") + CGit::ms_LastMsysGitDir + _T(")");

	temp.Format(IDS_ABOUTVERSION, TGIT_VERMAJOR, TGIT_VERMINOR, TGIT_VERMICRO, TGIT_VERBUILD,out);
#if 0
	const svn_version_t * svnver = svn_client_version();

	temp.Format(IDS_ABOUTVERSION, TSVN_VERMAJOR, TSVN_VERMINOR, TSVN_VERMICRO, TSVN_VERBUILD, _T(TSVN_PLATFORM), _T(TSVN_VERDATE),
		svnver->major, svnver->minor, svnver->patch, CString(svnver->tag),
		APR_MAJOR_VERSION, APR_MINOR_VERSION, APR_PATCH_VERSION,
		APU_MAJOR_VERSION, APU_MINOR_VERSION, APU_PATCH_VERSION,
		_T(NEON_VERSION),
		_T(OPENSSL_VERSION_TEXT),
		_T(ZLIB_VERSION));
#endif
	SetDlgItemText(IDC_VERSIONABOUT, temp);

	this->SetWindowText(_T("TortoiseGit"));

	CPictureHolder tmpPic;
	tmpPic.CreateFromBitmap(IDB_LOGOFLIPPED);
	m_renderSrc.Create32BitFromPicture(&tmpPic,468,64);
	m_renderDest.Create32BitFromPicture(&tmpPic,468,64);

	m_waterEffect.Create(468,64);
	SetTimer(ID_EFFECTTIMER, 40, NULL);
	SetTimer(ID_DROPTIMER, 1500, NULL);

	m_cWebLink.SetURL(_T("http://code.google.com/p/tortoisegit/"));
	m_cSupportLink.SetURL(_T("https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=GJGTG75GV5PL6&lc=C2&item_name=TortoiseGit&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted"));

	CenterWindow(CWnd::FromHandle(hWndExplorer));
	GetDlgItem(IDOK)->SetFocus();
	return FALSE;
}
コード例 #6
0
ファイル: timectl.cpp プロジェクト: jetlive/skiaming
void CTimeCtrl::OnDraw(
			CDC* pdc, const CRect& rcBounds, const CRect&)
{
	CBitmap bitmap;
	BITMAP  bmp;
	CPictureHolder picHolder;
	CRect rcSrcBounds;

	// Load clock bitmap
	bitmap.LoadBitmap(IDB_CLOCK);
	bitmap.GetObject(sizeof(BITMAP), &bmp);
	rcSrcBounds.right = bmp.bmWidth;
	rcSrcBounds.bottom = bmp.bmHeight;

	// Create picture and render
	picHolder.CreateFromBitmap((HBITMAP)bitmap.m_hObject, NULL, FALSE);
	picHolder.Render(pdc, rcBounds, rcSrcBounds);
}
コード例 #7
0
BOOL CAboutDlg::OnInitDialog()
{
    CStandAloneDialog::OnInitDialog();
    CAppUtils::MarkWindowAsUnpinnable(m_hWnd);

    // set the version string
    CString temp;

    CString cmd, out, err;
    cmd=_T("git.exe --version");
    if (g_Git.Run(cmd, &out, &err, CP_UTF8))
        out = _T("git not found (") + err + _T(")");;
    int start =0;
    out=out.Tokenize(_T("\n"),start);

    CAppUtils::GetMsysgitVersion(&out);
    if (!CGit::ms_LastMsysGitDir.IsEmpty())
        out += _T(" (") + CGit::ms_LastMsysGitDir + _T(")");

    CString tortoisegitprocpath;
    tortoisegitprocpath.Format(_T("(%s)"), CPathUtils::GetAppDirectory());
    temp.Format(IDS_ABOUTVERSION, TGIT_VERMAJOR, TGIT_VERMINOR, TGIT_VERMICRO, TGIT_VERBUILD, tortoisegitprocpath, out);
    SetDlgItemText(IDC_VERSIONABOUT, temp);

    this->SetWindowText(_T("TortoiseGit"));

    CPictureHolder tmpPic;
    tmpPic.CreateFromBitmap(IDB_LOGOFLIPPED);
    m_renderSrc.Create32BitFromPicture(&tmpPic,468,64);
    m_renderDest.Create32BitFromPicture(&tmpPic,468,64);

    m_waterEffect.Create(468,64);
    SetTimer(ID_EFFECTTIMER, 40, NULL);
    SetTimer(ID_DROPTIMER, 1500, NULL);

    m_cWebLink.SetURL(_T("http://code.google.com/p/tortoisegit/"));
    m_cSupportLink.SetURL(_T("https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=GJGTG75GV5PL6&lc=C2&item_name=Donate%20To%20The%20TortoiseGit%20Project&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted"));

    CenterWindow(CWnd::FromHandle(hWndExplorer));
    GetDlgItem(IDOK)->SetFocus();
    return FALSE;
}
コード例 #8
0
ファイル: EtsEodManager.cpp プロジェクト: AlexS2172/IVRM
void CEtsEodManagerApp::_LoadTypeIcons(long nResID)
{
	HICON hIcon = (HICON)::LoadImage(AfxGetInstanceHandle(),
							MAKEINTRESOURCE(nResID), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
	
	_variant_t vtIcon;

	if(hIcon)
	{
		CPictureHolder pic;
		if(pic.CreateFromIcon(hIcon))
		{
			LPPICTUREDISP lppicDisp = pic.GetPictureDispatch();
			if(lppicDisp)
				vtIcon = _variant_t(lppicDisp, false);
		}

		::DestroyIcon(hIcon);
	}

	m_mapTypeIcons[nResID] = vtIcon;
}