Docs/Users: Contributors.txt
PATCH: [ 1447348 ] Build language files to Build directory
Src/Languages: BuildDll.bat
+ PATCH: [ 1447806 ] Use JPEG splashscreen
+ Src: Merge.dsp Merge.rc resource.h Splash.cpp Splash.h
+ Src/Common new files: Picture.cpp Picture.h
+ Src/res new file: splash.jpg
+ Src/res deleted file: splash1.bmp
+ Src/Languages/*: Merge*.rc
2006-03-11 Takashi
BUG: [ 1441389 ] Comparing root directory - mysterious
--- /dev/null
+////////////////////////////////////////////////////////////////
+// MSDN Magazine -- October 2001
+// If this code works, it was written by Paul DiLascia.
+// If not, I don't know who wrote it.
+// Compiles with Visual C++ 6.0 for Windows 98 and probably Windows 2000 too.
+// Set tabsize = 3 in your editor.
+//
+#include "StdAfx.h"
+#include <afxpriv2.h>
+#include "Picture.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+////////////////////////////////////////////////////////////////
+// CPicture implementation
+//
+
+CPicture::CPicture()
+{
+}
+
+CPicture::~CPicture()
+{
+}
+
+//////////////////
+// Load from resource. Looks for "IMAGE" type.
+//
+BOOL CPicture::Load(UINT nIDRes)
+{
+ // find resource in resource file
+ HINSTANCE hInst = AfxGetResourceHandle();
+ HRSRC hRsrc = ::FindResource(hInst,
+ MAKEINTRESOURCE(nIDRes),
+ TEXT("IMAGE")); // type
+ if (!hRsrc)
+ return FALSE;
+
+ // load resource into memory
+ DWORD len = SizeofResource(hInst, hRsrc);
+ BYTE* lpRsrc = (BYTE*)LoadResource(hInst, hRsrc);
+ if (!lpRsrc)
+ return FALSE;
+
+ // create memory file and load it
+ CMemFile file(lpRsrc, len);
+ BOOL bRet = Load(file);
+ FreeResource(hRsrc);
+
+ return bRet;
+}
+
+//////////////////
+// Load from path name.
+//
+BOOL CPicture::Load(LPCTSTR pszPathName)
+{
+ CFile file;
+ if (!file.Open(pszPathName, CFile::modeRead|CFile::shareDenyWrite))
+ return FALSE;
+ BOOL bRet = Load(file);
+ file.Close();
+ return bRet;
+}
+
+//////////////////
+// Load from CFile
+//
+BOOL CPicture::Load(CFile& file)
+{
+ CArchive ar(&file, CArchive::load | CArchive::bNoFlushOnDelete);
+ return Load(ar);
+}
+
+//////////////////
+// Load from archive--create stream and load from stream.
+//
+// CArchiveStream Doesn't compile with VS2003.Net
+BOOL CPicture::Load(CArchive& ar)
+{
+ CArchiveStream arcstream(&ar);
+ return Load((IStream*)&arcstream);
+}
+
+
+//////////////////
+// Load from stream (IStream). This is the one that really does it: call
+// OleLoadPicture to do the work.
+//
+BOOL CPicture::Load(IStream* pstm)
+{
+ Free();
+ HRESULT hr = OleLoadPicture(pstm, 0, FALSE,
+ IID_IPicture, (void**)&m_spIPicture);
+ ASSERT(SUCCEEDED(hr) && m_spIPicture);
+ return TRUE;
+}
+
+//////////////////
+// Render to device context. Covert to HIMETRIC for IPicture.
+//
+BOOL CPicture::Render(CDC* pDC, CRect rc, LPCRECT prcMFBounds) const
+{
+ ASSERT(pDC);
+
+ if (rc.IsRectNull()) {
+ CSize sz = GetImageSize(pDC);
+ rc.right = sz.cx;
+ rc.bottom = sz.cy;
+ }
+ long hmWidth,hmHeight; // HIMETRIC units
+ GetHIMETRICSize(hmWidth, hmHeight);
+ m_spIPicture->Render(*pDC, rc.left, rc.top, rc.Width(), rc.Height(),
+ 0, hmHeight, hmWidth, -hmHeight, prcMFBounds);
+
+ return TRUE;
+}
+
+//////////////////
+// Get image size in pixels. Converts from HIMETRIC to device coords.
+//
+CSize CPicture::GetImageSize(CDC* pDC) const
+{
+ if (!m_spIPicture)
+ return CSize(0,0);
+
+ LONG hmWidth, hmHeight; // HIMETRIC units
+ m_spIPicture->get_Width(&hmWidth);
+ m_spIPicture->get_Height(&hmHeight);
+ CSize sz(hmWidth,hmHeight);
+ if (pDC==NULL) {
+ CWindowDC dc(NULL);
+ dc.HIMETRICtoDP(&sz); // convert to pixels
+ } else {
+ pDC->HIMETRICtoDP(&sz);
+ }
+ return sz;
+}
+
--- /dev/null
+////////////////////////////////////////////////////////////////
+// MSDN Magazine -- October 2001
+// If this code works, it was written by Paul DiLascia.
+// If not, I don't know who wrote it.
+// Compiles with Visual C++ 6.0 for Windows 98 and probably Windows 2000 too.
+// Set tabsize = 3 in your editor.
+//
+#pragma once
+#include <atlbase.h>
+
+//////////////////
+// Picture object--encapsulates IPicture
+//
+class CPicture {
+public:
+ CPicture();
+ ~CPicture();
+
+ // Load frm various sosurces
+ BOOL Load(UINT nIDRes);
+ BOOL Load(LPCTSTR pszPathName);
+ BOOL Load(CFile& file);
+ BOOL Load(CArchive& ar);
+ BOOL Load(IStream* pstm);
+
+ // render to device context
+ BOOL Render(CDC* pDC, CRect rc=CRect(0,0,0,0),
+ LPCRECT prcMFBounds=NULL) const;
+
+ CSize GetImageSize(CDC* pDC=NULL) const;
+
+ operator IPicture*() {
+ return m_spIPicture;
+ }
+
+ void GetHIMETRICSize(OLE_XSIZE_HIMETRIC& cx, OLE_YSIZE_HIMETRIC& cy) const {
+ cx = cy = 0;
+ const_cast<CPicture*>(this)->m_hr = m_spIPicture->get_Width(&cx);
+ ASSERT(SUCCEEDED(m_hr));
+ const_cast<CPicture*>(this)->m_hr = m_spIPicture->get_Height(&cy);
+ ASSERT(SUCCEEDED(m_hr));
+ }
+
+ void Free() {
+ if (m_spIPicture) {
+ m_spIPicture.Release();
+ }
+ }
+
+protected:
+ CComQIPtr<IPicture>m_spIPicture; // ATL smart pointer to IPicture
+ HRESULT m_hr; // last error code
+};
/////////////////////////////////////////////////////////////////////////////
//
+// Image
+//
+IDR_SPLASH IMAGE "..\\..\\res\\splash.jpg"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
// Bitmap
//
/////////////////////////////////////////////////////////////////////////////
//
+// Image
+//
+IDR_SPLASH IMAGE "..\\..\\res\\splash.jpg"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
// Bitmap
//
/////////////////////////////////////////////////////////////////////////////
//
+// Image
+//
+IDR_SPLASH IMAGE "..\\..\\res\\splash.jpg"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
// Bitmap
//
/////////////////////////////////////////////////////////////////////////////
//
+// Image
+//
+IDR_SPLASH IMAGE "..\\..\\res\\splash.jpg"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
// Bitmap
//
/////////////////////////////////////////////////////////////////////////////
//
+// Image
+//
+IDR_SPLASH IMAGE "..\\..\\res\\splash.jpg"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
// Bitmap
//
/////////////////////////////////////////////////////////////////////////////
//
+// Image
+//
+IDR_SPLASH IMAGE "..\\..\\res\\splash.jpg"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
// Bitmap
//
/////////////////////////////////////////////////////////////////////////////
//
+// Image
+//
+IDR_SPLASH IMAGE "..\\..\\res\\splash.jpg"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
// Bitmap
//
/////////////////////////////////////////////////////////////////////////////
//
+// Image
+//
+IDR_SPLASH IMAGE "..\\..\\res\\splash.jpg"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
// Bitmap
//
/////////////////////////////////////////////////////////////////////////////
//
+// Image
+//
+IDR_SPLASH IMAGE "..\\..\\res\\splash.jpg"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
// Bitmap
//
/////////////////////////////////////////////////////////////////////////////
//
+// Image
+//
+IDR_SPLASH IMAGE "..\\..\\res\\splash.jpg"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
// Bitmap
//
/////////////////////////////////////////////////////////////////////////////
//
+// Image
+//
+IDR_SPLASH IMAGE "..\\..\\res\\splash.jpg"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
// Bitmap
//
/////////////////////////////////////////////////////////////////////////////
//
+// Image
+//
+IDR_SPLASH IMAGE "..\\..\\res\\splash.jpg"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
// Bitmap
//
/////////////////////////////////////////////////////////////////////////////
//
+// Image
+//
+IDR_SPLASH IMAGE "..\\..\\res\\splash.jpg"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
// Bitmap
//
/////////////////////////////////////////////////////////////////////////////
//
+// Image
+//
+IDR_SPLASH IMAGE "..\\..\\res\\splash.jpg"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
// Bitmap
//
/////////////////////////////////////////////////////////////////////////////
//
+// Image
+//
+IDR_SPLASH IMAGE "..\\..\\res\\splash.jpg"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
// Bitmap
//
/////////////////////////////////////////////////////////////////////////////
//
+// Image
+//
+IDR_SPLASH IMAGE "..\\..\\res\\splash.jpg"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
// Bitmap
//
/////////////////////////////////////////////////////////////////////////////
//
+// Image
+//
+IDR_SPLASH IMAGE "..\\..\\res\\splash.jpg"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
// Bitmap
//
/////////////////////////////////////////////////////////////////////////////
//
+// Image
+//
+IDR_SPLASH IMAGE "..\\..\\res\\splash.jpg"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
// Bitmap
//
/////////////////////////////////////////////////////////////////////////////
//
+// Image
+//
+IDR_SPLASH IMAGE "..\\..\\res\\splash.jpg"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
// Bitmap
//
/////////////////////////////////////////////////////////////////////////////
//
+// Image
+//
+IDR_SPLASH IMAGE "..\\..\\res\\splash.jpg"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
// Bitmap
//
/////////////////////////////////////////////////////////////////////////////
//
+// Image
+//
+IDR_SPLASH IMAGE "..\\..\\res\\splash.jpg"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
// Bitmap
//
# End Source File
# Begin Source File
+SOURCE=.\Common\Picture.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\PluginManager.cpp
# End Source File
# Begin Source File
# End Source File
# Begin Source File
-
SOURCE=.\PropVss.cpp
!IF "$(CFG)" == "Merge - Win32 Debug"
# End Source File
# Begin Source File
+SOURCE=.\Common\Picture.h
+# End Source File
+# Begin Source File
+
SOURCE=.\PluginManager.h
# End Source File
# Begin Source File
/////////////////////////////////////////////////////////////////////////////
//
+// Image
+//
+IDR_SPLASH IMAGE "res\\splash.jpg"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
// Bitmap
//
IDR_MAINFRAME BITMAP "res\\Toolbar.bmp"
-IDB_SPLASH BITMAP "res\\splash1.bmp"
IDB_EDIT_COPY BITMAP "res\\copy.bmp"
IDB_EDIT_CUT BITMAP "res\\cut.bmp"
IDB_EDIT_PASTE BITMAP "res\\paste.bmp"
#include "stdafx.h"
#include "resource.h"
+#include "Picture.h"
#include "Splash.h"
#include "version.h"
* @brief Default constructor.
*/
CSplashWnd::CSplashWnd()
+ : m_pPicture(NULL)
{
}
}
/**
- * @brief Loads splashscreen bitmap
+ * @brief Loads splashscreen image.
+ * Loads splashscreen image from resource and creates window with same size.
*/
BOOL CSplashWnd::Create(CWnd* pParentWnd /*= NULL*/)
{
- if (!m_bitmap.LoadBitmap(IDB_SPLASH))
+ if (m_pPicture == NULL)
+ m_pPicture = new CPicture();
+
+ if (m_pPicture == NULL)
+ return FALSE;
+
+ if (!m_pPicture->Load(IDR_SPLASH))
return FALSE;
- BITMAP bm;
- m_bitmap.GetBitmap(&bm);
+ CSize imgSize = m_pPicture->GetImageSize();
return CreateEx(0,
AfxRegisterWndClass(0, AfxGetApp()->LoadStandardCursor(IDC_ARROW)),
- NULL, WS_POPUP | WS_VISIBLE, 0, 0, bm.bmWidth, bm.bmHeight, pParentWnd->GetSafeHwnd(), NULL);
+ NULL, WS_POPUP | WS_VISIBLE, 0, 0, imgSize.cx, imgSize.cy, pParentWnd->GetSafeHwnd(), NULL);
}
/**
- * @brief Destroy the window, and update the mainframe.
+ * @brief Destroy the window and splash image then update the mainframe.
*/
void CSplashWnd::HideSplashScreen()
{
+ m_pPicture->Free();
+ delete m_pPicture;
+ m_pPicture = NULL;
DestroyWindow();
AfxGetMainWnd()->UpdateWindow();
}
}
/**
- * @brief Add version text to bitmap.
+ * @brief Paint splashscreen.
+ * Draws image to window size (which is already set to image size).
+ * Then adds texts over image.
*/
void CSplashWnd::OnPaint()
{
CPaintDC dc(this);
-
- CDC dcImage;
- if (!dcImage.CreateCompatibleDC(&dc))
- return;
-
- BITMAP bm;
- m_bitmap.GetBitmap(&bm);
-
- // Paint the image.
- CBitmap* pOldBitmap = dcImage.SelectObject(&m_bitmap);
- dc.BitBlt(0, 0, bm.bmWidth, bm.bmHeight, &dcImage, 0, 0, SRCCOPY);
- dcImage.SelectObject(pOldBitmap);
+ m_pPicture->Render(&dc);
CVersionInfo version;
CString s;
//
/////////////////////////////////////////////////////////////////////////////
/**
- * @file Splash.h
+ * @file Src/Splash.h
*
* @brief Declaration file for CSplashWnd
*
#ifndef _SPLASH_SCRN_
#define _SPLASH_SCRN_
-/////////////////////////////////////////////////////////////////////////////
-// Splash Screen class
+class CPicture;
+/**
+ * @brief Splash screen class.
+ * Loads image from resource and shows it as a splash screen
+ * at program startup.
+ */
class CSplashWnd : public CWnd
{
// Construction
CSplashWnd();
// Attributes:
-public:
- CBitmap m_bitmap;
+private:
+ CPicture * m_pPicture; /**< Image loader/viewer for splash image */
// Operations
public:
#define IDD_LOAD_SAVE_CODEPAGE 230
#define IDD_TEST_FILTER 231
#define IDD_PROPPAGE_COLORS_TEXT 232
-#define IDB_SPLASH 308
+#define IDR_SPLASH 308
#define IDB_WINMERGE 309
#define IDB_OLDSPLASH 310
#define IDB_EDIT_COPY 316