Language: More code cleanup, status messages, dialog box, etc
This commit is contained in:
parent
0bd4b9deb9
commit
bd3fd85b99
|
@ -2521,6 +2521,15 @@ public:
|
||||||
return ::DrawText(m_hDC, lpstrText, cchText, lpRect, uFormat);
|
return ::DrawText(m_hDC, lpstrText, cchText, lpRect, uFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int DrawTextW(LPCWSTR lpstrText, int cchText, LPRECT lpRect, UINT uFormat)
|
||||||
|
{
|
||||||
|
ATLASSERT(m_hDC != NULL);
|
||||||
|
#ifndef _WIN32_WCE
|
||||||
|
ATLASSERT((uFormat & DT_MODIFYSTRING) == 0);
|
||||||
|
#endif // !_WIN32_WCE
|
||||||
|
return ::DrawTextW(m_hDC, lpstrText, cchText, lpRect, uFormat);
|
||||||
|
}
|
||||||
|
|
||||||
int DrawText(LPTSTR lpstrText, int cchText, LPRECT lpRect, UINT uFormat)
|
int DrawText(LPTSTR lpstrText, int cchText, LPRECT lpRect, UINT uFormat)
|
||||||
{
|
{
|
||||||
ATLASSERT(m_hDC != NULL);
|
ATLASSERT(m_hDC != NULL);
|
||||||
|
|
|
@ -126,9 +126,9 @@ bool C7zip::GetFile(int index, Byte * Data, size_t DataLen )
|
||||||
size_t offset;
|
size_t offset;
|
||||||
size_t outSizeProcessed;
|
size_t outSizeProcessed;
|
||||||
|
|
||||||
char Msg[200];
|
wchar_t Msg[200];
|
||||||
std::string FileName = FileNameIndex(index);
|
std::wstring FileName = FileNameIndex(index);
|
||||||
sprintf(Msg,"Getting %s",FileName.c_str());
|
_snwprintf(Msg, sizeof(Msg) / sizeof(Msg[0]), L"extracting %s", FileName.c_str());
|
||||||
m_NotfyCallback(Msg,m_NotfyCallbackInfo);
|
m_NotfyCallback(Msg,m_NotfyCallbackInfo);
|
||||||
|
|
||||||
SRes res = SzArEx_Extract(m_db, &m_archiveLookStream.s, index,
|
SRes res = SzArEx_Extract(m_db, &m_archiveLookStream.s, index,
|
||||||
|
@ -146,7 +146,7 @@ bool C7zip::GetFile(int index, Byte * Data, size_t DataLen )
|
||||||
outSizeProcessed = DataLen;
|
outSizeProcessed = DataLen;
|
||||||
}
|
}
|
||||||
memcpy(Data,m_outBuffer + offset,outSizeProcessed);
|
memcpy(Data,m_outBuffer + offset,outSizeProcessed);
|
||||||
m_NotfyCallback("",m_NotfyCallbackInfo);
|
m_NotfyCallback(L"",m_NotfyCallbackInfo);
|
||||||
m_CurrentFile = -1;
|
m_CurrentFile = -1;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -222,10 +222,9 @@ const char * C7zip::FileName ( char * FileName, int SizeOfFileName ) const
|
||||||
return FileName;
|
return FileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string C7zip::FileNameIndex (int index)
|
std::wstring C7zip::FileNameIndex (int index)
|
||||||
{
|
{
|
||||||
std::string filename;
|
std::wstring filename;
|
||||||
|
|
||||||
if (m_db == NULL || m_db->FileNameOffsets == 0)
|
if (m_db == NULL || m_db->FileNameOffsets == 0)
|
||||||
{
|
{
|
||||||
/* no filename */
|
/* no filename */
|
||||||
|
@ -237,20 +236,7 @@ std::string C7zip::FileNameIndex (int index)
|
||||||
/* no filename */
|
/* no filename */
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
std::wstring filename_utf16;
|
|
||||||
filename_utf16.resize(namelen);
|
|
||||||
|
|
||||||
SzArEx_GetFileNameUtf16(m_db, index, (UInt16 *)filename_utf16.c_str());
|
|
||||||
namelen = WideCharToMultiByte(CP_UTF8, 0, filename_utf16.c_str(), -1, NULL, 0, NULL, NULL);
|
|
||||||
if (namelen == 0)
|
|
||||||
{
|
|
||||||
/* no filename */
|
|
||||||
return filename;
|
|
||||||
}
|
|
||||||
filename.resize(namelen);
|
filename.resize(namelen);
|
||||||
if (WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR)filename_utf16.c_str(), -1, (LPSTR)filename.c_str(), namelen, NULL, NULL) == 0)
|
SzArEx_GetFileNameUtf16(m_db, index, (UInt16 *)filename.c_str());
|
||||||
{
|
|
||||||
filename.clear();
|
|
||||||
}
|
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ public:
|
||||||
C7zip (LPCSTR FileName);
|
C7zip (LPCSTR FileName);
|
||||||
~C7zip ();
|
~C7zip ();
|
||||||
|
|
||||||
typedef void (__stdcall *LP7ZNOTIFICATION)( LPCSTR Status, void * CBInfo );
|
typedef void (__stdcall *LP7ZNOTIFICATION)( LPCWSTR Status, void * CBInfo );
|
||||||
|
|
||||||
inline int NumFiles ( void ) const { return m_db ? m_db->db.NumFiles : 0; }
|
inline int NumFiles ( void ) const { return m_db ? m_db->db.NumFiles : 0; }
|
||||||
inline CSzFileItem * FileItem ( int index ) const { return m_db ? &m_db->db.Files[index] : NULL; }
|
inline CSzFileItem * FileItem ( int index ) const { return m_db ? &m_db->db.Files[index] : NULL; }
|
||||||
|
@ -31,7 +31,7 @@ public:
|
||||||
|
|
||||||
bool GetFile ( int index, Byte * Data, size_t DataLen );
|
bool GetFile ( int index, Byte * Data, size_t DataLen );
|
||||||
const char * FileName ( char * FileName, int SizeOfFileName ) const;
|
const char * FileName ( char * FileName, int SizeOfFileName ) const;
|
||||||
std::string FileNameIndex (int index);
|
std::wstring FileNameIndex (int index);
|
||||||
|
|
||||||
void SetNotificationCallback (LP7ZNOTIFICATION NotfyFnc, void * CBInfo);
|
void SetNotificationCallback (LP7ZNOTIFICATION NotfyFnc, void * CBInfo);
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ private:
|
||||||
|
|
||||||
//static void __stdcall StatusUpdate(_7Z_STATUS status, int Value1, int Value2, C7zip * _this);
|
//static void __stdcall StatusUpdate(_7Z_STATUS status, int Value1, int Value2, C7zip * _this);
|
||||||
|
|
||||||
static void __stdcall NotfyCallbackDefault ( LPCSTR /*Status*/, void * /*CBInfo*/ ) { }
|
static void __stdcall NotfyCallbackDefault ( LPCWSTR /*Status*/, void * /*CBInfo*/ ) { }
|
||||||
|
|
||||||
LP7ZNOTIFICATION m_NotfyCallback;
|
LP7ZNOTIFICATION m_NotfyCallback;
|
||||||
void * m_NotfyCallbackInfo;
|
void * m_NotfyCallbackInfo;
|
||||||
|
|
|
@ -292,7 +292,7 @@ bool CN64Rom::LoadN64Image ( const char * FileLoc, bool LoadBootCodeOnly ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
C7zip ZipFile(FullPath);
|
C7zip ZipFile(FullPath);
|
||||||
//ZipFile.SetNotificationCallback((C7zip::LP7ZNOTIFICATION)NotificationCB,this);
|
ZipFile.SetNotificationCallback((C7zip::LP7ZNOTIFICATION)NotificationCB,this);
|
||||||
for (int i = 0; i < ZipFile.NumFiles(); i++)
|
for (int i = 0; i < ZipFile.NumFiles(); i++)
|
||||||
{
|
{
|
||||||
CSzFileItem * f = ZipFile.FileItem(i);
|
CSzFileItem * f = ZipFile.FileItem(i);
|
||||||
|
@ -300,7 +300,9 @@ bool CN64Rom::LoadN64Image ( const char * FileLoc, bool LoadBootCodeOnly ) {
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (_stricmp(ZipFile.FileNameIndex(i).c_str(), SubFile) != 0)
|
stdstr ZipFileName;
|
||||||
|
ZipFileName.FromUTF16(ZipFile.FileNameIndex(i).c_str());
|
||||||
|
if (_stricmp(ZipFileName.c_str(), SubFile) != 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -470,23 +470,24 @@ void CMainGui::RefreshMenu (void)
|
||||||
m_Menu->ResetMenu();
|
m_Menu->ResetMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainGui::SetStatusText (int Panel,const char * Text) {
|
void CMainGui::SetStatusText (int Panel,const wchar_t * Text)
|
||||||
static char Message[2][500];
|
{
|
||||||
|
static wchar_t Message[2][500];
|
||||||
if (Panel >= 2)
|
if (Panel >= 2)
|
||||||
{
|
{
|
||||||
Notify().BreakPoint(__FILE__,__LINE__);
|
Notify().BreakPoint(__FILE__,__LINE__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
char * Msg = Message[Panel];
|
wchar_t * Msg = Message[Panel];
|
||||||
|
|
||||||
memset(Msg,0,sizeof(Message[0]));
|
memset(Msg,0,sizeof(Message[0]));
|
||||||
_snprintf(Msg,sizeof(Message[0]),"%s",Text);
|
_snwprintf(Msg, sizeof(Message[0]) / sizeof(Message[0][0]), L"%s", Text);
|
||||||
Msg[sizeof(Message[0]) - 1] = 0;
|
Msg[(sizeof(Message[0]) / sizeof(Message[0][0])) - 1] = 0;
|
||||||
if (GetCurrentThreadId() == m_ThreadId)
|
if (GetCurrentThreadId() == m_ThreadId)
|
||||||
{
|
{
|
||||||
SendMessage( (HWND)m_hStatusWnd, SB_SETTEXT, Panel, (LPARAM)Msg );
|
SendMessageW( (HWND)m_hStatusWnd, SB_SETTEXTW, Panel, (LPARAM)Msg );
|
||||||
} else {
|
} else {
|
||||||
PostMessage( (HWND)m_hStatusWnd, SB_SETTEXT, Panel, (LPARAM)Msg );
|
PostMessageW( (HWND)m_hStatusWnd, SB_SETTEXTW, Panel, (LPARAM)Msg );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ public:
|
||||||
CBaseMenu * GetMenuClass ( void ) { return m_Menu; }
|
CBaseMenu * GetMenuClass ( void ) { return m_Menu; }
|
||||||
|
|
||||||
// Status bar
|
// Status bar
|
||||||
void SetStatusText ( int Panel,const char * Text );
|
void SetStatusText ( int Panel,const wchar_t * Text );
|
||||||
void ShowStatusBar ( bool ShowBar );
|
void ShowStatusBar ( bool ShowBar );
|
||||||
|
|
||||||
//About Window
|
//About Window
|
||||||
|
|
|
@ -49,7 +49,8 @@ void CMainMenu::SettingsChanged (CMainMenu * _this )
|
||||||
_this->ResetMenu();
|
_this->ResetMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
int CMainMenu::ProcessAccelerator ( HWND hWnd, void * lpMsg ) {
|
int CMainMenu::ProcessAccelerator ( HWND hWnd, void * lpMsg )
|
||||||
|
{
|
||||||
if (m_ResetAccelerators)
|
if (m_ResetAccelerators)
|
||||||
{
|
{
|
||||||
m_ResetAccelerators = false;
|
m_ResetAccelerators = false;
|
||||||
|
@ -59,7 +60,8 @@ int CMainMenu::ProcessAccelerator ( HWND hWnd, void * lpMsg ) {
|
||||||
return TranslateAccelerator((HWND)hWnd,(HACCEL)m_AccelTable,(LPMSG)lpMsg);
|
return TranslateAccelerator((HWND)hWnd,(HACCEL)m_AccelTable,(LPMSG)lpMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuID) {
|
bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuID)
|
||||||
|
{
|
||||||
switch (MenuID) {
|
switch (MenuID) {
|
||||||
case ID_FILE_OPEN_ROM:
|
case ID_FILE_OPEN_ROM:
|
||||||
{
|
{
|
||||||
|
|
|
@ -105,20 +105,20 @@ void CNotification::DisplayMessage ( int DisplayTime, const wchar_t * Message,
|
||||||
va_end( ap );
|
va_end( ap );
|
||||||
|
|
||||||
|
|
||||||
stdstr PluginMessage;
|
|
||||||
PluginMessage.FromUTF16(Msg);
|
|
||||||
if (InFullScreen())
|
if (InFullScreen())
|
||||||
{
|
{
|
||||||
if (m_gfxPlugin && m_gfxPlugin->DrawStatus)
|
if (m_gfxPlugin && m_gfxPlugin->DrawStatus)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceGfxPlugin,__FUNCTION__ ": DrawStatus - Starting");
|
WriteTrace(TraceGfxPlugin,__FUNCTION__ ": DrawStatus - Starting");
|
||||||
m_gfxPlugin->DrawStatus(PluginMessage.c_str(),FALSE);
|
stdstr PluginMessage;
|
||||||
|
PluginMessage.FromUTF16(Msg);
|
||||||
|
m_gfxPlugin->DrawStatus(PluginMessage.c_str(), FALSE);
|
||||||
WriteTrace(TraceGfxPlugin,__FUNCTION__ ": DrawStatus - Done");
|
WriteTrace(TraceGfxPlugin,__FUNCTION__ ": DrawStatus - Done");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_hWnd->SetStatusText(0,PluginMessage.c_str());
|
m_hWnd->SetStatusText(0, Msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,10 +137,7 @@ void CNotification::DisplayMessage2 ( const wchar_t * Message, va_list ap ) con
|
||||||
_vsnwprintf( Msg,sizeof(Msg) - 1 ,Message, ap );
|
_vsnwprintf( Msg,sizeof(Msg) - 1 ,Message, ap );
|
||||||
va_end( ap );
|
va_end( ap );
|
||||||
|
|
||||||
stdstr DisplayMessage;
|
m_hWnd->SetStatusText(1,Msg);
|
||||||
DisplayMessage.FromUTF16(Msg);
|
|
||||||
|
|
||||||
m_hWnd->SetStatusText(1,DisplayMessage.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CNotification::SetGfxPlugin( CGfxPlugin * Plugin )
|
void CNotification::SetGfxPlugin( CGfxPlugin * Plugin )
|
||||||
|
|
|
@ -364,21 +364,26 @@ DWORD CRomBrowser::AsciiToHex (char * HexValue) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CRomBrowser::CreateRomListControl (void) {
|
void CRomBrowser::CreateRomListControl (void)
|
||||||
|
{
|
||||||
m_hRomList = (HWND)CreateWindowEx( WS_EX_CLIENTEDGE,WC_LISTVIEW,NULL,
|
m_hRomList = (HWND)CreateWindowEx( WS_EX_CLIENTEDGE,WC_LISTVIEW,NULL,
|
||||||
WS_TABSTOP | WS_VISIBLE | WS_CHILD | LVS_OWNERDRAWFIXED |
|
WS_TABSTOP | WS_VISIBLE | WS_CHILD | LVS_OWNERDRAWFIXED |
|
||||||
WS_BORDER | LVS_SINGLESEL | LVS_REPORT,
|
WS_BORDER | LVS_SINGLESEL | LVS_REPORT,
|
||||||
0,0,0,0,(HWND)m_MainWindow,(HMENU)IDC_ROMLIST,GetModuleHandle(NULL),NULL);
|
0,0,0,0,m_MainWindow,(HMENU)IDC_ROMLIST,GetModuleHandle(NULL),NULL);
|
||||||
ResetRomBrowserColomuns();
|
ResetRomBrowserColomuns();
|
||||||
LoadRomList();
|
LoadRomList();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRomBrowser::DeallocateBrushs (void) {
|
void CRomBrowser::DeallocateBrushs (void)
|
||||||
for (size_t count = 0; count < m_RomInfo.size(); count++) {
|
{
|
||||||
if (m_RomInfo[count].SelColor == -1) {
|
for (size_t count = 0; count < m_RomInfo.size(); count++)
|
||||||
|
{
|
||||||
|
if (m_RomInfo[count].SelColor == -1)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (m_RomInfo[count].SelColorBrush) {
|
if (m_RomInfo[count].SelColorBrush)
|
||||||
|
{
|
||||||
DeleteObject((HBRUSH)m_RomInfo[count].SelColorBrush);
|
DeleteObject((HBRUSH)m_RomInfo[count].SelColorBrush);
|
||||||
m_RomInfo[count].SelColorBrush = NULL;
|
m_RomInfo[count].SelColorBrush = NULL;
|
||||||
}
|
}
|
||||||
|
@ -406,36 +411,45 @@ void CRomBrowser::FillRomExtensionInfo(ROM_INFO * pRomInfo)
|
||||||
sprintf(Identifier,"%08X-%08X-C:%X",pRomInfo->CRC1,pRomInfo->CRC2,pRomInfo->Country);
|
sprintf(Identifier,"%08X-%08X-C:%X",pRomInfo->CRC1,pRomInfo->CRC2,pRomInfo->Country);
|
||||||
|
|
||||||
//Rom Notes
|
//Rom Notes
|
||||||
if (m_Fields[RB_UserNotes].Pos() >= 0) {
|
if (m_Fields[RB_UserNotes].Pos() >= 0)
|
||||||
|
{
|
||||||
m_NotesIniFile->GetString(Identifier,"Note","",pRomInfo->UserNotes,sizeof(pRomInfo->UserNotes));
|
m_NotesIniFile->GetString(Identifier,"Note","",pRomInfo->UserNotes,sizeof(pRomInfo->UserNotes));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Rom Extension info
|
//Rom Extension info
|
||||||
if (m_Fields[RB_Developer].Pos() >= 0) {
|
if (m_Fields[RB_Developer].Pos() >= 0)
|
||||||
|
{
|
||||||
m_ExtIniFile->GetString(Identifier,"Developer","",pRomInfo->Developer,sizeof(pRomInfo->Developer));
|
m_ExtIniFile->GetString(Identifier,"Developer","",pRomInfo->Developer,sizeof(pRomInfo->Developer));
|
||||||
}
|
}
|
||||||
if (m_Fields[RB_ReleaseDate].Pos() >= 0) {
|
if (m_Fields[RB_ReleaseDate].Pos() >= 0)
|
||||||
|
{
|
||||||
m_ExtIniFile->GetString(Identifier,"ReleaseDate","",pRomInfo->ReleaseDate,sizeof(pRomInfo->ReleaseDate));
|
m_ExtIniFile->GetString(Identifier,"ReleaseDate","",pRomInfo->ReleaseDate,sizeof(pRomInfo->ReleaseDate));
|
||||||
}
|
}
|
||||||
if (m_Fields[RB_Genre].Pos() >= 0) {
|
if (m_Fields[RB_Genre].Pos() >= 0)
|
||||||
|
{
|
||||||
m_ExtIniFile->GetString(Identifier,"Genre","",pRomInfo->Genre,sizeof(pRomInfo->Genre));
|
m_ExtIniFile->GetString(Identifier,"Genre","",pRomInfo->Genre,sizeof(pRomInfo->Genre));
|
||||||
}
|
}
|
||||||
if (m_Fields[RB_Players].Pos() >= 0) {
|
if (m_Fields[RB_Players].Pos() >= 0)
|
||||||
|
{
|
||||||
m_ExtIniFile->GetNumber(Identifier,"Players",1,(DWORD &)pRomInfo->Players);
|
m_ExtIniFile->GetNumber(Identifier,"Players",1,(DWORD &)pRomInfo->Players);
|
||||||
}
|
}
|
||||||
if (m_Fields[RB_ForceFeedback].Pos() >= 0) {
|
if (m_Fields[RB_ForceFeedback].Pos() >= 0)
|
||||||
|
{
|
||||||
m_ExtIniFile->GetString(Identifier,"ForceFeedback","unknown",pRomInfo->ForceFeedback,sizeof(pRomInfo->ForceFeedback));
|
m_ExtIniFile->GetString(Identifier,"ForceFeedback","unknown",pRomInfo->ForceFeedback,sizeof(pRomInfo->ForceFeedback));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Rom Settings
|
//Rom Settings
|
||||||
if (m_Fields[RB_GoodName].Pos() >= 0) {
|
if (m_Fields[RB_GoodName].Pos() >= 0)
|
||||||
|
{
|
||||||
m_RomIniFile->GetString(Identifier,"Good Name",pRomInfo->GoodName,pRomInfo->GoodName,sizeof(pRomInfo->GoodName));
|
m_RomIniFile->GetString(Identifier,"Good Name",pRomInfo->GoodName,pRomInfo->GoodName,sizeof(pRomInfo->GoodName));
|
||||||
}
|
}
|
||||||
m_RomIniFile->GetString(Identifier,"Status",pRomInfo->Status,pRomInfo->Status,sizeof(pRomInfo->Status));
|
m_RomIniFile->GetString(Identifier,"Status",pRomInfo->Status,pRomInfo->Status,sizeof(pRomInfo->Status));
|
||||||
if (m_Fields[RB_CoreNotes].Pos() >= 0) {
|
if (m_Fields[RB_CoreNotes].Pos() >= 0)
|
||||||
|
{
|
||||||
m_RomIniFile->GetString(Identifier,"Core Note","",pRomInfo->CoreNotes,sizeof(pRomInfo->CoreNotes));
|
m_RomIniFile->GetString(Identifier,"Core Note","",pRomInfo->CoreNotes,sizeof(pRomInfo->CoreNotes));
|
||||||
}
|
}
|
||||||
if (m_Fields[RB_PluginNotes].Pos() >= 0) {
|
if (m_Fields[RB_PluginNotes].Pos() >= 0)
|
||||||
|
{
|
||||||
m_RomIniFile->GetString(Identifier,"Plugin Note","",pRomInfo->PluginNotes,sizeof(pRomInfo->PluginNotes));
|
m_RomIniFile->GetString(Identifier,"Plugin Note","",pRomInfo->PluginNotes,sizeof(pRomInfo->PluginNotes));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,9 +463,12 @@ void CRomBrowser::FillRomExtensionInfo(ROM_INFO * pRomInfo)
|
||||||
sprintf(String,"%s.Sel",pRomInfo->Status);
|
sprintf(String,"%s.Sel",pRomInfo->Status);
|
||||||
m_RomIniFile->GetString("Rom Status",String,"FFFFFFFF",String,9);
|
m_RomIniFile->GetString("Rom Status",String,"FFFFFFFF",String,9);
|
||||||
int selcol = AsciiToHex(String);
|
int selcol = AsciiToHex(String);
|
||||||
if (selcol < 0) {
|
if (selcol < 0)
|
||||||
|
{
|
||||||
pRomInfo->SelColor = - 1;
|
pRomInfo->SelColor = - 1;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
selcol = (AsciiToHex(String) & 0xFFFFFF);
|
selcol = (AsciiToHex(String) & 0xFFFFFF);
|
||||||
selcol = (selcol & 0x00FF00) | ((selcol >> 0x10) & 0xFF) | ((selcol & 0xFF) << 0x10);
|
selcol = (selcol & 0x00FF00) | ((selcol >> 0x10) & 0xFF) | ((selcol & 0xFF) << 0x10);
|
||||||
pRomInfo->SelColor = selcol;
|
pRomInfo->SelColor = selcol;
|
||||||
|
@ -464,7 +481,8 @@ void CRomBrowser::FillRomExtensionInfo(ROM_INFO * pRomInfo)
|
||||||
pRomInfo->SelTextColor = (pRomInfo->SelTextColor & 0x00FF00) | ((pRomInfo->SelTextColor >> 0x10) & 0xFF) | ((pRomInfo->SelTextColor & 0xFF) << 0x10);
|
pRomInfo->SelTextColor = (pRomInfo->SelTextColor & 0x00FF00) | ((pRomInfo->SelTextColor >> 0x10) & 0xFF) | ((pRomInfo->SelTextColor & 0xFF) << 0x10);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CRomBrowser::FillRomInfo(ROM_INFO * pRomInfo) {
|
bool CRomBrowser::FillRomInfo(ROM_INFO * pRomInfo)
|
||||||
|
{
|
||||||
int count;
|
int count;
|
||||||
BYTE RomData[0x1000];
|
BYTE RomData[0x1000];
|
||||||
|
|
||||||
|
@ -477,13 +495,17 @@ bool CRomBrowser::FillRomInfo(ROM_INFO * pRomInfo) {
|
||||||
if (strstr(pRomInfo->szFullFileName,"?") != NULL)
|
if (strstr(pRomInfo->szFullFileName,"?") != NULL)
|
||||||
{
|
{
|
||||||
strcpy(pRomInfo->FileName,strstr(pRomInfo->szFullFileName,"?") + 1);
|
strcpy(pRomInfo->FileName,strstr(pRomInfo->szFullFileName,"?") + 1);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
char drive[_MAX_DRIVE] ,dir[_MAX_DIR], ext[_MAX_EXT];
|
char drive[_MAX_DRIVE] ,dir[_MAX_DIR], ext[_MAX_EXT];
|
||||||
_splitpath( pRomInfo->szFullFileName, drive, dir, pRomInfo->FileName, ext );
|
_splitpath( pRomInfo->szFullFileName, drive, dir, pRomInfo->FileName, ext );
|
||||||
}
|
}
|
||||||
if (m_Fields[RB_InternalName].Pos() >= 0) {
|
if (m_Fields[RB_InternalName].Pos() >= 0)
|
||||||
|
{
|
||||||
memcpy(pRomInfo->InternalName,(void *)(RomData + 0x20),20);
|
memcpy(pRomInfo->InternalName,(void *)(RomData + 0x20),20);
|
||||||
for( count = 0 ; count < 20; count += 4 ) {
|
for( count = 0 ; count < 20; count += 4 )
|
||||||
|
{
|
||||||
pRomInfo->InternalName[count] ^= pRomInfo->InternalName[count+3];
|
pRomInfo->InternalName[count] ^= pRomInfo->InternalName[count+3];
|
||||||
pRomInfo->InternalName[count + 3] ^= pRomInfo->InternalName[count];
|
pRomInfo->InternalName[count + 3] ^= pRomInfo->InternalName[count];
|
||||||
pRomInfo->InternalName[count] ^= pRomInfo->InternalName[count+3];
|
pRomInfo->InternalName[count] ^= pRomInfo->InternalName[count+3];
|
||||||
|
@ -504,9 +526,12 @@ bool CRomBrowser::FillRomInfo(ROM_INFO * pRomInfo) {
|
||||||
|
|
||||||
FillRomExtensionInfo(pRomInfo);
|
FillRomExtensionInfo(pRomInfo);
|
||||||
|
|
||||||
if (pRomInfo->SelColor == -1) {
|
if (pRomInfo->SelColor == -1)
|
||||||
|
{
|
||||||
pRomInfo->SelColorBrush = (DWORD)((HBRUSH)(COLOR_HIGHLIGHT + 1));
|
pRomInfo->SelColorBrush = (DWORD)((HBRUSH)(COLOR_HIGHLIGHT + 1));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
pRomInfo->SelColorBrush = (DWORD)CreateSolidBrush(pRomInfo->SelColor);
|
pRomInfo->SelColorBrush = (DWORD)CreateSolidBrush(pRomInfo->SelColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -528,7 +553,8 @@ bool CRomBrowser::GetRomFileNames( strlist & FileList, const CPath & BaseDirecto
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do
|
||||||
|
{
|
||||||
if (InWatchThread && WaitForSingleObject(m_WatchStopEvent,0) != WAIT_TIMEOUT)
|
if (InWatchThread && WaitForSingleObject(m_WatchStopEvent,0) != WAIT_TIMEOUT)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -541,7 +567,9 @@ bool CRomBrowser::GetRomFileNames( strlist & FileList, const CPath & BaseDirecto
|
||||||
stdstr CurrentDir = Directory + SearchPath.GetCurrentDirectory() + "\\";
|
stdstr CurrentDir = Directory + SearchPath.GetCurrentDirectory() + "\\";
|
||||||
GetRomFileNames(FileList,BaseDirectory,CurrentDir,InWatchThread);
|
GetRomFileNames(FileList,BaseDirectory,CurrentDir,InWatchThread);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
AddFileNameToList(FileList, Directory, SearchPath);
|
AddFileNameToList(FileList, Directory, SearchPath);
|
||||||
}
|
}
|
||||||
} while (SearchPath.FindNext());
|
} while (SearchPath.FindNext());
|
||||||
|
@ -585,7 +613,8 @@ void CRomBrowser::FillRomList ( strlist & FileList, const CPath & BaseDirectory,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do
|
||||||
|
{
|
||||||
WriteTraceF(TraceDebug,__FUNCTION__ ": 2 %s m_StopRefresh = %d",(LPCSTR)SearchPath,m_StopRefresh);
|
WriteTraceF(TraceDebug,__FUNCTION__ ": 2 %s m_StopRefresh = %d",(LPCSTR)SearchPath,m_StopRefresh);
|
||||||
if (m_StopRefresh) { break; }
|
if (m_StopRefresh) { break; }
|
||||||
|
|
||||||
|
@ -635,12 +664,14 @@ void CRomBrowser::FillRomList ( strlist & FileList, const CPath & BaseDirectory,
|
||||||
}
|
}
|
||||||
ROM_INFO RomInfo;
|
ROM_INFO RomInfo;
|
||||||
|
|
||||||
std::string FileName = ZipFile.FileNameIndex(i);
|
std::wstring FileNameW = ZipFile.FileNameIndex(i);
|
||||||
if (FileName.length() == 0)
|
if (FileNameW.length() == 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stdstr FileName;
|
||||||
|
FileName.FromUTF16(FileNameW.c_str());
|
||||||
WriteTrace(TraceDebug,__FUNCTION__ ": 5");
|
WriteTrace(TraceDebug,__FUNCTION__ ": 5");
|
||||||
char drive2[_MAX_DRIVE] ,dir2[_MAX_DIR], FileName2[MAX_PATH], ext2[_MAX_EXT];
|
char drive2[_MAX_DRIVE] ,dir2[_MAX_DIR], FileName2[MAX_PATH], ext2[_MAX_EXT];
|
||||||
_splitpath( FileName.c_str(), drive2, dir2, FileName2, ext2 );
|
_splitpath( FileName.c_str(), drive2, dir2, FileName2, ext2 );
|
||||||
|
@ -657,7 +688,7 @@ void CRomBrowser::FillRomList ( strlist & FileList, const CPath & BaseDirectory,
|
||||||
WriteTrace(TraceDebug,__FUNCTION__ ": 7");
|
WriteTrace(TraceDebug,__FUNCTION__ ": 7");
|
||||||
memset(&RomInfo, 0, sizeof(ROM_INFO));
|
memset(&RomInfo, 0, sizeof(ROM_INFO));
|
||||||
stdstr_f zipFileName("%s?%s",(LPCSTR)SearchPath,FileName.c_str());
|
stdstr_f zipFileName("%s?%s",(LPCSTR)SearchPath,FileName.c_str());
|
||||||
//ZipFile.SetNotificationCallback((C7zip::LP7ZNOTIFICATION)NotificationCB,this);
|
ZipFile.SetNotificationCallback((C7zip::LP7ZNOTIFICATION)NotificationCB,this);
|
||||||
|
|
||||||
strncpy(RomInfo.szFullFileName, zipFileName.c_str(), sizeof(RomInfo.szFullFileName) - 1);
|
strncpy(RomInfo.szFullFileName, zipFileName.c_str(), sizeof(RomInfo.szFullFileName) - 1);
|
||||||
RomInfo.szFullFileName[sizeof(RomInfo.szFullFileName) - 1] = 0;
|
RomInfo.szFullFileName[sizeof(RomInfo.szFullFileName) - 1] = 0;
|
||||||
|
@ -1475,7 +1506,7 @@ void CRomBrowser::RomList_PopupMenu(DWORD /*pnmh*/)
|
||||||
GetCursorPos(&Mouse);
|
GetCursorPos(&Mouse);
|
||||||
|
|
||||||
//Show the menu
|
//Show the menu
|
||||||
TrackPopupMenu(hPopupMenu, 0, Mouse.x, Mouse.y, 0,(HWND)m_MainWindow, NULL);
|
TrackPopupMenu(hPopupMenu, 0, Mouse.x, Mouse.y, 0,m_MainWindow, NULL);
|
||||||
DestroyMenu(hMenu);
|
DestroyMenu(hMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1577,7 +1608,8 @@ int CALLBACK CRomBrowser::SelectRomDirCallBack(HWND hwnd,DWORD uMsg,DWORD /*lp*/
|
||||||
// It would be FALSE if you were passing a pidl.
|
// It would be FALSE if you were passing a pidl.
|
||||||
if (lpData)
|
if (lpData)
|
||||||
{
|
{
|
||||||
SendMessage((HWND)hwnd,BFFM_SETSELECTION,TRUE,lpData);
|
SendMessage(hwnd,BFFM_SETSELECTION,TRUE,lpData);
|
||||||
|
SetWindowTextW(hwnd, GS(DIR_SELECT_ROM));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1586,24 +1618,21 @@ int CALLBACK CRomBrowser::SelectRomDirCallBack(HWND hwnd,DWORD uMsg,DWORD /*lp*/
|
||||||
|
|
||||||
void CRomBrowser::SelectRomDir(void)
|
void CRomBrowser::SelectRomDir(void)
|
||||||
{
|
{
|
||||||
char SelectedDir[MAX_PATH];
|
wchar_t SelectedDir[MAX_PATH];
|
||||||
LPITEMIDLIST pidl;
|
LPITEMIDLIST pidl;
|
||||||
BROWSEINFO bi;
|
BROWSEINFOW bi;
|
||||||
|
|
||||||
stdstr WindowTitle;
|
|
||||||
WindowTitle.FromUTF16(GS(SELECT_ROM_DIR));
|
|
||||||
|
|
||||||
WriteTrace(TraceDebug,__FUNCTION__ " 1");
|
WriteTrace(TraceDebug,__FUNCTION__ " 1");
|
||||||
stdstr RomDir = g_Settings->LoadString(Directory_Game);
|
stdstr RomDir = g_Settings->LoadString(Directory_Game);
|
||||||
bi.hwndOwner = (HWND)m_MainWindow;
|
bi.hwndOwner = m_MainWindow;
|
||||||
bi.pidlRoot = NULL;
|
bi.pidlRoot = NULL;
|
||||||
bi.pszDisplayName = SelectedDir;
|
bi.pszDisplayName = SelectedDir;
|
||||||
bi.lpszTitle = WindowTitle.c_str();
|
bi.lpszTitle = GS(SELECT_ROM_DIR);
|
||||||
bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
|
bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
|
||||||
bi.lpfn = (BFFCALLBACK)SelectRomDirCallBack;
|
bi.lpfn = (BFFCALLBACK)SelectRomDirCallBack;
|
||||||
bi.lParam = (DWORD)RomDir.c_str();
|
bi.lParam = (DWORD)RomDir.c_str();
|
||||||
WriteTrace(TraceDebug,__FUNCTION__ " 2");
|
WriteTrace(TraceDebug,__FUNCTION__ " 2");
|
||||||
if ((pidl = SHBrowseForFolder(&bi)) != NULL)
|
if ((pidl = SHBrowseForFolderW(&bi)) != NULL)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceDebug,__FUNCTION__ " 3");
|
WriteTrace(TraceDebug,__FUNCTION__ " 3");
|
||||||
char Directory[_MAX_PATH];
|
char Directory[_MAX_PATH];
|
||||||
|
@ -1632,11 +1661,11 @@ void CRomBrowser::FixRomListWindow (void)
|
||||||
{
|
{
|
||||||
//Change the window Style
|
//Change the window Style
|
||||||
long Style = GetWindowLong(m_MainWindow,GWL_STYLE) | WS_SIZEBOX | WS_MAXIMIZEBOX;
|
long Style = GetWindowLong(m_MainWindow,GWL_STYLE) | WS_SIZEBOX | WS_MAXIMIZEBOX;
|
||||||
SetWindowLong((HWND)m_MainWindow,GWL_STYLE,Style);
|
SetWindowLong(m_MainWindow,GWL_STYLE,Style);
|
||||||
|
|
||||||
//Get the current window size
|
//Get the current window size
|
||||||
RECT rect;
|
RECT rect;
|
||||||
GetWindowRect((HWND)m_MainWindow, &rect);
|
GetWindowRect(m_MainWindow, &rect);
|
||||||
|
|
||||||
//We find the middle position of the screen, we use this if theres no setting
|
//We find the middle position of the screen, we use this if theres no setting
|
||||||
int X = (GetSystemMetrics(SM_CXSCREEN) - (rect.right - rect.left)) / 2;
|
int X = (GetSystemMetrics(SM_CXSCREEN) - (rect.right - rect.left)) / 2;
|
||||||
|
@ -1660,12 +1689,12 @@ void CRomBrowser::FixRomListWindow (void)
|
||||||
rcClient.bottom = Height;
|
rcClient.bottom = Height;
|
||||||
rcClient.left = 0;
|
rcClient.left = 0;
|
||||||
rcClient.right = Width;
|
rcClient.right = Width;
|
||||||
AdjustWindowRect(&rcClient,GetWindowLong((HWND)m_MainWindow,GWL_STYLE),true);
|
AdjustWindowRect(&rcClient,GetWindowLong(m_MainWindow,GWL_STYLE),true);
|
||||||
|
|
||||||
int WindowHeight = rcClient.bottom - rcClient.top;
|
int WindowHeight = rcClient.bottom - rcClient.top;
|
||||||
int WindowWidth = rcClient.right - rcClient.left;
|
int WindowWidth = rcClient.right - rcClient.left;
|
||||||
|
|
||||||
SetWindowPos((HWND)m_MainWindow,NULL,0,0,WindowWidth,WindowHeight,SWP_NOMOVE|SWP_NOZORDER);
|
SetWindowPos(m_MainWindow,NULL,0,0,WindowWidth,WindowHeight,SWP_NOMOVE|SWP_NOZORDER);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRomBrowser::ShowRomList (void)
|
void CRomBrowser::ShowRomList (void)
|
||||||
|
@ -1687,7 +1716,7 @@ void CRomBrowser::ShowRomList (void)
|
||||||
m_Visible = true;
|
m_Visible = true;
|
||||||
|
|
||||||
RECT rcWindow;
|
RECT rcWindow;
|
||||||
if (GetClientRect((HWND)m_MainWindow,&rcWindow))
|
if (GetClientRect(m_MainWindow,&rcWindow))
|
||||||
{
|
{
|
||||||
ResizeRomList((WORD)rcWindow.right,(WORD)rcWindow.bottom);
|
ResizeRomList((WORD)rcWindow.right,(WORD)rcWindow.bottom);
|
||||||
}
|
}
|
||||||
|
@ -1702,7 +1731,7 @@ void CRomBrowser::ShowRomList (void)
|
||||||
void CRomBrowser::HideRomList (void)
|
void CRomBrowser::HideRomList (void)
|
||||||
{
|
{
|
||||||
if (!RomBrowserVisible()) { return; }
|
if (!RomBrowserVisible()) { return; }
|
||||||
ShowWindow((HWND)m_MainWindow,SW_HIDE);
|
ShowWindow(m_MainWindow,SW_HIDE);
|
||||||
|
|
||||||
SaveRomListColoumnInfo();
|
SaveRomListColoumnInfo();
|
||||||
WatchThreadStop();
|
WatchThreadStop();
|
||||||
|
@ -1714,28 +1743,28 @@ void CRomBrowser::HideRomList (void)
|
||||||
EnableWindow((HWND)m_hRomList,FALSE);
|
EnableWindow((HWND)m_hRomList,FALSE);
|
||||||
ShowWindow((HWND)m_hRomList,SW_HIDE);
|
ShowWindow((HWND)m_hRomList,SW_HIDE);
|
||||||
|
|
||||||
if (g_Settings->LoadBool(RomBrowser_Maximized)) { ShowWindow((HWND)m_MainWindow,SW_RESTORE); }
|
if (g_Settings->LoadBool(RomBrowser_Maximized)) { ShowWindow(m_MainWindow,SW_RESTORE); }
|
||||||
|
|
||||||
//Change the window style
|
//Change the window style
|
||||||
long Style = GetWindowLong((HWND)m_MainWindow,GWL_STYLE) & ~(WS_SIZEBOX | WS_MAXIMIZEBOX);
|
long Style = GetWindowLong(m_MainWindow,GWL_STYLE) & ~(WS_SIZEBOX | WS_MAXIMIZEBOX);
|
||||||
SetWindowLong((HWND)m_MainWindow,GWL_STYLE,Style);
|
SetWindowLong(m_MainWindow,GWL_STYLE,Style);
|
||||||
|
|
||||||
//Move window to correct location
|
//Move window to correct location
|
||||||
RECT rect;
|
RECT rect;
|
||||||
GetWindowRect((HWND)m_MainWindow,&rect);
|
GetWindowRect(m_MainWindow,&rect);
|
||||||
int X = (GetSystemMetrics( SM_CXSCREEN ) - (rect.right - rect.left)) / 2;
|
int X = (GetSystemMetrics( SM_CXSCREEN ) - (rect.right - rect.left)) / 2;
|
||||||
int Y = (GetSystemMetrics( SM_CYSCREEN ) - (rect.bottom - rect.top)) / 2;
|
int Y = (GetSystemMetrics( SM_CYSCREEN ) - (rect.bottom - rect.top)) / 2;
|
||||||
g_Settings->LoadDword(UserInterface_MainWindowTop,(DWORD &)Y);
|
g_Settings->LoadDword(UserInterface_MainWindowTop,(DWORD &)Y);
|
||||||
g_Settings->LoadDword(UserInterface_MainWindowLeft,(DWORD &)X);
|
g_Settings->LoadDword(UserInterface_MainWindowLeft,(DWORD &)X);
|
||||||
SetWindowPos((HWND)m_MainWindow,NULL,X,Y,0,0,SWP_NOZORDER|SWP_NOSIZE);
|
SetWindowPos(m_MainWindow,NULL,X,Y,0,0,SWP_NOZORDER|SWP_NOSIZE);
|
||||||
|
|
||||||
//Mark the window as not visible
|
//Mark the window as not visible
|
||||||
m_Visible = false;
|
m_Visible = false;
|
||||||
|
|
||||||
//Make the main window visible again
|
//Make the main window visible again
|
||||||
ShowWindow((HWND)m_MainWindow,SW_SHOW);
|
ShowWindow(m_MainWindow,SW_SHOW);
|
||||||
BringWindowToTop((HWND)m_MainWindow);
|
BringWindowToTop(m_MainWindow);
|
||||||
PostMessage((HWND)m_MainWindow, WM_MAKE_FOCUS, 0,0 );
|
PostMessage(m_MainWindow, WM_MAKE_FOCUS, 0,0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CRomBrowser::RomDirNeedsRefresh ( void )
|
bool CRomBrowser::RomDirNeedsRefresh ( void )
|
||||||
|
|
|
@ -63,7 +63,7 @@ int CALLBACK COptionsDirectoriesPage::SelectDirCallBack (HWND hwnd,DWORD uMsg,DW
|
||||||
// It would be FALSE if you were passing a pidl.
|
// It would be FALSE if you were passing a pidl.
|
||||||
if (lpData)
|
if (lpData)
|
||||||
{
|
{
|
||||||
SendMessage((HWND)hwnd,BFFM_SETSELECTION,TRUE,lpData);
|
SendMessage(hwnd,BFFM_SETSELECTION,TRUE,lpData);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,18 @@ protected:
|
||||||
}
|
}
|
||||||
bool Create(HWND hParent, const RECT & rcDispay)
|
bool Create(HWND hParent, const RECT & rcDispay)
|
||||||
{
|
{
|
||||||
CDialogImpl<T>::Create(hParent);
|
BOOL result = m_thunk.Init(NULL, NULL);
|
||||||
|
if (result == FALSE)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_OUTOFMEMORY);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_AtlWinModule.AddCreateWndData(&m_thunk.cd, this);
|
||||||
|
#ifdef _DEBUG
|
||||||
|
m_bModal = false;
|
||||||
|
#endif //_DEBUG
|
||||||
|
m_hWnd = ::CreateDialogParamW(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCEW(static_cast<T*>(this)->IDD), hParent, T::StartDialogProc, NULL);
|
||||||
if (m_hWnd == NULL)
|
if (m_hWnd == NULL)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Microsoft Visual C++ generated resource script.
|
// Microsoft Visual C++ generated resource script.
|
||||||
//
|
//
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "Version.h"
|
#include "../Version.h"
|
||||||
|
|
||||||
#define APSTUDIO_READONLY_SYMBOLS
|
#define APSTUDIO_READONLY_SYMBOLS
|
||||||
|
|
||||||
|
|
|
@ -10,14 +10,30 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
BOOL CPartialGroupBox::Attach(HWND hWndNew)
|
BOOL CPartialGroupBox::Attach(HWND hWnd)
|
||||||
{
|
{
|
||||||
return SubclassWindow(hWndNew);
|
ATLASSUME(m_hWnd == NULL);
|
||||||
|
ATLASSERT(::IsWindow(hWnd));
|
||||||
|
|
||||||
|
// Allocate the thunk structure here, where we can fail gracefully.
|
||||||
|
|
||||||
|
BOOL result = m_thunk.Init(GetWindowProc(), this);
|
||||||
|
if (result == FALSE)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
WNDPROC pProc = m_thunk.GetWNDPROC();
|
||||||
|
WNDPROC pfnWndProc = (WNDPROC)::SetWindowLongPtrW(hWnd, GWLP_WNDPROC, (LONG_PTR)pProc);
|
||||||
|
if (pfnWndProc == NULL)
|
||||||
|
return FALSE;
|
||||||
|
m_pfnSuperWindowProc = pfnWndProc;
|
||||||
|
m_hWnd = hWnd;
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CPartialGroupBox::AttachToDlgItem(HWND parent, UINT dlgID)
|
BOOL CPartialGroupBox::AttachToDlgItem(HWND parent, UINT dlgID)
|
||||||
{
|
{
|
||||||
return SubclassWindow(::GetDlgItem(parent,dlgID));
|
return Attach(::GetDlgItem(parent,dlgID));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPartialGroupBox::Draw3dLine(CPaintDC & dc, LPCRECT lpRect, COLORREF clrTopLeft, COLORREF /*clrBottomRight*/)
|
void CPartialGroupBox::Draw3dLine(CPaintDC & dc, LPCRECT lpRect, COLORREF clrTopLeft, COLORREF /*clrBottomRight*/)
|
||||||
|
@ -48,11 +64,11 @@ void CPartialGroupBox::OnPaint(HDC /*hDC*/)
|
||||||
dc.SetMapMode(MM_TEXT);
|
dc.SetMapMode(MM_TEXT);
|
||||||
dc.SelectBrush(GetSysColorBrush(COLOR_BTNFACE));
|
dc.SelectBrush(GetSysColorBrush(COLOR_BTNFACE));
|
||||||
|
|
||||||
TCHAR grptext[MAX_PATH];
|
wchar_t grptext[500];
|
||||||
GetWindowText(grptext,MAX_PATH);
|
GetWindowTextW(m_hWnd, grptext, sizeof(grptext) / sizeof(grptext[0]));
|
||||||
|
|
||||||
CRect fontsizerect(0,0,0,0);
|
CRect fontsizerect(0,0,0,0);
|
||||||
dc.DrawText(grptext,-1,fontsizerect,DT_SINGLELINE|DT_LEFT|DT_CALCRECT);
|
dc.DrawTextW(grptext, -1, fontsizerect, DT_SINGLELINE | DT_LEFT | DT_CALCRECT);
|
||||||
|
|
||||||
CRect framerect(controlrect);
|
CRect framerect(controlrect);
|
||||||
framerect.top += (fontsizerect.Height())/2;
|
framerect.top += (fontsizerect.Height())/2;
|
||||||
|
@ -71,7 +87,7 @@ void CPartialGroupBox::OnPaint(HDC /*hDC*/)
|
||||||
Draw3dLine(dc,framerect,GetSysColor(COLOR_3DHILIGHT),GetSysColor(COLOR_3DSHADOW));
|
Draw3dLine(dc,framerect,GetSysColor(COLOR_3DHILIGHT),GetSysColor(COLOR_3DSHADOW));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_tcslen(grptext))
|
if (wcslen(grptext))
|
||||||
{
|
{
|
||||||
CRect fontrect(controlrect);
|
CRect fontrect(controlrect);
|
||||||
fontrect.bottom = controlrect.top+fontsizerect.Height();
|
fontrect.bottom = controlrect.top+fontsizerect.Height();
|
||||||
|
@ -100,7 +116,7 @@ void CPartialGroupBox::OnPaint(HDC /*hDC*/)
|
||||||
dc.SetBkMode(OPAQUE);
|
dc.SetBkMode(OPAQUE);
|
||||||
dc.SetBkColor(GetSysColor(COLOR_BTNFACE));
|
dc.SetBkColor(GetSysColor(COLOR_BTNFACE));
|
||||||
|
|
||||||
dc.DrawText(grptext,-1,fontrect,DT_SINGLELINE|DT_LEFT);
|
dc.DrawTextW(grptext,-1,fontrect,DT_SINGLELINE|DT_LEFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual ~CPartialGroupBox()
|
virtual ~CPartialGroupBox()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue