From 95b019069734ffd73b6034a07174d1addb11ac0b Mon Sep 17 00:00:00 2001 From: Steve Williams <90905675+stevewgr@users.noreply.github.com> Date: Mon, 11 Nov 2024 02:34:39 -0500 Subject: [PATCH 1/7] Rename N3 namespace to n3std for clarity and standardization. This change highlights that the namespace contains utility functions intended to standardize the codebase, similar to the `std` namespace. --- src/common/N3Utils.h | 16 ++++++++-------- src/game/UIStateBar.cpp | 2 +- src/server/AIServer/Npc.cpp | 10 +++++----- src/server/Aujard/DBAgent.cpp | 12 ++++++------ src/tool/N3Indoor/OrganizeView.cpp | 4 ++-- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/common/N3Utils.h b/src/common/N3Utils.h index c8107dc7..84337202 100644 --- a/src/common/N3Utils.h +++ b/src/common/N3Utils.h @@ -5,28 +5,28 @@ #include #include -namespace N3 { +namespace n3std { static bool iequals(const std::string_view & lhs, const std::string_view & rhs) { auto to_lower{std::ranges::views::transform(::tolower)}; return std::ranges::equal(lhs | to_lower, rhs | to_lower); } -static std::string BytesToHex(const uint8_t * const byData, const size_t iSize) { - if (!byData || iSize == 0) { +static std::string bytes_to_hex(const uint8_t * const data, const size_t size) { + if (!data || size == 0) { return ""; } static const char * hex_digits = "0123456789ABCDEF"; std::string result; - result.reserve(iSize * 2); - for (size_t i = 0; i < iSize; ++i) { - result += hex_digits[(byData[i] & 0xF0) >> 4]; - result += hex_digits[byData[i] & 0x0F]; + result.reserve(size * 2); + for (size_t i = 0; i < size; ++i) { + result += hex_digits[(data[i] & 0xF0) >> 4]; + result += hex_digits[data[i] & 0x0F]; } return result; } -} // namespace N3 +} // namespace n3std diff --git a/src/game/UIStateBar.cpp b/src/game/UIStateBar.cpp index d979d3ff..83c575e4 100644 --- a/src/game/UIStateBar.cpp +++ b/src/game/UIStateBar.cpp @@ -733,7 +733,7 @@ void CUIStateBar::DelMagic(__TABLE_UPC_SKILL * pSkill) { __DurationMagicImg * pMagicImg = (*it); CN3UIDBCLButton * pIcon = pMagicImg->pIcon; CN3Texture * pTex = pIcon->GetTex(); - if (pTex && N3::iequals(szTexFN, pTex->FileName())) { + if (pTex && n3std::iequals(szTexFN, pTex->FileName())) { itRemove = it; } if (itRemove != ite) { diff --git a/src/server/AIServer/Npc.cpp b/src/server/AIServer/Npc.cpp index 47b4f557..e832b1ee 100644 --- a/src/server/AIServer/Npc.cpp +++ b/src/server/AIServer/Npc.cpp @@ -3916,14 +3916,14 @@ BOOL CNpc::SetDamage(int nAttackType, int nDamage, const std::string & id, int u for (int i = 0; i < NPC_HAVE_USER_LIST; i++) { if (m_DamagedUserList[i].iUid == uid) { - if (N3::iequals("**duration**", id)) { + if (n3std::iequals("**duration**", id)) { bFlag = TRUE; strcpy(strDurationID, pUser->m_strUserID); - if (N3::iequals(m_DamagedUserList[i].strUserID, strDurationID)) { + if (n3std::iequals(m_DamagedUserList[i].strUserID, strDurationID)) { m_DamagedUserList[i].nDamage += userDamage; goto go_result; } - } else if (N3::iequals(m_DamagedUserList[i].strUserID, id)) { + } else if (n3std::iequals(m_DamagedUserList[i].strUserID, id)) { m_DamagedUserList[i].nDamage += userDamage; goto go_result; } @@ -3943,7 +3943,7 @@ BOOL CNpc::SetDamage(int nAttackType, int nDamage, const std::string & id, int u if (bFlag == TRUE) { strcpy(m_DamagedUserList[i].strUserID, strDurationID); } else { - if (N3::iequals("**duration**", id)) { + if (n3std::iequals("**duration**", id)) { strcpy(m_DamagedUserList[i].strUserID, pUser->m_strUserID); } else { strcpy(m_DamagedUserList[i].strUserID, id.c_str()); @@ -5025,7 +5025,7 @@ void CNpc::IsUserInSight() { // 갖고있는 리스트상의 유저와 같다면 if (m_DamagedUserList[i].iUid == pUser->m_iUserId) { // 최종 ID를 비교해서 동일하면 - if (N3::iequals(m_DamagedUserList[i].strUserID, pUser->m_strUserID)) { + if (n3std::iequals(m_DamagedUserList[i].strUserID, pUser->m_strUserID)) { // 이때서야 존재한다는 표시를 한다 m_DamagedUserList[i].bIs = TRUE; } diff --git a/src/server/Aujard/DBAgent.cpp b/src/server/Aujard/DBAgent.cpp index f9eea0d4..8e024e86 100644 --- a/src/server/Aujard/DBAgent.cpp +++ b/src/server/Aujard/DBAgent.cpp @@ -548,10 +548,10 @@ int CDBAgent::UpdateUser(const char * userid, int uid, int type) { SQLFreeHandle((SQLSMALLINT)SQL_HANDLE_STMT, hstmt); char logstr[1024]{}; - std::string strBySkill = N3::BytesToHex(reinterpret_cast(bySkill), sizeof(bySkill)); - std::string strByItem = N3::BytesToHex(reinterpret_cast(byItem), sizeof(byItem)); - sprintf(logstr, "[Error-DB Fail] %s, Skill[%s] Item[%s] \r\n", szSQL, strBySkill.c_str(), - strByItem.c_str()); + std::string szBySkill = n3std::bytes_to_hex(reinterpret_cast(bySkill), sizeof(bySkill)); + std::string szByItem = n3std::bytes_to_hex(reinterpret_cast(byItem), sizeof(byItem)); + sprintf(logstr, "[Error-DB Fail] %s, Skill[%s] Item[%s] \r\n", szSQL, szBySkill.c_str(), + szByItem.c_str()); m_pMain->WriteLogFile(logstr); //m_pMain->m_LogFile.Write(logstr, strlen(logstr)); return 0; @@ -1314,8 +1314,8 @@ int CDBAgent::UpdateWarehouseData(const char * accountid, int uid, int type) { SQLFreeHandle((SQLSMALLINT)SQL_HANDLE_STMT, hstmt); char logstr[2048]{}; - std::string strByItem = N3::BytesToHex(reinterpret_cast(byItem), sizeof(byItem)); - sprintf(logstr, "%s, Item[%s] \r\n", szSQL, strByItem.c_str()); + std::string szByItem = n3std::bytes_to_hex(reinterpret_cast(byItem), sizeof(byItem)); + sprintf(logstr, "%s, Item[%s] \r\n", szSQL, szByItem.c_str()); m_pMain->WriteLogFile(logstr); //m_pMain->m_LogFile.Write(logstr, strlen(logstr)); return FALSE; diff --git a/src/tool/N3Indoor/OrganizeView.cpp b/src/tool/N3Indoor/OrganizeView.cpp index 0cff1773..e8fa2a68 100644 --- a/src/tool/N3Indoor/OrganizeView.cpp +++ b/src/tool/N3Indoor/OrganizeView.cpp @@ -1269,7 +1269,7 @@ void COrganizeView::OnFileWorkshopOpen() { } std::string szPath(dlg.GetPathName().GetString()), szExt(dlg.GetFileExt().GetString()); - if (!N3::iequals(szExt, "wshop")) { + if (!n3std::iequals(szExt, "wshop")) { return; } @@ -1293,7 +1293,7 @@ void COrganizeView::OnFileOpenGamedata() { } std::string szPath(dlg.GetPathName().GetString()), szExt(dlg.GetFileExt().GetString()); - if (!N3::iequals(szExt, "n3indoor")) { + if (!n3std::iequals(szExt, "n3indoor")) { return; } From ec0ec98e1a876c9f5383b3581f432db368a315b5 Mon Sep 17 00:00:00 2001 From: Steve Williams <90905675+stevewgr@users.noreply.github.com> Date: Mon, 11 Nov 2024 21:49:43 -0500 Subject: [PATCH 2/7] Refactor and relocate GetProgPath and LogFileWrite to N3Utils.h. Centralized these functions to reduce code duplication across the project. The refactored implementation ensures compatibility across all platforms. --- src/common/N3Utils.h | 48 +++++++++++++++++++++++ src/common/StdBase.h | 2 - src/engine/N3Base/N3Eng.cpp | 8 +--- src/server/AIServer/AIServerDlg.cpp | 4 +- src/server/AIServer/GameSocket.cpp | 6 +-- src/server/AIServer/IOCPort.cpp | 4 +- src/server/AIServer/Ini.cpp | 14 +------ src/server/AIServer/Npc.cpp | 4 +- src/server/AIServer/global.cpp | 31 +-------------- src/server/AIServer/global.h | 42 ++++++++++---------- src/server/Aujard/AujardDlg.cpp | 4 +- src/server/Aujard/Define.h | 31 +-------------- src/server/Aujard/Global.cpp | 33 +--------------- src/server/Aujard/SharedMem.cpp | 4 +- src/server/Ebenezer/AISocket.cpp | 4 +- src/server/Ebenezer/Define.h | 29 -------------- src/server/Ebenezer/EbenezerDlg.cpp | 44 ++++++++++----------- src/server/Ebenezer/Global.cpp | 29 -------------- src/server/Ebenezer/IOCPSocket2.cpp | 6 +-- src/server/Ebenezer/IOCPort.cpp | 10 ++--- src/server/Ebenezer/Ini.cpp | 14 +------ src/server/Ebenezer/Map.cpp | 20 +++++----- src/server/Ebenezer/SharedMem.cpp | 6 +-- src/server/Ebenezer/User.cpp | 10 ++--- src/server/ItemManager/Define.h | 32 +-------------- src/server/ItemManager/ItemManagerDlg.cpp | 18 +++++---- src/server/ItemManager/SharedMem.cpp | 4 +- src/server/LoginServer/DBProcess.cpp | 2 +- src/server/LoginServer/Define.h | 31 +-------------- src/server/LoginServer/IOCPort.cpp | 2 +- src/server/LoginServer/LoginServerDlg.cpp | 11 ++---- src/tool/Launcher/LauncherDlg.cpp | 40 ++++--------------- src/tool/Launcher/LauncherDlg.h | 3 +- src/tool/UIE/MainFrm.cpp | 4 +- 34 files changed, 169 insertions(+), 385 deletions(-) diff --git a/src/common/N3Utils.h b/src/common/N3Utils.h index 84337202..a6197436 100644 --- a/src/common/N3Utils.h +++ b/src/common/N3Utils.h @@ -4,9 +4,57 @@ #include #include #include +#include +#include + +namespace fs = std::filesystem; + +#if defined(_WIN32) || defined(_WIN64) +#define VC_EXTRALEAN +#include +#elif defined(__APPLE__) +#include +#elif defined(__linux__) +#include +#endif // #if defined(_WIN32) || defined(_WIN64) namespace n3std { +inline fs::path get_app_path() { + static fs::path app_path = [] { + fs::path::value_type buff[512]{}; +#if defined(_WIN32) || defined(_WIN64) + GetModuleFileNameW(NULL, buff, static_cast(std::size(buff))); +#elif defined(__APPLE__) + _NSGetExecutablePath(buff, (uint32_t *)sizeof(buff)); +#elif defined(__linux__) + readlink("/proc/self/exe", buff, sizeof(buff) - 1); +#endif // #if defined(_WIN32) || defined(_WIN64) + return fs::path(buff); + }(); + + return app_path; +} + +inline fs::path get_app_dir() { + static fs::path app_dir = get_app_path().parent_path(); + + return app_dir; +} + +inline void log_file_write(std::string_view log_msg) { + static fs::path log_path = get_app_path().replace_extension(".log"); + + std::ofstream ofile(log_path, std::ios::app); + if (ofile.is_open()) { + ofile << log_msg; + } +} + +inline void log_file_write(const char * log_msg) { + log_file_write(std::string_view(log_msg)); +} + static bool iequals(const std::string_view & lhs, const std::string_view & rhs) { auto to_lower{std::ranges::views::transform(::tolower)}; return std::ranges::equal(lhs | to_lower, rhs | to_lower); diff --git a/src/common/StdBase.h b/src/common/StdBase.h index 1713cf5d..5dee11ad 100644 --- a/src/common/StdBase.h +++ b/src/common/StdBase.h @@ -19,5 +19,3 @@ #include #include - -namespace fs = std::filesystem; diff --git a/src/engine/N3Base/N3Eng.cpp b/src/engine/N3Base/N3Eng.cpp index 95d76785..dec87c95 100644 --- a/src/engine/N3Base/N3Eng.cpp +++ b/src/engine/N3Base/N3Eng.cpp @@ -39,14 +39,8 @@ CN3Eng::CN3Eng() { exit(-1); } - // 프로그램이 실행된 경로.. if (CN3Base::PathGet().empty()) { - char szPath[256]; - char szDrive[_MAX_DRIVE], szDir[_MAX_DIR]; - ::GetModuleFileName(NULL, szPath, 256); - _splitpath(szPath, szDrive, szDir, NULL, NULL); - sprintf(szPath, "%s%s", szDrive, szDir); - CN3Base::PathSet(szPath); // 경로 설정.. + CN3Base::PathSet(n3std::get_app_dir().string()); } #ifdef _N3GAME diff --git a/src/server/AIServer/AIServerDlg.cpp b/src/server/AIServer/AIServerDlg.cpp index b386f049..fc423af7 100644 --- a/src/server/AIServer/AIServerDlg.cpp +++ b/src/server/AIServer/AIServerDlg.cpp @@ -207,7 +207,7 @@ BOOL CServerDlg::OnInitDialog() { logstr.Format("[AI ServerStart - %d-%d-%d, %d:%d]\r\n", time.GetYear(), time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute()); TRACE(logstr); - LogFileWrite(logstr); + n3std::log_file_write(logstr); //---------------------------------------------------------------------- // Logfile initialize @@ -1709,7 +1709,7 @@ void CServerDlg::CheckAliveTest() { if (m_sErrorSocketCount == 10) { logstr.Format("*** All Socket Closed *** %d-%d-%d, %d:%d]\r\n", time.GetYear(), time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute()); - //LogFileWrite( logstr ); + //n3std::log_file_write( logstr ); } count++; } diff --git a/src/server/AIServer/GameSocket.cpp b/src/server/AIServer/GameSocket.cpp index 598ebd43..72c2661c 100644 --- a/src/server/AIServer/GameSocket.cpp +++ b/src/server/AIServer/GameSocket.cpp @@ -55,7 +55,7 @@ void CGameSocket::CloseProcess() { CTime time = CTime::GetCurrentTime(); logstr.Format("*** CloseProcess - socketID=%d ... sSid = %d *** %d-%d-%d, %d:%d]\r\n", m_Sid, m_sSocketID, time.GetYear(), time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute()); - LogFileWrite(logstr); + n3std::log_file_write(logstr); TRACE("*** CloseProcess - socketID=%d ... sSid = %d *** \n", m_Sid, m_sSocketID); m_pMain->DeleteAllUserList(m_sSocketID); @@ -229,7 +229,7 @@ void CGameSocket::RecvUserInfo(char * pBuf) { CTime cur = CTime::GetCurrentTime(); sprintf(countstr, "RecvUserInfo() Fail : %d월 %d일 %d시 %d분 - uid=%d, name=%s\r\n", cur.GetMonth(), cur.GetDay(), cur.GetHour(), cur.GetMinute(), uid, strName); - LogFileWrite(countstr); + n3std::log_file_write(countstr); TRACE("### RecvUserInfo() Fail ---> uid = %d, name=%s ### \n", uid, strName); return; } @@ -1103,4 +1103,4 @@ void CGameSocket::RecvBattleEvent(char * pBuf) { } } } -} \ No newline at end of file +} diff --git a/src/server/AIServer/IOCPort.cpp b/src/server/AIServer/IOCPort.cpp index 70613d1e..5e6b3bbc 100644 --- a/src/server/AIServer/IOCPort.cpp +++ b/src/server/AIServer/IOCPort.cpp @@ -57,7 +57,7 @@ DWORD WINAPI AcceptThread(LPVOID lp) { if (!pSocket) { TRACE("Socket Array has Broken...\n"); sprintf(logstr, "Socket Array has Broken...[sid:%d]\r\n", sid); - LogFileWrite(logstr); + n3std::log_file_write(logstr); // pIocport->PutOldSid( sid ); // Invalid sid must forbidden to use goto loop_pass_accept; } @@ -688,4 +688,4 @@ void CIOCPort::CreateSendThread() { //} } -// ~sungyong 2002.05.22 \ No newline at end of file +// ~sungyong 2002.05.22 diff --git a/src/server/AIServer/Ini.cpp b/src/server/AIServer/Ini.cpp index df11a2b0..78fdc23d 100644 --- a/src/server/AIServer/Ini.cpp +++ b/src/server/AIServer/Ini.cpp @@ -54,18 +54,8 @@ const char * CIni::GetProfileString(const char * lpAppName, const char * lpKeyNa } bool CIni::SetPath(const char * filename) { - char Buf[256], Path[256]; - char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT]; - - ::GetModuleFileName(AfxGetApp()->m_hInstance, Buf, 256); - _splitpath(Buf, drive, dir, fname, ext); - strcpy(Path, drive); - strcat(Path, dir); - char IniPath[256] = ""; - strcpy(IniPath, Path); - wsprintf(IniPath, "%s%s", IniPath, filename); - //IniPath += filename; - strcpy(m_szFileName, (LPCTSTR)IniPath); + fs::path fsIniPath = n3std::get_app_dir() / filename; + std::snprintf(m_szFileName, sizeof(m_szFileName), fsIniPath.string().c_str()); return true; } diff --git a/src/server/AIServer/Npc.cpp b/src/server/AIServer/Npc.cpp index e832b1ee..10bb0b24 100644 --- a/src/server/AIServer/Npc.cpp +++ b/src/server/AIServer/Npc.cpp @@ -5559,7 +5559,7 @@ void CNpc::GiveNpcHaveItem(CIOCPort * pIOCP) { EnterCriticalSection(&g_LogFileWrite); m_pMain->m_ItemLogFile.Write(string, string.GetLength()); LeaveCriticalSection(&g_LogFileWrite); - //LogFileWrite( logfile ); + //n3std::log_file_write( logfile ); } //TRACE("Npc-GiveNpcHaveItem() : [nid - %d,%s, giveme=%d, count=%d, num=%d], list=%d, count=%d\n", m_sNid+NPC_BAND, m_strName, m_sMaxDamageUserid, nCount, i, m_GiveItemList[i].sSid, m_GiveItemList[i].count); } @@ -6672,4 +6672,4 @@ BOOL CNpc::Teleport(CIOCPort * pIOCP) { SetUid(m_fCurX, m_fCurZ, m_sNid + NPC_BAND); return TRUE; -} \ No newline at end of file +} diff --git a/src/server/AIServer/global.cpp b/src/server/AIServer/global.cpp index 78f0ff83..6247aba8 100644 --- a/src/server/AIServer/global.cpp +++ b/src/server/AIServer/global.cpp @@ -117,18 +117,6 @@ int ParseSpace(char * tBuf, char * sBuf) { return index; } -CString GetProgPath() { - char Buf[256], Path[256]; - char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT]; - - ::GetModuleFileName(AfxGetApp()->m_hInstance, Buf, 256); - _splitpath(Buf, drive, dir, fname, ext); - strcpy(Path, drive); - strcat(Path, dir); - CString _Path = Path; - return _Path; -} - int myrand(int min, int max, BOOL bSame) { static int nOld = 0; int nRet = 0; @@ -243,27 +231,10 @@ BOOL CheckMaxValueReturn(DWORD & dest, DWORD add) { } } -void LogFileWrite(CString logstr) { - CString ProgPath, LogFileName; - CFile file; - int loglength; - - ProgPath = GetProgPath(); - loglength = logstr.GetLength(); - - LogFileName.Format("%s\\AIServer.log", ProgPath); - - file.Open(LogFileName, CFile::modeCreate | CFile::modeNoTruncate | CFile::modeWrite); - - file.SeekToEnd(); - file.Write(logstr, loglength); - file.Close(); -} - void TimeTrace(TCHAR * pMsg) { CString szMsg = _T(""); CTime time = CTime::GetCurrentTime(); szMsg.Format("%s,, time : %d-%d-%d, %d:%d]\n", pMsg, time.GetYear(), time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute()); TRACE(szMsg); -} \ No newline at end of file +} diff --git a/src/server/AIServer/global.h b/src/server/AIServer/global.h index 02b13c4f..0e54345d 100644 --- a/src/server/AIServer/global.h +++ b/src/server/AIServer/global.h @@ -2,28 +2,26 @@ //#include "StdAfx.h" -BOOL CheckGetVarString(int nLength, TCHAR * tBuf, TCHAR * sBuf, int nSize, int & index); -int GetVarString(TCHAR * tBuf, TCHAR * sBuf, int nSize, int & index); -void GetString(char * tBuf, char * sBuf, int len, int & index); -BYTE GetByte(char * sBuf, int & index); -int GetShort(char * sBuf, int & index); -int GetInt(char * sBuf, int & index); -DWORD GetDWORD(char * sBuf, int & index); -float Getfloat(char * sBuf, int & index); -void SetString(char * tBuf, char * sBuf, int len, int & index); -void SetVarString(TCHAR * tBuf, TCHAR * sBuf, int len, int & index); -void SetByte(char * tBuf, BYTE sByte, int & index); -void SetShort(char * tBuf, int sShort, int & index); -void SetInt(char * tBuf, int sInt, int & index); -void SetDWORD(char * tBuf, DWORD sDword, int & index); -void Setfloat(char * tBuf, float sFloat, int & index); -int ParseSpace(char * tBuf, char * sBuf); -CString GetProgPath(); -void LogFileWrite(CString logstr); -int myrand(int min, int max, BOOL bSame = FALSE); -int XdY(int x, int y); -void SpaceCopy(LPSTR source, CString dest, int size); -void SpaceCopy(CString & source, CString dest, int size); +BOOL CheckGetVarString(int nLength, TCHAR * tBuf, TCHAR * sBuf, int nSize, int & index); +int GetVarString(TCHAR * tBuf, TCHAR * sBuf, int nSize, int & index); +void GetString(char * tBuf, char * sBuf, int len, int & index); +BYTE GetByte(char * sBuf, int & index); +int GetShort(char * sBuf, int & index); +int GetInt(char * sBuf, int & index); +DWORD GetDWORD(char * sBuf, int & index); +float Getfloat(char * sBuf, int & index); +void SetString(char * tBuf, char * sBuf, int len, int & index); +void SetVarString(TCHAR * tBuf, TCHAR * sBuf, int len, int & index); +void SetByte(char * tBuf, BYTE sByte, int & index); +void SetShort(char * tBuf, int sShort, int & index); +void SetInt(char * tBuf, int sInt, int & index); +void SetDWORD(char * tBuf, DWORD sDword, int & index); +void Setfloat(char * tBuf, float sFloat, int & index); +int ParseSpace(char * tBuf, char * sBuf); +int myrand(int min, int max, BOOL bSame = FALSE); +int XdY(int x, int y); +void SpaceCopy(LPSTR source, CString dest, int size); +void SpaceCopy(CString & source, CString dest, int size); void CheckMaxValue(DWORD & dest, DWORD add); void CheckMaxValue(int & dest, int add); diff --git a/src/server/Aujard/AujardDlg.cpp b/src/server/Aujard/AujardDlg.cpp index 4262083e..129a9612 100644 --- a/src/server/Aujard/AujardDlg.cpp +++ b/src/server/Aujard/AujardDlg.cpp @@ -173,8 +173,8 @@ BOOL CAujardDlg::OnInitDialog() { return FALSE; } - CString inipath; - inipath.Format("%s\\Aujard.ini", GetProgPath()); + std::string szIniPath = (n3std::get_app_dir() / "Aujard.ini").string(); + const char * inipath = szIniPath.c_str(); GetPrivateProfileString("ODBC", "ACCOUNT_DSN", "kodb", m_szOdbcAccountDsn, sizeof(m_szOdbcAccountDsn), inipath); GetPrivateProfileString("ODBC", "ACCOUNT_UID", "kodb_user", m_szOdbcAccountUid, sizeof(m_szOdbcAccountUid), diff --git a/src/server/Aujard/Define.h b/src/server/Aujard/Define.h index b5d25c22..a2fad0d6 100644 --- a/src/server/Aujard/Define.h +++ b/src/server/Aujard/Define.h @@ -379,35 +379,6 @@ inline int ParseSpace(char * tBuf, char * sBuf) { return index; }; -inline CString GetProgPath() { - char Buf[256], Path[256]; - char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT]; - - ::GetModuleFileName(AfxGetApp()->m_hInstance, Buf, 256); - _splitpath(Buf, drive, dir, fname, ext); - strcpy(Path, drive); - strcat(Path, dir); - CString _Path = Path; - return _Path; -}; - -inline void LogFileWrite(LPCTSTR logstr) { - CString ProgPath, LogFileName; - CFile file; - int loglength; - - ProgPath = GetProgPath(); - loglength = strlen(logstr); - - LogFileName.Format("%s\\Aujard.log", ProgPath); - - file.Open(LogFileName, CFile::modeCreate | CFile::modeNoTruncate | CFile::modeWrite); - - file.SeekToEnd(); - file.Write(logstr, loglength); - file.Close(); -}; - inline int DisplayErrorMsg(SQLHANDLE hstmt) { SQLCHAR SqlState[6], Msg[1024]; SQLINTEGER NativeError; @@ -420,7 +391,7 @@ inline int DisplayErrorMsg(SQLHANDLE hstmt) { while ((rc2 = SQLGetDiagRec(SQL_HANDLE_STMT, hstmt, i, SqlState, &NativeError, Msg, sizeof(Msg), &MsgLen)) != SQL_NO_DATA) { sprintf(logstr, "*** %s, %d, %s, %d ***\r\n", SqlState, NativeError, Msg, MsgLen); - LogFileWrite(logstr); + n3std::log_file_write(logstr); i++; } diff --git a/src/server/Aujard/Global.cpp b/src/server/Aujard/Global.cpp index 37d35b7c..0be7f3fc 100644 --- a/src/server/Aujard/Global.cpp +++ b/src/server/Aujard/Global.cpp @@ -76,37 +76,6 @@ int ParseSpace(char * tBuf, char * sBuf) { return index; } -void GetProgPath(char * path) { - char Buf[256], Path[256]; - char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT]; - - ::GetModuleFileName(AfxGetApp()->m_hInstance, Buf, 256); - _splitpath(Buf, drive, dir, fname, ext); - strcpy(Path, drive); - strcat(Path, dir); - - strcpy(path, Path); -} - -void LogFileWrite(LPCSTR logstr) { - char ProgPath[256], LogFileName[256]; - memset(ProgPath, 0x00, 256); - memset(LogFileName, 0x00, 256); - CFile file; - int loglength; - - GetProgPath(ProgPath); - loglength = strlen(logstr); - - sprintf(LogFileName, "%s\\Aujard.log", ProgPath); - - file.Open(LogFileName, CFile::modeCreate | CFile::modeNoTruncate | CFile::modeWrite); - - file.SeekToEnd(); - file.Write(logstr, loglength); - file.Close(); -} - void DisplayErrorMsg(SQLHANDLE hstmt) { SQLCHAR SqlState[6], Msg[1024]; SQLINTEGER NativeError; @@ -119,7 +88,7 @@ void DisplayErrorMsg(SQLHANDLE hstmt) { while ((rc2 = SQLGetDiagRec(SQL_HANDLE_STMT, hstmt, i, SqlState, &NativeError, Msg, sizeof(Msg), &MsgLen)) != SQL_NO_DATA) { sprintf(logstr, "*** %s, %d, %s, %d ***\r\n", SqlState, NativeError, Msg, MsgLen); - LogFileWrite(logstr); + n3std::log_file_write(logstr); // TRACE("*** %s, %d, %s, %d ***\n", SqlState,NativeError,Msg,MsgLen); i++; diff --git a/src/server/Aujard/SharedMem.cpp b/src/server/Aujard/SharedMem.cpp index 15aea5fa..5cc054da 100644 --- a/src/server/Aujard/SharedMem.cpp +++ b/src/server/Aujard/SharedMem.cpp @@ -55,7 +55,7 @@ BOOL CSharedMemQueue::InitailizeMMF(DWORD dwOffsetsize, int maxcount, LPCTSTR lp if (m_hMMFile == NULL) { strcpy(logstr, "Shared Memory Open Fail!!\r\n"); - LogFileWrite(logstr); + n3std::log_file_write(logstr); return FALSE; } @@ -88,7 +88,7 @@ int CSharedMemQueue::PutData(char * pBuf, int size) { if (size > m_wOffset) { sprintf(logstr, "DataSize Over.. - %d bytes\r\n", size); - LogFileWrite(logstr); + n3std::log_file_write(logstr); return SMQ_PKTSIZEOVER; } diff --git a/src/server/Ebenezer/AISocket.cpp b/src/server/Ebenezer/AISocket.cpp index 6c4ebc89..8dd68312 100644 --- a/src/server/Ebenezer/AISocket.cpp +++ b/src/server/Ebenezer/AISocket.cpp @@ -116,7 +116,7 @@ void CAISocket::CloseProcess() { CTime time = CTime::GetCurrentTime(); logstr.Format("*** CloseProcess - socketID=%d... *** %d-%d-%d, %d:%d]\r\n", m_Sid, time.GetYear(), time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute()); - LogFileWrite(logstr); + n3std::log_file_write(logstr); Initialize(); @@ -1530,4 +1530,4 @@ void CAISocket::RecvGateOpen(char * pBuf) { m_pMain->Send_Region(send_buff, send_index, pNpc->m_sCurZone, pNpc->m_sRegion_X, pNpc->m_sRegion_Z, NULL, false); } -} \ No newline at end of file +} diff --git a/src/server/Ebenezer/Define.h b/src/server/Ebenezer/Define.h index 11d3907d..ee8e9211 100644 --- a/src/server/Ebenezer/Define.h +++ b/src/server/Ebenezer/Define.h @@ -439,35 +439,6 @@ inline int ParseSpace(char * tBuf, char * sBuf) { return index; }; -inline CString GetProgPath() { - char Buf[256], Path[256]; - char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT]; - - ::GetModuleFileName(AfxGetApp()->m_hInstance, Buf, 256); - _splitpath(Buf, drive, dir, fname, ext); - strcpy(Path, drive); - strcat(Path, dir); - CString _Path = Path; - return _Path; -}; - -inline void LogFileWrite(LPCTSTR logstr) { - CString ProgPath, LogFileName; - CFile file; - int loglength; - - ProgPath = GetProgPath(); - loglength = strlen(logstr); - - LogFileName.Format("%s\\Ebenezer.log", ProgPath); - - file.Open(LogFileName, CFile::modeCreate | CFile::modeNoTruncate | CFile::modeWrite); - - file.SeekToEnd(); - file.Write(logstr, loglength); - file.Close(); -}; - inline void DisplayErrorMsg(SQLHANDLE hstmt) { SQLCHAR SqlState[6], Msg[1024]; SQLINTEGER NativeError; diff --git a/src/server/Ebenezer/EbenezerDlg.cpp b/src/server/Ebenezer/EbenezerDlg.cpp index 682059bc..0930b49a 100644 --- a/src/server/Ebenezer/EbenezerDlg.cpp +++ b/src/server/Ebenezer/EbenezerDlg.cpp @@ -379,101 +379,101 @@ BOOL CEbenezerDlg::OnInitDialog() { return FALSE; } - LogFileWrite("before item\r\n"); + n3std::log_file_write("before item\r\n"); if (LoadItemTable() == FALSE) { AfxMessageBox("ItemTable Load Fail"); AfxPostQuitMessage(0); return FALSE; } - LogFileWrite("before main\r\n"); + n3std::log_file_write("before main\r\n"); if (LoadMagicTable() == FALSE) { AfxMessageBox("MagicTable Load Fail"); AfxPostQuitMessage(0); return FALSE; } - LogFileWrite("before 1\r\n"); + n3std::log_file_write("before 1\r\n"); if (LoadMagicType1() == FALSE) { AfxMessageBox("MagicType1 Load Fail"); AfxPostQuitMessage(0); return FALSE; } - LogFileWrite("before 2\r\n"); + n3std::log_file_write("before 2\r\n"); if (LoadMagicType2() == FALSE) { AfxMessageBox("MagicType2 Load Fail"); AfxPostQuitMessage(0); return FALSE; } - LogFileWrite("before 3\r\n"); + n3std::log_file_write("before 3\r\n"); if (LoadMagicType3() == FALSE) { AfxMessageBox("MagicType3 Load Fail"); AfxPostQuitMessage(0); return FALSE; } - LogFileWrite("before 4\r\n"); + n3std::log_file_write("before 4\r\n"); if (LoadMagicType4() == FALSE) { AfxMessageBox("MagicType4 Load Fail"); AfxPostQuitMessage(0); return FALSE; } - LogFileWrite("before 5\r\n"); + n3std::log_file_write("before 5\r\n"); if (LoadMagicType5() == FALSE) { AfxMessageBox("MagicType5 Load Fail"); AfxPostQuitMessage(0); return FALSE; } - LogFileWrite("before 8\r\n"); + n3std::log_file_write("before 8\r\n"); if (LoadMagicType8() == FALSE) { AfxMessageBox("MagicType8 Load Fail"); AfxPostQuitMessage(0); return FALSE; } - LogFileWrite("before Coeffi\r\n"); + n3std::log_file_write("before Coeffi\r\n"); if (LoadCoefficientTable() == FALSE) { AfxMessageBox("CharaterDataTable Load Fail"); AfxPostQuitMessage(0); return FALSE; } - LogFileWrite("before Level\r\n"); + n3std::log_file_write("before Level\r\n"); if (LoadLevelUpTable() == FALSE) { AfxMessageBox("LevelUpTable Load Fail"); AfxPostQuitMessage(0); return FALSE; } - LogFileWrite("before All Kinghts\r\n"); + n3std::log_file_write("before All Kinghts\r\n"); if (LoadAllKnights() == FALSE) { AfxMessageBox("KnightsData Load Fail"); AfxPostQuitMessage(0); return FALSE; } - LogFileWrite("before All Knights User\r\n"); + n3std::log_file_write("before All Knights User\r\n"); if (LoadAllKnightsUserData() == FALSE) { AfxMessageBox("LoadAllKnightsUserData Load Fail"); AfxPostQuitMessage(0); return FALSE; } - LogFileWrite("before home\r\n"); + n3std::log_file_write("before home\r\n"); if (LoadHomeTable() == FALSE) { AfxMessageBox("LoadHomeTable Load Fail"); AfxPostQuitMessage(0); return FALSE; } - LogFileWrite("before battle\r\n"); + n3std::log_file_write("before battle\r\n"); if (LoadBattleTable() == FALSE) { AfxMessageBox("LoadBattleTable Load Fail"); AfxPostQuitMessage(0); return FALSE; } - LogFileWrite("before map file\r\n"); + n3std::log_file_write("before map file\r\n"); if (!MapFileLoad()) { AfxPostQuitMessage(0); } - LogFileWrite("after map file\r\n"); + n3std::log_file_write("after map file\r\n"); LoadNoticeData(); @@ -495,14 +495,14 @@ BOOL CEbenezerDlg::OnInitDialog() { #endif } - LogFileWrite("success\r\n"); + n3std::log_file_write("success\r\n"); UserAcceptThread(); //CTime cur = CTime::GetCurrentTime(); CString starttime; starttime.Format("Game Server Start : %d월 %d일 %d시 %d분\r\n", cur.GetMonth(), cur.GetDay(), cur.GetHour(), cur.GetMinute()); - LogFileWrite((char *)(LPCTSTR)starttime); + n3std::log_file_write((char *)(LPCTSTR)starttime); m_StatusList.AddString(starttime); return TRUE; // return TRUE unless you set the focus to a control @@ -1122,7 +1122,7 @@ BOOL CEbenezerDlg::MapFileLoad() { sZoneName = ZoneInfoSet.m_strZoneName; szFullPath.Format(".\\Ebenezer_MAP\\%s", sZoneName); - LogFileWrite("mapfile load\r\n"); + n3std::log_file_write("mapfile load\r\n"); if (!file.Open(szFullPath, CFile::modeRead)) { errormsg.Format("File Open Fail - %s\n", szFullPath); AfxMessageBox(errormsg); @@ -1148,7 +1148,7 @@ BOOL CEbenezerDlg::MapFileLoad() { m_ZoneArray.push_back(pMap); // 스트립트를 읽어 들인다. - LogFileWrite("before script\r\n"); + n3std::log_file_write("before script\r\n"); pEvent = new EVENT; if (!pEvent->LoadEvent(ZoneInfoSet.m_ZoneNo)) { @@ -3737,7 +3737,7 @@ void CEbenezerDlg::WritePacketLog() { CString starttime; starttime.Format("* Packet Check : send=%d, realsend=%d, recv=%d, time %d:%d분\r\n", m_iPacketCount, m_iSendPacketCount, m_iRecvPacketCount, cur.GetHour(), cur.GetMinute()); - LogFileWrite((char *)(LPCTSTR)starttime); + n3std::log_file_write((char *)(LPCTSTR)starttime); } int CEbenezerDlg::GetKnightsGrade(int nPoints) { @@ -3775,7 +3775,7 @@ void CEbenezerDlg::CheckAliveUser() { char logstr[1024]; memset(logstr, NULL, 1024); sprintf(logstr, "User Alive Close - (%d) %s\r\n", pUser->GetSocketID(), pUser->m_pUserData->m_id); - LogFileWrite(logstr); + n3std::log_file_write(logstr); } pUser->m_sAliveCount++; } diff --git a/src/server/Ebenezer/Global.cpp b/src/server/Ebenezer/Global.cpp index d986f75a..9d5617c5 100644 --- a/src/server/Ebenezer/Global.cpp +++ b/src/server/Ebenezer/Global.cpp @@ -116,35 +116,6 @@ int ParseSpace(char * tBuf, char * sBuf) { return index; } -CString GetProgPath() { - char Buf[256], Path[256]; - char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT]; - - ::GetModuleFileName(AfxGetApp()->m_hInstance, Buf, 256); - _splitpath(Buf, drive, dir, fname, ext); - strcpy(Path, drive); - strcat(Path, dir); - CString _Path = Path; - return _Path; -} - -void LogFileWrite(LPCTSTR logstr) { - CString ProgPath, LogFileName; - CFile file; - int loglength; - - ProgPath = GetProgPath(); - loglength = strlen(logstr); - - LogFileName.Format("%s\\Ebenezer.log", ProgPath); - - file.Open(LogFileName, CFile::modeCreate | CFile::modeNoTruncate | CFile::modeWrite); - - file.SeekToEnd(); - file.Write(logstr, loglength); - file.Close(); -} - void DisplayErrorMsg(SQLHANDLE hstmt) { SQLCHAR SqlState[6], Msg[1024]; SQLINTEGER NativeError; diff --git a/src/server/Ebenezer/IOCPSocket2.cpp b/src/server/Ebenezer/IOCPSocket2.cpp index 30194eef..237a19bf 100644 --- a/src/server/Ebenezer/IOCPSocket2.cpp +++ b/src/server/Ebenezer/IOCPSocket2.cpp @@ -198,7 +198,7 @@ int CIOCPSocket2::Send(char * pBuf, long length, int dwFlag) { TRACE("SEND : ERROR [SID=%d] - %d\n", m_Sid, last_err); // char logstr[1024]; memset( logstr, NULL, 1024 ); // sprintf( logstr, "SEND : ERROR [SID=%d] - %d\r\n", m_Sid, last_err); - // LogFileWrite( logstr ); + // n3std::log_file_write( logstr ); m_nSocketErr++; goto close_routine; } @@ -518,7 +518,7 @@ BOOL CIOCPSocket2::Accept(SOCKET listensocket, struct sockaddr * addr, int * len char logstr[1024]; memset(logstr, NULL, 1024); sprintf(logstr, "Socket Accepting Fail - %d\r\n", err); - LogFileWrite(logstr); + n3std::log_file_write(logstr); return FALSE; } @@ -661,4 +661,4 @@ void CIOCPSocket2::SendCryptionKey() { m_CryptionFlag = 1; } -///~ \ No newline at end of file +///~ diff --git a/src/server/Ebenezer/IOCPort.cpp b/src/server/Ebenezer/IOCPort.cpp index e00c6239..f96c211a 100644 --- a/src/server/Ebenezer/IOCPort.cpp +++ b/src/server/Ebenezer/IOCPort.cpp @@ -42,7 +42,7 @@ DWORD WINAPI AcceptThread(LPVOID lp) { char logstr[1024]; memset(logstr, NULL, 1024); sprintf(logstr, "Wait failed Error %d\r\n", GetLastError()); - LogFileWrite(logstr); + n3std::log_file_write(logstr); return 1; } @@ -59,7 +59,7 @@ DWORD WINAPI AcceptThread(LPVOID lp) { char logstr[1024]; memset(logstr, NULL, 1024); sprintf(logstr, "Accepting User Socket Fail - New Uid is -1\r\n"); - LogFileWrite(logstr); + n3std::log_file_write(logstr); goto loop_pass_accept; } @@ -69,7 +69,7 @@ DWORD WINAPI AcceptThread(LPVOID lp) { char logstr[1024]; memset(logstr, NULL, 1024); sprintf(logstr, "Socket Array has Broken...\r\n"); - LogFileWrite(logstr); + n3std::log_file_write(logstr); // pIocport->PutOldSid( sid ); // Invalid sid must forbidden to use goto loop_pass_accept; } @@ -80,7 +80,7 @@ DWORD WINAPI AcceptThread(LPVOID lp) { char logstr[1024]; memset(logstr, NULL, 1024); sprintf(logstr, "Accept Fail %d\r\n", sid); - LogFileWrite(logstr); + n3std::log_file_write(logstr); EnterCriticalSection(&g_critical); pIocport->RidIOCPSocket(sid, pSocket); @@ -96,7 +96,7 @@ DWORD WINAPI AcceptThread(LPVOID lp) { char logstr[1024]; memset(logstr, NULL, 1024); sprintf(logstr, "Socket Associate Fail\r\n"); - LogFileWrite(logstr); + n3std::log_file_write(logstr); EnterCriticalSection(&g_critical); pSocket->CloseProcess(); diff --git a/src/server/Ebenezer/Ini.cpp b/src/server/Ebenezer/Ini.cpp index df11a2b0..78fdc23d 100644 --- a/src/server/Ebenezer/Ini.cpp +++ b/src/server/Ebenezer/Ini.cpp @@ -54,18 +54,8 @@ const char * CIni::GetProfileString(const char * lpAppName, const char * lpKeyNa } bool CIni::SetPath(const char * filename) { - char Buf[256], Path[256]; - char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT]; - - ::GetModuleFileName(AfxGetApp()->m_hInstance, Buf, 256); - _splitpath(Buf, drive, dir, fname, ext); - strcpy(Path, drive); - strcat(Path, dir); - char IniPath[256] = ""; - strcpy(IniPath, Path); - wsprintf(IniPath, "%s%s", IniPath, filename); - //IniPath += filename; - strcpy(m_szFileName, (LPCTSTR)IniPath); + fs::path fsIniPath = n3std::get_app_dir() / filename; + std::snprintf(m_szFileName, sizeof(m_szFileName), fsIniPath.string().c_str()); return true; } diff --git a/src/server/Ebenezer/Map.cpp b/src/server/Ebenezer/Map.cpp index 58b7852c..6e97ee96 100644 --- a/src/server/Ebenezer/Map.cpp +++ b/src/server/Ebenezer/Map.cpp @@ -86,7 +86,7 @@ C3DMap::~C3DMap() { BOOL C3DMap::LoadMap(HANDLE hFile) { m_pMain = (CEbenezerDlg *)AfxGetApp()->GetMainWnd(); - LogFileWrite("load teerr\r\n"); + n3std::log_file_write("load teerr\r\n"); LoadTerrain(hFile); m_N3ShapeMgr.Create((m_nMapSize - 1) * m_fUnitDist, (m_nMapSize - 1) * m_fUnitDist); @@ -99,7 +99,7 @@ BOOL C3DMap::LoadMap(HANDLE hFile) { return FALSE; } - LogFileWrite("mapfile adfasfdasdd\r\n"); + n3std::log_file_write("mapfile adfasfdasdd\r\n"); int mapwidth = (int)m_N3ShapeMgr.Width(); m_nXRegion = (int)(mapwidth / VIEW_DISTANCE) + 1; @@ -111,14 +111,14 @@ BOOL C3DMap::LoadMap(HANDLE hFile) { } LoadObjectEvent(hFile); - LogFileWrite("amp tile\r\n"); + n3std::log_file_write("amp tile\r\n"); LoadMapTile(hFile); - LogFileWrite("regene\r\n"); + n3std::log_file_write("regene\r\n"); LoadRegeneEvent(hFile); // 이건 내가 추가했슴 - LogFileWrite("warplist\r\n"); + n3std::log_file_write("warplist\r\n"); LoadWarpList(hFile); - LogFileWrite("load event before\r\n"); + n3std::log_file_write("load event before\r\n"); if (!LoadEvent()) { AfxMessageBox("Event Load Fail!!"); return FALSE; @@ -521,15 +521,15 @@ BOOL C3DMap::LoadEvent() { CEventSet EventSet; CGameEvent * pEvent = NULL; - LogFileWrite("LoadEvent start \r\n"); + n3std::log_file_write("LoadEvent start \r\n"); if (!EventSet.Open()) { - LogFileWrite("LoadEvent 22 \r\n"); + n3std::log_file_write("LoadEvent 22 \r\n"); AfxMessageBox(_T("EventTable Open Fail!")); return FALSE; } if (EventSet.IsBOF() || EventSet.IsEOF()) { - LogFileWrite("LoadEvent 33 \r\n"); + n3std::log_file_write("LoadEvent 33 \r\n"); AfxMessageBox(_T("EventTable Empty!")); return FALSE; } @@ -568,7 +568,7 @@ BOOL C3DMap::LoadEvent() { EventSet.MoveNext(); } - LogFileWrite("LoadEvent 44 \r\n"); + n3std::log_file_write("LoadEvent 44 \r\n"); return TRUE; } diff --git a/src/server/Ebenezer/SharedMem.cpp b/src/server/Ebenezer/SharedMem.cpp index 56de60c1..b1b45905 100644 --- a/src/server/Ebenezer/SharedMem.cpp +++ b/src/server/Ebenezer/SharedMem.cpp @@ -55,7 +55,7 @@ BOOL CSharedMemQueue::InitailizeMMF(DWORD dwOffsetsize, int maxcount, LPCTSTR lp if (m_hMMFile == NULL) { strcpy(logstr, "Shared Memory Open Fail!!\r\n"); - LogFileWrite(logstr); + n3std::log_file_write(logstr); return FALSE; } @@ -88,7 +88,7 @@ int CSharedMemQueue::PutData(char * pBuf, int size) { if (size > m_wOffset) { sprintf(logstr, "DataSize Over.. - %d bytes\r\n", size); - LogFileWrite(logstr); + n3std::log_file_write(logstr); return SMQ_PKTSIZEOVER; } @@ -169,7 +169,7 @@ int CSharedMemQueue::GetData(char * pBuf) { char logstr[256]; memset(logstr, 0x00, 256); sprintf(logstr, "SMQ EMPTY Block Find - F:%d, R:%d\n", m_pHeader->Front, m_pHeader->Rear); - LogFileWrite(logstr); + n3std::log_file_write(logstr); TRACE(logstr); } return SMQ_EMPTY; diff --git a/src/server/Ebenezer/User.cpp b/src/server/Ebenezer/User.cpp index 9fc43a83..4678006f 100644 --- a/src/server/Ebenezer/User.cpp +++ b/src/server/Ebenezer/User.cpp @@ -5197,7 +5197,7 @@ void CUser::SpeedHackUser() { char logstr[256]; memset(logstr, NULL, 256); sprintf(logstr, "%s Speed Hack Used\r\n", m_pUserData->m_id); - LogFileWrite(logstr); + n3std::log_file_write(logstr); if (m_pUserData->m_bAuthority != 0) { m_pUserData->m_bAuthority = -1; @@ -7547,7 +7547,7 @@ void CUser::SpeedHackTime(char * pBuf) { char logstr[256]; memset(logstr, NULL, 256); sprintf(logstr, "%s SpeedHack User Checked By Server Time\r\n", m_pUserData->m_id); - LogFileWrite(logstr); + n3std::log_file_write(logstr); Close(); } else if (client_gap - server_gap < 0.0f) { @@ -7565,7 +7565,7 @@ void CUser::SpeedHackTime(char * pBuf) { char logstr[256]; memset( logstr, NULL, 256 ); sprintf( logstr, "%s SpeedHack User Checked By Server Time\r\n", m_pUserData->m_id); - LogFileWrite( logstr ); + n3std::log_file_write( logstr ); // if( m_pUserData->m_bAuthority != 0 ) // m_pUserData->m_bAuthority = -1; @@ -7989,7 +7989,7 @@ void CUser::ReportBug(char * pBuf) { return; } sprintf(logstr, "%s -> ERROR : %s\r\n", m_pUserData->m_id, chatstr); - LogFileWrite(logstr); + n3std::log_file_write(logstr); } void CUser::Home() { @@ -10102,7 +10102,7 @@ void CUser::SetLogInInfoToDB(BYTE bInit) { if (!pInfo) { CString logstr; logstr.Format("%d Server Info Invalid User Closed...\r\n", m_pMain->m_nServerNo); - LogFileWrite(logstr); + n3std::log_file_write(logstr); Close(); } diff --git a/src/server/ItemManager/Define.h b/src/server/ItemManager/Define.h index 8ff661a5..f88b9c98 100644 --- a/src/server/ItemManager/Define.h +++ b/src/server/ItemManager/Define.h @@ -210,36 +210,6 @@ inline int ParseSpace(char * tBuf, char * sBuf) { } return index; }; - -inline CString GetProgPath() { - char Buf[256], Path[256]; - char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT]; - - ::GetModuleFileName(AfxGetApp()->m_hInstance, Buf, 256); - _splitpath(Buf, drive, dir, fname, ext); - strcpy(Path, drive); - strcat(Path, dir); - CString _Path = Path; - return _Path; -}; - -inline void LogFileWrite(LPCTSTR logstr) { - CString ProgPath, LogFileName; - CFile file; - int loglength; - - ProgPath = GetProgPath(); - loglength = strlen(logstr); - - LogFileName.Format("%s\\Aujard.log", ProgPath); - - file.Open(LogFileName, CFile::modeCreate | CFile::modeNoTruncate | CFile::modeWrite); - - file.SeekToEnd(); - file.Write(logstr, loglength); - file.Close(); -}; - inline int DisplayErrorMsg(SQLHANDLE hstmt) { SQLCHAR SqlState[6], Msg[1024]; SQLINTEGER NativeError; @@ -252,7 +222,7 @@ inline int DisplayErrorMsg(SQLHANDLE hstmt) { while ((rc2 = SQLGetDiagRec(SQL_HANDLE_STMT, hstmt, i, SqlState, &NativeError, Msg, sizeof(Msg), &MsgLen)) != SQL_NO_DATA) { sprintf(logstr, "*** %s, %d, %s, %d ***\r\n", SqlState, NativeError, Msg, MsgLen); - LogFileWrite(logstr); + n3std::log_file_write(logstr); i++; } diff --git a/src/server/ItemManager/ItemManagerDlg.cpp b/src/server/ItemManager/ItemManagerDlg.cpp index 94029296..040976d2 100644 --- a/src/server/ItemManager/ItemManagerDlg.cpp +++ b/src/server/ItemManager/ItemManagerDlg.cpp @@ -108,21 +108,23 @@ BOOL CItemManagerDlg::OnInitDialog() { m_nExpLogFileDay = time.GetDay(); m_LoggerRecvQueue.InitailizeMMF(MAX_PKTSIZE, MAX_COUNT, SMQ_ITEMLOGGER, FALSE); // Dispatcher 의 Send Queue - /* - CString inipath; - inipath.Format( "%s\\ItemDB.ini", GetProgPath() ); - GetPrivateProfileString( "ODBC", "GAME_DSN", "kodb", m_strGameDSN, 24, inipath ); - GetPrivateProfileString( "ODBC", "GAME_UID", "kodb_user", m_strGameUID, 24, inipath ); - GetPrivateProfileString( "ODBC", "GAME_PWD", "kodb_user", m_strGamePWD, 24, inipath ); + /* + std::string szIniPath = (n3std::get_app_path() / "ItemDB.ini").string(); + const char * inipath = szIniPath.c_str(); + + GetPrivateProfileString("ODBC", "GAME_DSN", "kodb", m_strGameDSN, 24, inipath); + GetPrivateProfileString("ODBC", "GAME_UID", "kodb_user", m_strGameUID, 24, inipath); + GetPrivateProfileString("ODBC", "GAME_PWD", "kodb_user", m_strGamePWD, 24, inipath); m_nServerNo = GetPrivateProfileInt("ZONE_INFO", "GROUP_INFO", 1, inipath); m_nZoneNo = GetPrivateProfileInt("ZONE_INFO", "ZONE_INFO", 1, inipath); - if( !m_DBAgent.DatabaseInit() ) { + if (!m_DBAgent.DatabaseInit()) { AfxPostQuitMessage(0); return FALSE; - } */ + } + */ DWORD id; m_hReadQueueThread = ::CreateThread(NULL, 0, ReadQueueThread, (LPVOID)this, 0, &id); diff --git a/src/server/ItemManager/SharedMem.cpp b/src/server/ItemManager/SharedMem.cpp index 15aea5fa..5cc054da 100644 --- a/src/server/ItemManager/SharedMem.cpp +++ b/src/server/ItemManager/SharedMem.cpp @@ -55,7 +55,7 @@ BOOL CSharedMemQueue::InitailizeMMF(DWORD dwOffsetsize, int maxcount, LPCTSTR lp if (m_hMMFile == NULL) { strcpy(logstr, "Shared Memory Open Fail!!\r\n"); - LogFileWrite(logstr); + n3std::log_file_write(logstr); return FALSE; } @@ -88,7 +88,7 @@ int CSharedMemQueue::PutData(char * pBuf, int size) { if (size > m_wOffset) { sprintf(logstr, "DataSize Over.. - %d bytes\r\n", size); - LogFileWrite(logstr); + n3std::log_file_write(logstr); return SMQ_PKTSIZEOVER; } diff --git a/src/server/LoginServer/DBProcess.cpp b/src/server/LoginServer/DBProcess.cpp index 45957a26..8e5711d2 100644 --- a/src/server/LoginServer/DBProcess.cpp +++ b/src/server/LoginServer/DBProcess.cpp @@ -40,7 +40,7 @@ void CDBProcess::ReConnectODBC(CDatabase * m_db, const char * strdb, const char CTime t = CTime::GetCurrentTime(); sprintf(strlog, "Try ReConnectODBC... %d월 %d일 %d시 %d분\r\n", t.GetMonth(), t.GetDay(), t.GetHour(), t.GetMinute()); - LogFileWrite(strlog); + n3std::log_file_write(strlog); // DATABASE 연결... CString strConnect; diff --git a/src/server/LoginServer/Define.h b/src/server/LoginServer/Define.h index 821fa679..04c9755b 100644 --- a/src/server/LoginServer/Define.h +++ b/src/server/LoginServer/Define.h @@ -184,35 +184,6 @@ inline int ParseSpace(char * tBuf, char * sBuf) { return index; }; -inline CString GetProgPath() { - char Buf[256], Path[256]; - char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT]; - - ::GetModuleFileName(AfxGetApp()->m_hInstance, Buf, 256); - _splitpath(Buf, drive, dir, fname, ext); - strcpy(Path, drive); - strcat(Path, dir); - CString _Path = Path; - return _Path; -}; - -inline void LogFileWrite(LPCTSTR logstr) { - CString ProgPath, LogFileName; - CFile file; - int loglength; - - ProgPath = GetProgPath(); - loglength = strlen(logstr); - - LogFileName.Format("%s\\Login.log", ProgPath); - - file.Open(LogFileName, CFile::modeCreate | CFile::modeNoTruncate | CFile::modeWrite); - - file.SeekToEnd(); - file.Write(logstr, loglength); - file.Close(); -}; - inline int DisplayErrorMsg(SQLHANDLE hstmt) { SQLCHAR SqlState[6], Msg[1024]; SQLINTEGER NativeError; @@ -225,7 +196,7 @@ inline int DisplayErrorMsg(SQLHANDLE hstmt) { while ((rc2 = SQLGetDiagRec(SQL_HANDLE_STMT, hstmt, i, SqlState, &NativeError, Msg, sizeof(Msg), &MsgLen)) != SQL_NO_DATA) { sprintf(logstr, "*** %s, %d, %s, %d ***\r\n", SqlState, NativeError, Msg, MsgLen); - LogFileWrite(logstr); + n3std::log_file_write(logstr); i++; } diff --git a/src/server/LoginServer/IOCPort.cpp b/src/server/LoginServer/IOCPort.cpp index 7fcb9530..aab2c3f8 100644 --- a/src/server/LoginServer/IOCPort.cpp +++ b/src/server/LoginServer/IOCPort.cpp @@ -58,7 +58,7 @@ DWORD WINAPI AcceptThread(LPVOID lp) { if (!pSocket) { TRACE("Socket Array has Broken...\n"); sprintf(logstr, "Socket Array has Broken...[sid:%d]\r\n", sid); - LogFileWrite(logstr); + n3std::log_file_write(logstr); // pIocport->PutOldSid( sid ); // Invalid sid must forbidden to use goto loop_pass_accept; } diff --git a/src/server/LoginServer/LoginServerDlg.cpp b/src/server/LoginServer/LoginServerDlg.cpp index 35233b2b..d2f707d8 100644 --- a/src/server/LoginServer/LoginServerDlg.cpp +++ b/src/server/LoginServer/LoginServerDlg.cpp @@ -107,10 +107,8 @@ BOOL CLoginServerDlg::OnInitDialog() { } BOOL CLoginServerDlg::GetInfoFromIni() { - int errorcode = 0; - CString errorstr, inipath; - - inipath.Format("%s\\Version.ini", GetProgPath()); + std::string szIniPath = (n3std::get_app_dir() / "Version.ini").string(); + const char * inipath = szIniPath.c_str(); GetPrivateProfileString("DOWNLOAD", "URL", "ftp.your-site.net", m_strFtpUrl, 256, inipath); GetPrivateProfileString("DOWNLOAD", "PATH", "/", m_strFilePath, 256, inipath); @@ -206,13 +204,12 @@ BOOL CLoginServerDlg::DestroyWindow() { } void CLoginServerDlg::OnVersionSetting() { - CString errorstr, inipath; - inipath.Format("%s\\Version.ini", GetProgPath()); + std::string szIniPath = (n3std::get_app_dir() / "Version.ini").string(); CSettingDlg setdlg(m_nLastVersion, this); strcpy(setdlg.m_strDefaultPath, m_strDefaultPath); if (setdlg.DoModal() == IDOK) { strcpy(m_strDefaultPath, setdlg.m_strDefaultPath); - WritePrivateProfileString("CONFIGURATION", "DEFAULT_PATH", m_strDefaultPath, inipath); + WritePrivateProfileString("CONFIGURATION", "DEFAULT_PATH", m_strDefaultPath, szIniPath.c_str()); } } diff --git a/src/tool/Launcher/LauncherDlg.cpp b/src/tool/Launcher/LauncherDlg.cpp index 934c399a..0ef6b5e7 100644 --- a/src/tool/Launcher/LauncherDlg.cpp +++ b/src/tool/Launcher/LauncherDlg.cpp @@ -184,18 +184,6 @@ BOOL CLauncherDlg::DestroyWindow() { return CDialog::DestroyWindow(); } -CString CLauncherDlg::GetProgPath() { - char Buf[256], Path[256]; - char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT]; - - ::GetModuleFileName(AfxGetApp()->m_hInstance, Buf, 256); - _splitpath(Buf, drive, dir, fname, ext); - strcpy(Path, drive); - strcat(Path, dir); - CString _Path = Path; - return _Path; -} - void CLauncherDlg::PacketSend_VersionReq() { int iOffset = 0; BYTE byBuffs[128]; @@ -288,22 +276,11 @@ void CLauncherDlg::PacketReceive_Version(const BYTE * pBuf, int & iIndex) { } void CLauncherDlg::StartGame() { - CString szCmd = GetCommandLine(); // 커맨드 라인을 가져오고.. - char szApp[_MAX_PATH] = ""; - GetModuleFileName(NULL, szApp, _MAX_PATH); - int iML = lstrlen(szApp); - - CString szParam; - if (iML >= 0) { - int ii = szCmd.Find(szApp); - if (ii >= 0 && szCmd.GetLength() > ii + iML + 2) { - szParam = szCmd.Mid(ii + iML + 2); - } - } - - std::string szExeFN = m_szInstalledPath + "\\" + m_szExeName; // 실행 파일 이름 만들고.. - ::ShellExecute(NULL, "open", szExeFN.c_str(), szParam, m_szInstalledPath.c_str(), SW_SHOWNORMAL); // 게임 실행.. - + std::string szCmd = GetCommandLine(); + std::string szAppPath = n3std::get_app_path().string(); + std::string szArgs = szCmd.find(szAppPath) != std::string::npos ? szCmd.substr(szAppPath.length() + 2) : ""; + std::string szExePath = (fs::path(m_szInstalledPath) / m_szExeName).string(); + ::ShellExecute(NULL, "open", szExePath.c_str(), szArgs.c_str(), m_szInstalledPath.c_str(), SW_SHOWNORMAL); PostQuitMessage(0); } @@ -385,10 +362,9 @@ void CLauncherDlg::DownloadProcess() { FTP_Close(); - // CString inipath, version; - // inipath.Format( "%s\\server.ini", GetProgPath() ); - // itoa( m_nServerVersion, (char*)(LPCTSTR)version, 10 ); - // WritePrivateProfileString("VERSION","CURRENT",version, inipath); + //std::string szIniPath = (n3std::get_app_path() / "server.ini").string(); + //std::string szVersion = std::to_string(m_nServerVersion); + //WritePrivateProfileString("VERSION", "CURRENT", szVersion.c_str(), szIniPath.c_str()); if (true == bExtractSuccess && m_hRegistryKey) // 압축 풀기와 쓰기, 압축 파일 삭제에 성공하면 버전을 쓰고.. { diff --git a/src/tool/Launcher/LauncherDlg.h b/src/tool/Launcher/LauncherDlg.h index 61b9192a..284b8fdf 100644 --- a/src/tool/Launcher/LauncherDlg.h +++ b/src/tool/Launcher/LauncherDlg.h @@ -66,8 +66,7 @@ class CLauncherDlg : public CDialog { CLauncherDlg(CWnd * pParent = NULL); // standard constructor - CString GetProgPath(); - void PacketSend_VersionReq(); + void PacketSend_VersionReq(); bool ArchiveClose(); bool ArchiveOpen(CString OpenFileName); diff --git a/src/tool/UIE/MainFrm.cpp b/src/tool/UIE/MainFrm.cpp index 667c2219..2d84411a 100644 --- a/src/tool/UIE/MainFrm.cpp +++ b/src/tool/UIE/MainFrm.cpp @@ -92,9 +92,7 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { ASSERT(pApp); CString szRet = pApp->GetProfileString("Work", "Path", "empty"); if (szRet == "empty") { - char szPath[_MAX_PATH]{}; - GetModuleFileName(NULL, szPath, _MAX_PATH); - std::string szDir = fs::path(szPath).parent_path().string(); + std::string szDir = n3std::get_app_dir().string(); pApp->WriteProfileString("Work", "Path", szDir.c_str()); SetBasePath(szDir.c_str()); } else { From 0e0dcef819fac1311a955be3fed43d1985e3a0bd Mon Sep 17 00:00:00 2001 From: Steve Williams <90905675+stevewgr@users.noreply.github.com> Date: Mon, 11 Nov 2024 21:52:26 -0500 Subject: [PATCH 3/7] Remove redundant unused code from Launcher. Seems like they copied this code from somewhere to use it as a custom button control for the Launcher but it was never used. Hence there is no reason to maintain this anymore. --- src/tool/Launcher/BtnST.cpp | 1174 ------------------------- src/tool/Launcher/BtnST.h | 191 ---- src/tool/Launcher/CButtonST_DemoDlg.h | 43 - 3 files changed, 1408 deletions(-) delete mode 100644 src/tool/Launcher/BtnST.cpp delete mode 100644 src/tool/Launcher/BtnST.h delete mode 100644 src/tool/Launcher/CButtonST_DemoDlg.h diff --git a/src/tool/Launcher/BtnST.cpp b/src/tool/Launcher/BtnST.cpp deleted file mode 100644 index 9a6fdd15..00000000 --- a/src/tool/Launcher/BtnST.cpp +++ /dev/null @@ -1,1174 +0,0 @@ -#include "StdAfx.h" -#include "BtnST.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CButtonST - -CButtonST::CButtonST() { - m_bIsPressed = FALSE; - m_bIsFocused = FALSE; - m_bIsDisabled = FALSE; - m_bMouseOnButton = FALSE; - - FreeResources(FALSE); - - // Default type is "flat" button - m_bIsFlat = TRUE; - - // By default draw border in "flat" button - m_bDrawBorder = TRUE; - - // By default icon is aligned horizontally - m_nAlign = ST_ALIGN_HORIZ; - - // By default, for "flat" button, don't draw the focus rect - m_bDrawFlatFocus = FALSE; - - // By default the button is not the default button - m_bIsDefault = FALSE; - - // By default the button is not a checkbox - m_bIsCheckBox = FALSE; - m_nCheck = 0; - - // Set default colors - SetDefaultColors(FALSE); - - // No tooltip created - m_ToolTip.m_hWnd = NULL; - - // Do not draw as a transparent button - m_bDrawTransparent = FALSE; - m_pbmpOldBk = NULL; - - // No URL defined - ::ZeroMemory(&m_szURL, sizeof(m_szURL)); - - // No cursor defined - m_hCursor = NULL; // Fix by kawasaki@us.dnttm.ro - - // No autorepeat - m_bAutoRepeat = FALSE; - m_hWndAutoRepeat = NULL; - m_nMsgAutoRepeat = WM_APP; - m_dwPeriodAutoRepeat = 100; -} // End of CButtonST - -CButtonST::~CButtonST() { - // Restore old bitmap (if any) - if (m_dcBk.m_hDC != NULL && m_pbmpOldBk != NULL) { - m_dcBk.SelectObject(m_pbmpOldBk); - } - - FreeResources(); - - // Destroy the cursor (if any) - if (m_hCursor != NULL) { - ::DestroyCursor(m_hCursor); - } -} // End of ~CButtonST - -BEGIN_MESSAGE_MAP(CButtonST, CButton) -//{{AFX_MSG_MAP(CButtonST) -ON_WM_CAPTURECHANGED() -ON_WM_SETCURSOR() -ON_WM_KILLFOCUS() -ON_WM_MOUSEMOVE() -ON_WM_SYSCOLORCHANGE() -ON_CONTROL_REFLECT_EX(BN_CLICKED, OnClicked) -ON_WM_ACTIVATE() -ON_WM_ENABLE() -ON_WM_CANCELMODE() -ON_WM_CTLCOLOR_REFLECT() -ON_WM_LBUTTONDOWN() -ON_WM_ERASEBKGND() -//}}AFX_MSG_MAP -END_MESSAGE_MAP() - -DWORD CButtonST::SetIcon(int nIconInId, int nIconOutId) { - HICON hIconIn; - HICON hIconOut; - HINSTANCE hInstResource; - - // Find correct resource handle - hInstResource = AfxFindResourceHandle(MAKEINTRESOURCE(nIconInId), RT_GROUP_ICON); - - // Set icon when the mouse is IN the button - hIconIn = (HICON)::LoadImage(hInstResource, MAKEINTRESOURCE(nIconInId), IMAGE_ICON, 0, 0, 0); - // Set icon when the mouse is OUT the button - hIconOut = (HICON)::LoadImage(hInstResource, MAKEINTRESOURCE(nIconOutId), IMAGE_ICON, 0, 0, 0); - - return SetIcon(hIconIn, hIconOut); -} // End of SetIcon - -DWORD CButtonST::SetIcon(HICON hIconIn, HICON hIconOut) { - BOOL bRetValue; - ICONINFO ii; - - // Free any loaded resource - FreeResources(); - - if (hIconIn != NULL) { - m_csIcons[0].hIcon = hIconIn; - - // Get icon dimension - ZeroMemory(&ii, sizeof(ICONINFO)); - bRetValue = ::GetIconInfo(hIconIn, &ii); - if (bRetValue == FALSE) { - FreeResources(); - return BTNST_INVALIDRESOURCE; - } // if - - m_csIcons[0].dwWidth = (DWORD)(ii.xHotspot * 2); - m_csIcons[0].dwHeight = (DWORD)(ii.yHotspot * 2); - ::DeleteObject(ii.hbmMask); - ::DeleteObject(ii.hbmColor); - - if (hIconOut != NULL) { - m_csIcons[1].hIcon = hIconOut; - - // Get icon dimension - ZeroMemory(&ii, sizeof(ICONINFO)); - bRetValue = ::GetIconInfo(hIconOut, &ii); - if (bRetValue == FALSE) { - FreeResources(); - return BTNST_INVALIDRESOURCE; - } // if - - m_csIcons[1].dwWidth = (DWORD)(ii.xHotspot * 2); - m_csIcons[1].dwHeight = (DWORD)(ii.yHotspot * 2); - ::DeleteObject(ii.hbmMask); - ::DeleteObject(ii.hbmColor); - } // if - } // if - - RedrawWindow(); - - return BTNST_OK; -} // End of SetIcon - -BOOL CButtonST::SetBtnCursor(int nCursorId) { - HINSTANCE hInstResource; - // Destroy any previous cursor - if (m_hCursor != NULL) { - ::DestroyCursor(m_hCursor); - } - m_hCursor = NULL; - - // If we want a cursor - if (nCursorId != NULL) { - hInstResource = AfxFindResourceHandle(MAKEINTRESOURCE(nCursorId), RT_GROUP_CURSOR); - // Load icon resource - m_hCursor = (HCURSOR)::LoadImage(hInstResource /*AfxGetApp()->m_hInstance*/, MAKEINTRESOURCE(nCursorId), - IMAGE_CURSOR, 0, 0, 0); - // If something wrong then return FALSE - if (m_hCursor == NULL) { - return FALSE; - } - } - - return TRUE; -} // End of SetBtnCursor - -void CButtonST::SetFlat(BOOL bState) { - m_bIsFlat = bState; - Invalidate(); -} // End of SetFlat - -BOOL CButtonST::GetFlat() { - return m_bIsFlat; -} // End of GetFlat - -void CButtonST::SetAlign(int nAlign) { - switch (nAlign) { - case ST_ALIGN_HORIZ: - case ST_ALIGN_HORIZ_RIGHT: - case ST_ALIGN_VERT: - m_nAlign = nAlign; - break; - } - Invalidate(); -} // End of SetAlign - -int CButtonST::GetAlign() { - return m_nAlign; -} // End of GetAlign - -void CButtonST::DrawBorder(BOOL bEnable) { - m_bDrawBorder = bEnable; -} // End of DrawBorder - -void CButtonST::OnMouseMove(UINT nFlags, CPoint point) { - CWnd * pWnd; // Active window - CWnd * pParent; // Window that owns the button - - CButton::OnMouseMove(nFlags, point); - - // If the mouse enter the button with the left button pressed then do nothing - if (nFlags & MK_LBUTTON && m_bMouseOnButton == FALSE) { - return; - } - - // If our button is not flat then do nothing - if (m_bIsFlat == FALSE) { - return; - } - - pWnd = GetActiveWindow(); - pParent = GetOwner(); - - if ((GetCapture() != this) && ( -#ifndef ST_LIKEIE - pWnd != NULL && -#endif - pParent != NULL)) { - m_bMouseOnButton = TRUE; - //SetFocus(); // Thanks Ralph! - SetCapture(); - Invalidate(); - } // if - else { - /* - CRect rc; - GetClientRect(&rc); - if (!rc.PtInRect(point)) - { - */ - - POINT p2 = point; - ClientToScreen(&p2); - CWnd * wndUnderMouse = WindowFromPoint(p2); - // if (wndUnderMouse != this) - if (wndUnderMouse && wndUnderMouse->m_hWnd != this->m_hWnd) { - // Redraw only if mouse goes out - if (m_bMouseOnButton == TRUE) { - m_bMouseOnButton = FALSE; - Invalidate(); - } // if - // If user is NOT pressing left button then release capture! - if (!(nFlags & MK_LBUTTON)) { - ReleaseCapture(); - } - } // if - } // else -} // End of OnMouseMove - -void CButtonST::OnKillFocus(CWnd * pNewWnd) { - CButton::OnKillFocus(pNewWnd); - - CancelHover(); -} // End of OnKillFocus - -void CButtonST::OnLButtonDown(UINT nFlags, CPoint point) { - CButton::OnLButtonDown(nFlags, point); - - if (m_bAutoRepeat == TRUE) { - MSG csMsg; - int nButtonID; - HWND hWndParent; - BOOL bInitialState = TRUE; - - nButtonID = GetDlgCtrlID(); - hWndParent = GetParent()->GetSafeHwnd(); - SetCapture(); - while (PeekMessage(&csMsg, m_hWnd, WM_LBUTTONUP, WM_LBUTTONUP, PM_REMOVE) == FALSE) { - ::SendMessage(hWndParent, WM_COMMAND, MAKEWPARAM((WORD)nButtonID, BN_CLICKED), (LPARAM)m_hWnd); - ::Sleep(m_dwPeriodAutoRepeat); - bInitialState = !bInitialState; - } // while - - if (!bInitialState) { - ::SendMessage(hWndParent, WM_COMMAND, MAKEWPARAM((WORD)nButtonID, BN_CLICKED), (LPARAM)m_hWnd); - } // if - ReleaseCapture(); - SendMessage(WM_LBUTTONUP); - CPoint ptCursor; - GetCursorPos(&ptCursor); - ScreenToClient(&ptCursor); - SendMessage(WM_MOUSEMOVE, 0, MAKELPARAM(ptCursor.x, ptCursor.y)); - } // if -} // End of OnLButtonDown - -void CButtonST::OnActivate(UINT nState, CWnd * pWndOther, BOOL bMinimized) { - CButton::OnActivate(nState, pWndOther, bMinimized); - - if (nState == WA_INACTIVE) { - CancelHover(); - } -} // End of OnActivate - -void CButtonST::OnEnable(BOOL bEnable) { - CButton::OnEnable(bEnable); - - if (bEnable == FALSE) { - CancelHover(); - } -} // End of OnEnable - -void CButtonST::OnCancelMode() { - CButton::OnCancelMode(); - - CancelHover(); -} // End of OnCancelMode - -void CButtonST::OnCaptureChanged(CWnd * pWnd) { - if (m_bMouseOnButton == TRUE) { - ReleaseCapture(); - Invalidate(); - } // if - - CButton::OnCaptureChanged(pWnd); -} // End of OnCaptureChanged - -void CButtonST::DrawItem(LPDRAWITEMSTRUCT lpDIS) { - CDC * pDC = CDC::FromHandle(lpDIS->hDC); - - CPen * pOldPen; - - // Checkbox or Radiobutton style ? - if (m_bIsCheckBox == TRUE) { - m_bIsPressed = (lpDIS->itemState & ODS_SELECTED) || (m_nCheck != 0); - //m_bIsPressed = TRUE; - } - // Normal button OR other button style ... - else { - m_bIsPressed = (lpDIS->itemState & ODS_SELECTED); - } - - m_bIsFocused = (lpDIS->itemState & ODS_FOCUS); - m_bIsDisabled = (lpDIS->itemState & ODS_DISABLED); - - CRect itemRect = lpDIS->rcItem; - - pDC->SetBkMode(TRANSPARENT); - - if (m_bIsFlat == FALSE) { - if (m_bIsFocused || (GetDefault() == TRUE)) { - CBrush br(RGB(0, 0, 0)); - pDC->FrameRect(&itemRect, &br); - itemRect.DeflateRect(1, 1); - } // if - } // if - - // Prepare draw... paint button background - - // Draw transparent? - if (m_bDrawTransparent == TRUE) { - PaintBk(pDC); - } else { - OnDrawBackground(pDC, &itemRect); - } - - // Draw pressed button - if (m_bIsPressed) { - if (m_bIsFlat == TRUE) { - if (m_bDrawBorder) { - OnDrawBorder(pDC, &itemRect); - } - } else { - CBrush brBtnShadow(GetSysColor(COLOR_BTNSHADOW)); - pDC->FrameRect(&itemRect, &brBtnShadow); - } - } else // ...else draw non pressed button - { - CPen penBtnHiLight(PS_SOLID, 0, GetSysColor(COLOR_BTNHILIGHT)); // White - CPen pen3DLight(PS_SOLID, 0, GetSysColor(COLOR_3DLIGHT)); // Light gray - CPen penBtnShadow(PS_SOLID, 0, GetSysColor(COLOR_BTNSHADOW)); // Dark gray - CPen pen3DDKShadow(PS_SOLID, 0, GetSysColor(COLOR_3DDKSHADOW)); // Black - - if (m_bIsFlat == TRUE) { - if (m_bMouseOnButton && m_bDrawBorder) { - OnDrawBorder(pDC, &itemRect); - } - } else { - // Draw top-left borders - // White line - pOldPen = pDC->SelectObject(&penBtnHiLight); - pDC->MoveTo(itemRect.left, itemRect.bottom - 1); - pDC->LineTo(itemRect.left, itemRect.top); - pDC->LineTo(itemRect.right, itemRect.top); - // Light gray line - pDC->SelectObject(pen3DLight); - pDC->MoveTo(itemRect.left + 1, itemRect.bottom - 1); - pDC->LineTo(itemRect.left + 1, itemRect.top + 1); - pDC->LineTo(itemRect.right, itemRect.top + 1); - // Draw bottom-right borders - // Black line - pDC->SelectObject(pen3DDKShadow); - pDC->MoveTo(itemRect.left, itemRect.bottom - 1); - pDC->LineTo(itemRect.right - 1, itemRect.bottom - 1); - pDC->LineTo(itemRect.right - 1, itemRect.top - 1); - // Dark gray line - pDC->SelectObject(penBtnShadow); - pDC->MoveTo(itemRect.left + 1, itemRect.bottom - 2); - pDC->LineTo(itemRect.right - 2, itemRect.bottom - 2); - pDC->LineTo(itemRect.right - 2, itemRect.top); - // - pDC->SelectObject(pOldPen); - } - } - - // Read the button's title - CString sTitle; - GetWindowText(sTitle); - - CRect captionRect = lpDIS->rcItem; - - // Draw the icon - if (m_csIcons[0].hIcon != NULL) { - DrawTheIcon(pDC, !sTitle.IsEmpty(), &lpDIS->rcItem, &captionRect, m_bIsPressed, m_bIsDisabled); - } - - if (m_csBitmaps[0].hBitmap != NULL) { - pDC->SetBkColor(RGB(255, 255, 255)); - DrawTheBitmap(pDC, !sTitle.IsEmpty(), &lpDIS->rcItem, &captionRect, m_bIsPressed, m_bIsDisabled); - } // if - - // Write the button title (if any) - if (sTitle.IsEmpty() == FALSE) { - // Draw the button's title - // If button is pressed then "press" title also - if (m_bIsPressed && m_bIsCheckBox == FALSE) { - captionRect.OffsetRect(1, 1); - } - - // ONLY FOR DEBUG - //CBrush brBtnShadow(RGB(255, 0, 0)); - //pDC->FrameRect(&captionRect, &brBtnShadow); - - /* - if ((m_bMouseOnButton == TRUE) || (bIsPressed)) - { - pDC->SetTextColor(GetActiveFgColor()); - pDC->SetBkColor(GetActiveBgColor()); - } - else - { - pDC->SetTextColor(GetInactiveFgColor()); - pDC->SetBkColor(GetInactiveBgColor()); - } - */ - // Center text - CRect centerRect = captionRect; - pDC->DrawText(sTitle, -1, captionRect, DT_WORDBREAK | DT_CENTER | DT_CALCRECT); - captionRect.OffsetRect((centerRect.Width() - captionRect.Width()) / 2, - (centerRect.Height() - captionRect.Height()) / 2); - /* RFU - captionRect.OffsetRect(0, (centerRect.Height() - captionRect.Height())/2); - captionRect.OffsetRect((centerRect.Width() - captionRect.Width())-4, (centerRect.Height() - captionRect.Height())/2); - */ - - pDC->SetBkMode(TRANSPARENT); - /* - pDC->DrawState(captionRect.TopLeft(), captionRect.Size(), (LPCTSTR)sTitle, (bIsDisabled ? DSS_DISABLED : DSS_NORMAL), - TRUE, 0, (CBrush*)NULL); - */ - if (m_bIsDisabled) { - captionRect.OffsetRect(1, 1); - pDC->SetTextColor(::GetSysColor(COLOR_3DHILIGHT)); - pDC->DrawText(sTitle, -1, captionRect, DT_WORDBREAK | DT_CENTER); - captionRect.OffsetRect(-1, -1); - pDC->SetTextColor(::GetSysColor(COLOR_3DSHADOW)); - pDC->DrawText(sTitle, -1, captionRect, DT_WORDBREAK | DT_CENTER); - } // if - else { - if (m_bMouseOnButton || m_bIsPressed) { - pDC->SetTextColor(m_crColors[BTNST_COLOR_FG_IN]); - pDC->SetBkColor(m_crColors[BTNST_COLOR_BK_IN]); - } // if - else { - pDC->SetTextColor(m_crColors[BTNST_COLOR_FG_OUT]); - pDC->SetBkColor(m_crColors[BTNST_COLOR_BK_OUT]); - } // else - pDC->DrawText(sTitle, -1, captionRect, DT_WORDBREAK | DT_CENTER); - } // if - } // if - - if (m_bIsFlat == FALSE || (m_bIsFlat == TRUE && m_bDrawFlatFocus == TRUE)) { - // Draw the focus rect - if (m_bIsFocused) { - CRect focusRect = itemRect; - focusRect.DeflateRect(3, 3); - pDC->DrawFocusRect(&focusRect); - } // if - } // if -} // End of DrawItem - -void CButtonST::DrawTheIcon(CDC * pDC, BOOL bHasTitle, RECT * rpItem, CRect * rpTitle, BOOL bIsPressed, - BOOL bIsDisabled) { - BYTE byIndex = 0; - - // Select the icon to use - if (m_bIsCheckBox == TRUE) { - if (bIsPressed == TRUE) { - byIndex = 0; - } else { - byIndex = (m_csIcons[1].hIcon == NULL ? 0 : 1); - } - } // if - else { - if (m_bMouseOnButton == TRUE || bIsPressed == TRUE) { - byIndex = 0; - } else { - byIndex = (m_csIcons[1].hIcon == NULL ? 0 : 1); - } - } // else - - CRect rImage; - PrepareImageRect(bHasTitle, rpItem, rpTitle, bIsPressed, m_csIcons[byIndex].dwWidth, m_csIcons[byIndex].dwHeight, - &rImage); - - // Ole'! - pDC->DrawState(rImage.TopLeft(), rImage.Size(), m_csIcons[byIndex].hIcon, (bIsDisabled ? DSS_DISABLED : DSS_NORMAL), - (CBrush *)NULL); -} // End of DrawTheIcon - -void CButtonST::PreSubclassWindow() { - UINT nBS; - - nBS = GetButtonStyle(); - - // Check if this is the default button - if (nBS & BS_DEFPUSHBUTTON) { - m_bIsDefault = TRUE; - } - - // Check if this is a checkbox - if (nBS & BS_CHECKBOX) { - m_bIsCheckBox = TRUE; - } - - // Add BS_OWNERDRAW style - SetButtonStyle(nBS | BS_OWNERDRAW); - - CButton::PreSubclassWindow(); -} // End of PreSubclassWindow - -BOOL CButtonST::PreTranslateMessage(MSG * pMsg) { - InitToolTip(); - m_ToolTip.RelayEvent(pMsg); - - return CButton::PreTranslateMessage(pMsg); -} // End of PreTranslateMessage - -LRESULT CButtonST::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam) { - if (message == WM_LBUTTONDBLCLK) { - message = WM_LBUTTONDOWN; - } // if - return CButton::DefWindowProc(message, wParam, lParam); -} // End of DefWindowProc - -void CButtonST::SetFlatFocus(BOOL bDrawFlatFocus, BOOL bRepaint) { - m_bDrawFlatFocus = bDrawFlatFocus; - - // Repaint the button - if (bRepaint == TRUE) { - Invalidate(); - } -} // End of SetFlatFocus - -BOOL CButtonST::OnSetCursor(CWnd * pWnd, UINT nHitTest, UINT message) { - // If a cursor was specified then use it! - if (m_hCursor != NULL) { - ::SetCursor(m_hCursor); - return TRUE; - } // if - - return CButton::OnSetCursor(pWnd, nHitTest, message); -} // End of OnSetCursor - -void CButtonST::SetTooltipText(LPCTSTR lpszText, BOOL bActivate) { - // We cannot accept NULL pointer - if (lpszText == NULL) { - return; - } - - // Initialize ToolTip - InitToolTip(); - - // If there is no tooltip defined then add it - if (m_ToolTip.GetToolCount() == 0) { - CRect rectBtn; - GetClientRect(rectBtn); - m_ToolTip.AddTool(this, lpszText, rectBtn, 1); - } - - // Set text for tooltip - m_ToolTip.UpdateTipText(lpszText, this, 1); - m_ToolTip.Activate(bActivate); -} // End of SetTooltipText - -void CButtonST::SetTooltipText(int nId, BOOL bActivate) { - CString sText; - - // load string resource - sText.LoadString(nId); - // If string resource is not empty - if (sText.IsEmpty() == FALSE) { - SetTooltipText((LPCTSTR)sText, bActivate); - } -} // End of SetTooltipText - -void CButtonST::ActivateTooltip(BOOL bActivate) { - // If there is no tooltip then do nothing - if (m_ToolTip.GetToolCount() == 0) { - return; - } - - // Activate tooltip - m_ToolTip.Activate(bActivate); -} // End of EnableTooltip - -BOOL CButtonST::GetDefault() { - return m_bIsDefault; -} // End of GetDefault - -void CButtonST::DrawTransparent(BOOL bRepaint) { - m_bDrawTransparent = TRUE; - - // Restore old bitmap (if any) - if (m_dcBk.m_hDC != NULL && m_pbmpOldBk != NULL) { - m_dcBk.SelectObject(m_pbmpOldBk); - } // if - - m_bmpBk.DeleteObject(); - m_dcBk.DeleteDC(); - - // Repaint the button - if (bRepaint == TRUE) { - Invalidate(); - } -} // End of DrawTransparent - -void CButtonST::InitToolTip() { - if (m_ToolTip.m_hWnd == NULL) { - // Create ToolTip control - m_ToolTip.Create(this); - // Create inactive - m_ToolTip.Activate(FALSE); - // Enable multiline - m_ToolTip.SendMessage(TTM_SETMAXTIPWIDTH, 0, 400); - } // if -} // End of InitToolTip - -void CButtonST::PaintBk(CDC * pDC) { - CClientDC clDC(GetParent()); - CRect rect; - CRect rect1; - - GetClientRect(rect); - - GetWindowRect(rect1); - GetParent()->ScreenToClient(rect1); - - if (m_dcBk.m_hDC == NULL) { - m_dcBk.CreateCompatibleDC(&clDC); - m_bmpBk.CreateCompatibleBitmap(&clDC, rect.Width(), rect.Height()); - m_pbmpOldBk = m_dcBk.SelectObject(&m_bmpBk); - m_dcBk.BitBlt(0, 0, rect.Width(), rect.Height(), &clDC, rect1.left, rect1.top, SRCCOPY); - } // if - - pDC->BitBlt(0, 0, rect.Width(), rect.Height(), &m_dcBk, 0, 0, SRCCOPY); -} // End of PaintBk - -HBRUSH CButtonST::CtlColor(CDC * pDC, UINT nCtlColor) { - return (HBRUSH)::GetStockObject(NULL_BRUSH); -} // End of CtlColor - -void CButtonST::OnSysColorChange() { - CButton::OnSysColorChange(); - - m_dcBk.DeleteDC(); - m_bmpBk.DeleteObject(); -} // End of OnSysColorChange - -BOOL CButtonST::OnClicked() { - if (m_bIsCheckBox == TRUE) { - m_nCheck = !m_nCheck; - Invalidate(); - } // if - else { - // Handle the URL (if any) - if (::lstrlen(m_szURL) > 0) { - ::ShellExecute(NULL, _T("open"), m_szURL, NULL, NULL, SW_SHOWMAXIMIZED); - } - } // else - - return FALSE; -} // End of OnClicked - -void CButtonST::SetCheck(int nCheck, BOOL bRepaint) { - if (m_bIsCheckBox == TRUE) { - if (nCheck == 0) { - m_nCheck = 0; - } else { - m_nCheck = 1; - } - - if (bRepaint == TRUE) { - Invalidate(); - } - } // if -} // End of SetCheck - -int CButtonST::GetCheck() { - return m_nCheck; -} // End of GetCheck - -void CButtonST::FreeResources(BOOL bCheckForNULL) { - if (bCheckForNULL == TRUE) { - // Destroy icons - // Note: the following two lines MUST be here! even if - // BoundChecker says they are unnecessary! - if (m_csIcons[0].hIcon != NULL) { - ::DeleteObject(m_csIcons[0].hIcon); - } - if (m_csIcons[1].hIcon != NULL) { - ::DeleteObject(m_csIcons[1].hIcon); - } - - // Destroy bitmaps - if (m_csBitmaps[0].hBitmap != NULL) { - ::DeleteObject(m_csBitmaps[0].hBitmap); - } - if (m_csBitmaps[1].hBitmap != NULL) { - ::DeleteObject(m_csBitmaps[1].hBitmap); - } - - // Destroy mask bitmaps - if (m_csBitmaps[0].hMask != NULL) { - ::DeleteObject(m_csBitmaps[0].hMask); - } - if (m_csBitmaps[1].hMask != NULL) { - ::DeleteObject(m_csBitmaps[1].hMask); - } - } // if - - ::ZeroMemory(&m_csIcons, sizeof(m_csIcons)); - ::ZeroMemory(&m_csBitmaps, sizeof(m_csBitmaps)); -} // End of FreeResources - -DWORD CButtonST::SetBitmaps(HBITMAP hBitmapIn, COLORREF crTransColorIn, HBITMAP hBitmapOut, COLORREF crTransColorOut) { - int nRetValue; - BITMAP csBitmapSize; - - // Free any loaded resource - FreeResources(); - - if (hBitmapIn != NULL) { - m_csBitmaps[0].hBitmap = hBitmapIn; - m_csBitmaps[0].crTransparent = crTransColorIn; - // Get bitmap size - nRetValue = ::GetObject(hBitmapIn, sizeof(csBitmapSize), &csBitmapSize); - if (nRetValue == 0) { - FreeResources(); - return BTNST_INVALIDRESOURCE; - } // if - m_csBitmaps[0].dwWidth = (DWORD)csBitmapSize.bmWidth; - m_csBitmaps[0].dwHeight = (DWORD)csBitmapSize.bmHeight; - - // Create mask for bitmap In - m_csBitmaps[0].hMask = - CreateBitmapMask(hBitmapIn, m_csBitmaps[0].dwWidth, m_csBitmaps[0].dwHeight, crTransColorIn); - if (m_csBitmaps[0].hMask == NULL) { - FreeResources(); - return BTNST_FAILEDMASK; - } // if - - if (hBitmapOut != NULL) { - m_csBitmaps[1].hBitmap = hBitmapOut; - m_csBitmaps[1].crTransparent = crTransColorOut; - // Get bitmap size - nRetValue = ::GetObject(hBitmapOut, sizeof(csBitmapSize), &csBitmapSize); - if (nRetValue == 0) { - FreeResources(); - return BTNST_INVALIDRESOURCE; - } // if - m_csBitmaps[1].dwWidth = (DWORD)csBitmapSize.bmWidth; - m_csBitmaps[1].dwHeight = (DWORD)csBitmapSize.bmHeight; - - // Create mask for bitmap Out - m_csBitmaps[1].hMask = - CreateBitmapMask(hBitmapOut, m_csBitmaps[1].dwWidth, m_csBitmaps[1].dwHeight, crTransColorOut); - if (m_csBitmaps[1].hMask == NULL) { - FreeResources(); - return BTNST_FAILEDMASK; - } // if - } // if - } // if - - RedrawWindow(); - - return BTNST_OK; -} // End of SetBitmaps - -DWORD CButtonST::SetBitmaps(int nBitmapIn, COLORREF crTransColorIn, int nBitmapOut, COLORREF crTransColorOut) { - HBITMAP hBitmapIn = NULL; - HBITMAP hBitmapOut = NULL; - HINSTANCE hInstResource = NULL; - - // Find correct resource handle - hInstResource = AfxFindResourceHandle(MAKEINTRESOURCE(nBitmapIn), RT_BITMAP); - - // Load bitmap In - hBitmapIn = (HBITMAP)::LoadImage(hInstResource, MAKEINTRESOURCE(nBitmapIn), IMAGE_BITMAP, 0, 0, 0); - - // Load bitmap Out - hBitmapOut = (HBITMAP)::LoadImage(hInstResource, MAKEINTRESOURCE(nBitmapOut), IMAGE_BITMAP, 0, 0, 0); - - return SetBitmaps(hBitmapIn, crTransColorIn, hBitmapOut, crTransColorOut); -} // End of SetBitmaps - -void CButtonST::DrawTheBitmap(CDC * pDC, BOOL bHasTitle, RECT * rItem, CRect * rCaption, BOOL bIsPressed, - BOOL bIsDisabled) { - HDC hdcBmpMem = NULL; - HBITMAP hbmOldBmp = NULL; - HDC hdcMem = NULL; - HBITMAP hbmT = NULL; - - BYTE byIndex = 0; - - // Select the bitmap to use - if (m_bIsCheckBox == TRUE) { - if (bIsPressed == TRUE) { - byIndex = 0; - } else { - byIndex = (m_csBitmaps[1].hBitmap == NULL ? 0 : 1); - } - } // if - else { - if (m_bMouseOnButton == TRUE || bIsPressed == TRUE) { - byIndex = 0; - } else { - byIndex = (m_csBitmaps[1].hBitmap == NULL ? 0 : 1); - } - } // else - - CRect rImage; - PrepareImageRect(bHasTitle, rItem, rCaption, bIsPressed, m_csBitmaps[byIndex].dwWidth, - m_csBitmaps[byIndex].dwHeight, &rImage); - - hdcBmpMem = ::CreateCompatibleDC(pDC->m_hDC); - - hbmOldBmp = (HBITMAP)::SelectObject(hdcBmpMem, m_csBitmaps[byIndex].hBitmap); - - hdcMem = ::CreateCompatibleDC(NULL); - - hbmT = (HBITMAP)::SelectObject(hdcMem, m_csBitmaps[byIndex].hMask); - - ::BitBlt(pDC->m_hDC, rImage.left, rImage.top, m_csBitmaps[byIndex].dwWidth, m_csBitmaps[byIndex].dwHeight, hdcMem, - 0, 0, SRCAND); - - ::BitBlt(pDC->m_hDC, rImage.left, rImage.top, m_csBitmaps[byIndex].dwWidth, m_csBitmaps[byIndex].dwHeight, - hdcBmpMem, 0, 0, SRCPAINT); - - ::SelectObject(hdcMem, hbmT); - ::DeleteDC(hdcMem); - - ::SelectObject(hdcBmpMem, hbmOldBmp); - ::DeleteDC(hdcBmpMem); -} // End of DrawTheBitmap - -HBITMAP CButtonST::CreateBitmapMask(HBITMAP hSourceBitmap, DWORD dwWidth, DWORD dwHeight, COLORREF crTransColor) { - HBITMAP hMask = NULL; - HDC hdcSrc = NULL; - HDC hdcDest = NULL; - HBITMAP hbmSrcT = NULL; - HBITMAP hbmDestT = NULL; - COLORREF crSaveBk; - COLORREF crSaveDestText; - - hMask = ::CreateBitmap(dwWidth, dwHeight, 1, 1, NULL); - if (hMask == NULL) { - return NULL; - } - - hdcSrc = ::CreateCompatibleDC(NULL); - hdcDest = ::CreateCompatibleDC(NULL); - - hbmSrcT = (HBITMAP)::SelectObject(hdcSrc, hSourceBitmap); - hbmDestT = (HBITMAP)::SelectObject(hdcDest, hMask); - - crSaveBk = ::SetBkColor(hdcSrc, crTransColor); - - ::BitBlt(hdcDest, 0, 0, dwWidth, dwHeight, hdcSrc, 0, 0, SRCCOPY); - - crSaveDestText = ::SetTextColor(hdcSrc, RGB(255, 255, 255)); - ::SetBkColor(hdcSrc, RGB(0, 0, 0)); - - ::BitBlt(hdcSrc, 0, 0, dwWidth, dwHeight, hdcDest, 0, 0, SRCAND); - - SetTextColor(hdcDest, crSaveDestText); - - ::SetBkColor(hdcSrc, crSaveBk); - ::SelectObject(hdcSrc, hbmSrcT); - ::SelectObject(hdcDest, hbmDestT); - - ::DeleteDC(hdcSrc); - ::DeleteDC(hdcDest); - - return hMask; -} // End of CreateBitmapMask - -// -// Parameters: -// [IN] bHasTitle -// TRUE if the button has a text -// [IN] rpItem -// A pointer to a RECT structure indicating the allowed paint area -// [IN/OUT]rpTitle -// A pointer to a CRect object indicating the paint area reserved for the -// text. This structure will be modified if necessary. -// [IN] bIsPressed -// TRUE if the button is currently pressed -// [IN] dwWidth -// Width of the image (icon or bitmap) -// [IN] dwHeight -// Height of the image (icon or bitmap) -// [OUT] rpImage -// A pointer to a CRect object that will receive the area available to the image -// -void CButtonST::PrepareImageRect(BOOL bHasTitle, RECT * rpItem, CRect * rpTitle, BOOL bIsPressed, DWORD dwWidth, - DWORD dwHeight, CRect * rpImage) { - CRect rBtn; - - rpImage->CopyRect(rpItem); - - switch (m_nAlign) { - case ST_ALIGN_HORIZ: - if (bHasTitle == FALSE /*spTitle->IsEmpty()*/) { - // Center image horizontally - rpImage->left += ((rpImage->Width() - dwWidth) / 2); - } else { - // Image must be placed just inside the focus rect - rpImage->left += 3; - rpTitle->left += dwWidth + 3; - } - // Center image vertically - rpImage->top += ((rpImage->Height() - dwHeight) / 2); - break; - - case ST_ALIGN_HORIZ_RIGHT: - GetClientRect(&rBtn); - if (bHasTitle == FALSE /*spTitle->IsEmpty()*/) { - // Center image horizontally - rpImage->left += ((rpImage->Width() - dwWidth) / 2); - } else { - // Image must be placed just inside the focus rect - rpTitle->right = rpTitle->Width() - dwWidth - 3; - rpTitle->left = 3; - rpImage->left = rBtn.right - dwWidth - 3; - // Center image vertically - rpImage->top += ((rpImage->Height() - dwHeight) / 2); - } - break; - - case ST_ALIGN_VERT: - // Center image horizontally - rpImage->left += ((rpImage->Width() - dwWidth) / 2); - if (bHasTitle == FALSE /*spTitle->IsEmpty()*/) { - // Center image vertically - rpImage->top += ((rpImage->Height() - dwHeight) / 2); - } else { - rpImage->top = 3; - rpTitle->top += dwHeight; - } - break; - } - - // If button is pressed then press image also - if (bIsPressed == TRUE && m_bIsCheckBox == FALSE) { - rpImage->OffsetRect(1, 1); - } -} // End of PrepareImageRect - -// -// Parameters: -// [IN] bRepaint -// If TRUE the control will be repainted. -// Return value: -// BTNST_OK -// Function executed successfully. -// -DWORD CButtonST::SetDefaultColors(BOOL bRepaint) { - m_crColors[BTNST_COLOR_BK_IN] = ::GetSysColor(COLOR_BTNFACE); - m_crColors[BTNST_COLOR_FG_IN] = ::GetSysColor(COLOR_BTNTEXT); - m_crColors[BTNST_COLOR_BK_OUT] = ::GetSysColor(COLOR_BTNFACE); - m_crColors[BTNST_COLOR_FG_OUT] = ::GetSysColor(COLOR_BTNTEXT); - - if (bRepaint == TRUE) { - Invalidate(); - } - - return BTNST_OK; -} // End of SetDefaultColors - -// -// Parameters: -// [IN] byColorIndex -// Index of the color to set. This index is zero-based. -// [IN] crColor -// New color. -// [IN] bRepaint -// If TRUE the control will be repainted. -// -// Return value: -// BTNST_OK -// Function executed successfully. -// BTNST_INVALIDINDEX -// Invalid color index. -// -DWORD CButtonST::SetColor(BYTE byColorIndex, COLORREF crColor, BOOL bRepaint) { - if (byColorIndex >= BTNST_MAX_COLORS) { - return BTNST_INVALIDINDEX; - } - - // Set new color - m_crColors[byColorIndex] = crColor; - - if (bRepaint == TRUE) { - Invalidate(); - } - - return BTNST_OK; -} // End of SetColor - -// -// Parameters: -// [IN] byColorIndex -// Index of the color to get. This index is zero-based. -// [OUT] crpColor -// A pointer to a COLORREF that will receive the color. -// -// Return value: -// BTNST_OK -// Function executed successfully. -// BTNST_INVALIDINDEX -// Invalid color index. -// -DWORD CButtonST::GetColor(BYTE byColorIndex, COLORREF * crpColor) { - if (byColorIndex >= BTNST_MAX_COLORS) { - return BTNST_INVALIDINDEX; - } - - // Get color - *crpColor = m_crColors[byColorIndex]; - - return BTNST_OK; -} // End of GetColor - -// -// Parameters: -// [IN] lpszURL -// Pointer to a null-terminated string that contains the URL. -// -// Return value: -// BTNST_OK -// Function executed successfully. -// -DWORD CButtonST::SetURL(LPCTSTR lpszURL) { - if (lpszURL != NULL) { - // Store the URL - ::lstrcpyn(m_szURL, lpszURL, _MAX_PATH); - } // if - else { - // Remove any existing URL - ::ZeroMemory(&m_szURL, sizeof(m_szURL)); - } // else - - return BTNST_OK; -} // End of SetURL - -void CButtonST::CancelHover() { - // If our button is not flat then do nothing - if (m_bIsFlat == FALSE) { - return; - } - - if (m_bMouseOnButton == TRUE) { - m_bMouseOnButton = FALSE; - Invalidate(); - } // if -} // End of CancelHover - -// This function enable or disable the autorepeat feature. -// -// Parameters: -// [IN] bSet -// TRUE to enable autorepeat. FALSE to disable. -// [IN] dwMilliseconds -// Time (in milliseconds) between each button click. -// If bSet is FALSE this parameter is ignored. -// -// Return value: -// BTNST_OK -// Function executed successfully. -// -DWORD CButtonST::SetAutoRepeat(BOOL bSet, DWORD dwMilliseconds) { - m_bAutoRepeat = bSet; - m_dwPeriodAutoRepeat = dwMilliseconds; - - return BTNST_OK; -} // End of SetAutoRepeat - -// This function is called every time the button background needs to be painted. -// If the button is in transparent mode this function will NOT be called. -// -// Parameters: -// [IN] pDC -// Pointer to a CDC object that indicates the device context. -// [IN] pRect -// Pointer to a CRect object that indicates the bounds of the -// area to be painted. -// -// Return value: -// BTNST_OK -// Function executed successfully. -// -DWORD CButtonST::OnDrawBackground(CDC * pDC, LPCRECT pRect) { - COLORREF crColor; - - if (m_bMouseOnButton || m_bIsPressed) { - crColor = m_crColors[BTNST_COLOR_BK_IN]; - } else { - crColor = m_crColors[BTNST_COLOR_BK_OUT]; - } - - CBrush brBackground(crColor); - - pDC->FillRect(pRect, &brBackground); - - return BTNST_OK; -} // End of OnDrawBackground - -// This function is called every time the button border needs to be painted. -// If the button is in standard (not flat) mode this function will NOT be called. -// -// Parameters: -// [IN] pDC -// Pointer to a CDC object that indicates the device context. -// [IN] pRect -// Pointer to a CRect object that indicates the bounds of the -// area to be painted. -// -// Return value: -// BTNST_OK -// Function executed successfully. -// -DWORD CButtonST::OnDrawBorder(CDC * pDC, LPCRECT pRect) { - if (m_bIsPressed) { - pDC->Draw3dRect(pRect, ::GetSysColor(COLOR_BTNSHADOW), ::GetSysColor(COLOR_BTNHILIGHT)); - } else { - pDC->Draw3dRect(pRect, ::GetSysColor(COLOR_BTNHILIGHT), ::GetSysColor(COLOR_BTNSHADOW)); - } - - return BTNST_OK; -} // End of OnDrawBorder - -#undef ST_LIKEIE diff --git a/src/tool/Launcher/BtnST.h b/src/tool/Launcher/BtnST.h deleted file mode 100644 index 9a5755d6..00000000 --- a/src/tool/Launcher/BtnST.h +++ /dev/null @@ -1,191 +0,0 @@ -// -// Class: CButtonST -// -// Compiler: Visual C++ -// Tested on: Visual C++ 5.0 -// Visual C++ 6.0 -// -// Version: See GetVersionC() or GetVersionI() -// -// Created: xx/xxxx/1998 -// Updated: 14/June/2001 -// -// Author: Davide Calabro' davide_calabro@yahoo.com -// -#pragma once - -// CBtnST.h : header file -// - -// Comment this if you don't want that CButtonST hilights itself -// also when the window is inactive (like happens in Internet Explorer) -//#define ST_LIKEIE - -// Return values -#ifndef BTNST_OK -#define BTNST_OK 0 -#endif -#ifndef BTNST_INVALIDRESOURCE -#define BTNST_INVALIDRESOURCE 1 -#endif -#ifndef BTNST_FAILEDMASK -#define BTNST_FAILEDMASK 2 -#endif -#ifndef BTNST_INVALIDINDEX -#define BTNST_INVALIDINDEX 3 -#endif - -class CButtonST : public CButton { - public: - CButtonST(); - ~CButtonST(); - - enum { - ST_ALIGN_HORIZ, - ST_ALIGN_VERT, - ST_ALIGN_HORIZ_RIGHT - }; - - enum { - BTNST_COLOR_BK_IN = 0, // Background color when mouse is INside - BTNST_COLOR_FG_IN, // Text color when mouse is INside - BTNST_COLOR_BK_OUT, // Background color when mouse is OUTside - BTNST_COLOR_FG_OUT, // Text color when mouse is OUTside - - BTNST_MAX_COLORS - }; - - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CButtonST) - public: - virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); - virtual BOOL PreTranslateMessage(MSG * pMsg); - - protected: - virtual void PreSubclassWindow(); - virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam); - //}}AFX_VIRTUAL - - public: - DWORD SetAutoRepeat(BOOL bSet, DWORD dwMilliseconds = 100); - DWORD SetURL(LPCTSTR lpszURL); - DWORD GetColor(BYTE byColorIndex, COLORREF * crpColor); - DWORD SetColor(BYTE byColorIndex, COLORREF crColor, BOOL bRepaint = TRUE); - DWORD SetDefaultColors(BOOL bRepaint = TRUE); - int GetCheck(); - void SetCheck(int nCheck, BOOL bRepaint = TRUE); - void DrawTransparent(BOOL bRepaint = FALSE); - - BOOL GetDefault(); - - void SetTooltipText(int nId, BOOL bActivate = TRUE); - void SetTooltipText(LPCTSTR lpszText, BOOL bActivate = TRUE); - void ActivateTooltip(BOOL bEnable = TRUE); - - BOOL SetBtnCursor(int nCursorId = NULL); - - void SetFlatFocus(BOOL bDrawFlatFocus, BOOL bRepaint = FALSE); - - void SetAlign(int nAlign); - int GetAlign(); - - void SetFlat(BOOL bState = TRUE); - BOOL GetFlat(); - - void DrawBorder(BOOL bEnable = TRUE); - DWORD SetIcon(int nIconInId, int nIconOutId = NULL); - DWORD SetIcon(HICON hIconIn, HICON hIconOut = NULL); - - DWORD SetBitmaps(int nBitmapIn, COLORREF crTransColorIn, int nBitmapOut = NULL, COLORREF crTransColorOut = 0); - DWORD SetBitmaps(HBITMAP hBitmapIn, COLORREF crTransColorIn, HBITMAP hBitmapOut = NULL, - COLORREF crTransColorOut = 0); - - static short GetVersionI() { return 32; } - static LPCTSTR GetVersionC() { return (LPCTSTR) _T("3.2"); } - - protected: - //{{AFX_MSG(CButtonST) - afx_msg void OnCaptureChanged(CWnd * pWnd); - afx_msg BOOL OnSetCursor(CWnd * pWnd, UINT nHitTest, UINT message); - afx_msg void OnKillFocus(CWnd * pNewWnd); - afx_msg void OnMouseMove(UINT nFlags, CPoint point); - afx_msg void OnSysColorChange(); - afx_msg BOOL OnClicked(); - afx_msg void OnActivate(UINT nState, CWnd * pWndOther, BOOL bMinimized); - afx_msg void OnEnable(BOOL bEnable); - afx_msg void OnCancelMode(); - afx_msg void OnLButtonDown(UINT nFlags, CPoint point); - //}}AFX_MSG - - afx_msg HBRUSH CtlColor(CDC * pDC, UINT nCtlColor); - virtual DWORD OnDrawBackground(CDC * pDC, LPCRECT pRect); - virtual DWORD OnDrawBorder(CDC * pDC, LPCRECT pRect); - - BOOL m_bDrawTransparent; - BOOL m_bMouseOnButton; - BOOL m_bIsPressed; - BOOL m_bIsFocused; - BOOL m_bIsDisabled; - COLORREF m_crColors[BTNST_MAX_COLORS]; - - private: - void CancelHover(); - void PrepareImageRect(BOOL bHasTitle, RECT * rpItem, CRect * rpTitle, BOOL bIsPressed, DWORD dwWidth, - DWORD dwHeight, CRect * rpImage); - HBITMAP CreateBitmapMask(HBITMAP hSourceBitmap, DWORD dwWidth, DWORD dwHeight, COLORREF crTransColor); - void DrawTheBitmap(CDC * pDC, BOOL bHasTitle, RECT * rItem, CRect * rCaption, BOOL bIsPressed, BOOL bIsDisabled); - void FreeResources(BOOL bCheckForNULL = TRUE); - void DrawTheIcon(CDC * pDC, BOOL bHasTitle, RECT * rpItem, CRect * rpTitle, BOOL bIsPressed, BOOL bIsDisabled); - void InitToolTip(); - void PaintBk(CDC * pDC); - - int m_nAlign; - BOOL m_bDrawBorder; - BOOL m_bIsFlat; - BOOL m_bDrawFlatFocus; - BOOL m_bAutoRepeat; - HWND m_hWndAutoRepeat; - UINT m_nMsgAutoRepeat; - DWORD m_dwPeriodAutoRepeat; - - HCURSOR m_hCursor; - CToolTipCtrl m_ToolTip; - -#pragma pack(1) - typedef struct _STRUCT_ICONS { - HICON hIcon; // Handle to icon - DWORD dwWidth; // Width of icon - DWORD dwHeight; // Height of icon - } STRUCT_ICONS; -#pragma pack() - -#pragma pack(1) - typedef struct _STRUCT_BITMAPS { - HBITMAP hBitmap; // Handle to bitmap - DWORD dwWidth; // Width of bitmap - DWORD dwHeight; // Height of bitmap - HBITMAP hMask; // Handle to mask bitmap - COLORREF crTransparent; // Transparent color - } STRUCT_BITMAPS; -#pragma pack() - - STRUCT_ICONS m_csIcons[2]; - STRUCT_BITMAPS m_csBitmaps[2]; - - CDC m_dcBk; - CBitmap m_bmpBk; - CBitmap * m_pbmpOldBk; - - BOOL m_bIsDefault; - BOOL m_bIsCheckBox; - int m_nCheck; - - TCHAR m_szURL[_MAX_PATH]; - - DECLARE_MESSAGE_MAP() -}; - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. diff --git a/src/tool/Launcher/CButtonST_DemoDlg.h b/src/tool/Launcher/CButtonST_DemoDlg.h deleted file mode 100644 index 6b05e02f..00000000 --- a/src/tool/Launcher/CButtonST_DemoDlg.h +++ /dev/null @@ -1,43 +0,0 @@ -#pragma once - -#include "BtnST.h" -#include "MyTabCtrl.h" -#include "HyperLink.h" - -class CCButtonST_DemoDlg : public CDialog { - public: - CCButtonST_DemoDlg(CWnd * pParent = NULL); - - //{{AFX_DATA(CCButtonST_DemoDlg) - enum { - IDD = IDD_CBUTTONST_DEMO_DIALOG - }; - // NOTE: the ClassWizard will add data members here - //}}AFX_DATA - - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CCButtonST_DemoDlg) - protected: - virtual void DoDataExchange(CDataExchange * pDX); - //}}AFX_VIRTUAL - - protected: - HICON m_hIcon; - - // Generated message map functions - //{{AFX_MSG(CCButtonST_DemoDlg) - virtual BOOL OnInitDialog(); - //}}AFX_MSG - - private: - CButtonST m_btnClose; - - CMyTabCtrl m_tabMyTabCtrl; - CHyperLink m_EMailLink; - CHyperLink m_HomePageLink; - - DECLARE_MESSAGE_MAP() -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. From 66220682917079ee270b2e9145df1ef38eff002f Mon Sep 17 00:00:00 2001 From: Steve Williams <90905675+stevewgr@users.noreply.github.com> Date: Mon, 11 Nov 2024 21:53:51 -0500 Subject: [PATCH 4/7] Remove unused Windows based ShellTree implementation. --- src/server/LoginServer/LoginServer.vcxproj | 2 - .../LoginServer/LoginServer.vcxproj.filters | 6 - src/server/LoginServer/ShellTree.cpp | 1153 ----------------- src/server/LoginServer/ShellTree.h | 114 -- src/tool/N3Indoor/N3Indoor.vcxproj | 2 - src/tool/N3Indoor/N3Indoor.vcxproj.filters | 6 - src/tool/N3Indoor/ShellTree.cpp | 1153 ----------------- src/tool/N3Indoor/ShellTree.h | 114 -- src/tool/N3ME/N3ME.vcxproj | 2 - src/tool/N3ME/N3ME.vcxproj.filters | 6 - src/tool/N3ME/ShellTree.cpp | 1153 ----------------- src/tool/N3ME/ShellTree.h | 114 -- src/tool/N3Viewer/N3Viewer.vcxproj | 2 - src/tool/N3Viewer/N3Viewer.vcxproj.filters | 6 - src/tool/N3Viewer/ShellTree.cpp | 1153 ----------------- src/tool/N3Viewer/ShellTree.h | 114 -- 16 files changed, 5100 deletions(-) delete mode 100644 src/server/LoginServer/ShellTree.cpp delete mode 100644 src/server/LoginServer/ShellTree.h delete mode 100644 src/tool/N3Indoor/ShellTree.cpp delete mode 100644 src/tool/N3Indoor/ShellTree.h delete mode 100644 src/tool/N3ME/ShellTree.cpp delete mode 100644 src/tool/N3ME/ShellTree.h delete mode 100644 src/tool/N3Viewer/ShellTree.cpp delete mode 100644 src/tool/N3Viewer/ShellTree.h diff --git a/src/server/LoginServer/LoginServer.vcxproj b/src/server/LoginServer/LoginServer.vcxproj index 0945fded..27634e19 100644 --- a/src/server/LoginServer/LoginServer.vcxproj +++ b/src/server/LoginServer/LoginServer.vcxproj @@ -125,7 +125,6 @@ - Create Create @@ -144,7 +143,6 @@ - diff --git a/src/server/LoginServer/LoginServer.vcxproj.filters b/src/server/LoginServer/LoginServer.vcxproj.filters index 39cc71ce..dcb27dd4 100644 --- a/src/server/LoginServer/LoginServer.vcxproj.filters +++ b/src/server/LoginServer/LoginServer.vcxproj.filters @@ -33,9 +33,6 @@ Source Files - - Source Files - Source Files @@ -74,9 +71,6 @@ Header Files - - Header Files - Header Files diff --git a/src/server/LoginServer/ShellTree.cpp b/src/server/LoginServer/ShellTree.cpp deleted file mode 100644 index a4a8365e..00000000 --- a/src/server/LoginServer/ShellTree.cpp +++ /dev/null @@ -1,1153 +0,0 @@ -// ShellTree.cpp : implementation file -// - -#include "StdAfx.h" -#include "ShellTree.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -CFileName::CFileName(CString szFileName) { - m_szFileName = szFileName; -} - -CFileName::~CFileName() {} - -void CFileName::SetFileName(CString szFileName) { - m_szFileName = szFileName; -} - -/***************************************************************** -* -* Function: GetFileName() -* -* Purpose: Retrieves current filename minus the path -* -* Remarks: if the filename is "c:\incoming\hello.txt", this -* function returns "hello.txt". -* -******************************************************************/ -CString CFileName::GetFileName() { - CString szFileName; - - _splitpath(m_szFileName, m_szDrive, m_szDir, m_szFname, m_szExt); - szFileName = m_szFname; - szFileName += m_szExt; - - return szFileName; -} - -/***************************************************************** -* -* Function: GetRoot() -* -* Purpose: Retrieves the path only of the current filename. -* -* Remarks: if the filename is "c:\incoming\hello.txt", this -* function returns "c:\incoming\". -* -******************************************************************/ -CString CFileName::GetRoot() { - CString szFileName; - - _splitpath(m_szFileName, m_szDrive, m_szDir, m_szFname, m_szExt); - szFileName = m_szDrive; - szFileName += m_szDir; - - return szFileName; -} - -/***************************************************************** -* -* Function: GetFileTitle() -* -* Purpose: Retrieves the title of the filename excluding -* the path and extension. -* -* Remarks: if the filename is "c:\incoming\hello.txt", this -* function returns "hello". -* -******************************************************************/ -CString CFileName::GetFileTitle() { - CString szFileName; - - _splitpath(m_szFileName, m_szDrive, m_szDir, m_szFname, m_szExt); - szFileName = m_szFname; - - return szFileName; -} - -/***************************************************************** -* -* Function: GetDescription() -* -* Purpose: Returns the description of the file -* -******************************************************************/ -CString CFileName::GetDescription() { - CString szTypeName; - SHFILEINFO sfi; - - SHGetFileInfo(m_szFileName, 0, &sfi, sizeof(SHFILEINFO), SHGFI_TYPENAME); - - szTypeName = sfi.szTypeName; - - return szTypeName; -} - -/***************************************************************** -* -* Function: Exists() -* -* Purpose: Determines whether a file or directory exists. -* -******************************************************************/ -bool CFileName::Exist() { - WIN32_FIND_DATA fd; - - CString szFindPath = m_szFileName; - int nSlash = szFindPath.ReverseFind('\\'); - - if (nSlash == szFindPath.GetLength() - 1) { - szFindPath = szFindPath.Left(nSlash); - } - - HANDLE hFind = FindFirstFile(szFindPath, &fd); - - if (hFind != INVALID_HANDLE_VALUE) { - FindClose(hFind); - } - - return hFind != INVALID_HANDLE_VALUE; -} - -LPITEMIDLIST CShellPidl::Next(LPCITEMIDLIST pidl) { - LPSTR lpMem = (LPSTR)pidl; - - lpMem += pidl->mkid.cb; - - return (LPITEMIDLIST)lpMem; -} - -/**************************************************************************** -* -* FUNCTION: GetSize(LPCITEMIDLIST pidl) -* -* PURPOSE: Gets the size of the PIDL -* -****************************************************************************/ -UINT CShellPidl::GetSize(LPCITEMIDLIST pidl) { - UINT cbTotal = 0; - if (pidl) { - cbTotal += sizeof(pidl->mkid.cb); // Null terminator - while (pidl->mkid.cb) { - cbTotal += pidl->mkid.cb; - pidl = Next(pidl); - } - } - - return cbTotal; -} - -/**************************************************************************** -* -* FUNCTION: CreatePidl(UINT cbSize) -* -* PURPOSE: Allocates a PIDL -* -****************************************************************************/ -LPITEMIDLIST CShellPidl::CreatePidl(UINT cbSize) { - LPMALLOC lpMalloc; - HRESULT hr; - LPITEMIDLIST pidl = NULL; - - hr = SHGetMalloc(&lpMalloc); - - if (FAILED(hr)) { - return 0; - } - - pidl = (LPITEMIDLIST)lpMalloc->Alloc(cbSize); - - if (pidl) { - memset(pidl, 0, cbSize); // zero-init for external task alloc - } - - if (lpMalloc) { - lpMalloc->Release(); - } - - return pidl; -} - -/**************************************************************************** -* -* FUNCTION: ConcatPidls(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) -* -* PURPOSE: Concatenates two PIDLs -* -****************************************************************************/ -LPITEMIDLIST CShellPidl::ConcatPidls(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) { - LPITEMIDLIST pidlNew; - UINT cb1; - UINT cb2; - - if (pidl1) { //May be NULL - cb1 = GetSize(pidl1) - sizeof(pidl1->mkid.cb); - } else { - cb1 = 0; - } - - cb2 = GetSize(pidl2); - - pidlNew = CreatePidl(cb1 + cb2); - if (pidlNew) { - if (pidl1) { - memcpy(pidlNew, pidl1, cb1); - } - memcpy(((LPSTR)pidlNew) + cb1, pidl2, cb2); - } - return pidlNew; -} - -/**************************************************************************** -* -* FUNCTION: CopyITEMID(LPMALLOC lpMalloc, LPITEMIDLIST lpi) -* -* PURPOSE: Copies the ITEMID -* -****************************************************************************/ -LPITEMIDLIST CShellPidl::CopyITEMID(LPMALLOC lpMalloc, LPITEMIDLIST lpi) { - LPITEMIDLIST lpiTemp; - - lpiTemp = (LPITEMIDLIST)lpMalloc->Alloc(lpi->mkid.cb + sizeof(lpi->mkid.cb)); - CopyMemory((PVOID)lpiTemp, (CONST VOID *)lpi, lpi->mkid.cb + sizeof(lpi->mkid.cb)); - - return lpiTemp; -} - -/**************************************************************************** -* -* FUNCTION: GetName(LPSHELLFOLDER lpsf,LPITEMIDLIST lpi,DWORD dwFlags, -* LPSTR lpFriendlyName) -* -* PURPOSE: Gets the friendly name for the folder -* -****************************************************************************/ -BOOL CShellPidl::GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi, DWORD dwFlags, LPSTR lpFriendlyName) { - BOOL bSuccess = TRUE; - STRRET str; - - if (NOERROR == lpsf->GetDisplayNameOf(lpi, dwFlags, &str)) { - switch (str.uType) { - case STRRET_WSTR: - - WideCharToMultiByte(CP_ACP, // CodePage - 0, // dwFlags - str.pOleStr, // lpWideCharStr - -1, // cchWideChar - lpFriendlyName, // lpMultiByteStr - MAX_PATH, - //sizeof(lpFriendlyName), // cchMultiByte, wrong. sizeof on a pointer, psk, psk - NULL, // lpDefaultChar, - NULL); // lpUsedDefaultChar - - break; - - case STRRET_OFFSET: - - lstrcpy(lpFriendlyName, (LPSTR)lpi + str.uOffset); - break; - - case STRRET_CSTR: - - lstrcpy(lpFriendlyName, (LPSTR)str.cStr); - break; - - default: - bSuccess = FALSE; - break; - } - } else { - bSuccess = FALSE; - } - - return bSuccess; -} - -/**************************************************************************** -* -* FUNCTION: GetFullyQualPidl(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi) -* -* PURPOSE: Gets the Fully qualified Pidls for the folder -* -****************************************************************************/ -LPITEMIDLIST CShellPidl::GetFullyQualPidl(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi) { - char szBuff[MAX_PATH]; - OLECHAR szOleChar[MAX_PATH]; - LPSHELLFOLDER lpsfDeskTop; - LPITEMIDLIST lpifq; - ULONG ulEaten, ulAttribs; - HRESULT hr; - - if (!GetName(lpsf, lpi, SHGDN_FORPARSING, szBuff)) { - return NULL; - } - - hr = SHGetDesktopFolder(&lpsfDeskTop); - - if (FAILED(hr)) { - return NULL; - } - - MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szBuff, -1, (WCHAR *)szOleChar, sizeof(szOleChar)); - - hr = lpsfDeskTop->ParseDisplayName(NULL, NULL, szOleChar, &ulEaten, &lpifq, &ulAttribs); - - lpsfDeskTop->Release(); - - if (FAILED(hr)) { - return NULL; - } - - return lpifq; -} - -/**************************************************************************** -* -* FUNCTION: DoTheMenuThing(HWND hwnd, -* LPSHELLFOLDER lpsfParent, -* LPITEMIDLIST lpi, -* LPPOINT lppt) -* -* PURPOSE: Displays a popup context menu, given a parent shell folder, -* relative item id and screen location. -* -* PARAMETERS: -* hwnd - Parent window handle -* lpsfParent - Pointer to parent shell folder. -* lpi - Pointer to item id that is relative to lpsfParent -* lppt - Screen location of where to popup the menu. -* -* RETURN VALUE: -* Returns TRUE on success, FALSE on failure -* -****************************************************************************/ -BOOL CShellPidl::DoTheMenuThing(HWND hwnd, LPSHELLFOLDER lpsfParent, LPITEMIDLIST lpi, LPPOINT lppt) { - LPCONTEXTMENU lpcm; - HRESULT hr; - char szTemp[64]; - CMINVOKECOMMANDINFO cmi; - DWORD dwAttribs = 0; - int idCmd; - HMENU hMenu; - BOOL bSuccess = TRUE; - - hr = lpsfParent->GetUIObjectOf(hwnd, - 1, //Number of objects to get attributes of - (const struct _ITEMIDLIST **)&lpi, IID_IContextMenu, 0, (LPVOID *)&lpcm); - if (SUCCEEDED(hr)) { - hMenu = CreatePopupMenu(); - - if (hMenu) { - hr = lpcm->QueryContextMenu(hMenu, 0, 1, 0x7fff, CMF_EXPLORE); - if (SUCCEEDED(hr)) { - idCmd = TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RETURNCMD | TPM_RIGHTBUTTON, lppt->x, lppt->y, 0, - hwnd, NULL); - - if (idCmd) { - cmi.cbSize = sizeof(CMINVOKECOMMANDINFO); - cmi.fMask = 0; - cmi.hwnd = hwnd; - cmi.lpVerb = MAKEINTRESOURCE(idCmd - 1); - cmi.lpParameters = NULL; - cmi.lpDirectory = NULL; - cmi.nShow = SW_SHOWNORMAL; - cmi.dwHotKey = 0; - cmi.hIcon = NULL; - hr = lpcm->InvokeCommand(&cmi); - if (!SUCCEEDED(hr)) { - wsprintf(szTemp, "InvokeCommand failed. hr=%lx", hr); - AfxMessageBox(szTemp); - } - } - - } else { - bSuccess = FALSE; - } - - DestroyMenu(hMenu); - } else { - bSuccess = FALSE; - } - - lpcm->Release(); - } else { - wsprintf(szTemp, "GetUIObjectOf failed! hr=%lx", hr); - AfxMessageBox(szTemp); - bSuccess = FALSE; - } - return bSuccess; -} - -/**************************************************************************** -* -* FUNCTION: GetIcon(LPITEMIDLIST lpi, UINT uFlags) -* -* PURPOSE: Gets the index for the current icon. Index is index into system -* image list. -* -* PARAMETERS: -* lpi - Fully qualified item id list for current item. -* uFlags - Flags for SHGetFileInfo() -* -* RETURN VALUE: -* Icon index for current item. -****************************************************************************/ -int CShellPidl::GetItemIcon(LPITEMIDLIST lpi, UINT uFlags) { - SHFILEINFO sfi; - - SHGetFileInfo((LPCSTR)lpi, 0, &sfi, sizeof(SHFILEINFO), uFlags); - - return sfi.iIcon; -} - -CShellTree::CShellTree() {} - -CShellTree::~CShellTree() {} - -BEGIN_MESSAGE_MAP(CShellTree, CTreeCtrl) -//{{AFX_MSG_MAP(CShellTree) -//}}AFX_MSG_MAP -END_MESSAGE_MAP() - -/**************************************************************************** -* -* FUNCTION: PopulateTree() -* -* PURPOSE: Processes the File.Fill/RefreshTree command -* -****************************************************************************/ -void CShellTree::PopulateTree() { - LPSHELLFOLDER lpsf = NULL; - LPITEMIDLIST lpi = NULL; - HRESULT hr; - TV_SORTCB tvscb; - - // Get a pointer to the desktop folder. - hr = SHGetDesktopFolder(&lpsf); - - if (SUCCEEDED(hr)) { - // Initialize the tree view to be empty. - DeleteAllItems(); - - // Fill in the tree view from the root. - FillTreeView(lpsf, NULL, TVI_ROOT); - //TunnelFillTree(lpsf, NULL, TVI_ROOT); - // Release the folder pointer. - lpsf->Release(); - } - tvscb.hParent = TVI_ROOT; - tvscb.lParam = 0; - tvscb.lpfnCompare = TreeViewCompareProc; - - // Sort the items in the tree view - SortChildrenCB(&tvscb /*, FALSE*/); - - HTREEITEM hItem; - hItem = GetRootItem(); - Expand(hItem, TVE_EXPAND); - Select(GetRootItem(), TVGN_CARET); -} - -/**************************************************************************** -* -* FUNCTION: PopulateTree() -* -* PURPOSE: Processes the File.Fill/RefreshTree command -* This overload has the ability to open from a -* special folderlocation like SHBrowseForFolder() -* -* WARNING: TunnelTree() will not work if you use a special -* folderlocation -* -****************************************************************************/ -void CShellTree::PopulateTree(int nFolder) { - LPSHELLFOLDER lpsf = NULL, lpsf2 = NULL; - LPITEMIDLIST lpi = NULL; - HRESULT hr; - TV_SORTCB tvscb; - - // Get a pointer to the desktop folder. - hr = SHGetDesktopFolder(&lpsf); - - if (SUCCEEDED(hr)) { - // Initialize the tree view to be empty. - DeleteAllItems(); - - if (!SUCCEEDED(SHGetSpecialFolderLocation(m_hWnd, nFolder, &lpi))) { - lpi = NULL; - FillTreeView(lpsf, NULL, TVI_ROOT); - } else { - hr = lpsf->BindToObject(lpi, 0, IID_IShellFolder, (LPVOID *)&lpsf2); - - if (SUCCEEDED(hr)) { - // Fill in the tree view from the root. - FillTreeView(lpsf2, lpi, TVI_ROOT); - lpsf2->Release(); - } else { - FillTreeView(lpsf, NULL, TVI_ROOT); - } - } - - // Release the folder pointer. - lpsf->Release(); - } - tvscb.hParent = TVI_ROOT; - tvscb.lParam = 0; - tvscb.lpfnCompare = TreeViewCompareProc; - - // Sort the items in the tree view - SortChildrenCB(&tvscb /*, FALSE*/); - - HTREEITEM hItem; - hItem = GetRootItem(); - Expand(hItem, TVE_EXPAND); - Select(GetRootItem(), TVGN_CARET); -} - -/**************************************************************************** -* -* FUNCTION: FillTreeView( LPSHELLFOLDER lpsf, -* LPITEMIDLIST lpifq, -* HTREEITEM hParent) -* -* PURPOSE: Fills a branch of the TreeView control. Given the -* shell folder, enumerate the subitems of this folder, -* and add the appropriate items to the tree. -* -* PARAMETERS: -* lpsf - Pointer to shell folder that we want to enumerate items -* lpifq - Fully qualified item id list to the item that we are enumerating -* items for. In other words, this is the PIDL to the item -* identified by the lpsf parameter. -* hParent - Parent node -* -* COMMENTS: -* This function enumerates the items in the folder identifed by lpsf. -* Note that since we are filling the left hand pane, we will only add -* items that are folders and/or have sub-folders. We *could* put all -* items in here if we wanted, but that's not the intent. -* -****************************************************************************/ -void CShellTree::FillTreeView(LPSHELLFOLDER lpsf, LPITEMIDLIST lpifq, HTREEITEM hParent) { - TV_ITEM tvi; // TreeView Item. - TV_INSERTSTRUCT tvins; // TreeView Insert Struct. - HTREEITEM hPrev = NULL; // Previous Item Added. - LPSHELLFOLDER lpsf2 = NULL; - LPENUMIDLIST lpe = NULL; - LPITEMIDLIST lpi = NULL, lpiTemp = NULL, lpifqThisItem = NULL; - LPTVITEMDATA lptvid = NULL; - LPMALLOC lpMalloc = NULL; - ULONG ulFetched; - UINT uCount = 0; - HRESULT hr; - char szBuff[256]; - HWND hwnd = ::GetParent(m_hWnd); - - // Allocate a shell memory object. - hr = ::SHGetMalloc(&lpMalloc); - if (FAILED(hr)) { - return; - } - - if (SUCCEEDED(hr)) { - // Get the IEnumIDList object for the given folder. - hr = lpsf->EnumObjects(hwnd, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS, &lpe); - - if (SUCCEEDED(hr)) { - // Enumerate throught the list of folder and non-folder objects. - while (S_OK == lpe->Next(1, &lpi, &ulFetched)) { - //Create a fully qualified path to the current item - //The SH* shell api's take a fully qualified path pidl, - //(see GetIcon above where I call SHGetFileInfo) whereas the - //interface methods take a relative path pidl. - ULONG ulAttrs = SFGAO_HASSUBFOLDER | SFGAO_FOLDER; - - // Determine what type of object we have. - lpsf->GetAttributesOf(1, (const struct _ITEMIDLIST **)&lpi, &ulAttrs); - - if (ulAttrs & (SFGAO_HASSUBFOLDER | SFGAO_FOLDER)) { - //We need this next if statement so that we don't add things like - //the MSN to our tree. MSN is not a folder, but according to the - //shell it has subfolders. - if (ulAttrs & SFGAO_FOLDER) { - tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; - - if (ulAttrs & SFGAO_HASSUBFOLDER) { - //This item has sub-folders, so let's put the + in the TreeView. - //The first time the user clicks on the item, we'll populate the - //sub-folders. - tvi.cChildren = 1; - tvi.mask |= TVIF_CHILDREN; - } - - //OK, let's get some memory for our ITEMDATA struct - lptvid = (LPTVITEMDATA)lpMalloc->Alloc(sizeof(TVITEMDATA)); - if (!lptvid) { - goto Done; // Error - could not allocate memory. - } - - //Now get the friendly name that we'll put in the treeview. - if (!GetName(lpsf, lpi, SHGDN_NORMAL, szBuff)) { - goto Done; // Error - could not get friendly name. - } - - tvi.pszText = szBuff; - tvi.cchTextMax = MAX_PATH; - - lpifqThisItem = ConcatPidls(lpifq, lpi); - - //Now, make a copy of the ITEMIDLIST - lptvid->lpi = CopyITEMID(lpMalloc, lpi); - - GetNormalAndSelectedIcons(lpifqThisItem, &tvi); - - lptvid->lpsfParent = lpsf; //Store the parent folders SF - lpsf->AddRef(); - - lptvid->lpifq = ConcatPidls(lpifq, lpi); - - tvi.lParam = (LPARAM)lptvid; - - // Populate the TreeVeiw Insert Struct - // The item is the one filled above. - // Insert it after the last item inserted at this level. - // And indicate this is a root entry. - tvins.item = tvi; - tvins.hInsertAfter = hPrev; - tvins.hParent = hParent; - - // Add the item to the tree - hPrev = InsertItem(&tvins); - } - // Free this items task allocator. - lpMalloc->Free(lpifqThisItem); - lpifqThisItem = 0; - } - - lpMalloc->Free(lpi); //Free the pidl that the shell gave us. - lpi = 0; - } - } - - } else { - return; - } - -Done: - - if (lpe) { - lpe->Release(); - } - - //The following 2 if statements will only be TRUE if we got here on an - //error condition from the "goto" statement. Otherwise, we free this memory - //at the end of the while loop above. - if (lpi && lpMalloc) { - lpMalloc->Free(lpi); - } - if (lpifqThisItem && lpMalloc) { - lpMalloc->Free(lpifqThisItem); - } - - if (lpMalloc) { - lpMalloc->Release(); - } -} - -/**************************************************************************** -* -* FUNCTION: GetNormalAndSelectedIcons(LPITEMIDLIST lpifq, LPTV_ITEM lptvitem) -* -* PURPOSE: Gets the index for the normal and selected icons for the current item. -* -* PARAMETERS: -* lpifq - Fully qualified item id list for current item. -* lptvitem - Pointer to treeview item we are about to add to the tree. -* -****************************************************************************/ -void CShellTree::GetNormalAndSelectedIcons(LPITEMIDLIST lpifq, LPTV_ITEM lptvitem) { - //Note that we don't check the return value here because if GetIcon() - //fails, then we're in big trouble... - - lptvitem->iImage = GetItemIcon(lpifq, SHGFI_PIDL | SHGFI_SYSICONINDEX | SHGFI_SMALLICON); - - lptvitem->iSelectedImage = GetItemIcon(lpifq, SHGFI_PIDL | SHGFI_SYSICONINDEX | SHGFI_SMALLICON | SHGFI_OPENICON); - - return; -} - -/**************************************************************************** -* -* FUNCTION: TreeViewCompareProc(LPARAM, LPARAM, LPARAM) -* -* PURPOSE: Callback routine for sorting the tree -* -****************************************************************************/ -int CALLBACK CShellTree::TreeViewCompareProc(LPARAM lparam1, LPARAM lparam2, LPARAM lparamSort) { - LPTVITEMDATA lptvid1 = (LPTVITEMDATA)lparam1; - LPTVITEMDATA lptvid2 = (LPTVITEMDATA)lparam2; - HRESULT hr; - - hr = lptvid1->lpsfParent->CompareIDs(0, lptvid1->lpi, lptvid2->lpi); - - if (FAILED(hr)) { - return 0; - } - - return (short)SCODE_CODE(GetScode(hr)); -} - -///////////////////////////////////////////////////////////////////////////// -// CShellTree message handlers - -/**************************************************************************** -* -* FUNCTION: OnFolderExpanding(NMHDR* pNMHDR, LRESULT* pResult) -* -* PURPOSE: Reponds to an TVN_ITEMEXPANDING message in order to fill up -* subdirectories. Pass the parameters from OnItemExpanding() to -* this function. You need to do that or your folders won't -* expand. -* -* OTHER: It can also be used to update a corresponding listview. Seem MFCENUM -* -* MESSAGEMAP: TVN_ITEMEXPANDING -* -****************************************************************************/ -void CShellTree::OnFolderExpanding(NMHDR * pNMHDR, LRESULT * pResult) { - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - HRESULT hr; - LPSHELLFOLDER lpsf2 = NULL; - static char szBuff[MAX_PATH]; - TV_SORTCB tvscb; - - NM_TREEVIEW * pnmtv = (NM_TREEVIEW *)pNMHDR; - // TODO: Add your control notification handler code here - if ((pnmtv->itemNew.state & TVIS_EXPANDEDONCE)) { - return; - } - - lptvid = (LPTVITEMDATA)pnmtv->itemNew.lParam; - if (lptvid) { - hr = lptvid->lpsfParent->BindToObject(lptvid->lpi, 0, IID_IShellFolder, (LPVOID *)&lpsf2); - - if (SUCCEEDED(hr)) { - FillTreeView(lpsf2, lptvid->lpifq, pnmtv->itemNew.hItem); - } - - tvscb.hParent = pnmtv->itemNew.hItem; - tvscb.lParam = 0; - tvscb.lpfnCompare = TreeViewCompareProc; - - SortChildrenCB(&tvscb /*, FALSE*/); - } - - *pResult = 0; -} - -/**************************************************************************** -* -* FUNCTION: GetContextMenu(NMHDR* pNMHDR, LRESULT* pResult) -* -* PURPOSE: Diplays a popup menu for the folder selected. Pass the -* parameters from Rclick() to this function. -* -* MESSAGEMAP: NM_RCLICK; -* -****************************************************************************/ -void CShellTree::GetContextMenu(NMHDR * pNMHDR, LRESULT * pResult) { - // TODO: Add your control notification handler code here - POINT pt; - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - LPSHELLFOLDER lpsf2 = NULL; - static char szBuff[MAX_PATH]; - TV_HITTESTINFO tvhti; - TV_ITEM tvi; - - // TODO: Add your control notification handler code here - ::GetCursorPos((LPPOINT)&pt); - ScreenToClient(&pt); - tvhti.pt = pt; - HitTest(&tvhti); - SelectItem(tvhti.hItem); - if (tvhti.flags & (TVHT_ONITEMLABEL | TVHT_ONITEMICON)) { - ClientToScreen(&pt); - tvi.mask = TVIF_PARAM; - tvi.hItem = tvhti.hItem; - - if (!GetItem(&tvi)) { - return; - } - - lptvid = (LPTVITEMDATA)tvi.lParam; - - DoTheMenuThing(::GetParent(m_hWnd), lptvid->lpsfParent, lptvid->lpi, &pt); - } - - *pResult = 0; -} - -/**************************************************************************** -* -* FUNCTION: OnFolderSelected(NMHDR* pNMHDR, LRESULT* pResult, CString &szFolderPath) -* -* PURPOSE: Call this function if for example you want to put the path of the folder -* selected inside a combobox or an edit window. You would pass the -* parameters from OnSelChanged() to this function along with a CString object -* that will hold the folder path. If the path is not -* in the filesystem(eg MyComputer) it returns false. -* -* MESSAGEMAP: TVN_SELCHANGED -* -****************************************************************************/ -BOOL CShellTree::OnFolderSelected(NMHDR * pNMHDR, LRESULT * pResult, CString & szFolderPath) { - // TODO: Add your control notification handler code here - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - LPSHELLFOLDER lpsf2 = NULL; - static char szBuff[MAX_PATH]; - HRESULT hr; - BOOL bRet = false; - TV_SORTCB tvscb; - HTREEITEM hItem = NULL; - - if ((hItem = GetSelectedItem())) { - lptvid = (LPTVITEMDATA)GetItemData(hItem); - - if (lptvid && lptvid->lpsfParent && lptvid->lpi) { - hr = lptvid->lpsfParent->BindToObject(lptvid->lpi, 0, IID_IShellFolder, (LPVOID *)&lpsf2); - - if (SUCCEEDED(hr)) { - ULONG ulAttrs = SFGAO_FILESYSTEM; - - // Determine what type of object we have. - lptvid->lpsfParent->GetAttributesOf(1, (const struct _ITEMIDLIST **)&lptvid->lpi, &ulAttrs); - - if (ulAttrs & (SFGAO_FILESYSTEM)) { - if (SHGetPathFromIDList(lptvid->lpifq, szBuff)) { - szFolderPath = szBuff; - bRet = true; - } - } - //non standard from here(NEW CODE) - NM_TREEVIEW * pnmtv = (NM_TREEVIEW *)pNMHDR; - if ((pnmtv->itemNew.cChildren == 1) && !(pnmtv->itemNew.state & TVIS_EXPANDEDONCE)) { - FillTreeView(lpsf2, lptvid->lpifq, pnmtv->itemNew.hItem); - - tvscb.hParent = pnmtv->itemNew.hItem; - tvscb.lParam = 0; - tvscb.lpfnCompare = TreeViewCompareProc; - SortChildrenCB(&tvscb); - - pnmtv->itemNew.state |= TVIS_EXPANDEDONCE; - pnmtv->itemNew.stateMask |= TVIS_EXPANDEDONCE; - pnmtv->itemNew.mask |= TVIF_STATE; - SetItem(&pnmtv->itemNew); - } - } - } - if (lpsf2) { - lpsf2->Release(); - } - } - *pResult = 0; - return bRet; -} - -/**************************************************************************** -* -* FUNCTION: OnDeleteShellItem(NMHDR* pNMHDR, LRESULT* pResult) -* -* PURPOSE: Releases the memory allocated by the shell folders -* -* MESSAGEMAP: TVN_DELETEITEM -* -* MISC: failure to call this function will result in a memory leak -* -****************************************************************************/ -void CShellTree::OnDeleteShellItem(NMHDR * pNMHDR, LRESULT * pResult) { - LPTVITEMDATA lptvid = NULL; - HRESULT hr; - LPMALLOC lpMalloc; - - NM_TREEVIEW * pNMTreeView = (NM_TREEVIEW *)pNMHDR; - - //Let's free the memory for the TreeView item data... - hr = SHGetMalloc(&lpMalloc); - if (FAILED(hr)) { - return; - } - - lptvid = (LPTVITEMDATA)pNMTreeView->itemOld.lParam; - lptvid->lpsfParent->Release(); - lpMalloc->Free(lptvid->lpi); - lpMalloc->Free(lptvid->lpifq); - lpMalloc->Free(lptvid); - lpMalloc->Release(); -} - -/**************************************************************************** -* -* FUNCTION: EnableImages() -* -* PURPOSE: Obtains a handle to the system image list and attaches it -* to the tree control. DO NOT DELETE the imagelist -* -* MESSAGEMAP: NONE -* -****************************************************************************/ -void CShellTree::EnableImages() { - // Get the handle to the system image list, for our icons - HIMAGELIST hImageList; - SHFILEINFO sfi; - - hImageList = - (HIMAGELIST)SHGetFileInfo((LPCSTR) "C:\\", 0, &sfi, sizeof(SHFILEINFO), SHGFI_SYSICONINDEX | SHGFI_SMALLICON); - - // Attach ImageList to TreeView - if (hImageList) { - ::SendMessage(m_hWnd, TVM_SETIMAGELIST, (WPARAM)TVSIL_NORMAL, (LPARAM)hImageList); - } -} - -/**************************************************************************** -* -* FUNCTION: GetSelectedFolderPath(CString &szFolderPath) -* -* PURPOSE: Retrieves the path of the currently selected string. -* Pass a CString object that will hold the folder path. -* If the path is not in the filesystem(eg MyComputer) -* or none is selected it returns false. -* -* MESSAGEMAP: NONE -* -****************************************************************************/ -BOOL CShellTree::GetSelectedFolderPath(CString & szFolderPath) { - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - LPSHELLFOLDER lpsf2 = NULL; - static char szBuff[MAX_PATH]; - HTREEITEM hItem = NULL; - HRESULT hr; - BOOL bRet = false; - - if ((hItem = GetSelectedItem())) { - lptvid = (LPTVITEMDATA)GetItemData(hItem); - - if (lptvid && lptvid->lpsfParent && lptvid->lpi) { - hr = lptvid->lpsfParent->BindToObject(lptvid->lpi, 0, IID_IShellFolder, (LPVOID *)&lpsf2); - - if (SUCCEEDED(hr)) { - ULONG ulAttrs = SFGAO_FILESYSTEM; - - // Determine what type of object we have. - lptvid->lpsfParent->GetAttributesOf(1, (const struct _ITEMIDLIST **)&lptvid->lpi, &ulAttrs); - - if (ulAttrs & (SFGAO_FILESYSTEM)) { - if (SHGetPathFromIDList(lptvid->lpifq, szBuff)) { - szFolderPath = szBuff; - bRet = true; - } - } - } - } - if (lpsf2) { - lpsf2->Release(); - } - } - return bRet; -} - -/**************************************************************************** -* -* FUNCTION: GetParentShellFolder(HTREEITEM folderNode) -* -* PURPOSE: Retrieves the pointer to the ISHELLFOLDER interface -* of the tree node passed as the paramter. -* -* MESSAGEMAP: NONE -* -****************************************************************************/ -LPSHELLFOLDER CShellTree::GetParentShellFolder(HTREEITEM folderNode) { - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - - lptvid = (LPTVITEMDATA)GetItemData(folderNode); - if (lptvid) { - return lptvid->lpsfParent; - } else { - return NULL; - } -} - -/**************************************************************************** -* -* FUNCTION: GetRelativeIDLIST(HTREEITEM folderNode) -* -* PURPOSE: Retrieves the Pointer to an ITEMIDLIST structure that -* identifies the subfolder relative to its parent folder. -* see GetParentShellFolder(); -* -* MESSAGEMAP: NONE -* -****************************************************************************/ -LPITEMIDLIST CShellTree::GetRelativeIDLIST(HTREEITEM folderNode) { - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - - lptvid = (LPTVITEMDATA)GetItemData(folderNode); - if (lptvid) { - return lptvid->lpifq; - } else { - return NULL; - } -} - -/**************************************************************************** -* -* FUNCTION: GetFullyQualifiedIDLIST(HTREEITEM folderNode) -* -* PURPOSE: Retrieves the Retrieves the Pointer to an ITEMIDLIST -* structure that identifies the subfolder relative to the -* desktop. This is a fully qualified Item Identifier -* -* MESSAGEMAP: NONE -* -****************************************************************************/ -LPITEMIDLIST CShellTree::GetFullyQualifiedID(HTREEITEM folderNode) { - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - - lptvid = (LPTVITEMDATA)GetItemData(folderNode); - if (lptvid) { - return lptvid->lpifq; - } else { - return NULL; - } -} - -/**************************************************************************** -* -* FUNCTION: SearchTree( HTREEITEM treeNode, -* CString szSearchName ) -* -* PURPOSE: Too crude to explain, just use it -* -* WARNING: Only works if you use the default PopulateTree() -* Not guaranteed to work on any future or existing -* version of windows. Use with caution. Pretty much -* ok if you're using on local drives -* -****************************************************************************/ -bool CShellTree::SearchTree(HTREEITEM treeNode, CString szSearchName, FindAttribs attr) { - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - LPSHELLFOLDER lpsf2 = NULL; - char drive[_MAX_DRIVE]; - char dir[_MAX_DIR]; - char fname[_MAX_FNAME]; - char ext[_MAX_EXT]; - bool bRet = false; - HRESULT hr; - CString szCompare; - - szSearchName.MakeUpper(); - while (treeNode && bRet == false) { - lptvid = (LPTVITEMDATA)GetItemData(treeNode); - if (lptvid && lptvid->lpsfParent && lptvid->lpi) { - hr = lptvid->lpsfParent->BindToObject(lptvid->lpi, 0, IID_IShellFolder, (LPVOID *)&lpsf2); - if (SUCCEEDED(hr)) { - ULONG ulAttrs = SFGAO_FILESYSTEM; - lptvid->lpsfParent->GetAttributesOf(1, (const struct _ITEMIDLIST **)&lptvid->lpi, &ulAttrs); - if (ulAttrs & (SFGAO_FILESYSTEM)) { - if (SHGetPathFromIDList(lptvid->lpifq, szCompare.GetBuffer(MAX_PATH))) { - switch (attr) { - case type_drive: - _splitpath(szCompare, drive, dir, fname, ext); - szCompare = drive; - break; - case type_folder: - szCompare = GetItemText(treeNode); - break; - } - szCompare.MakeUpper(); - if (szCompare == szSearchName) { - EnsureVisible(treeNode); - SelectItem(treeNode); - bRet = true; - } - } - } - lpsf2->Release(); - } - } - treeNode = GetNextSiblingItem(treeNode); - } - return bRet; -} - -/**************************************************************************** -* -* FUNCTION: TunnelTree(CString szFindPath) -* -* PURPOSE: Too crude to explain, just use it -* -* WARNING: Only works if you use the default PopulateTree() -* Not guaranteed to work on any future or existing -* version of windows. Use with caution. Pretty much -* ok if you're using on local drives -* -****************************************************************************/ -void CShellTree::TunnelTree(CString szFindPath) { - HTREEITEM subNode = GetRootItem(); - CString szPathHop; - char drive[_MAX_DRIVE]; - char dir[_MAX_DIR]; - char fname[_MAX_FNAME]; - char ext[_MAX_EXT]; - char delimiter[] = "\\"; - - CFileName checkPath(szFindPath); - if (!checkPath.Exist()) { - MessageBox(szFindPath, "Folder not found", MB_ICONERROR); - return; - } - - if (szFindPath.ReverseFind('\\') != szFindPath.GetLength() - 1) { - szFindPath += "\\"; - } - - _splitpath(szFindPath, drive, dir, fname, ext); - - //search the drive first - szPathHop = drive; - subNode = GetChildItem(subNode); - if (subNode) { - if (SearchTree(subNode, szPathHop, CShellTree::type_drive)) { - //break down subfolders and search - char * p = strtok(dir, delimiter); - while (p) { - subNode = GetSelectedItem(); - subNode = GetChildItem(subNode); - if (SearchTree(subNode, p, CShellTree::type_folder)) { - p = strtok(NULL, delimiter); - } else { - p = NULL; - } - } - } - } -} \ No newline at end of file diff --git a/src/server/LoginServer/ShellTree.h b/src/server/LoginServer/ShellTree.h deleted file mode 100644 index dc6b0dcb..00000000 --- a/src/server/LoginServer/ShellTree.h +++ /dev/null @@ -1,114 +0,0 @@ -#pragma once - -// ShellTree.h : header file -// - -#include - -class CFileName { - public: - CFileName(CString szFileName = ""); - virtual ~CFileName(); - - void SetFileName(CString szFileName); - CString GetFileName(); - CString GetRoot(); - CString GetFileTitle(); - CString GetDescription(); - bool Exist(); - - private: - CString m_szFileName; - char m_szDrive[_MAX_DRIVE]; - char m_szDir[_MAX_DIR]; - char m_szFname[_MAX_FNAME]; - char m_szExt[_MAX_EXT]; -}; - -class CShellPidl { - public: - // STRUCTURES - typedef struct tagLVID { - LPSHELLFOLDER lpsfParent; - LPITEMIDLIST lpi; - ULONG ulAttribs; - } LVITEMDATA, *LPLVITEMDATA; - - typedef struct tagID { - LPSHELLFOLDER lpsfParent; - LPITEMIDLIST lpi; - LPITEMIDLIST lpifq; - } TVITEMDATA, *LPTVITEMDATA; - - public: - // Functions that deal with PIDLs - LPITEMIDLIST ConcatPidls(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2); - LPITEMIDLIST GetFullyQualPidl(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi); - LPITEMIDLIST CopyITEMID(LPMALLOC lpMalloc, LPITEMIDLIST lpi); - BOOL GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi, DWORD dwFlags, LPSTR lpFriendlyName); - LPITEMIDLIST CreatePidl(UINT cbSize); - UINT GetSize(LPCITEMIDLIST pidl); - LPITEMIDLIST Next(LPCITEMIDLIST pidl); - - // Utility Functions - BOOL DoTheMenuThing(HWND hwnd, LPSHELLFOLDER lpsfParent, LPITEMIDLIST lpi, LPPOINT lppt); - int GetItemIcon(LPITEMIDLIST lpi, UINT uFlags); -}; - -class CShellTree : public CTreeCtrl, public CShellPidl { - public: - enum FindAttribs { - type_drive, - type_folder - }; - - // Construction - public: - CShellTree(); - - // Attributes - public: - BOOL m_bOutaHere; - - // Operations - public: - void PopulateTree(); - void PopulateTree(int nFolder); - void OnFolderExpanding(NMHDR * pNMHDR, LRESULT * pResult); - void GetContextMenu(NMHDR * pNMHDR, LRESULT * pResult); - BOOL OnFolderSelected(NMHDR * pNMHDR, LRESULT * pResult, CString & szFolderPath); - void OnDeleteShellItem(NMHDR * pNMHDR, LRESULT * pResult); - void EnableImages(); - BOOL GetSelectedFolderPath(CString & szFolderPath); - bool SearchTree(HTREEITEM treeNode, CString szSearchName, FindAttribs attr); - void TunnelTree(CString szFindPath); - LPSHELLFOLDER GetParentShellFolder(HTREEITEM folderNode); - LPITEMIDLIST GetRelativeIDLIST(HTREEITEM folderNode); - LPITEMIDLIST GetFullyQualifiedID(HTREEITEM folderNode); - void FindTreePidl(HTREEITEM nextNode, HTREEITEM & folderNode, LPLVITEMDATA lplvid, bool & valid); - - // Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CShellTree) - //}}AFX_VIRTUAL - - // Implementation - public: - virtual ~CShellTree(); - - // Generated message map functions - protected: - void FillTreeView(LPSHELLFOLDER lpsf, LPITEMIDLIST lpifq, HTREEITEM hParent); - void GetNormalAndSelectedIcons(LPITEMIDLIST lpifq, LPTV_ITEM lptvitem); - static int CALLBACK TreeViewCompareProc(LPARAM, LPARAM, LPARAM); - - //{{AFX_MSG(CShellTree) - //}}AFX_MSG - - DECLARE_MESSAGE_MAP() -}; - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. diff --git a/src/tool/N3Indoor/N3Indoor.vcxproj b/src/tool/N3Indoor/N3Indoor.vcxproj index cdc2a0cf..49ec9789 100644 --- a/src/tool/N3Indoor/N3Indoor.vcxproj +++ b/src/tool/N3Indoor/N3Indoor.vcxproj @@ -196,7 +196,6 @@ - @@ -274,7 +273,6 @@ - Create Create diff --git a/src/tool/N3Indoor/N3Indoor.vcxproj.filters b/src/tool/N3Indoor/N3Indoor.vcxproj.filters index 90524f53..cb7fa5bc 100644 --- a/src/tool/N3Indoor/N3Indoor.vcxproj.filters +++ b/src/tool/N3Indoor/N3Indoor.vcxproj.filters @@ -79,9 +79,6 @@ N3Indoor - - N3Indoor - N3Indoor @@ -324,9 +321,6 @@ N3Indoor - - N3Indoor - N3Indoor diff --git a/src/tool/N3Indoor/ShellTree.cpp b/src/tool/N3Indoor/ShellTree.cpp deleted file mode 100644 index a4a8365e..00000000 --- a/src/tool/N3Indoor/ShellTree.cpp +++ /dev/null @@ -1,1153 +0,0 @@ -// ShellTree.cpp : implementation file -// - -#include "StdAfx.h" -#include "ShellTree.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -CFileName::CFileName(CString szFileName) { - m_szFileName = szFileName; -} - -CFileName::~CFileName() {} - -void CFileName::SetFileName(CString szFileName) { - m_szFileName = szFileName; -} - -/***************************************************************** -* -* Function: GetFileName() -* -* Purpose: Retrieves current filename minus the path -* -* Remarks: if the filename is "c:\incoming\hello.txt", this -* function returns "hello.txt". -* -******************************************************************/ -CString CFileName::GetFileName() { - CString szFileName; - - _splitpath(m_szFileName, m_szDrive, m_szDir, m_szFname, m_szExt); - szFileName = m_szFname; - szFileName += m_szExt; - - return szFileName; -} - -/***************************************************************** -* -* Function: GetRoot() -* -* Purpose: Retrieves the path only of the current filename. -* -* Remarks: if the filename is "c:\incoming\hello.txt", this -* function returns "c:\incoming\". -* -******************************************************************/ -CString CFileName::GetRoot() { - CString szFileName; - - _splitpath(m_szFileName, m_szDrive, m_szDir, m_szFname, m_szExt); - szFileName = m_szDrive; - szFileName += m_szDir; - - return szFileName; -} - -/***************************************************************** -* -* Function: GetFileTitle() -* -* Purpose: Retrieves the title of the filename excluding -* the path and extension. -* -* Remarks: if the filename is "c:\incoming\hello.txt", this -* function returns "hello". -* -******************************************************************/ -CString CFileName::GetFileTitle() { - CString szFileName; - - _splitpath(m_szFileName, m_szDrive, m_szDir, m_szFname, m_szExt); - szFileName = m_szFname; - - return szFileName; -} - -/***************************************************************** -* -* Function: GetDescription() -* -* Purpose: Returns the description of the file -* -******************************************************************/ -CString CFileName::GetDescription() { - CString szTypeName; - SHFILEINFO sfi; - - SHGetFileInfo(m_szFileName, 0, &sfi, sizeof(SHFILEINFO), SHGFI_TYPENAME); - - szTypeName = sfi.szTypeName; - - return szTypeName; -} - -/***************************************************************** -* -* Function: Exists() -* -* Purpose: Determines whether a file or directory exists. -* -******************************************************************/ -bool CFileName::Exist() { - WIN32_FIND_DATA fd; - - CString szFindPath = m_szFileName; - int nSlash = szFindPath.ReverseFind('\\'); - - if (nSlash == szFindPath.GetLength() - 1) { - szFindPath = szFindPath.Left(nSlash); - } - - HANDLE hFind = FindFirstFile(szFindPath, &fd); - - if (hFind != INVALID_HANDLE_VALUE) { - FindClose(hFind); - } - - return hFind != INVALID_HANDLE_VALUE; -} - -LPITEMIDLIST CShellPidl::Next(LPCITEMIDLIST pidl) { - LPSTR lpMem = (LPSTR)pidl; - - lpMem += pidl->mkid.cb; - - return (LPITEMIDLIST)lpMem; -} - -/**************************************************************************** -* -* FUNCTION: GetSize(LPCITEMIDLIST pidl) -* -* PURPOSE: Gets the size of the PIDL -* -****************************************************************************/ -UINT CShellPidl::GetSize(LPCITEMIDLIST pidl) { - UINT cbTotal = 0; - if (pidl) { - cbTotal += sizeof(pidl->mkid.cb); // Null terminator - while (pidl->mkid.cb) { - cbTotal += pidl->mkid.cb; - pidl = Next(pidl); - } - } - - return cbTotal; -} - -/**************************************************************************** -* -* FUNCTION: CreatePidl(UINT cbSize) -* -* PURPOSE: Allocates a PIDL -* -****************************************************************************/ -LPITEMIDLIST CShellPidl::CreatePidl(UINT cbSize) { - LPMALLOC lpMalloc; - HRESULT hr; - LPITEMIDLIST pidl = NULL; - - hr = SHGetMalloc(&lpMalloc); - - if (FAILED(hr)) { - return 0; - } - - pidl = (LPITEMIDLIST)lpMalloc->Alloc(cbSize); - - if (pidl) { - memset(pidl, 0, cbSize); // zero-init for external task alloc - } - - if (lpMalloc) { - lpMalloc->Release(); - } - - return pidl; -} - -/**************************************************************************** -* -* FUNCTION: ConcatPidls(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) -* -* PURPOSE: Concatenates two PIDLs -* -****************************************************************************/ -LPITEMIDLIST CShellPidl::ConcatPidls(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) { - LPITEMIDLIST pidlNew; - UINT cb1; - UINT cb2; - - if (pidl1) { //May be NULL - cb1 = GetSize(pidl1) - sizeof(pidl1->mkid.cb); - } else { - cb1 = 0; - } - - cb2 = GetSize(pidl2); - - pidlNew = CreatePidl(cb1 + cb2); - if (pidlNew) { - if (pidl1) { - memcpy(pidlNew, pidl1, cb1); - } - memcpy(((LPSTR)pidlNew) + cb1, pidl2, cb2); - } - return pidlNew; -} - -/**************************************************************************** -* -* FUNCTION: CopyITEMID(LPMALLOC lpMalloc, LPITEMIDLIST lpi) -* -* PURPOSE: Copies the ITEMID -* -****************************************************************************/ -LPITEMIDLIST CShellPidl::CopyITEMID(LPMALLOC lpMalloc, LPITEMIDLIST lpi) { - LPITEMIDLIST lpiTemp; - - lpiTemp = (LPITEMIDLIST)lpMalloc->Alloc(lpi->mkid.cb + sizeof(lpi->mkid.cb)); - CopyMemory((PVOID)lpiTemp, (CONST VOID *)lpi, lpi->mkid.cb + sizeof(lpi->mkid.cb)); - - return lpiTemp; -} - -/**************************************************************************** -* -* FUNCTION: GetName(LPSHELLFOLDER lpsf,LPITEMIDLIST lpi,DWORD dwFlags, -* LPSTR lpFriendlyName) -* -* PURPOSE: Gets the friendly name for the folder -* -****************************************************************************/ -BOOL CShellPidl::GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi, DWORD dwFlags, LPSTR lpFriendlyName) { - BOOL bSuccess = TRUE; - STRRET str; - - if (NOERROR == lpsf->GetDisplayNameOf(lpi, dwFlags, &str)) { - switch (str.uType) { - case STRRET_WSTR: - - WideCharToMultiByte(CP_ACP, // CodePage - 0, // dwFlags - str.pOleStr, // lpWideCharStr - -1, // cchWideChar - lpFriendlyName, // lpMultiByteStr - MAX_PATH, - //sizeof(lpFriendlyName), // cchMultiByte, wrong. sizeof on a pointer, psk, psk - NULL, // lpDefaultChar, - NULL); // lpUsedDefaultChar - - break; - - case STRRET_OFFSET: - - lstrcpy(lpFriendlyName, (LPSTR)lpi + str.uOffset); - break; - - case STRRET_CSTR: - - lstrcpy(lpFriendlyName, (LPSTR)str.cStr); - break; - - default: - bSuccess = FALSE; - break; - } - } else { - bSuccess = FALSE; - } - - return bSuccess; -} - -/**************************************************************************** -* -* FUNCTION: GetFullyQualPidl(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi) -* -* PURPOSE: Gets the Fully qualified Pidls for the folder -* -****************************************************************************/ -LPITEMIDLIST CShellPidl::GetFullyQualPidl(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi) { - char szBuff[MAX_PATH]; - OLECHAR szOleChar[MAX_PATH]; - LPSHELLFOLDER lpsfDeskTop; - LPITEMIDLIST lpifq; - ULONG ulEaten, ulAttribs; - HRESULT hr; - - if (!GetName(lpsf, lpi, SHGDN_FORPARSING, szBuff)) { - return NULL; - } - - hr = SHGetDesktopFolder(&lpsfDeskTop); - - if (FAILED(hr)) { - return NULL; - } - - MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szBuff, -1, (WCHAR *)szOleChar, sizeof(szOleChar)); - - hr = lpsfDeskTop->ParseDisplayName(NULL, NULL, szOleChar, &ulEaten, &lpifq, &ulAttribs); - - lpsfDeskTop->Release(); - - if (FAILED(hr)) { - return NULL; - } - - return lpifq; -} - -/**************************************************************************** -* -* FUNCTION: DoTheMenuThing(HWND hwnd, -* LPSHELLFOLDER lpsfParent, -* LPITEMIDLIST lpi, -* LPPOINT lppt) -* -* PURPOSE: Displays a popup context menu, given a parent shell folder, -* relative item id and screen location. -* -* PARAMETERS: -* hwnd - Parent window handle -* lpsfParent - Pointer to parent shell folder. -* lpi - Pointer to item id that is relative to lpsfParent -* lppt - Screen location of where to popup the menu. -* -* RETURN VALUE: -* Returns TRUE on success, FALSE on failure -* -****************************************************************************/ -BOOL CShellPidl::DoTheMenuThing(HWND hwnd, LPSHELLFOLDER lpsfParent, LPITEMIDLIST lpi, LPPOINT lppt) { - LPCONTEXTMENU lpcm; - HRESULT hr; - char szTemp[64]; - CMINVOKECOMMANDINFO cmi; - DWORD dwAttribs = 0; - int idCmd; - HMENU hMenu; - BOOL bSuccess = TRUE; - - hr = lpsfParent->GetUIObjectOf(hwnd, - 1, //Number of objects to get attributes of - (const struct _ITEMIDLIST **)&lpi, IID_IContextMenu, 0, (LPVOID *)&lpcm); - if (SUCCEEDED(hr)) { - hMenu = CreatePopupMenu(); - - if (hMenu) { - hr = lpcm->QueryContextMenu(hMenu, 0, 1, 0x7fff, CMF_EXPLORE); - if (SUCCEEDED(hr)) { - idCmd = TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RETURNCMD | TPM_RIGHTBUTTON, lppt->x, lppt->y, 0, - hwnd, NULL); - - if (idCmd) { - cmi.cbSize = sizeof(CMINVOKECOMMANDINFO); - cmi.fMask = 0; - cmi.hwnd = hwnd; - cmi.lpVerb = MAKEINTRESOURCE(idCmd - 1); - cmi.lpParameters = NULL; - cmi.lpDirectory = NULL; - cmi.nShow = SW_SHOWNORMAL; - cmi.dwHotKey = 0; - cmi.hIcon = NULL; - hr = lpcm->InvokeCommand(&cmi); - if (!SUCCEEDED(hr)) { - wsprintf(szTemp, "InvokeCommand failed. hr=%lx", hr); - AfxMessageBox(szTemp); - } - } - - } else { - bSuccess = FALSE; - } - - DestroyMenu(hMenu); - } else { - bSuccess = FALSE; - } - - lpcm->Release(); - } else { - wsprintf(szTemp, "GetUIObjectOf failed! hr=%lx", hr); - AfxMessageBox(szTemp); - bSuccess = FALSE; - } - return bSuccess; -} - -/**************************************************************************** -* -* FUNCTION: GetIcon(LPITEMIDLIST lpi, UINT uFlags) -* -* PURPOSE: Gets the index for the current icon. Index is index into system -* image list. -* -* PARAMETERS: -* lpi - Fully qualified item id list for current item. -* uFlags - Flags for SHGetFileInfo() -* -* RETURN VALUE: -* Icon index for current item. -****************************************************************************/ -int CShellPidl::GetItemIcon(LPITEMIDLIST lpi, UINT uFlags) { - SHFILEINFO sfi; - - SHGetFileInfo((LPCSTR)lpi, 0, &sfi, sizeof(SHFILEINFO), uFlags); - - return sfi.iIcon; -} - -CShellTree::CShellTree() {} - -CShellTree::~CShellTree() {} - -BEGIN_MESSAGE_MAP(CShellTree, CTreeCtrl) -//{{AFX_MSG_MAP(CShellTree) -//}}AFX_MSG_MAP -END_MESSAGE_MAP() - -/**************************************************************************** -* -* FUNCTION: PopulateTree() -* -* PURPOSE: Processes the File.Fill/RefreshTree command -* -****************************************************************************/ -void CShellTree::PopulateTree() { - LPSHELLFOLDER lpsf = NULL; - LPITEMIDLIST lpi = NULL; - HRESULT hr; - TV_SORTCB tvscb; - - // Get a pointer to the desktop folder. - hr = SHGetDesktopFolder(&lpsf); - - if (SUCCEEDED(hr)) { - // Initialize the tree view to be empty. - DeleteAllItems(); - - // Fill in the tree view from the root. - FillTreeView(lpsf, NULL, TVI_ROOT); - //TunnelFillTree(lpsf, NULL, TVI_ROOT); - // Release the folder pointer. - lpsf->Release(); - } - tvscb.hParent = TVI_ROOT; - tvscb.lParam = 0; - tvscb.lpfnCompare = TreeViewCompareProc; - - // Sort the items in the tree view - SortChildrenCB(&tvscb /*, FALSE*/); - - HTREEITEM hItem; - hItem = GetRootItem(); - Expand(hItem, TVE_EXPAND); - Select(GetRootItem(), TVGN_CARET); -} - -/**************************************************************************** -* -* FUNCTION: PopulateTree() -* -* PURPOSE: Processes the File.Fill/RefreshTree command -* This overload has the ability to open from a -* special folderlocation like SHBrowseForFolder() -* -* WARNING: TunnelTree() will not work if you use a special -* folderlocation -* -****************************************************************************/ -void CShellTree::PopulateTree(int nFolder) { - LPSHELLFOLDER lpsf = NULL, lpsf2 = NULL; - LPITEMIDLIST lpi = NULL; - HRESULT hr; - TV_SORTCB tvscb; - - // Get a pointer to the desktop folder. - hr = SHGetDesktopFolder(&lpsf); - - if (SUCCEEDED(hr)) { - // Initialize the tree view to be empty. - DeleteAllItems(); - - if (!SUCCEEDED(SHGetSpecialFolderLocation(m_hWnd, nFolder, &lpi))) { - lpi = NULL; - FillTreeView(lpsf, NULL, TVI_ROOT); - } else { - hr = lpsf->BindToObject(lpi, 0, IID_IShellFolder, (LPVOID *)&lpsf2); - - if (SUCCEEDED(hr)) { - // Fill in the tree view from the root. - FillTreeView(lpsf2, lpi, TVI_ROOT); - lpsf2->Release(); - } else { - FillTreeView(lpsf, NULL, TVI_ROOT); - } - } - - // Release the folder pointer. - lpsf->Release(); - } - tvscb.hParent = TVI_ROOT; - tvscb.lParam = 0; - tvscb.lpfnCompare = TreeViewCompareProc; - - // Sort the items in the tree view - SortChildrenCB(&tvscb /*, FALSE*/); - - HTREEITEM hItem; - hItem = GetRootItem(); - Expand(hItem, TVE_EXPAND); - Select(GetRootItem(), TVGN_CARET); -} - -/**************************************************************************** -* -* FUNCTION: FillTreeView( LPSHELLFOLDER lpsf, -* LPITEMIDLIST lpifq, -* HTREEITEM hParent) -* -* PURPOSE: Fills a branch of the TreeView control. Given the -* shell folder, enumerate the subitems of this folder, -* and add the appropriate items to the tree. -* -* PARAMETERS: -* lpsf - Pointer to shell folder that we want to enumerate items -* lpifq - Fully qualified item id list to the item that we are enumerating -* items for. In other words, this is the PIDL to the item -* identified by the lpsf parameter. -* hParent - Parent node -* -* COMMENTS: -* This function enumerates the items in the folder identifed by lpsf. -* Note that since we are filling the left hand pane, we will only add -* items that are folders and/or have sub-folders. We *could* put all -* items in here if we wanted, but that's not the intent. -* -****************************************************************************/ -void CShellTree::FillTreeView(LPSHELLFOLDER lpsf, LPITEMIDLIST lpifq, HTREEITEM hParent) { - TV_ITEM tvi; // TreeView Item. - TV_INSERTSTRUCT tvins; // TreeView Insert Struct. - HTREEITEM hPrev = NULL; // Previous Item Added. - LPSHELLFOLDER lpsf2 = NULL; - LPENUMIDLIST lpe = NULL; - LPITEMIDLIST lpi = NULL, lpiTemp = NULL, lpifqThisItem = NULL; - LPTVITEMDATA lptvid = NULL; - LPMALLOC lpMalloc = NULL; - ULONG ulFetched; - UINT uCount = 0; - HRESULT hr; - char szBuff[256]; - HWND hwnd = ::GetParent(m_hWnd); - - // Allocate a shell memory object. - hr = ::SHGetMalloc(&lpMalloc); - if (FAILED(hr)) { - return; - } - - if (SUCCEEDED(hr)) { - // Get the IEnumIDList object for the given folder. - hr = lpsf->EnumObjects(hwnd, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS, &lpe); - - if (SUCCEEDED(hr)) { - // Enumerate throught the list of folder and non-folder objects. - while (S_OK == lpe->Next(1, &lpi, &ulFetched)) { - //Create a fully qualified path to the current item - //The SH* shell api's take a fully qualified path pidl, - //(see GetIcon above where I call SHGetFileInfo) whereas the - //interface methods take a relative path pidl. - ULONG ulAttrs = SFGAO_HASSUBFOLDER | SFGAO_FOLDER; - - // Determine what type of object we have. - lpsf->GetAttributesOf(1, (const struct _ITEMIDLIST **)&lpi, &ulAttrs); - - if (ulAttrs & (SFGAO_HASSUBFOLDER | SFGAO_FOLDER)) { - //We need this next if statement so that we don't add things like - //the MSN to our tree. MSN is not a folder, but according to the - //shell it has subfolders. - if (ulAttrs & SFGAO_FOLDER) { - tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; - - if (ulAttrs & SFGAO_HASSUBFOLDER) { - //This item has sub-folders, so let's put the + in the TreeView. - //The first time the user clicks on the item, we'll populate the - //sub-folders. - tvi.cChildren = 1; - tvi.mask |= TVIF_CHILDREN; - } - - //OK, let's get some memory for our ITEMDATA struct - lptvid = (LPTVITEMDATA)lpMalloc->Alloc(sizeof(TVITEMDATA)); - if (!lptvid) { - goto Done; // Error - could not allocate memory. - } - - //Now get the friendly name that we'll put in the treeview. - if (!GetName(lpsf, lpi, SHGDN_NORMAL, szBuff)) { - goto Done; // Error - could not get friendly name. - } - - tvi.pszText = szBuff; - tvi.cchTextMax = MAX_PATH; - - lpifqThisItem = ConcatPidls(lpifq, lpi); - - //Now, make a copy of the ITEMIDLIST - lptvid->lpi = CopyITEMID(lpMalloc, lpi); - - GetNormalAndSelectedIcons(lpifqThisItem, &tvi); - - lptvid->lpsfParent = lpsf; //Store the parent folders SF - lpsf->AddRef(); - - lptvid->lpifq = ConcatPidls(lpifq, lpi); - - tvi.lParam = (LPARAM)lptvid; - - // Populate the TreeVeiw Insert Struct - // The item is the one filled above. - // Insert it after the last item inserted at this level. - // And indicate this is a root entry. - tvins.item = tvi; - tvins.hInsertAfter = hPrev; - tvins.hParent = hParent; - - // Add the item to the tree - hPrev = InsertItem(&tvins); - } - // Free this items task allocator. - lpMalloc->Free(lpifqThisItem); - lpifqThisItem = 0; - } - - lpMalloc->Free(lpi); //Free the pidl that the shell gave us. - lpi = 0; - } - } - - } else { - return; - } - -Done: - - if (lpe) { - lpe->Release(); - } - - //The following 2 if statements will only be TRUE if we got here on an - //error condition from the "goto" statement. Otherwise, we free this memory - //at the end of the while loop above. - if (lpi && lpMalloc) { - lpMalloc->Free(lpi); - } - if (lpifqThisItem && lpMalloc) { - lpMalloc->Free(lpifqThisItem); - } - - if (lpMalloc) { - lpMalloc->Release(); - } -} - -/**************************************************************************** -* -* FUNCTION: GetNormalAndSelectedIcons(LPITEMIDLIST lpifq, LPTV_ITEM lptvitem) -* -* PURPOSE: Gets the index for the normal and selected icons for the current item. -* -* PARAMETERS: -* lpifq - Fully qualified item id list for current item. -* lptvitem - Pointer to treeview item we are about to add to the tree. -* -****************************************************************************/ -void CShellTree::GetNormalAndSelectedIcons(LPITEMIDLIST lpifq, LPTV_ITEM lptvitem) { - //Note that we don't check the return value here because if GetIcon() - //fails, then we're in big trouble... - - lptvitem->iImage = GetItemIcon(lpifq, SHGFI_PIDL | SHGFI_SYSICONINDEX | SHGFI_SMALLICON); - - lptvitem->iSelectedImage = GetItemIcon(lpifq, SHGFI_PIDL | SHGFI_SYSICONINDEX | SHGFI_SMALLICON | SHGFI_OPENICON); - - return; -} - -/**************************************************************************** -* -* FUNCTION: TreeViewCompareProc(LPARAM, LPARAM, LPARAM) -* -* PURPOSE: Callback routine for sorting the tree -* -****************************************************************************/ -int CALLBACK CShellTree::TreeViewCompareProc(LPARAM lparam1, LPARAM lparam2, LPARAM lparamSort) { - LPTVITEMDATA lptvid1 = (LPTVITEMDATA)lparam1; - LPTVITEMDATA lptvid2 = (LPTVITEMDATA)lparam2; - HRESULT hr; - - hr = lptvid1->lpsfParent->CompareIDs(0, lptvid1->lpi, lptvid2->lpi); - - if (FAILED(hr)) { - return 0; - } - - return (short)SCODE_CODE(GetScode(hr)); -} - -///////////////////////////////////////////////////////////////////////////// -// CShellTree message handlers - -/**************************************************************************** -* -* FUNCTION: OnFolderExpanding(NMHDR* pNMHDR, LRESULT* pResult) -* -* PURPOSE: Reponds to an TVN_ITEMEXPANDING message in order to fill up -* subdirectories. Pass the parameters from OnItemExpanding() to -* this function. You need to do that or your folders won't -* expand. -* -* OTHER: It can also be used to update a corresponding listview. Seem MFCENUM -* -* MESSAGEMAP: TVN_ITEMEXPANDING -* -****************************************************************************/ -void CShellTree::OnFolderExpanding(NMHDR * pNMHDR, LRESULT * pResult) { - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - HRESULT hr; - LPSHELLFOLDER lpsf2 = NULL; - static char szBuff[MAX_PATH]; - TV_SORTCB tvscb; - - NM_TREEVIEW * pnmtv = (NM_TREEVIEW *)pNMHDR; - // TODO: Add your control notification handler code here - if ((pnmtv->itemNew.state & TVIS_EXPANDEDONCE)) { - return; - } - - lptvid = (LPTVITEMDATA)pnmtv->itemNew.lParam; - if (lptvid) { - hr = lptvid->lpsfParent->BindToObject(lptvid->lpi, 0, IID_IShellFolder, (LPVOID *)&lpsf2); - - if (SUCCEEDED(hr)) { - FillTreeView(lpsf2, lptvid->lpifq, pnmtv->itemNew.hItem); - } - - tvscb.hParent = pnmtv->itemNew.hItem; - tvscb.lParam = 0; - tvscb.lpfnCompare = TreeViewCompareProc; - - SortChildrenCB(&tvscb /*, FALSE*/); - } - - *pResult = 0; -} - -/**************************************************************************** -* -* FUNCTION: GetContextMenu(NMHDR* pNMHDR, LRESULT* pResult) -* -* PURPOSE: Diplays a popup menu for the folder selected. Pass the -* parameters from Rclick() to this function. -* -* MESSAGEMAP: NM_RCLICK; -* -****************************************************************************/ -void CShellTree::GetContextMenu(NMHDR * pNMHDR, LRESULT * pResult) { - // TODO: Add your control notification handler code here - POINT pt; - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - LPSHELLFOLDER lpsf2 = NULL; - static char szBuff[MAX_PATH]; - TV_HITTESTINFO tvhti; - TV_ITEM tvi; - - // TODO: Add your control notification handler code here - ::GetCursorPos((LPPOINT)&pt); - ScreenToClient(&pt); - tvhti.pt = pt; - HitTest(&tvhti); - SelectItem(tvhti.hItem); - if (tvhti.flags & (TVHT_ONITEMLABEL | TVHT_ONITEMICON)) { - ClientToScreen(&pt); - tvi.mask = TVIF_PARAM; - tvi.hItem = tvhti.hItem; - - if (!GetItem(&tvi)) { - return; - } - - lptvid = (LPTVITEMDATA)tvi.lParam; - - DoTheMenuThing(::GetParent(m_hWnd), lptvid->lpsfParent, lptvid->lpi, &pt); - } - - *pResult = 0; -} - -/**************************************************************************** -* -* FUNCTION: OnFolderSelected(NMHDR* pNMHDR, LRESULT* pResult, CString &szFolderPath) -* -* PURPOSE: Call this function if for example you want to put the path of the folder -* selected inside a combobox or an edit window. You would pass the -* parameters from OnSelChanged() to this function along with a CString object -* that will hold the folder path. If the path is not -* in the filesystem(eg MyComputer) it returns false. -* -* MESSAGEMAP: TVN_SELCHANGED -* -****************************************************************************/ -BOOL CShellTree::OnFolderSelected(NMHDR * pNMHDR, LRESULT * pResult, CString & szFolderPath) { - // TODO: Add your control notification handler code here - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - LPSHELLFOLDER lpsf2 = NULL; - static char szBuff[MAX_PATH]; - HRESULT hr; - BOOL bRet = false; - TV_SORTCB tvscb; - HTREEITEM hItem = NULL; - - if ((hItem = GetSelectedItem())) { - lptvid = (LPTVITEMDATA)GetItemData(hItem); - - if (lptvid && lptvid->lpsfParent && lptvid->lpi) { - hr = lptvid->lpsfParent->BindToObject(lptvid->lpi, 0, IID_IShellFolder, (LPVOID *)&lpsf2); - - if (SUCCEEDED(hr)) { - ULONG ulAttrs = SFGAO_FILESYSTEM; - - // Determine what type of object we have. - lptvid->lpsfParent->GetAttributesOf(1, (const struct _ITEMIDLIST **)&lptvid->lpi, &ulAttrs); - - if (ulAttrs & (SFGAO_FILESYSTEM)) { - if (SHGetPathFromIDList(lptvid->lpifq, szBuff)) { - szFolderPath = szBuff; - bRet = true; - } - } - //non standard from here(NEW CODE) - NM_TREEVIEW * pnmtv = (NM_TREEVIEW *)pNMHDR; - if ((pnmtv->itemNew.cChildren == 1) && !(pnmtv->itemNew.state & TVIS_EXPANDEDONCE)) { - FillTreeView(lpsf2, lptvid->lpifq, pnmtv->itemNew.hItem); - - tvscb.hParent = pnmtv->itemNew.hItem; - tvscb.lParam = 0; - tvscb.lpfnCompare = TreeViewCompareProc; - SortChildrenCB(&tvscb); - - pnmtv->itemNew.state |= TVIS_EXPANDEDONCE; - pnmtv->itemNew.stateMask |= TVIS_EXPANDEDONCE; - pnmtv->itemNew.mask |= TVIF_STATE; - SetItem(&pnmtv->itemNew); - } - } - } - if (lpsf2) { - lpsf2->Release(); - } - } - *pResult = 0; - return bRet; -} - -/**************************************************************************** -* -* FUNCTION: OnDeleteShellItem(NMHDR* pNMHDR, LRESULT* pResult) -* -* PURPOSE: Releases the memory allocated by the shell folders -* -* MESSAGEMAP: TVN_DELETEITEM -* -* MISC: failure to call this function will result in a memory leak -* -****************************************************************************/ -void CShellTree::OnDeleteShellItem(NMHDR * pNMHDR, LRESULT * pResult) { - LPTVITEMDATA lptvid = NULL; - HRESULT hr; - LPMALLOC lpMalloc; - - NM_TREEVIEW * pNMTreeView = (NM_TREEVIEW *)pNMHDR; - - //Let's free the memory for the TreeView item data... - hr = SHGetMalloc(&lpMalloc); - if (FAILED(hr)) { - return; - } - - lptvid = (LPTVITEMDATA)pNMTreeView->itemOld.lParam; - lptvid->lpsfParent->Release(); - lpMalloc->Free(lptvid->lpi); - lpMalloc->Free(lptvid->lpifq); - lpMalloc->Free(lptvid); - lpMalloc->Release(); -} - -/**************************************************************************** -* -* FUNCTION: EnableImages() -* -* PURPOSE: Obtains a handle to the system image list and attaches it -* to the tree control. DO NOT DELETE the imagelist -* -* MESSAGEMAP: NONE -* -****************************************************************************/ -void CShellTree::EnableImages() { - // Get the handle to the system image list, for our icons - HIMAGELIST hImageList; - SHFILEINFO sfi; - - hImageList = - (HIMAGELIST)SHGetFileInfo((LPCSTR) "C:\\", 0, &sfi, sizeof(SHFILEINFO), SHGFI_SYSICONINDEX | SHGFI_SMALLICON); - - // Attach ImageList to TreeView - if (hImageList) { - ::SendMessage(m_hWnd, TVM_SETIMAGELIST, (WPARAM)TVSIL_NORMAL, (LPARAM)hImageList); - } -} - -/**************************************************************************** -* -* FUNCTION: GetSelectedFolderPath(CString &szFolderPath) -* -* PURPOSE: Retrieves the path of the currently selected string. -* Pass a CString object that will hold the folder path. -* If the path is not in the filesystem(eg MyComputer) -* or none is selected it returns false. -* -* MESSAGEMAP: NONE -* -****************************************************************************/ -BOOL CShellTree::GetSelectedFolderPath(CString & szFolderPath) { - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - LPSHELLFOLDER lpsf2 = NULL; - static char szBuff[MAX_PATH]; - HTREEITEM hItem = NULL; - HRESULT hr; - BOOL bRet = false; - - if ((hItem = GetSelectedItem())) { - lptvid = (LPTVITEMDATA)GetItemData(hItem); - - if (lptvid && lptvid->lpsfParent && lptvid->lpi) { - hr = lptvid->lpsfParent->BindToObject(lptvid->lpi, 0, IID_IShellFolder, (LPVOID *)&lpsf2); - - if (SUCCEEDED(hr)) { - ULONG ulAttrs = SFGAO_FILESYSTEM; - - // Determine what type of object we have. - lptvid->lpsfParent->GetAttributesOf(1, (const struct _ITEMIDLIST **)&lptvid->lpi, &ulAttrs); - - if (ulAttrs & (SFGAO_FILESYSTEM)) { - if (SHGetPathFromIDList(lptvid->lpifq, szBuff)) { - szFolderPath = szBuff; - bRet = true; - } - } - } - } - if (lpsf2) { - lpsf2->Release(); - } - } - return bRet; -} - -/**************************************************************************** -* -* FUNCTION: GetParentShellFolder(HTREEITEM folderNode) -* -* PURPOSE: Retrieves the pointer to the ISHELLFOLDER interface -* of the tree node passed as the paramter. -* -* MESSAGEMAP: NONE -* -****************************************************************************/ -LPSHELLFOLDER CShellTree::GetParentShellFolder(HTREEITEM folderNode) { - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - - lptvid = (LPTVITEMDATA)GetItemData(folderNode); - if (lptvid) { - return lptvid->lpsfParent; - } else { - return NULL; - } -} - -/**************************************************************************** -* -* FUNCTION: GetRelativeIDLIST(HTREEITEM folderNode) -* -* PURPOSE: Retrieves the Pointer to an ITEMIDLIST structure that -* identifies the subfolder relative to its parent folder. -* see GetParentShellFolder(); -* -* MESSAGEMAP: NONE -* -****************************************************************************/ -LPITEMIDLIST CShellTree::GetRelativeIDLIST(HTREEITEM folderNode) { - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - - lptvid = (LPTVITEMDATA)GetItemData(folderNode); - if (lptvid) { - return lptvid->lpifq; - } else { - return NULL; - } -} - -/**************************************************************************** -* -* FUNCTION: GetFullyQualifiedIDLIST(HTREEITEM folderNode) -* -* PURPOSE: Retrieves the Retrieves the Pointer to an ITEMIDLIST -* structure that identifies the subfolder relative to the -* desktop. This is a fully qualified Item Identifier -* -* MESSAGEMAP: NONE -* -****************************************************************************/ -LPITEMIDLIST CShellTree::GetFullyQualifiedID(HTREEITEM folderNode) { - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - - lptvid = (LPTVITEMDATA)GetItemData(folderNode); - if (lptvid) { - return lptvid->lpifq; - } else { - return NULL; - } -} - -/**************************************************************************** -* -* FUNCTION: SearchTree( HTREEITEM treeNode, -* CString szSearchName ) -* -* PURPOSE: Too crude to explain, just use it -* -* WARNING: Only works if you use the default PopulateTree() -* Not guaranteed to work on any future or existing -* version of windows. Use with caution. Pretty much -* ok if you're using on local drives -* -****************************************************************************/ -bool CShellTree::SearchTree(HTREEITEM treeNode, CString szSearchName, FindAttribs attr) { - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - LPSHELLFOLDER lpsf2 = NULL; - char drive[_MAX_DRIVE]; - char dir[_MAX_DIR]; - char fname[_MAX_FNAME]; - char ext[_MAX_EXT]; - bool bRet = false; - HRESULT hr; - CString szCompare; - - szSearchName.MakeUpper(); - while (treeNode && bRet == false) { - lptvid = (LPTVITEMDATA)GetItemData(treeNode); - if (lptvid && lptvid->lpsfParent && lptvid->lpi) { - hr = lptvid->lpsfParent->BindToObject(lptvid->lpi, 0, IID_IShellFolder, (LPVOID *)&lpsf2); - if (SUCCEEDED(hr)) { - ULONG ulAttrs = SFGAO_FILESYSTEM; - lptvid->lpsfParent->GetAttributesOf(1, (const struct _ITEMIDLIST **)&lptvid->lpi, &ulAttrs); - if (ulAttrs & (SFGAO_FILESYSTEM)) { - if (SHGetPathFromIDList(lptvid->lpifq, szCompare.GetBuffer(MAX_PATH))) { - switch (attr) { - case type_drive: - _splitpath(szCompare, drive, dir, fname, ext); - szCompare = drive; - break; - case type_folder: - szCompare = GetItemText(treeNode); - break; - } - szCompare.MakeUpper(); - if (szCompare == szSearchName) { - EnsureVisible(treeNode); - SelectItem(treeNode); - bRet = true; - } - } - } - lpsf2->Release(); - } - } - treeNode = GetNextSiblingItem(treeNode); - } - return bRet; -} - -/**************************************************************************** -* -* FUNCTION: TunnelTree(CString szFindPath) -* -* PURPOSE: Too crude to explain, just use it -* -* WARNING: Only works if you use the default PopulateTree() -* Not guaranteed to work on any future or existing -* version of windows. Use with caution. Pretty much -* ok if you're using on local drives -* -****************************************************************************/ -void CShellTree::TunnelTree(CString szFindPath) { - HTREEITEM subNode = GetRootItem(); - CString szPathHop; - char drive[_MAX_DRIVE]; - char dir[_MAX_DIR]; - char fname[_MAX_FNAME]; - char ext[_MAX_EXT]; - char delimiter[] = "\\"; - - CFileName checkPath(szFindPath); - if (!checkPath.Exist()) { - MessageBox(szFindPath, "Folder not found", MB_ICONERROR); - return; - } - - if (szFindPath.ReverseFind('\\') != szFindPath.GetLength() - 1) { - szFindPath += "\\"; - } - - _splitpath(szFindPath, drive, dir, fname, ext); - - //search the drive first - szPathHop = drive; - subNode = GetChildItem(subNode); - if (subNode) { - if (SearchTree(subNode, szPathHop, CShellTree::type_drive)) { - //break down subfolders and search - char * p = strtok(dir, delimiter); - while (p) { - subNode = GetSelectedItem(); - subNode = GetChildItem(subNode); - if (SearchTree(subNode, p, CShellTree::type_folder)) { - p = strtok(NULL, delimiter); - } else { - p = NULL; - } - } - } - } -} \ No newline at end of file diff --git a/src/tool/N3Indoor/ShellTree.h b/src/tool/N3Indoor/ShellTree.h deleted file mode 100644 index dc6b0dcb..00000000 --- a/src/tool/N3Indoor/ShellTree.h +++ /dev/null @@ -1,114 +0,0 @@ -#pragma once - -// ShellTree.h : header file -// - -#include - -class CFileName { - public: - CFileName(CString szFileName = ""); - virtual ~CFileName(); - - void SetFileName(CString szFileName); - CString GetFileName(); - CString GetRoot(); - CString GetFileTitle(); - CString GetDescription(); - bool Exist(); - - private: - CString m_szFileName; - char m_szDrive[_MAX_DRIVE]; - char m_szDir[_MAX_DIR]; - char m_szFname[_MAX_FNAME]; - char m_szExt[_MAX_EXT]; -}; - -class CShellPidl { - public: - // STRUCTURES - typedef struct tagLVID { - LPSHELLFOLDER lpsfParent; - LPITEMIDLIST lpi; - ULONG ulAttribs; - } LVITEMDATA, *LPLVITEMDATA; - - typedef struct tagID { - LPSHELLFOLDER lpsfParent; - LPITEMIDLIST lpi; - LPITEMIDLIST lpifq; - } TVITEMDATA, *LPTVITEMDATA; - - public: - // Functions that deal with PIDLs - LPITEMIDLIST ConcatPidls(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2); - LPITEMIDLIST GetFullyQualPidl(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi); - LPITEMIDLIST CopyITEMID(LPMALLOC lpMalloc, LPITEMIDLIST lpi); - BOOL GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi, DWORD dwFlags, LPSTR lpFriendlyName); - LPITEMIDLIST CreatePidl(UINT cbSize); - UINT GetSize(LPCITEMIDLIST pidl); - LPITEMIDLIST Next(LPCITEMIDLIST pidl); - - // Utility Functions - BOOL DoTheMenuThing(HWND hwnd, LPSHELLFOLDER lpsfParent, LPITEMIDLIST lpi, LPPOINT lppt); - int GetItemIcon(LPITEMIDLIST lpi, UINT uFlags); -}; - -class CShellTree : public CTreeCtrl, public CShellPidl { - public: - enum FindAttribs { - type_drive, - type_folder - }; - - // Construction - public: - CShellTree(); - - // Attributes - public: - BOOL m_bOutaHere; - - // Operations - public: - void PopulateTree(); - void PopulateTree(int nFolder); - void OnFolderExpanding(NMHDR * pNMHDR, LRESULT * pResult); - void GetContextMenu(NMHDR * pNMHDR, LRESULT * pResult); - BOOL OnFolderSelected(NMHDR * pNMHDR, LRESULT * pResult, CString & szFolderPath); - void OnDeleteShellItem(NMHDR * pNMHDR, LRESULT * pResult); - void EnableImages(); - BOOL GetSelectedFolderPath(CString & szFolderPath); - bool SearchTree(HTREEITEM treeNode, CString szSearchName, FindAttribs attr); - void TunnelTree(CString szFindPath); - LPSHELLFOLDER GetParentShellFolder(HTREEITEM folderNode); - LPITEMIDLIST GetRelativeIDLIST(HTREEITEM folderNode); - LPITEMIDLIST GetFullyQualifiedID(HTREEITEM folderNode); - void FindTreePidl(HTREEITEM nextNode, HTREEITEM & folderNode, LPLVITEMDATA lplvid, bool & valid); - - // Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CShellTree) - //}}AFX_VIRTUAL - - // Implementation - public: - virtual ~CShellTree(); - - // Generated message map functions - protected: - void FillTreeView(LPSHELLFOLDER lpsf, LPITEMIDLIST lpifq, HTREEITEM hParent); - void GetNormalAndSelectedIcons(LPITEMIDLIST lpifq, LPTV_ITEM lptvitem); - static int CALLBACK TreeViewCompareProc(LPARAM, LPARAM, LPARAM); - - //{{AFX_MSG(CShellTree) - //}}AFX_MSG - - DECLARE_MESSAGE_MAP() -}; - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. diff --git a/src/tool/N3ME/N3ME.vcxproj b/src/tool/N3ME/N3ME.vcxproj index 68f300ca..7f15c52d 100644 --- a/src/tool/N3ME/N3ME.vcxproj +++ b/src/tool/N3ME/N3ME.vcxproj @@ -225,7 +225,6 @@ - @@ -349,7 +348,6 @@ - diff --git a/src/tool/N3ME/N3ME.vcxproj.filters b/src/tool/N3ME/N3ME.vcxproj.filters index 5dbb99ab..a9ba36cc 100644 --- a/src/tool/N3ME/N3ME.vcxproj.filters +++ b/src/tool/N3ME/N3ME.vcxproj.filters @@ -148,9 +148,6 @@ N3ME\Dialogs - - N3ME\Dialogs - N3ME\Controls @@ -614,9 +611,6 @@ N3ME\Dialogs - - N3ME\Dialogs - N3ME\Controls diff --git a/src/tool/N3ME/ShellTree.cpp b/src/tool/N3ME/ShellTree.cpp deleted file mode 100644 index a4a8365e..00000000 --- a/src/tool/N3ME/ShellTree.cpp +++ /dev/null @@ -1,1153 +0,0 @@ -// ShellTree.cpp : implementation file -// - -#include "StdAfx.h" -#include "ShellTree.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -CFileName::CFileName(CString szFileName) { - m_szFileName = szFileName; -} - -CFileName::~CFileName() {} - -void CFileName::SetFileName(CString szFileName) { - m_szFileName = szFileName; -} - -/***************************************************************** -* -* Function: GetFileName() -* -* Purpose: Retrieves current filename minus the path -* -* Remarks: if the filename is "c:\incoming\hello.txt", this -* function returns "hello.txt". -* -******************************************************************/ -CString CFileName::GetFileName() { - CString szFileName; - - _splitpath(m_szFileName, m_szDrive, m_szDir, m_szFname, m_szExt); - szFileName = m_szFname; - szFileName += m_szExt; - - return szFileName; -} - -/***************************************************************** -* -* Function: GetRoot() -* -* Purpose: Retrieves the path only of the current filename. -* -* Remarks: if the filename is "c:\incoming\hello.txt", this -* function returns "c:\incoming\". -* -******************************************************************/ -CString CFileName::GetRoot() { - CString szFileName; - - _splitpath(m_szFileName, m_szDrive, m_szDir, m_szFname, m_szExt); - szFileName = m_szDrive; - szFileName += m_szDir; - - return szFileName; -} - -/***************************************************************** -* -* Function: GetFileTitle() -* -* Purpose: Retrieves the title of the filename excluding -* the path and extension. -* -* Remarks: if the filename is "c:\incoming\hello.txt", this -* function returns "hello". -* -******************************************************************/ -CString CFileName::GetFileTitle() { - CString szFileName; - - _splitpath(m_szFileName, m_szDrive, m_szDir, m_szFname, m_szExt); - szFileName = m_szFname; - - return szFileName; -} - -/***************************************************************** -* -* Function: GetDescription() -* -* Purpose: Returns the description of the file -* -******************************************************************/ -CString CFileName::GetDescription() { - CString szTypeName; - SHFILEINFO sfi; - - SHGetFileInfo(m_szFileName, 0, &sfi, sizeof(SHFILEINFO), SHGFI_TYPENAME); - - szTypeName = sfi.szTypeName; - - return szTypeName; -} - -/***************************************************************** -* -* Function: Exists() -* -* Purpose: Determines whether a file or directory exists. -* -******************************************************************/ -bool CFileName::Exist() { - WIN32_FIND_DATA fd; - - CString szFindPath = m_szFileName; - int nSlash = szFindPath.ReverseFind('\\'); - - if (nSlash == szFindPath.GetLength() - 1) { - szFindPath = szFindPath.Left(nSlash); - } - - HANDLE hFind = FindFirstFile(szFindPath, &fd); - - if (hFind != INVALID_HANDLE_VALUE) { - FindClose(hFind); - } - - return hFind != INVALID_HANDLE_VALUE; -} - -LPITEMIDLIST CShellPidl::Next(LPCITEMIDLIST pidl) { - LPSTR lpMem = (LPSTR)pidl; - - lpMem += pidl->mkid.cb; - - return (LPITEMIDLIST)lpMem; -} - -/**************************************************************************** -* -* FUNCTION: GetSize(LPCITEMIDLIST pidl) -* -* PURPOSE: Gets the size of the PIDL -* -****************************************************************************/ -UINT CShellPidl::GetSize(LPCITEMIDLIST pidl) { - UINT cbTotal = 0; - if (pidl) { - cbTotal += sizeof(pidl->mkid.cb); // Null terminator - while (pidl->mkid.cb) { - cbTotal += pidl->mkid.cb; - pidl = Next(pidl); - } - } - - return cbTotal; -} - -/**************************************************************************** -* -* FUNCTION: CreatePidl(UINT cbSize) -* -* PURPOSE: Allocates a PIDL -* -****************************************************************************/ -LPITEMIDLIST CShellPidl::CreatePidl(UINT cbSize) { - LPMALLOC lpMalloc; - HRESULT hr; - LPITEMIDLIST pidl = NULL; - - hr = SHGetMalloc(&lpMalloc); - - if (FAILED(hr)) { - return 0; - } - - pidl = (LPITEMIDLIST)lpMalloc->Alloc(cbSize); - - if (pidl) { - memset(pidl, 0, cbSize); // zero-init for external task alloc - } - - if (lpMalloc) { - lpMalloc->Release(); - } - - return pidl; -} - -/**************************************************************************** -* -* FUNCTION: ConcatPidls(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) -* -* PURPOSE: Concatenates two PIDLs -* -****************************************************************************/ -LPITEMIDLIST CShellPidl::ConcatPidls(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) { - LPITEMIDLIST pidlNew; - UINT cb1; - UINT cb2; - - if (pidl1) { //May be NULL - cb1 = GetSize(pidl1) - sizeof(pidl1->mkid.cb); - } else { - cb1 = 0; - } - - cb2 = GetSize(pidl2); - - pidlNew = CreatePidl(cb1 + cb2); - if (pidlNew) { - if (pidl1) { - memcpy(pidlNew, pidl1, cb1); - } - memcpy(((LPSTR)pidlNew) + cb1, pidl2, cb2); - } - return pidlNew; -} - -/**************************************************************************** -* -* FUNCTION: CopyITEMID(LPMALLOC lpMalloc, LPITEMIDLIST lpi) -* -* PURPOSE: Copies the ITEMID -* -****************************************************************************/ -LPITEMIDLIST CShellPidl::CopyITEMID(LPMALLOC lpMalloc, LPITEMIDLIST lpi) { - LPITEMIDLIST lpiTemp; - - lpiTemp = (LPITEMIDLIST)lpMalloc->Alloc(lpi->mkid.cb + sizeof(lpi->mkid.cb)); - CopyMemory((PVOID)lpiTemp, (CONST VOID *)lpi, lpi->mkid.cb + sizeof(lpi->mkid.cb)); - - return lpiTemp; -} - -/**************************************************************************** -* -* FUNCTION: GetName(LPSHELLFOLDER lpsf,LPITEMIDLIST lpi,DWORD dwFlags, -* LPSTR lpFriendlyName) -* -* PURPOSE: Gets the friendly name for the folder -* -****************************************************************************/ -BOOL CShellPidl::GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi, DWORD dwFlags, LPSTR lpFriendlyName) { - BOOL bSuccess = TRUE; - STRRET str; - - if (NOERROR == lpsf->GetDisplayNameOf(lpi, dwFlags, &str)) { - switch (str.uType) { - case STRRET_WSTR: - - WideCharToMultiByte(CP_ACP, // CodePage - 0, // dwFlags - str.pOleStr, // lpWideCharStr - -1, // cchWideChar - lpFriendlyName, // lpMultiByteStr - MAX_PATH, - //sizeof(lpFriendlyName), // cchMultiByte, wrong. sizeof on a pointer, psk, psk - NULL, // lpDefaultChar, - NULL); // lpUsedDefaultChar - - break; - - case STRRET_OFFSET: - - lstrcpy(lpFriendlyName, (LPSTR)lpi + str.uOffset); - break; - - case STRRET_CSTR: - - lstrcpy(lpFriendlyName, (LPSTR)str.cStr); - break; - - default: - bSuccess = FALSE; - break; - } - } else { - bSuccess = FALSE; - } - - return bSuccess; -} - -/**************************************************************************** -* -* FUNCTION: GetFullyQualPidl(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi) -* -* PURPOSE: Gets the Fully qualified Pidls for the folder -* -****************************************************************************/ -LPITEMIDLIST CShellPidl::GetFullyQualPidl(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi) { - char szBuff[MAX_PATH]; - OLECHAR szOleChar[MAX_PATH]; - LPSHELLFOLDER lpsfDeskTop; - LPITEMIDLIST lpifq; - ULONG ulEaten, ulAttribs; - HRESULT hr; - - if (!GetName(lpsf, lpi, SHGDN_FORPARSING, szBuff)) { - return NULL; - } - - hr = SHGetDesktopFolder(&lpsfDeskTop); - - if (FAILED(hr)) { - return NULL; - } - - MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szBuff, -1, (WCHAR *)szOleChar, sizeof(szOleChar)); - - hr = lpsfDeskTop->ParseDisplayName(NULL, NULL, szOleChar, &ulEaten, &lpifq, &ulAttribs); - - lpsfDeskTop->Release(); - - if (FAILED(hr)) { - return NULL; - } - - return lpifq; -} - -/**************************************************************************** -* -* FUNCTION: DoTheMenuThing(HWND hwnd, -* LPSHELLFOLDER lpsfParent, -* LPITEMIDLIST lpi, -* LPPOINT lppt) -* -* PURPOSE: Displays a popup context menu, given a parent shell folder, -* relative item id and screen location. -* -* PARAMETERS: -* hwnd - Parent window handle -* lpsfParent - Pointer to parent shell folder. -* lpi - Pointer to item id that is relative to lpsfParent -* lppt - Screen location of where to popup the menu. -* -* RETURN VALUE: -* Returns TRUE on success, FALSE on failure -* -****************************************************************************/ -BOOL CShellPidl::DoTheMenuThing(HWND hwnd, LPSHELLFOLDER lpsfParent, LPITEMIDLIST lpi, LPPOINT lppt) { - LPCONTEXTMENU lpcm; - HRESULT hr; - char szTemp[64]; - CMINVOKECOMMANDINFO cmi; - DWORD dwAttribs = 0; - int idCmd; - HMENU hMenu; - BOOL bSuccess = TRUE; - - hr = lpsfParent->GetUIObjectOf(hwnd, - 1, //Number of objects to get attributes of - (const struct _ITEMIDLIST **)&lpi, IID_IContextMenu, 0, (LPVOID *)&lpcm); - if (SUCCEEDED(hr)) { - hMenu = CreatePopupMenu(); - - if (hMenu) { - hr = lpcm->QueryContextMenu(hMenu, 0, 1, 0x7fff, CMF_EXPLORE); - if (SUCCEEDED(hr)) { - idCmd = TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RETURNCMD | TPM_RIGHTBUTTON, lppt->x, lppt->y, 0, - hwnd, NULL); - - if (idCmd) { - cmi.cbSize = sizeof(CMINVOKECOMMANDINFO); - cmi.fMask = 0; - cmi.hwnd = hwnd; - cmi.lpVerb = MAKEINTRESOURCE(idCmd - 1); - cmi.lpParameters = NULL; - cmi.lpDirectory = NULL; - cmi.nShow = SW_SHOWNORMAL; - cmi.dwHotKey = 0; - cmi.hIcon = NULL; - hr = lpcm->InvokeCommand(&cmi); - if (!SUCCEEDED(hr)) { - wsprintf(szTemp, "InvokeCommand failed. hr=%lx", hr); - AfxMessageBox(szTemp); - } - } - - } else { - bSuccess = FALSE; - } - - DestroyMenu(hMenu); - } else { - bSuccess = FALSE; - } - - lpcm->Release(); - } else { - wsprintf(szTemp, "GetUIObjectOf failed! hr=%lx", hr); - AfxMessageBox(szTemp); - bSuccess = FALSE; - } - return bSuccess; -} - -/**************************************************************************** -* -* FUNCTION: GetIcon(LPITEMIDLIST lpi, UINT uFlags) -* -* PURPOSE: Gets the index for the current icon. Index is index into system -* image list. -* -* PARAMETERS: -* lpi - Fully qualified item id list for current item. -* uFlags - Flags for SHGetFileInfo() -* -* RETURN VALUE: -* Icon index for current item. -****************************************************************************/ -int CShellPidl::GetItemIcon(LPITEMIDLIST lpi, UINT uFlags) { - SHFILEINFO sfi; - - SHGetFileInfo((LPCSTR)lpi, 0, &sfi, sizeof(SHFILEINFO), uFlags); - - return sfi.iIcon; -} - -CShellTree::CShellTree() {} - -CShellTree::~CShellTree() {} - -BEGIN_MESSAGE_MAP(CShellTree, CTreeCtrl) -//{{AFX_MSG_MAP(CShellTree) -//}}AFX_MSG_MAP -END_MESSAGE_MAP() - -/**************************************************************************** -* -* FUNCTION: PopulateTree() -* -* PURPOSE: Processes the File.Fill/RefreshTree command -* -****************************************************************************/ -void CShellTree::PopulateTree() { - LPSHELLFOLDER lpsf = NULL; - LPITEMIDLIST lpi = NULL; - HRESULT hr; - TV_SORTCB tvscb; - - // Get a pointer to the desktop folder. - hr = SHGetDesktopFolder(&lpsf); - - if (SUCCEEDED(hr)) { - // Initialize the tree view to be empty. - DeleteAllItems(); - - // Fill in the tree view from the root. - FillTreeView(lpsf, NULL, TVI_ROOT); - //TunnelFillTree(lpsf, NULL, TVI_ROOT); - // Release the folder pointer. - lpsf->Release(); - } - tvscb.hParent = TVI_ROOT; - tvscb.lParam = 0; - tvscb.lpfnCompare = TreeViewCompareProc; - - // Sort the items in the tree view - SortChildrenCB(&tvscb /*, FALSE*/); - - HTREEITEM hItem; - hItem = GetRootItem(); - Expand(hItem, TVE_EXPAND); - Select(GetRootItem(), TVGN_CARET); -} - -/**************************************************************************** -* -* FUNCTION: PopulateTree() -* -* PURPOSE: Processes the File.Fill/RefreshTree command -* This overload has the ability to open from a -* special folderlocation like SHBrowseForFolder() -* -* WARNING: TunnelTree() will not work if you use a special -* folderlocation -* -****************************************************************************/ -void CShellTree::PopulateTree(int nFolder) { - LPSHELLFOLDER lpsf = NULL, lpsf2 = NULL; - LPITEMIDLIST lpi = NULL; - HRESULT hr; - TV_SORTCB tvscb; - - // Get a pointer to the desktop folder. - hr = SHGetDesktopFolder(&lpsf); - - if (SUCCEEDED(hr)) { - // Initialize the tree view to be empty. - DeleteAllItems(); - - if (!SUCCEEDED(SHGetSpecialFolderLocation(m_hWnd, nFolder, &lpi))) { - lpi = NULL; - FillTreeView(lpsf, NULL, TVI_ROOT); - } else { - hr = lpsf->BindToObject(lpi, 0, IID_IShellFolder, (LPVOID *)&lpsf2); - - if (SUCCEEDED(hr)) { - // Fill in the tree view from the root. - FillTreeView(lpsf2, lpi, TVI_ROOT); - lpsf2->Release(); - } else { - FillTreeView(lpsf, NULL, TVI_ROOT); - } - } - - // Release the folder pointer. - lpsf->Release(); - } - tvscb.hParent = TVI_ROOT; - tvscb.lParam = 0; - tvscb.lpfnCompare = TreeViewCompareProc; - - // Sort the items in the tree view - SortChildrenCB(&tvscb /*, FALSE*/); - - HTREEITEM hItem; - hItem = GetRootItem(); - Expand(hItem, TVE_EXPAND); - Select(GetRootItem(), TVGN_CARET); -} - -/**************************************************************************** -* -* FUNCTION: FillTreeView( LPSHELLFOLDER lpsf, -* LPITEMIDLIST lpifq, -* HTREEITEM hParent) -* -* PURPOSE: Fills a branch of the TreeView control. Given the -* shell folder, enumerate the subitems of this folder, -* and add the appropriate items to the tree. -* -* PARAMETERS: -* lpsf - Pointer to shell folder that we want to enumerate items -* lpifq - Fully qualified item id list to the item that we are enumerating -* items for. In other words, this is the PIDL to the item -* identified by the lpsf parameter. -* hParent - Parent node -* -* COMMENTS: -* This function enumerates the items in the folder identifed by lpsf. -* Note that since we are filling the left hand pane, we will only add -* items that are folders and/or have sub-folders. We *could* put all -* items in here if we wanted, but that's not the intent. -* -****************************************************************************/ -void CShellTree::FillTreeView(LPSHELLFOLDER lpsf, LPITEMIDLIST lpifq, HTREEITEM hParent) { - TV_ITEM tvi; // TreeView Item. - TV_INSERTSTRUCT tvins; // TreeView Insert Struct. - HTREEITEM hPrev = NULL; // Previous Item Added. - LPSHELLFOLDER lpsf2 = NULL; - LPENUMIDLIST lpe = NULL; - LPITEMIDLIST lpi = NULL, lpiTemp = NULL, lpifqThisItem = NULL; - LPTVITEMDATA lptvid = NULL; - LPMALLOC lpMalloc = NULL; - ULONG ulFetched; - UINT uCount = 0; - HRESULT hr; - char szBuff[256]; - HWND hwnd = ::GetParent(m_hWnd); - - // Allocate a shell memory object. - hr = ::SHGetMalloc(&lpMalloc); - if (FAILED(hr)) { - return; - } - - if (SUCCEEDED(hr)) { - // Get the IEnumIDList object for the given folder. - hr = lpsf->EnumObjects(hwnd, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS, &lpe); - - if (SUCCEEDED(hr)) { - // Enumerate throught the list of folder and non-folder objects. - while (S_OK == lpe->Next(1, &lpi, &ulFetched)) { - //Create a fully qualified path to the current item - //The SH* shell api's take a fully qualified path pidl, - //(see GetIcon above where I call SHGetFileInfo) whereas the - //interface methods take a relative path pidl. - ULONG ulAttrs = SFGAO_HASSUBFOLDER | SFGAO_FOLDER; - - // Determine what type of object we have. - lpsf->GetAttributesOf(1, (const struct _ITEMIDLIST **)&lpi, &ulAttrs); - - if (ulAttrs & (SFGAO_HASSUBFOLDER | SFGAO_FOLDER)) { - //We need this next if statement so that we don't add things like - //the MSN to our tree. MSN is not a folder, but according to the - //shell it has subfolders. - if (ulAttrs & SFGAO_FOLDER) { - tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; - - if (ulAttrs & SFGAO_HASSUBFOLDER) { - //This item has sub-folders, so let's put the + in the TreeView. - //The first time the user clicks on the item, we'll populate the - //sub-folders. - tvi.cChildren = 1; - tvi.mask |= TVIF_CHILDREN; - } - - //OK, let's get some memory for our ITEMDATA struct - lptvid = (LPTVITEMDATA)lpMalloc->Alloc(sizeof(TVITEMDATA)); - if (!lptvid) { - goto Done; // Error - could not allocate memory. - } - - //Now get the friendly name that we'll put in the treeview. - if (!GetName(lpsf, lpi, SHGDN_NORMAL, szBuff)) { - goto Done; // Error - could not get friendly name. - } - - tvi.pszText = szBuff; - tvi.cchTextMax = MAX_PATH; - - lpifqThisItem = ConcatPidls(lpifq, lpi); - - //Now, make a copy of the ITEMIDLIST - lptvid->lpi = CopyITEMID(lpMalloc, lpi); - - GetNormalAndSelectedIcons(lpifqThisItem, &tvi); - - lptvid->lpsfParent = lpsf; //Store the parent folders SF - lpsf->AddRef(); - - lptvid->lpifq = ConcatPidls(lpifq, lpi); - - tvi.lParam = (LPARAM)lptvid; - - // Populate the TreeVeiw Insert Struct - // The item is the one filled above. - // Insert it after the last item inserted at this level. - // And indicate this is a root entry. - tvins.item = tvi; - tvins.hInsertAfter = hPrev; - tvins.hParent = hParent; - - // Add the item to the tree - hPrev = InsertItem(&tvins); - } - // Free this items task allocator. - lpMalloc->Free(lpifqThisItem); - lpifqThisItem = 0; - } - - lpMalloc->Free(lpi); //Free the pidl that the shell gave us. - lpi = 0; - } - } - - } else { - return; - } - -Done: - - if (lpe) { - lpe->Release(); - } - - //The following 2 if statements will only be TRUE if we got here on an - //error condition from the "goto" statement. Otherwise, we free this memory - //at the end of the while loop above. - if (lpi && lpMalloc) { - lpMalloc->Free(lpi); - } - if (lpifqThisItem && lpMalloc) { - lpMalloc->Free(lpifqThisItem); - } - - if (lpMalloc) { - lpMalloc->Release(); - } -} - -/**************************************************************************** -* -* FUNCTION: GetNormalAndSelectedIcons(LPITEMIDLIST lpifq, LPTV_ITEM lptvitem) -* -* PURPOSE: Gets the index for the normal and selected icons for the current item. -* -* PARAMETERS: -* lpifq - Fully qualified item id list for current item. -* lptvitem - Pointer to treeview item we are about to add to the tree. -* -****************************************************************************/ -void CShellTree::GetNormalAndSelectedIcons(LPITEMIDLIST lpifq, LPTV_ITEM lptvitem) { - //Note that we don't check the return value here because if GetIcon() - //fails, then we're in big trouble... - - lptvitem->iImage = GetItemIcon(lpifq, SHGFI_PIDL | SHGFI_SYSICONINDEX | SHGFI_SMALLICON); - - lptvitem->iSelectedImage = GetItemIcon(lpifq, SHGFI_PIDL | SHGFI_SYSICONINDEX | SHGFI_SMALLICON | SHGFI_OPENICON); - - return; -} - -/**************************************************************************** -* -* FUNCTION: TreeViewCompareProc(LPARAM, LPARAM, LPARAM) -* -* PURPOSE: Callback routine for sorting the tree -* -****************************************************************************/ -int CALLBACK CShellTree::TreeViewCompareProc(LPARAM lparam1, LPARAM lparam2, LPARAM lparamSort) { - LPTVITEMDATA lptvid1 = (LPTVITEMDATA)lparam1; - LPTVITEMDATA lptvid2 = (LPTVITEMDATA)lparam2; - HRESULT hr; - - hr = lptvid1->lpsfParent->CompareIDs(0, lptvid1->lpi, lptvid2->lpi); - - if (FAILED(hr)) { - return 0; - } - - return (short)SCODE_CODE(GetScode(hr)); -} - -///////////////////////////////////////////////////////////////////////////// -// CShellTree message handlers - -/**************************************************************************** -* -* FUNCTION: OnFolderExpanding(NMHDR* pNMHDR, LRESULT* pResult) -* -* PURPOSE: Reponds to an TVN_ITEMEXPANDING message in order to fill up -* subdirectories. Pass the parameters from OnItemExpanding() to -* this function. You need to do that or your folders won't -* expand. -* -* OTHER: It can also be used to update a corresponding listview. Seem MFCENUM -* -* MESSAGEMAP: TVN_ITEMEXPANDING -* -****************************************************************************/ -void CShellTree::OnFolderExpanding(NMHDR * pNMHDR, LRESULT * pResult) { - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - HRESULT hr; - LPSHELLFOLDER lpsf2 = NULL; - static char szBuff[MAX_PATH]; - TV_SORTCB tvscb; - - NM_TREEVIEW * pnmtv = (NM_TREEVIEW *)pNMHDR; - // TODO: Add your control notification handler code here - if ((pnmtv->itemNew.state & TVIS_EXPANDEDONCE)) { - return; - } - - lptvid = (LPTVITEMDATA)pnmtv->itemNew.lParam; - if (lptvid) { - hr = lptvid->lpsfParent->BindToObject(lptvid->lpi, 0, IID_IShellFolder, (LPVOID *)&lpsf2); - - if (SUCCEEDED(hr)) { - FillTreeView(lpsf2, lptvid->lpifq, pnmtv->itemNew.hItem); - } - - tvscb.hParent = pnmtv->itemNew.hItem; - tvscb.lParam = 0; - tvscb.lpfnCompare = TreeViewCompareProc; - - SortChildrenCB(&tvscb /*, FALSE*/); - } - - *pResult = 0; -} - -/**************************************************************************** -* -* FUNCTION: GetContextMenu(NMHDR* pNMHDR, LRESULT* pResult) -* -* PURPOSE: Diplays a popup menu for the folder selected. Pass the -* parameters from Rclick() to this function. -* -* MESSAGEMAP: NM_RCLICK; -* -****************************************************************************/ -void CShellTree::GetContextMenu(NMHDR * pNMHDR, LRESULT * pResult) { - // TODO: Add your control notification handler code here - POINT pt; - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - LPSHELLFOLDER lpsf2 = NULL; - static char szBuff[MAX_PATH]; - TV_HITTESTINFO tvhti; - TV_ITEM tvi; - - // TODO: Add your control notification handler code here - ::GetCursorPos((LPPOINT)&pt); - ScreenToClient(&pt); - tvhti.pt = pt; - HitTest(&tvhti); - SelectItem(tvhti.hItem); - if (tvhti.flags & (TVHT_ONITEMLABEL | TVHT_ONITEMICON)) { - ClientToScreen(&pt); - tvi.mask = TVIF_PARAM; - tvi.hItem = tvhti.hItem; - - if (!GetItem(&tvi)) { - return; - } - - lptvid = (LPTVITEMDATA)tvi.lParam; - - DoTheMenuThing(::GetParent(m_hWnd), lptvid->lpsfParent, lptvid->lpi, &pt); - } - - *pResult = 0; -} - -/**************************************************************************** -* -* FUNCTION: OnFolderSelected(NMHDR* pNMHDR, LRESULT* pResult, CString &szFolderPath) -* -* PURPOSE: Call this function if for example you want to put the path of the folder -* selected inside a combobox or an edit window. You would pass the -* parameters from OnSelChanged() to this function along with a CString object -* that will hold the folder path. If the path is not -* in the filesystem(eg MyComputer) it returns false. -* -* MESSAGEMAP: TVN_SELCHANGED -* -****************************************************************************/ -BOOL CShellTree::OnFolderSelected(NMHDR * pNMHDR, LRESULT * pResult, CString & szFolderPath) { - // TODO: Add your control notification handler code here - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - LPSHELLFOLDER lpsf2 = NULL; - static char szBuff[MAX_PATH]; - HRESULT hr; - BOOL bRet = false; - TV_SORTCB tvscb; - HTREEITEM hItem = NULL; - - if ((hItem = GetSelectedItem())) { - lptvid = (LPTVITEMDATA)GetItemData(hItem); - - if (lptvid && lptvid->lpsfParent && lptvid->lpi) { - hr = lptvid->lpsfParent->BindToObject(lptvid->lpi, 0, IID_IShellFolder, (LPVOID *)&lpsf2); - - if (SUCCEEDED(hr)) { - ULONG ulAttrs = SFGAO_FILESYSTEM; - - // Determine what type of object we have. - lptvid->lpsfParent->GetAttributesOf(1, (const struct _ITEMIDLIST **)&lptvid->lpi, &ulAttrs); - - if (ulAttrs & (SFGAO_FILESYSTEM)) { - if (SHGetPathFromIDList(lptvid->lpifq, szBuff)) { - szFolderPath = szBuff; - bRet = true; - } - } - //non standard from here(NEW CODE) - NM_TREEVIEW * pnmtv = (NM_TREEVIEW *)pNMHDR; - if ((pnmtv->itemNew.cChildren == 1) && !(pnmtv->itemNew.state & TVIS_EXPANDEDONCE)) { - FillTreeView(lpsf2, lptvid->lpifq, pnmtv->itemNew.hItem); - - tvscb.hParent = pnmtv->itemNew.hItem; - tvscb.lParam = 0; - tvscb.lpfnCompare = TreeViewCompareProc; - SortChildrenCB(&tvscb); - - pnmtv->itemNew.state |= TVIS_EXPANDEDONCE; - pnmtv->itemNew.stateMask |= TVIS_EXPANDEDONCE; - pnmtv->itemNew.mask |= TVIF_STATE; - SetItem(&pnmtv->itemNew); - } - } - } - if (lpsf2) { - lpsf2->Release(); - } - } - *pResult = 0; - return bRet; -} - -/**************************************************************************** -* -* FUNCTION: OnDeleteShellItem(NMHDR* pNMHDR, LRESULT* pResult) -* -* PURPOSE: Releases the memory allocated by the shell folders -* -* MESSAGEMAP: TVN_DELETEITEM -* -* MISC: failure to call this function will result in a memory leak -* -****************************************************************************/ -void CShellTree::OnDeleteShellItem(NMHDR * pNMHDR, LRESULT * pResult) { - LPTVITEMDATA lptvid = NULL; - HRESULT hr; - LPMALLOC lpMalloc; - - NM_TREEVIEW * pNMTreeView = (NM_TREEVIEW *)pNMHDR; - - //Let's free the memory for the TreeView item data... - hr = SHGetMalloc(&lpMalloc); - if (FAILED(hr)) { - return; - } - - lptvid = (LPTVITEMDATA)pNMTreeView->itemOld.lParam; - lptvid->lpsfParent->Release(); - lpMalloc->Free(lptvid->lpi); - lpMalloc->Free(lptvid->lpifq); - lpMalloc->Free(lptvid); - lpMalloc->Release(); -} - -/**************************************************************************** -* -* FUNCTION: EnableImages() -* -* PURPOSE: Obtains a handle to the system image list and attaches it -* to the tree control. DO NOT DELETE the imagelist -* -* MESSAGEMAP: NONE -* -****************************************************************************/ -void CShellTree::EnableImages() { - // Get the handle to the system image list, for our icons - HIMAGELIST hImageList; - SHFILEINFO sfi; - - hImageList = - (HIMAGELIST)SHGetFileInfo((LPCSTR) "C:\\", 0, &sfi, sizeof(SHFILEINFO), SHGFI_SYSICONINDEX | SHGFI_SMALLICON); - - // Attach ImageList to TreeView - if (hImageList) { - ::SendMessage(m_hWnd, TVM_SETIMAGELIST, (WPARAM)TVSIL_NORMAL, (LPARAM)hImageList); - } -} - -/**************************************************************************** -* -* FUNCTION: GetSelectedFolderPath(CString &szFolderPath) -* -* PURPOSE: Retrieves the path of the currently selected string. -* Pass a CString object that will hold the folder path. -* If the path is not in the filesystem(eg MyComputer) -* or none is selected it returns false. -* -* MESSAGEMAP: NONE -* -****************************************************************************/ -BOOL CShellTree::GetSelectedFolderPath(CString & szFolderPath) { - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - LPSHELLFOLDER lpsf2 = NULL; - static char szBuff[MAX_PATH]; - HTREEITEM hItem = NULL; - HRESULT hr; - BOOL bRet = false; - - if ((hItem = GetSelectedItem())) { - lptvid = (LPTVITEMDATA)GetItemData(hItem); - - if (lptvid && lptvid->lpsfParent && lptvid->lpi) { - hr = lptvid->lpsfParent->BindToObject(lptvid->lpi, 0, IID_IShellFolder, (LPVOID *)&lpsf2); - - if (SUCCEEDED(hr)) { - ULONG ulAttrs = SFGAO_FILESYSTEM; - - // Determine what type of object we have. - lptvid->lpsfParent->GetAttributesOf(1, (const struct _ITEMIDLIST **)&lptvid->lpi, &ulAttrs); - - if (ulAttrs & (SFGAO_FILESYSTEM)) { - if (SHGetPathFromIDList(lptvid->lpifq, szBuff)) { - szFolderPath = szBuff; - bRet = true; - } - } - } - } - if (lpsf2) { - lpsf2->Release(); - } - } - return bRet; -} - -/**************************************************************************** -* -* FUNCTION: GetParentShellFolder(HTREEITEM folderNode) -* -* PURPOSE: Retrieves the pointer to the ISHELLFOLDER interface -* of the tree node passed as the paramter. -* -* MESSAGEMAP: NONE -* -****************************************************************************/ -LPSHELLFOLDER CShellTree::GetParentShellFolder(HTREEITEM folderNode) { - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - - lptvid = (LPTVITEMDATA)GetItemData(folderNode); - if (lptvid) { - return lptvid->lpsfParent; - } else { - return NULL; - } -} - -/**************************************************************************** -* -* FUNCTION: GetRelativeIDLIST(HTREEITEM folderNode) -* -* PURPOSE: Retrieves the Pointer to an ITEMIDLIST structure that -* identifies the subfolder relative to its parent folder. -* see GetParentShellFolder(); -* -* MESSAGEMAP: NONE -* -****************************************************************************/ -LPITEMIDLIST CShellTree::GetRelativeIDLIST(HTREEITEM folderNode) { - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - - lptvid = (LPTVITEMDATA)GetItemData(folderNode); - if (lptvid) { - return lptvid->lpifq; - } else { - return NULL; - } -} - -/**************************************************************************** -* -* FUNCTION: GetFullyQualifiedIDLIST(HTREEITEM folderNode) -* -* PURPOSE: Retrieves the Retrieves the Pointer to an ITEMIDLIST -* structure that identifies the subfolder relative to the -* desktop. This is a fully qualified Item Identifier -* -* MESSAGEMAP: NONE -* -****************************************************************************/ -LPITEMIDLIST CShellTree::GetFullyQualifiedID(HTREEITEM folderNode) { - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - - lptvid = (LPTVITEMDATA)GetItemData(folderNode); - if (lptvid) { - return lptvid->lpifq; - } else { - return NULL; - } -} - -/**************************************************************************** -* -* FUNCTION: SearchTree( HTREEITEM treeNode, -* CString szSearchName ) -* -* PURPOSE: Too crude to explain, just use it -* -* WARNING: Only works if you use the default PopulateTree() -* Not guaranteed to work on any future or existing -* version of windows. Use with caution. Pretty much -* ok if you're using on local drives -* -****************************************************************************/ -bool CShellTree::SearchTree(HTREEITEM treeNode, CString szSearchName, FindAttribs attr) { - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - LPSHELLFOLDER lpsf2 = NULL; - char drive[_MAX_DRIVE]; - char dir[_MAX_DIR]; - char fname[_MAX_FNAME]; - char ext[_MAX_EXT]; - bool bRet = false; - HRESULT hr; - CString szCompare; - - szSearchName.MakeUpper(); - while (treeNode && bRet == false) { - lptvid = (LPTVITEMDATA)GetItemData(treeNode); - if (lptvid && lptvid->lpsfParent && lptvid->lpi) { - hr = lptvid->lpsfParent->BindToObject(lptvid->lpi, 0, IID_IShellFolder, (LPVOID *)&lpsf2); - if (SUCCEEDED(hr)) { - ULONG ulAttrs = SFGAO_FILESYSTEM; - lptvid->lpsfParent->GetAttributesOf(1, (const struct _ITEMIDLIST **)&lptvid->lpi, &ulAttrs); - if (ulAttrs & (SFGAO_FILESYSTEM)) { - if (SHGetPathFromIDList(lptvid->lpifq, szCompare.GetBuffer(MAX_PATH))) { - switch (attr) { - case type_drive: - _splitpath(szCompare, drive, dir, fname, ext); - szCompare = drive; - break; - case type_folder: - szCompare = GetItemText(treeNode); - break; - } - szCompare.MakeUpper(); - if (szCompare == szSearchName) { - EnsureVisible(treeNode); - SelectItem(treeNode); - bRet = true; - } - } - } - lpsf2->Release(); - } - } - treeNode = GetNextSiblingItem(treeNode); - } - return bRet; -} - -/**************************************************************************** -* -* FUNCTION: TunnelTree(CString szFindPath) -* -* PURPOSE: Too crude to explain, just use it -* -* WARNING: Only works if you use the default PopulateTree() -* Not guaranteed to work on any future or existing -* version of windows. Use with caution. Pretty much -* ok if you're using on local drives -* -****************************************************************************/ -void CShellTree::TunnelTree(CString szFindPath) { - HTREEITEM subNode = GetRootItem(); - CString szPathHop; - char drive[_MAX_DRIVE]; - char dir[_MAX_DIR]; - char fname[_MAX_FNAME]; - char ext[_MAX_EXT]; - char delimiter[] = "\\"; - - CFileName checkPath(szFindPath); - if (!checkPath.Exist()) { - MessageBox(szFindPath, "Folder not found", MB_ICONERROR); - return; - } - - if (szFindPath.ReverseFind('\\') != szFindPath.GetLength() - 1) { - szFindPath += "\\"; - } - - _splitpath(szFindPath, drive, dir, fname, ext); - - //search the drive first - szPathHop = drive; - subNode = GetChildItem(subNode); - if (subNode) { - if (SearchTree(subNode, szPathHop, CShellTree::type_drive)) { - //break down subfolders and search - char * p = strtok(dir, delimiter); - while (p) { - subNode = GetSelectedItem(); - subNode = GetChildItem(subNode); - if (SearchTree(subNode, p, CShellTree::type_folder)) { - p = strtok(NULL, delimiter); - } else { - p = NULL; - } - } - } - } -} \ No newline at end of file diff --git a/src/tool/N3ME/ShellTree.h b/src/tool/N3ME/ShellTree.h deleted file mode 100644 index dc6b0dcb..00000000 --- a/src/tool/N3ME/ShellTree.h +++ /dev/null @@ -1,114 +0,0 @@ -#pragma once - -// ShellTree.h : header file -// - -#include - -class CFileName { - public: - CFileName(CString szFileName = ""); - virtual ~CFileName(); - - void SetFileName(CString szFileName); - CString GetFileName(); - CString GetRoot(); - CString GetFileTitle(); - CString GetDescription(); - bool Exist(); - - private: - CString m_szFileName; - char m_szDrive[_MAX_DRIVE]; - char m_szDir[_MAX_DIR]; - char m_szFname[_MAX_FNAME]; - char m_szExt[_MAX_EXT]; -}; - -class CShellPidl { - public: - // STRUCTURES - typedef struct tagLVID { - LPSHELLFOLDER lpsfParent; - LPITEMIDLIST lpi; - ULONG ulAttribs; - } LVITEMDATA, *LPLVITEMDATA; - - typedef struct tagID { - LPSHELLFOLDER lpsfParent; - LPITEMIDLIST lpi; - LPITEMIDLIST lpifq; - } TVITEMDATA, *LPTVITEMDATA; - - public: - // Functions that deal with PIDLs - LPITEMIDLIST ConcatPidls(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2); - LPITEMIDLIST GetFullyQualPidl(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi); - LPITEMIDLIST CopyITEMID(LPMALLOC lpMalloc, LPITEMIDLIST lpi); - BOOL GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi, DWORD dwFlags, LPSTR lpFriendlyName); - LPITEMIDLIST CreatePidl(UINT cbSize); - UINT GetSize(LPCITEMIDLIST pidl); - LPITEMIDLIST Next(LPCITEMIDLIST pidl); - - // Utility Functions - BOOL DoTheMenuThing(HWND hwnd, LPSHELLFOLDER lpsfParent, LPITEMIDLIST lpi, LPPOINT lppt); - int GetItemIcon(LPITEMIDLIST lpi, UINT uFlags); -}; - -class CShellTree : public CTreeCtrl, public CShellPidl { - public: - enum FindAttribs { - type_drive, - type_folder - }; - - // Construction - public: - CShellTree(); - - // Attributes - public: - BOOL m_bOutaHere; - - // Operations - public: - void PopulateTree(); - void PopulateTree(int nFolder); - void OnFolderExpanding(NMHDR * pNMHDR, LRESULT * pResult); - void GetContextMenu(NMHDR * pNMHDR, LRESULT * pResult); - BOOL OnFolderSelected(NMHDR * pNMHDR, LRESULT * pResult, CString & szFolderPath); - void OnDeleteShellItem(NMHDR * pNMHDR, LRESULT * pResult); - void EnableImages(); - BOOL GetSelectedFolderPath(CString & szFolderPath); - bool SearchTree(HTREEITEM treeNode, CString szSearchName, FindAttribs attr); - void TunnelTree(CString szFindPath); - LPSHELLFOLDER GetParentShellFolder(HTREEITEM folderNode); - LPITEMIDLIST GetRelativeIDLIST(HTREEITEM folderNode); - LPITEMIDLIST GetFullyQualifiedID(HTREEITEM folderNode); - void FindTreePidl(HTREEITEM nextNode, HTREEITEM & folderNode, LPLVITEMDATA lplvid, bool & valid); - - // Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CShellTree) - //}}AFX_VIRTUAL - - // Implementation - public: - virtual ~CShellTree(); - - // Generated message map functions - protected: - void FillTreeView(LPSHELLFOLDER lpsf, LPITEMIDLIST lpifq, HTREEITEM hParent); - void GetNormalAndSelectedIcons(LPITEMIDLIST lpifq, LPTV_ITEM lptvitem); - static int CALLBACK TreeViewCompareProc(LPARAM, LPARAM, LPARAM); - - //{{AFX_MSG(CShellTree) - //}}AFX_MSG - - DECLARE_MESSAGE_MAP() -}; - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. diff --git a/src/tool/N3Viewer/N3Viewer.vcxproj b/src/tool/N3Viewer/N3Viewer.vcxproj index 2b2efed7..f40d685c 100644 --- a/src/tool/N3Viewer/N3Viewer.vcxproj +++ b/src/tool/N3Viewer/N3Viewer.vcxproj @@ -169,7 +169,6 @@ - Create Create @@ -230,7 +229,6 @@ - diff --git a/src/tool/N3Viewer/N3Viewer.vcxproj.filters b/src/tool/N3Viewer/N3Viewer.vcxproj.filters index b7fbffae..71cc6a44 100644 --- a/src/tool/N3Viewer/N3Viewer.vcxproj.filters +++ b/src/tool/N3Viewer/N3Viewer.vcxproj.filters @@ -42,9 +42,6 @@ Source Files - - Source Files - Source Files @@ -200,9 +197,6 @@ Header Files - - Header Files - Header Files diff --git a/src/tool/N3Viewer/ShellTree.cpp b/src/tool/N3Viewer/ShellTree.cpp deleted file mode 100644 index a4a8365e..00000000 --- a/src/tool/N3Viewer/ShellTree.cpp +++ /dev/null @@ -1,1153 +0,0 @@ -// ShellTree.cpp : implementation file -// - -#include "StdAfx.h" -#include "ShellTree.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -CFileName::CFileName(CString szFileName) { - m_szFileName = szFileName; -} - -CFileName::~CFileName() {} - -void CFileName::SetFileName(CString szFileName) { - m_szFileName = szFileName; -} - -/***************************************************************** -* -* Function: GetFileName() -* -* Purpose: Retrieves current filename minus the path -* -* Remarks: if the filename is "c:\incoming\hello.txt", this -* function returns "hello.txt". -* -******************************************************************/ -CString CFileName::GetFileName() { - CString szFileName; - - _splitpath(m_szFileName, m_szDrive, m_szDir, m_szFname, m_szExt); - szFileName = m_szFname; - szFileName += m_szExt; - - return szFileName; -} - -/***************************************************************** -* -* Function: GetRoot() -* -* Purpose: Retrieves the path only of the current filename. -* -* Remarks: if the filename is "c:\incoming\hello.txt", this -* function returns "c:\incoming\". -* -******************************************************************/ -CString CFileName::GetRoot() { - CString szFileName; - - _splitpath(m_szFileName, m_szDrive, m_szDir, m_szFname, m_szExt); - szFileName = m_szDrive; - szFileName += m_szDir; - - return szFileName; -} - -/***************************************************************** -* -* Function: GetFileTitle() -* -* Purpose: Retrieves the title of the filename excluding -* the path and extension. -* -* Remarks: if the filename is "c:\incoming\hello.txt", this -* function returns "hello". -* -******************************************************************/ -CString CFileName::GetFileTitle() { - CString szFileName; - - _splitpath(m_szFileName, m_szDrive, m_szDir, m_szFname, m_szExt); - szFileName = m_szFname; - - return szFileName; -} - -/***************************************************************** -* -* Function: GetDescription() -* -* Purpose: Returns the description of the file -* -******************************************************************/ -CString CFileName::GetDescription() { - CString szTypeName; - SHFILEINFO sfi; - - SHGetFileInfo(m_szFileName, 0, &sfi, sizeof(SHFILEINFO), SHGFI_TYPENAME); - - szTypeName = sfi.szTypeName; - - return szTypeName; -} - -/***************************************************************** -* -* Function: Exists() -* -* Purpose: Determines whether a file or directory exists. -* -******************************************************************/ -bool CFileName::Exist() { - WIN32_FIND_DATA fd; - - CString szFindPath = m_szFileName; - int nSlash = szFindPath.ReverseFind('\\'); - - if (nSlash == szFindPath.GetLength() - 1) { - szFindPath = szFindPath.Left(nSlash); - } - - HANDLE hFind = FindFirstFile(szFindPath, &fd); - - if (hFind != INVALID_HANDLE_VALUE) { - FindClose(hFind); - } - - return hFind != INVALID_HANDLE_VALUE; -} - -LPITEMIDLIST CShellPidl::Next(LPCITEMIDLIST pidl) { - LPSTR lpMem = (LPSTR)pidl; - - lpMem += pidl->mkid.cb; - - return (LPITEMIDLIST)lpMem; -} - -/**************************************************************************** -* -* FUNCTION: GetSize(LPCITEMIDLIST pidl) -* -* PURPOSE: Gets the size of the PIDL -* -****************************************************************************/ -UINT CShellPidl::GetSize(LPCITEMIDLIST pidl) { - UINT cbTotal = 0; - if (pidl) { - cbTotal += sizeof(pidl->mkid.cb); // Null terminator - while (pidl->mkid.cb) { - cbTotal += pidl->mkid.cb; - pidl = Next(pidl); - } - } - - return cbTotal; -} - -/**************************************************************************** -* -* FUNCTION: CreatePidl(UINT cbSize) -* -* PURPOSE: Allocates a PIDL -* -****************************************************************************/ -LPITEMIDLIST CShellPidl::CreatePidl(UINT cbSize) { - LPMALLOC lpMalloc; - HRESULT hr; - LPITEMIDLIST pidl = NULL; - - hr = SHGetMalloc(&lpMalloc); - - if (FAILED(hr)) { - return 0; - } - - pidl = (LPITEMIDLIST)lpMalloc->Alloc(cbSize); - - if (pidl) { - memset(pidl, 0, cbSize); // zero-init for external task alloc - } - - if (lpMalloc) { - lpMalloc->Release(); - } - - return pidl; -} - -/**************************************************************************** -* -* FUNCTION: ConcatPidls(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) -* -* PURPOSE: Concatenates two PIDLs -* -****************************************************************************/ -LPITEMIDLIST CShellPidl::ConcatPidls(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) { - LPITEMIDLIST pidlNew; - UINT cb1; - UINT cb2; - - if (pidl1) { //May be NULL - cb1 = GetSize(pidl1) - sizeof(pidl1->mkid.cb); - } else { - cb1 = 0; - } - - cb2 = GetSize(pidl2); - - pidlNew = CreatePidl(cb1 + cb2); - if (pidlNew) { - if (pidl1) { - memcpy(pidlNew, pidl1, cb1); - } - memcpy(((LPSTR)pidlNew) + cb1, pidl2, cb2); - } - return pidlNew; -} - -/**************************************************************************** -* -* FUNCTION: CopyITEMID(LPMALLOC lpMalloc, LPITEMIDLIST lpi) -* -* PURPOSE: Copies the ITEMID -* -****************************************************************************/ -LPITEMIDLIST CShellPidl::CopyITEMID(LPMALLOC lpMalloc, LPITEMIDLIST lpi) { - LPITEMIDLIST lpiTemp; - - lpiTemp = (LPITEMIDLIST)lpMalloc->Alloc(lpi->mkid.cb + sizeof(lpi->mkid.cb)); - CopyMemory((PVOID)lpiTemp, (CONST VOID *)lpi, lpi->mkid.cb + sizeof(lpi->mkid.cb)); - - return lpiTemp; -} - -/**************************************************************************** -* -* FUNCTION: GetName(LPSHELLFOLDER lpsf,LPITEMIDLIST lpi,DWORD dwFlags, -* LPSTR lpFriendlyName) -* -* PURPOSE: Gets the friendly name for the folder -* -****************************************************************************/ -BOOL CShellPidl::GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi, DWORD dwFlags, LPSTR lpFriendlyName) { - BOOL bSuccess = TRUE; - STRRET str; - - if (NOERROR == lpsf->GetDisplayNameOf(lpi, dwFlags, &str)) { - switch (str.uType) { - case STRRET_WSTR: - - WideCharToMultiByte(CP_ACP, // CodePage - 0, // dwFlags - str.pOleStr, // lpWideCharStr - -1, // cchWideChar - lpFriendlyName, // lpMultiByteStr - MAX_PATH, - //sizeof(lpFriendlyName), // cchMultiByte, wrong. sizeof on a pointer, psk, psk - NULL, // lpDefaultChar, - NULL); // lpUsedDefaultChar - - break; - - case STRRET_OFFSET: - - lstrcpy(lpFriendlyName, (LPSTR)lpi + str.uOffset); - break; - - case STRRET_CSTR: - - lstrcpy(lpFriendlyName, (LPSTR)str.cStr); - break; - - default: - bSuccess = FALSE; - break; - } - } else { - bSuccess = FALSE; - } - - return bSuccess; -} - -/**************************************************************************** -* -* FUNCTION: GetFullyQualPidl(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi) -* -* PURPOSE: Gets the Fully qualified Pidls for the folder -* -****************************************************************************/ -LPITEMIDLIST CShellPidl::GetFullyQualPidl(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi) { - char szBuff[MAX_PATH]; - OLECHAR szOleChar[MAX_PATH]; - LPSHELLFOLDER lpsfDeskTop; - LPITEMIDLIST lpifq; - ULONG ulEaten, ulAttribs; - HRESULT hr; - - if (!GetName(lpsf, lpi, SHGDN_FORPARSING, szBuff)) { - return NULL; - } - - hr = SHGetDesktopFolder(&lpsfDeskTop); - - if (FAILED(hr)) { - return NULL; - } - - MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szBuff, -1, (WCHAR *)szOleChar, sizeof(szOleChar)); - - hr = lpsfDeskTop->ParseDisplayName(NULL, NULL, szOleChar, &ulEaten, &lpifq, &ulAttribs); - - lpsfDeskTop->Release(); - - if (FAILED(hr)) { - return NULL; - } - - return lpifq; -} - -/**************************************************************************** -* -* FUNCTION: DoTheMenuThing(HWND hwnd, -* LPSHELLFOLDER lpsfParent, -* LPITEMIDLIST lpi, -* LPPOINT lppt) -* -* PURPOSE: Displays a popup context menu, given a parent shell folder, -* relative item id and screen location. -* -* PARAMETERS: -* hwnd - Parent window handle -* lpsfParent - Pointer to parent shell folder. -* lpi - Pointer to item id that is relative to lpsfParent -* lppt - Screen location of where to popup the menu. -* -* RETURN VALUE: -* Returns TRUE on success, FALSE on failure -* -****************************************************************************/ -BOOL CShellPidl::DoTheMenuThing(HWND hwnd, LPSHELLFOLDER lpsfParent, LPITEMIDLIST lpi, LPPOINT lppt) { - LPCONTEXTMENU lpcm; - HRESULT hr; - char szTemp[64]; - CMINVOKECOMMANDINFO cmi; - DWORD dwAttribs = 0; - int idCmd; - HMENU hMenu; - BOOL bSuccess = TRUE; - - hr = lpsfParent->GetUIObjectOf(hwnd, - 1, //Number of objects to get attributes of - (const struct _ITEMIDLIST **)&lpi, IID_IContextMenu, 0, (LPVOID *)&lpcm); - if (SUCCEEDED(hr)) { - hMenu = CreatePopupMenu(); - - if (hMenu) { - hr = lpcm->QueryContextMenu(hMenu, 0, 1, 0x7fff, CMF_EXPLORE); - if (SUCCEEDED(hr)) { - idCmd = TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RETURNCMD | TPM_RIGHTBUTTON, lppt->x, lppt->y, 0, - hwnd, NULL); - - if (idCmd) { - cmi.cbSize = sizeof(CMINVOKECOMMANDINFO); - cmi.fMask = 0; - cmi.hwnd = hwnd; - cmi.lpVerb = MAKEINTRESOURCE(idCmd - 1); - cmi.lpParameters = NULL; - cmi.lpDirectory = NULL; - cmi.nShow = SW_SHOWNORMAL; - cmi.dwHotKey = 0; - cmi.hIcon = NULL; - hr = lpcm->InvokeCommand(&cmi); - if (!SUCCEEDED(hr)) { - wsprintf(szTemp, "InvokeCommand failed. hr=%lx", hr); - AfxMessageBox(szTemp); - } - } - - } else { - bSuccess = FALSE; - } - - DestroyMenu(hMenu); - } else { - bSuccess = FALSE; - } - - lpcm->Release(); - } else { - wsprintf(szTemp, "GetUIObjectOf failed! hr=%lx", hr); - AfxMessageBox(szTemp); - bSuccess = FALSE; - } - return bSuccess; -} - -/**************************************************************************** -* -* FUNCTION: GetIcon(LPITEMIDLIST lpi, UINT uFlags) -* -* PURPOSE: Gets the index for the current icon. Index is index into system -* image list. -* -* PARAMETERS: -* lpi - Fully qualified item id list for current item. -* uFlags - Flags for SHGetFileInfo() -* -* RETURN VALUE: -* Icon index for current item. -****************************************************************************/ -int CShellPidl::GetItemIcon(LPITEMIDLIST lpi, UINT uFlags) { - SHFILEINFO sfi; - - SHGetFileInfo((LPCSTR)lpi, 0, &sfi, sizeof(SHFILEINFO), uFlags); - - return sfi.iIcon; -} - -CShellTree::CShellTree() {} - -CShellTree::~CShellTree() {} - -BEGIN_MESSAGE_MAP(CShellTree, CTreeCtrl) -//{{AFX_MSG_MAP(CShellTree) -//}}AFX_MSG_MAP -END_MESSAGE_MAP() - -/**************************************************************************** -* -* FUNCTION: PopulateTree() -* -* PURPOSE: Processes the File.Fill/RefreshTree command -* -****************************************************************************/ -void CShellTree::PopulateTree() { - LPSHELLFOLDER lpsf = NULL; - LPITEMIDLIST lpi = NULL; - HRESULT hr; - TV_SORTCB tvscb; - - // Get a pointer to the desktop folder. - hr = SHGetDesktopFolder(&lpsf); - - if (SUCCEEDED(hr)) { - // Initialize the tree view to be empty. - DeleteAllItems(); - - // Fill in the tree view from the root. - FillTreeView(lpsf, NULL, TVI_ROOT); - //TunnelFillTree(lpsf, NULL, TVI_ROOT); - // Release the folder pointer. - lpsf->Release(); - } - tvscb.hParent = TVI_ROOT; - tvscb.lParam = 0; - tvscb.lpfnCompare = TreeViewCompareProc; - - // Sort the items in the tree view - SortChildrenCB(&tvscb /*, FALSE*/); - - HTREEITEM hItem; - hItem = GetRootItem(); - Expand(hItem, TVE_EXPAND); - Select(GetRootItem(), TVGN_CARET); -} - -/**************************************************************************** -* -* FUNCTION: PopulateTree() -* -* PURPOSE: Processes the File.Fill/RefreshTree command -* This overload has the ability to open from a -* special folderlocation like SHBrowseForFolder() -* -* WARNING: TunnelTree() will not work if you use a special -* folderlocation -* -****************************************************************************/ -void CShellTree::PopulateTree(int nFolder) { - LPSHELLFOLDER lpsf = NULL, lpsf2 = NULL; - LPITEMIDLIST lpi = NULL; - HRESULT hr; - TV_SORTCB tvscb; - - // Get a pointer to the desktop folder. - hr = SHGetDesktopFolder(&lpsf); - - if (SUCCEEDED(hr)) { - // Initialize the tree view to be empty. - DeleteAllItems(); - - if (!SUCCEEDED(SHGetSpecialFolderLocation(m_hWnd, nFolder, &lpi))) { - lpi = NULL; - FillTreeView(lpsf, NULL, TVI_ROOT); - } else { - hr = lpsf->BindToObject(lpi, 0, IID_IShellFolder, (LPVOID *)&lpsf2); - - if (SUCCEEDED(hr)) { - // Fill in the tree view from the root. - FillTreeView(lpsf2, lpi, TVI_ROOT); - lpsf2->Release(); - } else { - FillTreeView(lpsf, NULL, TVI_ROOT); - } - } - - // Release the folder pointer. - lpsf->Release(); - } - tvscb.hParent = TVI_ROOT; - tvscb.lParam = 0; - tvscb.lpfnCompare = TreeViewCompareProc; - - // Sort the items in the tree view - SortChildrenCB(&tvscb /*, FALSE*/); - - HTREEITEM hItem; - hItem = GetRootItem(); - Expand(hItem, TVE_EXPAND); - Select(GetRootItem(), TVGN_CARET); -} - -/**************************************************************************** -* -* FUNCTION: FillTreeView( LPSHELLFOLDER lpsf, -* LPITEMIDLIST lpifq, -* HTREEITEM hParent) -* -* PURPOSE: Fills a branch of the TreeView control. Given the -* shell folder, enumerate the subitems of this folder, -* and add the appropriate items to the tree. -* -* PARAMETERS: -* lpsf - Pointer to shell folder that we want to enumerate items -* lpifq - Fully qualified item id list to the item that we are enumerating -* items for. In other words, this is the PIDL to the item -* identified by the lpsf parameter. -* hParent - Parent node -* -* COMMENTS: -* This function enumerates the items in the folder identifed by lpsf. -* Note that since we are filling the left hand pane, we will only add -* items that are folders and/or have sub-folders. We *could* put all -* items in here if we wanted, but that's not the intent. -* -****************************************************************************/ -void CShellTree::FillTreeView(LPSHELLFOLDER lpsf, LPITEMIDLIST lpifq, HTREEITEM hParent) { - TV_ITEM tvi; // TreeView Item. - TV_INSERTSTRUCT tvins; // TreeView Insert Struct. - HTREEITEM hPrev = NULL; // Previous Item Added. - LPSHELLFOLDER lpsf2 = NULL; - LPENUMIDLIST lpe = NULL; - LPITEMIDLIST lpi = NULL, lpiTemp = NULL, lpifqThisItem = NULL; - LPTVITEMDATA lptvid = NULL; - LPMALLOC lpMalloc = NULL; - ULONG ulFetched; - UINT uCount = 0; - HRESULT hr; - char szBuff[256]; - HWND hwnd = ::GetParent(m_hWnd); - - // Allocate a shell memory object. - hr = ::SHGetMalloc(&lpMalloc); - if (FAILED(hr)) { - return; - } - - if (SUCCEEDED(hr)) { - // Get the IEnumIDList object for the given folder. - hr = lpsf->EnumObjects(hwnd, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS, &lpe); - - if (SUCCEEDED(hr)) { - // Enumerate throught the list of folder and non-folder objects. - while (S_OK == lpe->Next(1, &lpi, &ulFetched)) { - //Create a fully qualified path to the current item - //The SH* shell api's take a fully qualified path pidl, - //(see GetIcon above where I call SHGetFileInfo) whereas the - //interface methods take a relative path pidl. - ULONG ulAttrs = SFGAO_HASSUBFOLDER | SFGAO_FOLDER; - - // Determine what type of object we have. - lpsf->GetAttributesOf(1, (const struct _ITEMIDLIST **)&lpi, &ulAttrs); - - if (ulAttrs & (SFGAO_HASSUBFOLDER | SFGAO_FOLDER)) { - //We need this next if statement so that we don't add things like - //the MSN to our tree. MSN is not a folder, but according to the - //shell it has subfolders. - if (ulAttrs & SFGAO_FOLDER) { - tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; - - if (ulAttrs & SFGAO_HASSUBFOLDER) { - //This item has sub-folders, so let's put the + in the TreeView. - //The first time the user clicks on the item, we'll populate the - //sub-folders. - tvi.cChildren = 1; - tvi.mask |= TVIF_CHILDREN; - } - - //OK, let's get some memory for our ITEMDATA struct - lptvid = (LPTVITEMDATA)lpMalloc->Alloc(sizeof(TVITEMDATA)); - if (!lptvid) { - goto Done; // Error - could not allocate memory. - } - - //Now get the friendly name that we'll put in the treeview. - if (!GetName(lpsf, lpi, SHGDN_NORMAL, szBuff)) { - goto Done; // Error - could not get friendly name. - } - - tvi.pszText = szBuff; - tvi.cchTextMax = MAX_PATH; - - lpifqThisItem = ConcatPidls(lpifq, lpi); - - //Now, make a copy of the ITEMIDLIST - lptvid->lpi = CopyITEMID(lpMalloc, lpi); - - GetNormalAndSelectedIcons(lpifqThisItem, &tvi); - - lptvid->lpsfParent = lpsf; //Store the parent folders SF - lpsf->AddRef(); - - lptvid->lpifq = ConcatPidls(lpifq, lpi); - - tvi.lParam = (LPARAM)lptvid; - - // Populate the TreeVeiw Insert Struct - // The item is the one filled above. - // Insert it after the last item inserted at this level. - // And indicate this is a root entry. - tvins.item = tvi; - tvins.hInsertAfter = hPrev; - tvins.hParent = hParent; - - // Add the item to the tree - hPrev = InsertItem(&tvins); - } - // Free this items task allocator. - lpMalloc->Free(lpifqThisItem); - lpifqThisItem = 0; - } - - lpMalloc->Free(lpi); //Free the pidl that the shell gave us. - lpi = 0; - } - } - - } else { - return; - } - -Done: - - if (lpe) { - lpe->Release(); - } - - //The following 2 if statements will only be TRUE if we got here on an - //error condition from the "goto" statement. Otherwise, we free this memory - //at the end of the while loop above. - if (lpi && lpMalloc) { - lpMalloc->Free(lpi); - } - if (lpifqThisItem && lpMalloc) { - lpMalloc->Free(lpifqThisItem); - } - - if (lpMalloc) { - lpMalloc->Release(); - } -} - -/**************************************************************************** -* -* FUNCTION: GetNormalAndSelectedIcons(LPITEMIDLIST lpifq, LPTV_ITEM lptvitem) -* -* PURPOSE: Gets the index for the normal and selected icons for the current item. -* -* PARAMETERS: -* lpifq - Fully qualified item id list for current item. -* lptvitem - Pointer to treeview item we are about to add to the tree. -* -****************************************************************************/ -void CShellTree::GetNormalAndSelectedIcons(LPITEMIDLIST lpifq, LPTV_ITEM lptvitem) { - //Note that we don't check the return value here because if GetIcon() - //fails, then we're in big trouble... - - lptvitem->iImage = GetItemIcon(lpifq, SHGFI_PIDL | SHGFI_SYSICONINDEX | SHGFI_SMALLICON); - - lptvitem->iSelectedImage = GetItemIcon(lpifq, SHGFI_PIDL | SHGFI_SYSICONINDEX | SHGFI_SMALLICON | SHGFI_OPENICON); - - return; -} - -/**************************************************************************** -* -* FUNCTION: TreeViewCompareProc(LPARAM, LPARAM, LPARAM) -* -* PURPOSE: Callback routine for sorting the tree -* -****************************************************************************/ -int CALLBACK CShellTree::TreeViewCompareProc(LPARAM lparam1, LPARAM lparam2, LPARAM lparamSort) { - LPTVITEMDATA lptvid1 = (LPTVITEMDATA)lparam1; - LPTVITEMDATA lptvid2 = (LPTVITEMDATA)lparam2; - HRESULT hr; - - hr = lptvid1->lpsfParent->CompareIDs(0, lptvid1->lpi, lptvid2->lpi); - - if (FAILED(hr)) { - return 0; - } - - return (short)SCODE_CODE(GetScode(hr)); -} - -///////////////////////////////////////////////////////////////////////////// -// CShellTree message handlers - -/**************************************************************************** -* -* FUNCTION: OnFolderExpanding(NMHDR* pNMHDR, LRESULT* pResult) -* -* PURPOSE: Reponds to an TVN_ITEMEXPANDING message in order to fill up -* subdirectories. Pass the parameters from OnItemExpanding() to -* this function. You need to do that or your folders won't -* expand. -* -* OTHER: It can also be used to update a corresponding listview. Seem MFCENUM -* -* MESSAGEMAP: TVN_ITEMEXPANDING -* -****************************************************************************/ -void CShellTree::OnFolderExpanding(NMHDR * pNMHDR, LRESULT * pResult) { - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - HRESULT hr; - LPSHELLFOLDER lpsf2 = NULL; - static char szBuff[MAX_PATH]; - TV_SORTCB tvscb; - - NM_TREEVIEW * pnmtv = (NM_TREEVIEW *)pNMHDR; - // TODO: Add your control notification handler code here - if ((pnmtv->itemNew.state & TVIS_EXPANDEDONCE)) { - return; - } - - lptvid = (LPTVITEMDATA)pnmtv->itemNew.lParam; - if (lptvid) { - hr = lptvid->lpsfParent->BindToObject(lptvid->lpi, 0, IID_IShellFolder, (LPVOID *)&lpsf2); - - if (SUCCEEDED(hr)) { - FillTreeView(lpsf2, lptvid->lpifq, pnmtv->itemNew.hItem); - } - - tvscb.hParent = pnmtv->itemNew.hItem; - tvscb.lParam = 0; - tvscb.lpfnCompare = TreeViewCompareProc; - - SortChildrenCB(&tvscb /*, FALSE*/); - } - - *pResult = 0; -} - -/**************************************************************************** -* -* FUNCTION: GetContextMenu(NMHDR* pNMHDR, LRESULT* pResult) -* -* PURPOSE: Diplays a popup menu for the folder selected. Pass the -* parameters from Rclick() to this function. -* -* MESSAGEMAP: NM_RCLICK; -* -****************************************************************************/ -void CShellTree::GetContextMenu(NMHDR * pNMHDR, LRESULT * pResult) { - // TODO: Add your control notification handler code here - POINT pt; - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - LPSHELLFOLDER lpsf2 = NULL; - static char szBuff[MAX_PATH]; - TV_HITTESTINFO tvhti; - TV_ITEM tvi; - - // TODO: Add your control notification handler code here - ::GetCursorPos((LPPOINT)&pt); - ScreenToClient(&pt); - tvhti.pt = pt; - HitTest(&tvhti); - SelectItem(tvhti.hItem); - if (tvhti.flags & (TVHT_ONITEMLABEL | TVHT_ONITEMICON)) { - ClientToScreen(&pt); - tvi.mask = TVIF_PARAM; - tvi.hItem = tvhti.hItem; - - if (!GetItem(&tvi)) { - return; - } - - lptvid = (LPTVITEMDATA)tvi.lParam; - - DoTheMenuThing(::GetParent(m_hWnd), lptvid->lpsfParent, lptvid->lpi, &pt); - } - - *pResult = 0; -} - -/**************************************************************************** -* -* FUNCTION: OnFolderSelected(NMHDR* pNMHDR, LRESULT* pResult, CString &szFolderPath) -* -* PURPOSE: Call this function if for example you want to put the path of the folder -* selected inside a combobox or an edit window. You would pass the -* parameters from OnSelChanged() to this function along with a CString object -* that will hold the folder path. If the path is not -* in the filesystem(eg MyComputer) it returns false. -* -* MESSAGEMAP: TVN_SELCHANGED -* -****************************************************************************/ -BOOL CShellTree::OnFolderSelected(NMHDR * pNMHDR, LRESULT * pResult, CString & szFolderPath) { - // TODO: Add your control notification handler code here - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - LPSHELLFOLDER lpsf2 = NULL; - static char szBuff[MAX_PATH]; - HRESULT hr; - BOOL bRet = false; - TV_SORTCB tvscb; - HTREEITEM hItem = NULL; - - if ((hItem = GetSelectedItem())) { - lptvid = (LPTVITEMDATA)GetItemData(hItem); - - if (lptvid && lptvid->lpsfParent && lptvid->lpi) { - hr = lptvid->lpsfParent->BindToObject(lptvid->lpi, 0, IID_IShellFolder, (LPVOID *)&lpsf2); - - if (SUCCEEDED(hr)) { - ULONG ulAttrs = SFGAO_FILESYSTEM; - - // Determine what type of object we have. - lptvid->lpsfParent->GetAttributesOf(1, (const struct _ITEMIDLIST **)&lptvid->lpi, &ulAttrs); - - if (ulAttrs & (SFGAO_FILESYSTEM)) { - if (SHGetPathFromIDList(lptvid->lpifq, szBuff)) { - szFolderPath = szBuff; - bRet = true; - } - } - //non standard from here(NEW CODE) - NM_TREEVIEW * pnmtv = (NM_TREEVIEW *)pNMHDR; - if ((pnmtv->itemNew.cChildren == 1) && !(pnmtv->itemNew.state & TVIS_EXPANDEDONCE)) { - FillTreeView(lpsf2, lptvid->lpifq, pnmtv->itemNew.hItem); - - tvscb.hParent = pnmtv->itemNew.hItem; - tvscb.lParam = 0; - tvscb.lpfnCompare = TreeViewCompareProc; - SortChildrenCB(&tvscb); - - pnmtv->itemNew.state |= TVIS_EXPANDEDONCE; - pnmtv->itemNew.stateMask |= TVIS_EXPANDEDONCE; - pnmtv->itemNew.mask |= TVIF_STATE; - SetItem(&pnmtv->itemNew); - } - } - } - if (lpsf2) { - lpsf2->Release(); - } - } - *pResult = 0; - return bRet; -} - -/**************************************************************************** -* -* FUNCTION: OnDeleteShellItem(NMHDR* pNMHDR, LRESULT* pResult) -* -* PURPOSE: Releases the memory allocated by the shell folders -* -* MESSAGEMAP: TVN_DELETEITEM -* -* MISC: failure to call this function will result in a memory leak -* -****************************************************************************/ -void CShellTree::OnDeleteShellItem(NMHDR * pNMHDR, LRESULT * pResult) { - LPTVITEMDATA lptvid = NULL; - HRESULT hr; - LPMALLOC lpMalloc; - - NM_TREEVIEW * pNMTreeView = (NM_TREEVIEW *)pNMHDR; - - //Let's free the memory for the TreeView item data... - hr = SHGetMalloc(&lpMalloc); - if (FAILED(hr)) { - return; - } - - lptvid = (LPTVITEMDATA)pNMTreeView->itemOld.lParam; - lptvid->lpsfParent->Release(); - lpMalloc->Free(lptvid->lpi); - lpMalloc->Free(lptvid->lpifq); - lpMalloc->Free(lptvid); - lpMalloc->Release(); -} - -/**************************************************************************** -* -* FUNCTION: EnableImages() -* -* PURPOSE: Obtains a handle to the system image list and attaches it -* to the tree control. DO NOT DELETE the imagelist -* -* MESSAGEMAP: NONE -* -****************************************************************************/ -void CShellTree::EnableImages() { - // Get the handle to the system image list, for our icons - HIMAGELIST hImageList; - SHFILEINFO sfi; - - hImageList = - (HIMAGELIST)SHGetFileInfo((LPCSTR) "C:\\", 0, &sfi, sizeof(SHFILEINFO), SHGFI_SYSICONINDEX | SHGFI_SMALLICON); - - // Attach ImageList to TreeView - if (hImageList) { - ::SendMessage(m_hWnd, TVM_SETIMAGELIST, (WPARAM)TVSIL_NORMAL, (LPARAM)hImageList); - } -} - -/**************************************************************************** -* -* FUNCTION: GetSelectedFolderPath(CString &szFolderPath) -* -* PURPOSE: Retrieves the path of the currently selected string. -* Pass a CString object that will hold the folder path. -* If the path is not in the filesystem(eg MyComputer) -* or none is selected it returns false. -* -* MESSAGEMAP: NONE -* -****************************************************************************/ -BOOL CShellTree::GetSelectedFolderPath(CString & szFolderPath) { - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - LPSHELLFOLDER lpsf2 = NULL; - static char szBuff[MAX_PATH]; - HTREEITEM hItem = NULL; - HRESULT hr; - BOOL bRet = false; - - if ((hItem = GetSelectedItem())) { - lptvid = (LPTVITEMDATA)GetItemData(hItem); - - if (lptvid && lptvid->lpsfParent && lptvid->lpi) { - hr = lptvid->lpsfParent->BindToObject(lptvid->lpi, 0, IID_IShellFolder, (LPVOID *)&lpsf2); - - if (SUCCEEDED(hr)) { - ULONG ulAttrs = SFGAO_FILESYSTEM; - - // Determine what type of object we have. - lptvid->lpsfParent->GetAttributesOf(1, (const struct _ITEMIDLIST **)&lptvid->lpi, &ulAttrs); - - if (ulAttrs & (SFGAO_FILESYSTEM)) { - if (SHGetPathFromIDList(lptvid->lpifq, szBuff)) { - szFolderPath = szBuff; - bRet = true; - } - } - } - } - if (lpsf2) { - lpsf2->Release(); - } - } - return bRet; -} - -/**************************************************************************** -* -* FUNCTION: GetParentShellFolder(HTREEITEM folderNode) -* -* PURPOSE: Retrieves the pointer to the ISHELLFOLDER interface -* of the tree node passed as the paramter. -* -* MESSAGEMAP: NONE -* -****************************************************************************/ -LPSHELLFOLDER CShellTree::GetParentShellFolder(HTREEITEM folderNode) { - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - - lptvid = (LPTVITEMDATA)GetItemData(folderNode); - if (lptvid) { - return lptvid->lpsfParent; - } else { - return NULL; - } -} - -/**************************************************************************** -* -* FUNCTION: GetRelativeIDLIST(HTREEITEM folderNode) -* -* PURPOSE: Retrieves the Pointer to an ITEMIDLIST structure that -* identifies the subfolder relative to its parent folder. -* see GetParentShellFolder(); -* -* MESSAGEMAP: NONE -* -****************************************************************************/ -LPITEMIDLIST CShellTree::GetRelativeIDLIST(HTREEITEM folderNode) { - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - - lptvid = (LPTVITEMDATA)GetItemData(folderNode); - if (lptvid) { - return lptvid->lpifq; - } else { - return NULL; - } -} - -/**************************************************************************** -* -* FUNCTION: GetFullyQualifiedIDLIST(HTREEITEM folderNode) -* -* PURPOSE: Retrieves the Retrieves the Pointer to an ITEMIDLIST -* structure that identifies the subfolder relative to the -* desktop. This is a fully qualified Item Identifier -* -* MESSAGEMAP: NONE -* -****************************************************************************/ -LPITEMIDLIST CShellTree::GetFullyQualifiedID(HTREEITEM folderNode) { - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - - lptvid = (LPTVITEMDATA)GetItemData(folderNode); - if (lptvid) { - return lptvid->lpifq; - } else { - return NULL; - } -} - -/**************************************************************************** -* -* FUNCTION: SearchTree( HTREEITEM treeNode, -* CString szSearchName ) -* -* PURPOSE: Too crude to explain, just use it -* -* WARNING: Only works if you use the default PopulateTree() -* Not guaranteed to work on any future or existing -* version of windows. Use with caution. Pretty much -* ok if you're using on local drives -* -****************************************************************************/ -bool CShellTree::SearchTree(HTREEITEM treeNode, CString szSearchName, FindAttribs attr) { - LPTVITEMDATA lptvid; //Long pointer to TreeView item data - LPSHELLFOLDER lpsf2 = NULL; - char drive[_MAX_DRIVE]; - char dir[_MAX_DIR]; - char fname[_MAX_FNAME]; - char ext[_MAX_EXT]; - bool bRet = false; - HRESULT hr; - CString szCompare; - - szSearchName.MakeUpper(); - while (treeNode && bRet == false) { - lptvid = (LPTVITEMDATA)GetItemData(treeNode); - if (lptvid && lptvid->lpsfParent && lptvid->lpi) { - hr = lptvid->lpsfParent->BindToObject(lptvid->lpi, 0, IID_IShellFolder, (LPVOID *)&lpsf2); - if (SUCCEEDED(hr)) { - ULONG ulAttrs = SFGAO_FILESYSTEM; - lptvid->lpsfParent->GetAttributesOf(1, (const struct _ITEMIDLIST **)&lptvid->lpi, &ulAttrs); - if (ulAttrs & (SFGAO_FILESYSTEM)) { - if (SHGetPathFromIDList(lptvid->lpifq, szCompare.GetBuffer(MAX_PATH))) { - switch (attr) { - case type_drive: - _splitpath(szCompare, drive, dir, fname, ext); - szCompare = drive; - break; - case type_folder: - szCompare = GetItemText(treeNode); - break; - } - szCompare.MakeUpper(); - if (szCompare == szSearchName) { - EnsureVisible(treeNode); - SelectItem(treeNode); - bRet = true; - } - } - } - lpsf2->Release(); - } - } - treeNode = GetNextSiblingItem(treeNode); - } - return bRet; -} - -/**************************************************************************** -* -* FUNCTION: TunnelTree(CString szFindPath) -* -* PURPOSE: Too crude to explain, just use it -* -* WARNING: Only works if you use the default PopulateTree() -* Not guaranteed to work on any future or existing -* version of windows. Use with caution. Pretty much -* ok if you're using on local drives -* -****************************************************************************/ -void CShellTree::TunnelTree(CString szFindPath) { - HTREEITEM subNode = GetRootItem(); - CString szPathHop; - char drive[_MAX_DRIVE]; - char dir[_MAX_DIR]; - char fname[_MAX_FNAME]; - char ext[_MAX_EXT]; - char delimiter[] = "\\"; - - CFileName checkPath(szFindPath); - if (!checkPath.Exist()) { - MessageBox(szFindPath, "Folder not found", MB_ICONERROR); - return; - } - - if (szFindPath.ReverseFind('\\') != szFindPath.GetLength() - 1) { - szFindPath += "\\"; - } - - _splitpath(szFindPath, drive, dir, fname, ext); - - //search the drive first - szPathHop = drive; - subNode = GetChildItem(subNode); - if (subNode) { - if (SearchTree(subNode, szPathHop, CShellTree::type_drive)) { - //break down subfolders and search - char * p = strtok(dir, delimiter); - while (p) { - subNode = GetSelectedItem(); - subNode = GetChildItem(subNode); - if (SearchTree(subNode, p, CShellTree::type_folder)) { - p = strtok(NULL, delimiter); - } else { - p = NULL; - } - } - } - } -} \ No newline at end of file diff --git a/src/tool/N3Viewer/ShellTree.h b/src/tool/N3Viewer/ShellTree.h deleted file mode 100644 index dc6b0dcb..00000000 --- a/src/tool/N3Viewer/ShellTree.h +++ /dev/null @@ -1,114 +0,0 @@ -#pragma once - -// ShellTree.h : header file -// - -#include - -class CFileName { - public: - CFileName(CString szFileName = ""); - virtual ~CFileName(); - - void SetFileName(CString szFileName); - CString GetFileName(); - CString GetRoot(); - CString GetFileTitle(); - CString GetDescription(); - bool Exist(); - - private: - CString m_szFileName; - char m_szDrive[_MAX_DRIVE]; - char m_szDir[_MAX_DIR]; - char m_szFname[_MAX_FNAME]; - char m_szExt[_MAX_EXT]; -}; - -class CShellPidl { - public: - // STRUCTURES - typedef struct tagLVID { - LPSHELLFOLDER lpsfParent; - LPITEMIDLIST lpi; - ULONG ulAttribs; - } LVITEMDATA, *LPLVITEMDATA; - - typedef struct tagID { - LPSHELLFOLDER lpsfParent; - LPITEMIDLIST lpi; - LPITEMIDLIST lpifq; - } TVITEMDATA, *LPTVITEMDATA; - - public: - // Functions that deal with PIDLs - LPITEMIDLIST ConcatPidls(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2); - LPITEMIDLIST GetFullyQualPidl(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi); - LPITEMIDLIST CopyITEMID(LPMALLOC lpMalloc, LPITEMIDLIST lpi); - BOOL GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi, DWORD dwFlags, LPSTR lpFriendlyName); - LPITEMIDLIST CreatePidl(UINT cbSize); - UINT GetSize(LPCITEMIDLIST pidl); - LPITEMIDLIST Next(LPCITEMIDLIST pidl); - - // Utility Functions - BOOL DoTheMenuThing(HWND hwnd, LPSHELLFOLDER lpsfParent, LPITEMIDLIST lpi, LPPOINT lppt); - int GetItemIcon(LPITEMIDLIST lpi, UINT uFlags); -}; - -class CShellTree : public CTreeCtrl, public CShellPidl { - public: - enum FindAttribs { - type_drive, - type_folder - }; - - // Construction - public: - CShellTree(); - - // Attributes - public: - BOOL m_bOutaHere; - - // Operations - public: - void PopulateTree(); - void PopulateTree(int nFolder); - void OnFolderExpanding(NMHDR * pNMHDR, LRESULT * pResult); - void GetContextMenu(NMHDR * pNMHDR, LRESULT * pResult); - BOOL OnFolderSelected(NMHDR * pNMHDR, LRESULT * pResult, CString & szFolderPath); - void OnDeleteShellItem(NMHDR * pNMHDR, LRESULT * pResult); - void EnableImages(); - BOOL GetSelectedFolderPath(CString & szFolderPath); - bool SearchTree(HTREEITEM treeNode, CString szSearchName, FindAttribs attr); - void TunnelTree(CString szFindPath); - LPSHELLFOLDER GetParentShellFolder(HTREEITEM folderNode); - LPITEMIDLIST GetRelativeIDLIST(HTREEITEM folderNode); - LPITEMIDLIST GetFullyQualifiedID(HTREEITEM folderNode); - void FindTreePidl(HTREEITEM nextNode, HTREEITEM & folderNode, LPLVITEMDATA lplvid, bool & valid); - - // Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CShellTree) - //}}AFX_VIRTUAL - - // Implementation - public: - virtual ~CShellTree(); - - // Generated message map functions - protected: - void FillTreeView(LPSHELLFOLDER lpsf, LPITEMIDLIST lpifq, HTREEITEM hParent); - void GetNormalAndSelectedIcons(LPITEMIDLIST lpifq, LPTV_ITEM lptvitem); - static int CALLBACK TreeViewCompareProc(LPARAM, LPARAM, LPARAM); - - //{{AFX_MSG(CShellTree) - //}}AFX_MSG - - DECLARE_MESSAGE_MAP() -}; - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. From c85184a4c673417da7fa61ac8a819dd3c883a630 Mon Sep 17 00:00:00 2001 From: Steve Williams <90905675+stevewgr@users.noreply.github.com> Date: Mon, 11 Nov 2024 22:01:34 -0500 Subject: [PATCH 5/7] Replace custom DlgBrowsePath implementation with CFolderPickerDialog. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous DlgBrowsePath dialog stored recent paths by updating registry values but was difficult to use for deeply nested folders and lacked copy-paste support for paths. Switching to CFolderPickerDialog leverages Windows Explorer’s modern file dialog, simplifying path selection. This update provides a more user-friendly and modern approach, available in VS12 / MFC11 and later. --- src/server/LoginServer/DlgBrowsePath.cpp | 192 ----------------- src/server/LoginServer/DlgBrowsePath.h | 60 ------ src/server/LoginServer/LoginServer.vcxproj | 2 - .../LoginServer/LoginServer.vcxproj.filters | 6 - src/server/LoginServer/SettingDlg.cpp | 15 +- src/tool/N3Indoor/DlgBrowsePath.cpp | 193 ------------------ src/tool/N3Indoor/DlgBrowsePath.h | 54 ----- src/tool/N3Indoor/MainFrm.cpp | 1 - src/tool/N3Indoor/N3Indoor.vcxproj | 2 - src/tool/N3Indoor/N3Indoor.vcxproj.filters | 6 - src/tool/N3Indoor/OrganizeView.cpp | 9 +- src/tool/N3ME/DlgBrowsePath.cpp | 192 ----------------- src/tool/N3ME/DlgBrowsePath.h | 60 ------ src/tool/N3ME/DlgFolderSelect.h | 51 ----- src/tool/N3ME/MainFrm.cpp | 8 +- src/tool/N3ME/N3ME.vcxproj | 2 - src/tool/N3ME/N3ME.vcxproj.filters | 6 - src/tool/N3Viewer/DlgBrowsePath.cpp | 192 ----------------- src/tool/N3Viewer/DlgBrowsePath.h | 60 ------ src/tool/N3Viewer/MainFrm.cpp | 8 +- src/tool/N3Viewer/N3Viewer.vcxproj | 2 - src/tool/N3Viewer/N3Viewer.vcxproj.filters | 6 - src/tool/UIE/DlgBar.cpp | 35 ++-- src/tool/UIE/UIEDoc.cpp | 76 ++++--- 24 files changed, 64 insertions(+), 1174 deletions(-) delete mode 100644 src/server/LoginServer/DlgBrowsePath.cpp delete mode 100644 src/server/LoginServer/DlgBrowsePath.h delete mode 100644 src/tool/N3Indoor/DlgBrowsePath.cpp delete mode 100644 src/tool/N3Indoor/DlgBrowsePath.h delete mode 100644 src/tool/N3ME/DlgBrowsePath.cpp delete mode 100644 src/tool/N3ME/DlgBrowsePath.h delete mode 100644 src/tool/N3ME/DlgFolderSelect.h delete mode 100644 src/tool/N3Viewer/DlgBrowsePath.cpp delete mode 100644 src/tool/N3Viewer/DlgBrowsePath.h diff --git a/src/server/LoginServer/DlgBrowsePath.cpp b/src/server/LoginServer/DlgBrowsePath.cpp deleted file mode 100644 index 977db3a6..00000000 --- a/src/server/LoginServer/DlgBrowsePath.cpp +++ /dev/null @@ -1,192 +0,0 @@ -// DlgBrowsePath.cpp : implementation file -// - -#include "StdAfx.h" -#include "DlgBrowsePath.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CAboutDlg dialog used for App About -// -// This source is part of CShellTree - Selom Ofori -// -// Version: 1.02 (any previously unversioned copies are older/inferior -// -// This code is free for all to use. Mutatilate it as much as you want -// See MFCENUM sample from microsoft - -///////////////////////////////////////////////////////////////////////////// -// CDlgBrowsePath dialog -// -// This source is part of CShellTree - Selom Ofori -// -// Version: 1.02 (any previously unversioned copies are older/inferior -// -// This code is free for all to use. Mutatilate it as much as you want -// See MFCENUM sample from microsoft - -CDlgBrowsePath::CDlgBrowsePath(CWnd * pParent /*=NULL*/) - : CDialog(CDlgBrowsePath::IDD, pParent) { - //{{AFX_DATA_INIT(CDlgBrowsePath) - //}}AFX_DATA_INIT - // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 - m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); -} - -void CDlgBrowsePath::DoDataExchange(CDataExchange * pDX) { - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CDlgBrowsePath) - DDX_Control(pDX, IDC_FILELIST, m_CBPath); - //}}AFX_DATA_MAP -} - -BEGIN_MESSAGE_MAP(CDlgBrowsePath, CDialog) -//{{AFX_MSG_MAP(CDlgBrowsePath) -ON_WM_PAINT() -ON_WM_QUERYDRAGICON() -ON_NOTIFY(TVN_ITEMEXPANDING, IDC_BROWSE_TREE, OnItemexpandingBrowseTree) -ON_NOTIFY(NM_RCLICK, IDC_BROWSE_TREE, OnRclickBrowseTree) -ON_NOTIFY(TVN_DELETEITEM, IDC_BROWSE_TREE, OnDeleteitemBrowseTree) -ON_BN_CLICKED(IDC_SYNCH_FOLDERS, OnSynchFolders) -ON_NOTIFY(TVN_SELCHANGED, IDC_BROWSE_TREE, OnSelchangedBrowseTree) -ON_WM_SYSCOMMAND() -//}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CDlgBrowsePath message handlers - -BOOL CDlgBrowsePath::OnInitDialog() { - CDialog::OnInitDialog(); - - // 최근에 쓴 폴더를 가져온다... - char szInitDir[256]; - DWORD dwLength = 256; - memset(szInitDir, 0, 256); - CString szKey; - HKEY hKey; - DWORD dwKeyType = REG_SZ; - if (ERROR_SUCCESS == RegOpenKey(HKEY_CURRENT_USER, "Recenet used folder", &hKey)) { - for (int i = 0; i < 10; i++) { - szKey.Format("Folder%.1d", i); - LONG success = RegQueryValueEx(hKey, szKey, NULL, &dwKeyType, (BYTE *)szInitDir, &dwLength); - if (success == ERROR_SUCCESS && lstrlen(szInitDir) != 0) { - m_CBPath.AddString(szInitDir); - } - } - } - - // 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 - - // TODO: Add extra initialization here - m_TreeCtl = (CShellTree *)GetDlgItem(IDC_BROWSE_TREE); - m_TreeCtl->EnableImages(); - m_TreeCtl->PopulateTree(); - - return TRUE; // return TRUE unless you set the focus to a control -} - -// If you add a minimize button to your dialog, you will need the code below -// to draw the icon. For MFC applications using the document/view model, -// this is automatically done for you by the framework. - -void CDlgBrowsePath::OnPaint() { - if (IsIconic()) { - CPaintDC dc(this); // device context for painting - - SendMessage(WM_ICONERASEBKGND, (WPARAM)dc.GetSafeHdc(), 0); - - // Center icon in client rectangle - int cxIcon = GetSystemMetrics(SM_CXICON); - int cyIcon = GetSystemMetrics(SM_CYICON); - CRect rect; - GetClientRect(&rect); - int x = (rect.Width() - cxIcon + 1) / 2; - int y = (rect.Height() - cyIcon + 1) / 2; - - // Draw the icon - dc.DrawIcon(x, y, m_hIcon); - } else { - CDialog::OnPaint(); - } -} - -// The system calls this to obtain the cursor to display while the user drags -// the minimized window. -HCURSOR CDlgBrowsePath::OnQueryDragIcon() { - return (HCURSOR)m_hIcon; -} - -void CDlgBrowsePath::OnItemexpandingBrowseTree(NMHDR * pNMHDR, LRESULT * pResult) { - NM_TREEVIEW * pNMTreeView = (NM_TREEVIEW *)pNMHDR; - // TODO: Add your control notification handler code here - m_TreeCtl->OnFolderExpanding(pNMHDR, pResult); - *pResult = 0; -} - -void CDlgBrowsePath::OnSelchangedBrowseTree(NMHDR * pNMHDR, LRESULT * pResult) { - NM_TREEVIEW * pNMTreeView = (NM_TREEVIEW *)pNMHDR; - // TODO: Add your control notification handler code here - CString szPath; - if (m_TreeCtl->OnFolderSelected(pNMHDR, pResult, szPath)) { - m_CBPath.SetWindowText(szPath); - } - *pResult = 0; -} - -void CDlgBrowsePath::OnRclickBrowseTree(NMHDR * pNMHDR, LRESULT * pResult) { - // TODO: Add your control notification handler code here - m_TreeCtl->GetContextMenu(pNMHDR, pResult); - *pResult = 0; -} - -void CDlgBrowsePath::OnDeleteitemBrowseTree(NMHDR * pNMHDR, LRESULT * pResult) { - NM_TREEVIEW * pNMTreeView = (NM_TREEVIEW *)pNMHDR; - // TODO: Add your control notification handler code here - m_TreeCtl->OnDeleteShellItem(pNMHDR, pResult); - *pResult = 0; -} - -void CDlgBrowsePath::OnSynchFolders() { - // TODO: Add your control notification handler code here - CString szFindFolder; - m_CBPath.GetWindowText(szFindFolder); - m_TreeCtl->TunnelTree(szFindFolder); -} - -void CDlgBrowsePath::OnOK() { - m_CBPath.GetWindowText(m_szPath); // 경로 기억.. - if (m_szPath.GetLength() > 0) { - m_CBPath.InsertString(0, m_szPath); // 경로 넣고... - } - - // 최근에 쓴 폴더를 저장해둔다.... - char szInitDir[256] = ""; - CString szKey; - HKEY hKey; - DWORD dwKeyType = REG_SZ; - if (ERROR_SUCCESS == RegCreateKey(HKEY_CURRENT_USER, "Recenet used folder", &hKey)) { - int nCBC = m_CBPath.GetCount(); - if (nCBC > 10) { - nCBC = 10; - } - for (int i = 0; i < nCBC; i++) { - szKey.Format("Folder%.1d", i); - m_CBPath.GetLBText(i, szInitDir); - int nLength = m_CBPath.GetLBTextLen(i); - if (nLength > 0) { - LONG success = RegSetValueEx(hKey, szKey, NULL, dwKeyType, (CONST BYTE *)szInitDir, nLength); - } - } - } - - CDialog::OnOK(); -} diff --git a/src/server/LoginServer/DlgBrowsePath.h b/src/server/LoginServer/DlgBrowsePath.h deleted file mode 100644 index bbd541e7..00000000 --- a/src/server/LoginServer/DlgBrowsePath.h +++ /dev/null @@ -1,60 +0,0 @@ -// CDlgBrowsePath.h : header file -// - -#pragma once - -#include "Resource.h" -#include "ShellTree.h" - -///////////////////////////////////////////////////////////////////////////// -// CDlgBrowsePath dialog -// -// This source is part of CShellTree - Selom Ofori -// -// Version: 1.02 (any previously unversioned copies are older/inferior -// -// This code is free for all to use. Mutatilate it as much as you want -// See MFCENUM sample from microsoft - -class CDlgBrowsePath : public CDialog { - // Construction - public: - CString m_szPath; - CString GetPath() { return m_szPath; } - CDlgBrowsePath(CWnd * pParent = NULL); // standard constructor - - // Dialog Data - //{{AFX_DATA(CDlgBrowsePath) - enum { - IDD = IDD_BROWSE_PATH - }; - CComboBox m_CBPath; - //}}AFX_DATA - - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CDlgBrowsePath) - protected: - virtual void DoDataExchange(CDataExchange * pDX); // DDX/DDV support - //}}AFX_VIRTUAL - - // Implementation - protected: - HICON m_hIcon; - CShellTree * m_TreeCtl; - // Generated message map functions - //{{AFX_MSG(CDlgBrowsePath) - virtual BOOL OnInitDialog(); - afx_msg void OnPaint(); - afx_msg HCURSOR OnQueryDragIcon(); - afx_msg void OnItemexpandingBrowseTree(NMHDR * pNMHDR, LRESULT * pResult); - afx_msg void OnRclickBrowseTree(NMHDR * pNMHDR, LRESULT * pResult); - afx_msg void OnDeleteitemBrowseTree(NMHDR * pNMHDR, LRESULT * pResult); - afx_msg void OnSynchFolders(); - afx_msg void OnSelchangedBrowseTree(NMHDR * pNMHDR, LRESULT * pResult); - virtual void OnOK(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. diff --git a/src/server/LoginServer/LoginServer.vcxproj b/src/server/LoginServer/LoginServer.vcxproj index 27634e19..39a6d26b 100644 --- a/src/server/LoginServer/LoginServer.vcxproj +++ b/src/server/LoginServer/LoginServer.vcxproj @@ -121,7 +121,6 @@ - @@ -139,7 +138,6 @@ - diff --git a/src/server/LoginServer/LoginServer.vcxproj.filters b/src/server/LoginServer/LoginServer.vcxproj.filters index dcb27dd4..dab13c9f 100644 --- a/src/server/LoginServer/LoginServer.vcxproj.filters +++ b/src/server/LoginServer/LoginServer.vcxproj.filters @@ -21,9 +21,6 @@ Source Files - - Source Files - Source Files @@ -59,9 +56,6 @@ Header Files - - Header Files - Header Files diff --git a/src/server/LoginServer/SettingDlg.cpp b/src/server/LoginServer/SettingDlg.cpp index 84dc0743..4642c321 100644 --- a/src/server/LoginServer/SettingDlg.cpp +++ b/src/server/LoginServer/SettingDlg.cpp @@ -1,15 +1,8 @@ -// SettingDlg.cpp : implementation file -// - #include "StdAfx.h" #include "LoginServer.h" #include "SettingDlg.h" -#include "DlgBrowsePath.h" #include "LoginServerDlg.h" -#pragma warning(disable : 4786) -#include - #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE @@ -247,9 +240,11 @@ void CSettingDlg::OnCompress() { } void CSettingDlg::OnPathBrowse() { - CDlgBrowsePath pathdlg; - if (pathdlg.DoModal() == IDOK) { - strcpy(m_strDefaultPath, (char *)(LPCTSTR)pathdlg.m_szPath); + CFolderPickerDialog dlg; + dlg.m_ofn.lpstrTitle = "Select a base path to where your patch content"; + if (dlg.DoModal() == IDOK) { + CString szDir = dlg.GetPathName(); + strcpy(m_strDefaultPath, szDir.GetString()); m_PathEdit.SetWindowText(m_strDefaultPath); } } diff --git a/src/tool/N3Indoor/DlgBrowsePath.cpp b/src/tool/N3Indoor/DlgBrowsePath.cpp deleted file mode 100644 index 4e57a90a..00000000 --- a/src/tool/N3Indoor/DlgBrowsePath.cpp +++ /dev/null @@ -1,193 +0,0 @@ -// DlgBrowsePath.cpp : implementation file -// - -#include "StdAfx.h" -#include "N3Indoor.h" -#include "DlgBrowsePath.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CAboutDlg dialog used for App About -// -// This source is part of CShellTree - Selom Ofori -// -// Version: 1.02 (any previously unversioned copies are older/inferior -// -// This code is free for all to use. Mutatilate it as much as you want -// See MFCENUM sample from microsoft - -///////////////////////////////////////////////////////////////////////////// -// CDlgBrowsePath dialog -// -// This source is part of CShellTree - Selom Ofori -// -// Version: 1.02 (any previously unversioned copies are older/inferior -// -// This code is free for all to use. Mutatilate it as much as you want -// See MFCENUM sample from microsoft - -CDlgBrowsePath::CDlgBrowsePath(CWnd * pParent /*=NULL*/) - : CDialog(CDlgBrowsePath::IDD, pParent) { - //{{AFX_DATA_INIT(CDlgBrowsePath) - //}}AFX_DATA_INIT - // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 - m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); -} - -void CDlgBrowsePath::DoDataExchange(CDataExchange * pDX) { - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CDlgBrowsePath) - DDX_Control(pDX, IDC_FILELIST, m_CBPath); - //}}AFX_DATA_MAP -} - -BEGIN_MESSAGE_MAP(CDlgBrowsePath, CDialog) -//{{AFX_MSG_MAP(CDlgBrowsePath) -ON_WM_PAINT() -ON_WM_QUERYDRAGICON() -ON_NOTIFY(TVN_ITEMEXPANDING, IDC_BROWSE_TREE, OnItemexpandingBrowseTree) -ON_NOTIFY(NM_RCLICK, IDC_BROWSE_TREE, OnRclickBrowseTree) -ON_NOTIFY(TVN_DELETEITEM, IDC_BROWSE_TREE, OnDeleteitemBrowseTree) -ON_BN_CLICKED(IDC_SYNCH_FOLDERS, OnSynchFolders) -ON_NOTIFY(TVN_SELCHANGED, IDC_BROWSE_TREE, OnSelchangedBrowseTree) -ON_WM_SYSCOMMAND() -//}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CDlgBrowsePath message handlers - -BOOL CDlgBrowsePath::OnInitDialog() { - CDialog::OnInitDialog(); - - // 최근에 쓴 폴더를 가져온다... - char szInitDir[256]; - DWORD dwLength = 256; - memset(szInitDir, 0, 256); - CString szKey; - HKEY hKey; - DWORD dwKeyType = REG_SZ; - if (ERROR_SUCCESS == RegOpenKey(HKEY_CURRENT_USER, "Recenet used folder", &hKey)) { - for (int i = 0; i < 10; i++) { - szKey.Format("Folder%.1d", i); - LONG success = RegQueryValueEx(hKey, szKey, NULL, &dwKeyType, (BYTE *)szInitDir, &dwLength); - if (success == ERROR_SUCCESS && lstrlen(szInitDir) != 0) { - m_CBPath.AddString(szInitDir); - } - } - } - - // 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 - - // TODO: Add extra initialization here - m_TreeCtl = (CShellTree *)GetDlgItem(IDC_BROWSE_TREE); - m_TreeCtl->EnableImages(); - m_TreeCtl->PopulateTree(); - - return TRUE; // return TRUE unless you set the focus to a control -} - -// If you add a minimize button to your dialog, you will need the code below -// to draw the icon. For MFC applications using the document/view model, -// this is automatically done for you by the framework. - -void CDlgBrowsePath::OnPaint() { - if (IsIconic()) { - CPaintDC dc(this); // device context for painting - - SendMessage(WM_ICONERASEBKGND, (WPARAM)dc.GetSafeHdc(), 0); - - // Center icon in client rectangle - int cxIcon = GetSystemMetrics(SM_CXICON); - int cyIcon = GetSystemMetrics(SM_CYICON); - CRect rect; - GetClientRect(&rect); - int x = (rect.Width() - cxIcon + 1) / 2; - int y = (rect.Height() - cyIcon + 1) / 2; - - // Draw the icon - dc.DrawIcon(x, y, m_hIcon); - } else { - CDialog::OnPaint(); - } -} - -// The system calls this to obtain the cursor to display while the user drags -// the minimized window. -HCURSOR CDlgBrowsePath::OnQueryDragIcon() { - return (HCURSOR)m_hIcon; -} - -void CDlgBrowsePath::OnItemexpandingBrowseTree(NMHDR * pNMHDR, LRESULT * pResult) { - NM_TREEVIEW * pNMTreeView = (NM_TREEVIEW *)pNMHDR; - // TODO: Add your control notification handler code here - m_TreeCtl->OnFolderExpanding(pNMHDR, pResult); - *pResult = 0; -} - -void CDlgBrowsePath::OnSelchangedBrowseTree(NMHDR * pNMHDR, LRESULT * pResult) { - NM_TREEVIEW * pNMTreeView = (NM_TREEVIEW *)pNMHDR; - // TODO: Add your control notification handler code here - CString szPath; - if (m_TreeCtl->OnFolderSelected(pNMHDR, pResult, szPath)) { - m_CBPath.SetWindowText(szPath); - } - *pResult = 0; -} - -void CDlgBrowsePath::OnRclickBrowseTree(NMHDR * pNMHDR, LRESULT * pResult) { - // TODO: Add your control notification handler code here - m_TreeCtl->GetContextMenu(pNMHDR, pResult); - *pResult = 0; -} - -void CDlgBrowsePath::OnDeleteitemBrowseTree(NMHDR * pNMHDR, LRESULT * pResult) { - NM_TREEVIEW * pNMTreeView = (NM_TREEVIEW *)pNMHDR; - // TODO: Add your control notification handler code here - m_TreeCtl->OnDeleteShellItem(pNMHDR, pResult); - *pResult = 0; -} - -void CDlgBrowsePath::OnSynchFolders() { - // TODO: Add your control notification handler code here - CString szFindFolder; - m_CBPath.GetWindowText(szFindFolder); - m_TreeCtl->TunnelTree(szFindFolder); -} - -void CDlgBrowsePath::OnOK() { - m_CBPath.GetWindowText(m_szPath); // 경로 기억.. - if (m_szPath.GetLength() > 0) { - m_CBPath.InsertString(0, m_szPath); // 경로 넣고... - } - - // 최근에 쓴 폴더를 저장해둔다.... - char szInitDir[256] = ""; - CString szKey; - HKEY hKey; - DWORD dwKeyType = REG_SZ; - if (ERROR_SUCCESS == RegCreateKey(HKEY_CURRENT_USER, "Recenet used folder", &hKey)) { - int nCBC = m_CBPath.GetCount(); - if (nCBC > 10) { - nCBC = 10; - } - for (int i = 0; i < nCBC; i++) { - szKey.Format("Folder%.1d", i); - m_CBPath.GetLBText(i, szInitDir); - int nLength = m_CBPath.GetLBTextLen(i); - if (nLength > 0) { - LONG success = RegSetValueEx(hKey, szKey, NULL, dwKeyType, (CONST BYTE *)szInitDir, nLength); - } - } - } - - CDialog::OnOK(); -} \ No newline at end of file diff --git a/src/tool/N3Indoor/DlgBrowsePath.h b/src/tool/N3Indoor/DlgBrowsePath.h deleted file mode 100644 index a6dc7fb1..00000000 --- a/src/tool/N3Indoor/DlgBrowsePath.h +++ /dev/null @@ -1,54 +0,0 @@ -#pragma once - -#include "Resource.h" -#include "ShellTree.h" - -// DlgBrowsePath.h : header file -// - -///////////////////////////////////////////////////////////////////////////// -// CDlgBrowsePath dialog - -class CDlgBrowsePath : public CDialog { - // Construction - public: - CString m_szPath; - CString GetPath() { return m_szPath; } - CDlgBrowsePath(CWnd * pParent = NULL); // standard constructor - - // Dialog Data - //{{AFX_DATA(CDlgBrowsePath) - enum { - IDD = IDD_BROWSE_PATH - }; - CComboBox m_CBPath; - //}}AFX_DATA - - // Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CDlgBrowsePath) - protected: - virtual void DoDataExchange(CDataExchange * pDX); // DDX/DDV support - //}}AFX_VIRTUAL - - // Implementation - protected: - HICON m_hIcon; - CShellTree * m_TreeCtl; - // Generated message map functions - //{{AFX_MSG(CDlgBrowsePath) - virtual BOOL OnInitDialog(); - afx_msg void OnPaint(); - afx_msg HCURSOR OnQueryDragIcon(); - virtual void OnOK(); - afx_msg void OnSynchFolders(); - afx_msg void OnSelchangedBrowseTree(NMHDR * pNMHDR, LRESULT * pResult); - afx_msg void OnDeleteitemBrowseTree(NMHDR * pNMHDR, LRESULT * pResult); - afx_msg void OnRclickBrowseTree(NMHDR * pNMHDR, LRESULT * pResult); - afx_msg void OnItemexpandingBrowseTree(NMHDR * pNMHDR, LRESULT * pResult); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. diff --git a/src/tool/N3Indoor/MainFrm.cpp b/src/tool/N3Indoor/MainFrm.cpp index 875778fe..271b453a 100644 --- a/src/tool/N3Indoor/MainFrm.cpp +++ b/src/tool/N3Indoor/MainFrm.cpp @@ -8,7 +8,6 @@ #include "N3IndoorView.h" #include "OrganizeView.h" -#include "DlgBrowsePath.h" #include "DlgBase.h" #include "DlgShapeList.h" #include "DlgUnusedFiles.h" diff --git a/src/tool/N3Indoor/N3Indoor.vcxproj b/src/tool/N3Indoor/N3Indoor.vcxproj index 49ec9789..8317d72e 100644 --- a/src/tool/N3Indoor/N3Indoor.vcxproj +++ b/src/tool/N3Indoor/N3Indoor.vcxproj @@ -177,7 +177,6 @@ - @@ -254,7 +253,6 @@ - diff --git a/src/tool/N3Indoor/N3Indoor.vcxproj.filters b/src/tool/N3Indoor/N3Indoor.vcxproj.filters index cb7fa5bc..a0827d68 100644 --- a/src/tool/N3Indoor/N3Indoor.vcxproj.filters +++ b/src/tool/N3Indoor/N3Indoor.vcxproj.filters @@ -31,9 +31,6 @@ N3Indoor\Dialogs - - N3Indoor\Dialogs - N3Indoor\Dialogs @@ -273,9 +270,6 @@ N3Indoor\Dialogs - - N3Indoor\Dialogs - N3Indoor\Dialogs diff --git a/src/tool/N3Indoor/OrganizeView.cpp b/src/tool/N3Indoor/OrganizeView.cpp index e8fa2a68..9e9996d4 100644 --- a/src/tool/N3Indoor/OrganizeView.cpp +++ b/src/tool/N3Indoor/OrganizeView.cpp @@ -4,7 +4,6 @@ #include "StdAfx.h" #include "N3Indoor.h" #include "OrganizeView.h" -#include "DlgBrowsePath.h" #include "MainFrm.h" #include "N3IndoorDoc.h" #include "N3IndoorView.h" @@ -182,13 +181,13 @@ void COrganizeView::OnButtonFileName() { } void COrganizeView::OnButtonResourcePath() { - // TODO: Add your control notification handler code here - CDlgBrowsePath dlg; - if (IDCANCEL == dlg.DoModal()) { + CFolderPickerDialog dlg; + dlg.m_ofn.lpstrTitle = "Select resource path"; + if (dlg.DoModal() == IDCANCEL) { return; } - std::string szPath(dlg.GetPath().GetString()); + std::string szPath(dlg.GetPathName().GetString()); SetDlgItemText(IDC_EDIT_RESOURCE_PATH, szPath.c_str()); CMainFrame * pFrm = (CMainFrame *)AfxGetMainWnd(); pFrm->m_strResourcePath = szPath + "\\N3Indoor"; diff --git a/src/tool/N3ME/DlgBrowsePath.cpp b/src/tool/N3ME/DlgBrowsePath.cpp deleted file mode 100644 index 977db3a6..00000000 --- a/src/tool/N3ME/DlgBrowsePath.cpp +++ /dev/null @@ -1,192 +0,0 @@ -// DlgBrowsePath.cpp : implementation file -// - -#include "StdAfx.h" -#include "DlgBrowsePath.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CAboutDlg dialog used for App About -// -// This source is part of CShellTree - Selom Ofori -// -// Version: 1.02 (any previously unversioned copies are older/inferior -// -// This code is free for all to use. Mutatilate it as much as you want -// See MFCENUM sample from microsoft - -///////////////////////////////////////////////////////////////////////////// -// CDlgBrowsePath dialog -// -// This source is part of CShellTree - Selom Ofori -// -// Version: 1.02 (any previously unversioned copies are older/inferior -// -// This code is free for all to use. Mutatilate it as much as you want -// See MFCENUM sample from microsoft - -CDlgBrowsePath::CDlgBrowsePath(CWnd * pParent /*=NULL*/) - : CDialog(CDlgBrowsePath::IDD, pParent) { - //{{AFX_DATA_INIT(CDlgBrowsePath) - //}}AFX_DATA_INIT - // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 - m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); -} - -void CDlgBrowsePath::DoDataExchange(CDataExchange * pDX) { - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CDlgBrowsePath) - DDX_Control(pDX, IDC_FILELIST, m_CBPath); - //}}AFX_DATA_MAP -} - -BEGIN_MESSAGE_MAP(CDlgBrowsePath, CDialog) -//{{AFX_MSG_MAP(CDlgBrowsePath) -ON_WM_PAINT() -ON_WM_QUERYDRAGICON() -ON_NOTIFY(TVN_ITEMEXPANDING, IDC_BROWSE_TREE, OnItemexpandingBrowseTree) -ON_NOTIFY(NM_RCLICK, IDC_BROWSE_TREE, OnRclickBrowseTree) -ON_NOTIFY(TVN_DELETEITEM, IDC_BROWSE_TREE, OnDeleteitemBrowseTree) -ON_BN_CLICKED(IDC_SYNCH_FOLDERS, OnSynchFolders) -ON_NOTIFY(TVN_SELCHANGED, IDC_BROWSE_TREE, OnSelchangedBrowseTree) -ON_WM_SYSCOMMAND() -//}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CDlgBrowsePath message handlers - -BOOL CDlgBrowsePath::OnInitDialog() { - CDialog::OnInitDialog(); - - // 최근에 쓴 폴더를 가져온다... - char szInitDir[256]; - DWORD dwLength = 256; - memset(szInitDir, 0, 256); - CString szKey; - HKEY hKey; - DWORD dwKeyType = REG_SZ; - if (ERROR_SUCCESS == RegOpenKey(HKEY_CURRENT_USER, "Recenet used folder", &hKey)) { - for (int i = 0; i < 10; i++) { - szKey.Format("Folder%.1d", i); - LONG success = RegQueryValueEx(hKey, szKey, NULL, &dwKeyType, (BYTE *)szInitDir, &dwLength); - if (success == ERROR_SUCCESS && lstrlen(szInitDir) != 0) { - m_CBPath.AddString(szInitDir); - } - } - } - - // 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 - - // TODO: Add extra initialization here - m_TreeCtl = (CShellTree *)GetDlgItem(IDC_BROWSE_TREE); - m_TreeCtl->EnableImages(); - m_TreeCtl->PopulateTree(); - - return TRUE; // return TRUE unless you set the focus to a control -} - -// If you add a minimize button to your dialog, you will need the code below -// to draw the icon. For MFC applications using the document/view model, -// this is automatically done for you by the framework. - -void CDlgBrowsePath::OnPaint() { - if (IsIconic()) { - CPaintDC dc(this); // device context for painting - - SendMessage(WM_ICONERASEBKGND, (WPARAM)dc.GetSafeHdc(), 0); - - // Center icon in client rectangle - int cxIcon = GetSystemMetrics(SM_CXICON); - int cyIcon = GetSystemMetrics(SM_CYICON); - CRect rect; - GetClientRect(&rect); - int x = (rect.Width() - cxIcon + 1) / 2; - int y = (rect.Height() - cyIcon + 1) / 2; - - // Draw the icon - dc.DrawIcon(x, y, m_hIcon); - } else { - CDialog::OnPaint(); - } -} - -// The system calls this to obtain the cursor to display while the user drags -// the minimized window. -HCURSOR CDlgBrowsePath::OnQueryDragIcon() { - return (HCURSOR)m_hIcon; -} - -void CDlgBrowsePath::OnItemexpandingBrowseTree(NMHDR * pNMHDR, LRESULT * pResult) { - NM_TREEVIEW * pNMTreeView = (NM_TREEVIEW *)pNMHDR; - // TODO: Add your control notification handler code here - m_TreeCtl->OnFolderExpanding(pNMHDR, pResult); - *pResult = 0; -} - -void CDlgBrowsePath::OnSelchangedBrowseTree(NMHDR * pNMHDR, LRESULT * pResult) { - NM_TREEVIEW * pNMTreeView = (NM_TREEVIEW *)pNMHDR; - // TODO: Add your control notification handler code here - CString szPath; - if (m_TreeCtl->OnFolderSelected(pNMHDR, pResult, szPath)) { - m_CBPath.SetWindowText(szPath); - } - *pResult = 0; -} - -void CDlgBrowsePath::OnRclickBrowseTree(NMHDR * pNMHDR, LRESULT * pResult) { - // TODO: Add your control notification handler code here - m_TreeCtl->GetContextMenu(pNMHDR, pResult); - *pResult = 0; -} - -void CDlgBrowsePath::OnDeleteitemBrowseTree(NMHDR * pNMHDR, LRESULT * pResult) { - NM_TREEVIEW * pNMTreeView = (NM_TREEVIEW *)pNMHDR; - // TODO: Add your control notification handler code here - m_TreeCtl->OnDeleteShellItem(pNMHDR, pResult); - *pResult = 0; -} - -void CDlgBrowsePath::OnSynchFolders() { - // TODO: Add your control notification handler code here - CString szFindFolder; - m_CBPath.GetWindowText(szFindFolder); - m_TreeCtl->TunnelTree(szFindFolder); -} - -void CDlgBrowsePath::OnOK() { - m_CBPath.GetWindowText(m_szPath); // 경로 기억.. - if (m_szPath.GetLength() > 0) { - m_CBPath.InsertString(0, m_szPath); // 경로 넣고... - } - - // 최근에 쓴 폴더를 저장해둔다.... - char szInitDir[256] = ""; - CString szKey; - HKEY hKey; - DWORD dwKeyType = REG_SZ; - if (ERROR_SUCCESS == RegCreateKey(HKEY_CURRENT_USER, "Recenet used folder", &hKey)) { - int nCBC = m_CBPath.GetCount(); - if (nCBC > 10) { - nCBC = 10; - } - for (int i = 0; i < nCBC; i++) { - szKey.Format("Folder%.1d", i); - m_CBPath.GetLBText(i, szInitDir); - int nLength = m_CBPath.GetLBTextLen(i); - if (nLength > 0) { - LONG success = RegSetValueEx(hKey, szKey, NULL, dwKeyType, (CONST BYTE *)szInitDir, nLength); - } - } - } - - CDialog::OnOK(); -} diff --git a/src/tool/N3ME/DlgBrowsePath.h b/src/tool/N3ME/DlgBrowsePath.h deleted file mode 100644 index bbd541e7..00000000 --- a/src/tool/N3ME/DlgBrowsePath.h +++ /dev/null @@ -1,60 +0,0 @@ -// CDlgBrowsePath.h : header file -// - -#pragma once - -#include "Resource.h" -#include "ShellTree.h" - -///////////////////////////////////////////////////////////////////////////// -// CDlgBrowsePath dialog -// -// This source is part of CShellTree - Selom Ofori -// -// Version: 1.02 (any previously unversioned copies are older/inferior -// -// This code is free for all to use. Mutatilate it as much as you want -// See MFCENUM sample from microsoft - -class CDlgBrowsePath : public CDialog { - // Construction - public: - CString m_szPath; - CString GetPath() { return m_szPath; } - CDlgBrowsePath(CWnd * pParent = NULL); // standard constructor - - // Dialog Data - //{{AFX_DATA(CDlgBrowsePath) - enum { - IDD = IDD_BROWSE_PATH - }; - CComboBox m_CBPath; - //}}AFX_DATA - - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CDlgBrowsePath) - protected: - virtual void DoDataExchange(CDataExchange * pDX); // DDX/DDV support - //}}AFX_VIRTUAL - - // Implementation - protected: - HICON m_hIcon; - CShellTree * m_TreeCtl; - // Generated message map functions - //{{AFX_MSG(CDlgBrowsePath) - virtual BOOL OnInitDialog(); - afx_msg void OnPaint(); - afx_msg HCURSOR OnQueryDragIcon(); - afx_msg void OnItemexpandingBrowseTree(NMHDR * pNMHDR, LRESULT * pResult); - afx_msg void OnRclickBrowseTree(NMHDR * pNMHDR, LRESULT * pResult); - afx_msg void OnDeleteitemBrowseTree(NMHDR * pNMHDR, LRESULT * pResult); - afx_msg void OnSynchFolders(); - afx_msg void OnSelchangedBrowseTree(NMHDR * pNMHDR, LRESULT * pResult); - virtual void OnOK(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. diff --git a/src/tool/N3ME/DlgFolderSelect.h b/src/tool/N3ME/DlgFolderSelect.h deleted file mode 100644 index 947ff9dd..00000000 --- a/src/tool/N3ME/DlgFolderSelect.h +++ /dev/null @@ -1,51 +0,0 @@ -#pragma once - -// DlgFolderSelect.h : header file -// - -#include "../Widget/DirTreeCtrl.h" -#include "Resource.h" -///////////////////////////////////////////////////////////////////////////// -// CDlgFolderSelect dialog - -class CDlgFolderSelect : public CDialog { - // Construction - public: - CString GetFolderName(); - void SetInitFolderName(CString & FolderName); - CDlgFolderSelect(CWnd * pParent = NULL); // standard constructor - - // Dialog Data - //{{AFX_DATA(CDlgFolderSelect) - enum { - IDD = IDD_FOLDER_SELECT - }; - CDirTreeCtrl m_DirTree; - CComboBox m_CBFolder; - //}}AFX_DATA - - // Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CDlgFolderSelect) - protected: - virtual void DoDataExchange(CDataExchange * pDX); // DDX/DDV support - //}}AFX_VIRTUAL - private: - CString m_FolderName; - - // Implementation - protected: - // Generated message map functions - //{{AFX_MSG(CDlgFolderSelect) - virtual BOOL OnInitDialog(); - afx_msg void OnSelchangedBrowseTree(NMHDR * pNMHDR, LRESULT * pResult); - afx_msg void OnTunnelTree(); - virtual void OnOK(); - virtual void OnCancel(); - afx_msg void OnSelchangeFolderList(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. diff --git a/src/tool/N3ME/MainFrm.cpp b/src/tool/N3ME/MainFrm.cpp index 222b80bc..78edc398 100644 --- a/src/tool/N3ME/MainFrm.cpp +++ b/src/tool/N3ME/MainFrm.cpp @@ -12,7 +12,6 @@ #include "DTexGroupMng.h" #include "DlgSetDTex.h" #include "MapMng.h" -#include "DlgBrowsePath.h" #include "DlgSowSeed.h" #include "DlgSaveDivision.h" @@ -654,12 +653,13 @@ void CMainFrame::OnUpdateViewDtex(CCmdUI * pCmdUI) { void CMainFrame::OnResourcePathSet() { ASSERT(m_pMapMng); - CDlgBrowsePath dlg; - if (IDCANCEL == dlg.DoModal()) { + CFolderPickerDialog dlg; + dlg.m_ofn.lpstrTitle = "Select resource path"; + if (dlg.DoModal() == IDCANCEL) { return; } - std::string szPath(dlg.GetPath().GetString()); + std::string szPath(dlg.GetPathName().GetString()); CN3Base::PathSet(szPath); // 경로 설정.. m_wndDlgBar.SetDlgItemText(IDC_E_PATH, szPath.c_str()); diff --git a/src/tool/N3ME/N3ME.vcxproj b/src/tool/N3ME/N3ME.vcxproj index 7f15c52d..62dee3d8 100644 --- a/src/tool/N3ME/N3ME.vcxproj +++ b/src/tool/N3ME/N3ME.vcxproj @@ -168,7 +168,6 @@ - @@ -290,7 +289,6 @@ - diff --git a/src/tool/N3ME/N3ME.vcxproj.filters b/src/tool/N3ME/N3ME.vcxproj.filters index a9ba36cc..00e9fda0 100644 --- a/src/tool/N3ME/N3ME.vcxproj.filters +++ b/src/tool/N3ME/N3ME.vcxproj.filters @@ -52,9 +52,6 @@ N3ME\Dialogs - - N3ME\Dialogs - N3ME\Dialogs @@ -515,9 +512,6 @@ N3ME\Dialogs - - N3ME\Dialogs - N3ME\Dialogs diff --git a/src/tool/N3Viewer/DlgBrowsePath.cpp b/src/tool/N3Viewer/DlgBrowsePath.cpp deleted file mode 100644 index 977db3a6..00000000 --- a/src/tool/N3Viewer/DlgBrowsePath.cpp +++ /dev/null @@ -1,192 +0,0 @@ -// DlgBrowsePath.cpp : implementation file -// - -#include "StdAfx.h" -#include "DlgBrowsePath.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CAboutDlg dialog used for App About -// -// This source is part of CShellTree - Selom Ofori -// -// Version: 1.02 (any previously unversioned copies are older/inferior -// -// This code is free for all to use. Mutatilate it as much as you want -// See MFCENUM sample from microsoft - -///////////////////////////////////////////////////////////////////////////// -// CDlgBrowsePath dialog -// -// This source is part of CShellTree - Selom Ofori -// -// Version: 1.02 (any previously unversioned copies are older/inferior -// -// This code is free for all to use. Mutatilate it as much as you want -// See MFCENUM sample from microsoft - -CDlgBrowsePath::CDlgBrowsePath(CWnd * pParent /*=NULL*/) - : CDialog(CDlgBrowsePath::IDD, pParent) { - //{{AFX_DATA_INIT(CDlgBrowsePath) - //}}AFX_DATA_INIT - // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 - m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); -} - -void CDlgBrowsePath::DoDataExchange(CDataExchange * pDX) { - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CDlgBrowsePath) - DDX_Control(pDX, IDC_FILELIST, m_CBPath); - //}}AFX_DATA_MAP -} - -BEGIN_MESSAGE_MAP(CDlgBrowsePath, CDialog) -//{{AFX_MSG_MAP(CDlgBrowsePath) -ON_WM_PAINT() -ON_WM_QUERYDRAGICON() -ON_NOTIFY(TVN_ITEMEXPANDING, IDC_BROWSE_TREE, OnItemexpandingBrowseTree) -ON_NOTIFY(NM_RCLICK, IDC_BROWSE_TREE, OnRclickBrowseTree) -ON_NOTIFY(TVN_DELETEITEM, IDC_BROWSE_TREE, OnDeleteitemBrowseTree) -ON_BN_CLICKED(IDC_SYNCH_FOLDERS, OnSynchFolders) -ON_NOTIFY(TVN_SELCHANGED, IDC_BROWSE_TREE, OnSelchangedBrowseTree) -ON_WM_SYSCOMMAND() -//}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CDlgBrowsePath message handlers - -BOOL CDlgBrowsePath::OnInitDialog() { - CDialog::OnInitDialog(); - - // 최근에 쓴 폴더를 가져온다... - char szInitDir[256]; - DWORD dwLength = 256; - memset(szInitDir, 0, 256); - CString szKey; - HKEY hKey; - DWORD dwKeyType = REG_SZ; - if (ERROR_SUCCESS == RegOpenKey(HKEY_CURRENT_USER, "Recenet used folder", &hKey)) { - for (int i = 0; i < 10; i++) { - szKey.Format("Folder%.1d", i); - LONG success = RegQueryValueEx(hKey, szKey, NULL, &dwKeyType, (BYTE *)szInitDir, &dwLength); - if (success == ERROR_SUCCESS && lstrlen(szInitDir) != 0) { - m_CBPath.AddString(szInitDir); - } - } - } - - // 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 - - // TODO: Add extra initialization here - m_TreeCtl = (CShellTree *)GetDlgItem(IDC_BROWSE_TREE); - m_TreeCtl->EnableImages(); - m_TreeCtl->PopulateTree(); - - return TRUE; // return TRUE unless you set the focus to a control -} - -// If you add a minimize button to your dialog, you will need the code below -// to draw the icon. For MFC applications using the document/view model, -// this is automatically done for you by the framework. - -void CDlgBrowsePath::OnPaint() { - if (IsIconic()) { - CPaintDC dc(this); // device context for painting - - SendMessage(WM_ICONERASEBKGND, (WPARAM)dc.GetSafeHdc(), 0); - - // Center icon in client rectangle - int cxIcon = GetSystemMetrics(SM_CXICON); - int cyIcon = GetSystemMetrics(SM_CYICON); - CRect rect; - GetClientRect(&rect); - int x = (rect.Width() - cxIcon + 1) / 2; - int y = (rect.Height() - cyIcon + 1) / 2; - - // Draw the icon - dc.DrawIcon(x, y, m_hIcon); - } else { - CDialog::OnPaint(); - } -} - -// The system calls this to obtain the cursor to display while the user drags -// the minimized window. -HCURSOR CDlgBrowsePath::OnQueryDragIcon() { - return (HCURSOR)m_hIcon; -} - -void CDlgBrowsePath::OnItemexpandingBrowseTree(NMHDR * pNMHDR, LRESULT * pResult) { - NM_TREEVIEW * pNMTreeView = (NM_TREEVIEW *)pNMHDR; - // TODO: Add your control notification handler code here - m_TreeCtl->OnFolderExpanding(pNMHDR, pResult); - *pResult = 0; -} - -void CDlgBrowsePath::OnSelchangedBrowseTree(NMHDR * pNMHDR, LRESULT * pResult) { - NM_TREEVIEW * pNMTreeView = (NM_TREEVIEW *)pNMHDR; - // TODO: Add your control notification handler code here - CString szPath; - if (m_TreeCtl->OnFolderSelected(pNMHDR, pResult, szPath)) { - m_CBPath.SetWindowText(szPath); - } - *pResult = 0; -} - -void CDlgBrowsePath::OnRclickBrowseTree(NMHDR * pNMHDR, LRESULT * pResult) { - // TODO: Add your control notification handler code here - m_TreeCtl->GetContextMenu(pNMHDR, pResult); - *pResult = 0; -} - -void CDlgBrowsePath::OnDeleteitemBrowseTree(NMHDR * pNMHDR, LRESULT * pResult) { - NM_TREEVIEW * pNMTreeView = (NM_TREEVIEW *)pNMHDR; - // TODO: Add your control notification handler code here - m_TreeCtl->OnDeleteShellItem(pNMHDR, pResult); - *pResult = 0; -} - -void CDlgBrowsePath::OnSynchFolders() { - // TODO: Add your control notification handler code here - CString szFindFolder; - m_CBPath.GetWindowText(szFindFolder); - m_TreeCtl->TunnelTree(szFindFolder); -} - -void CDlgBrowsePath::OnOK() { - m_CBPath.GetWindowText(m_szPath); // 경로 기억.. - if (m_szPath.GetLength() > 0) { - m_CBPath.InsertString(0, m_szPath); // 경로 넣고... - } - - // 최근에 쓴 폴더를 저장해둔다.... - char szInitDir[256] = ""; - CString szKey; - HKEY hKey; - DWORD dwKeyType = REG_SZ; - if (ERROR_SUCCESS == RegCreateKey(HKEY_CURRENT_USER, "Recenet used folder", &hKey)) { - int nCBC = m_CBPath.GetCount(); - if (nCBC > 10) { - nCBC = 10; - } - for (int i = 0; i < nCBC; i++) { - szKey.Format("Folder%.1d", i); - m_CBPath.GetLBText(i, szInitDir); - int nLength = m_CBPath.GetLBTextLen(i); - if (nLength > 0) { - LONG success = RegSetValueEx(hKey, szKey, NULL, dwKeyType, (CONST BYTE *)szInitDir, nLength); - } - } - } - - CDialog::OnOK(); -} diff --git a/src/tool/N3Viewer/DlgBrowsePath.h b/src/tool/N3Viewer/DlgBrowsePath.h deleted file mode 100644 index bbd541e7..00000000 --- a/src/tool/N3Viewer/DlgBrowsePath.h +++ /dev/null @@ -1,60 +0,0 @@ -// CDlgBrowsePath.h : header file -// - -#pragma once - -#include "Resource.h" -#include "ShellTree.h" - -///////////////////////////////////////////////////////////////////////////// -// CDlgBrowsePath dialog -// -// This source is part of CShellTree - Selom Ofori -// -// Version: 1.02 (any previously unversioned copies are older/inferior -// -// This code is free for all to use. Mutatilate it as much as you want -// See MFCENUM sample from microsoft - -class CDlgBrowsePath : public CDialog { - // Construction - public: - CString m_szPath; - CString GetPath() { return m_szPath; } - CDlgBrowsePath(CWnd * pParent = NULL); // standard constructor - - // Dialog Data - //{{AFX_DATA(CDlgBrowsePath) - enum { - IDD = IDD_BROWSE_PATH - }; - CComboBox m_CBPath; - //}}AFX_DATA - - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CDlgBrowsePath) - protected: - virtual void DoDataExchange(CDataExchange * pDX); // DDX/DDV support - //}}AFX_VIRTUAL - - // Implementation - protected: - HICON m_hIcon; - CShellTree * m_TreeCtl; - // Generated message map functions - //{{AFX_MSG(CDlgBrowsePath) - virtual BOOL OnInitDialog(); - afx_msg void OnPaint(); - afx_msg HCURSOR OnQueryDragIcon(); - afx_msg void OnItemexpandingBrowseTree(NMHDR * pNMHDR, LRESULT * pResult); - afx_msg void OnRclickBrowseTree(NMHDR * pNMHDR, LRESULT * pResult); - afx_msg void OnDeleteitemBrowseTree(NMHDR * pNMHDR, LRESULT * pResult); - afx_msg void OnSynchFolders(); - afx_msg void OnSelchangedBrowseTree(NMHDR * pNMHDR, LRESULT * pResult); - virtual void OnOK(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Developer Studio will insert additional declarations immediately before the previous line. diff --git a/src/tool/N3Viewer/MainFrm.cpp b/src/tool/N3Viewer/MainFrm.cpp index 3009ec3a..913cca57 100644 --- a/src/tool/N3Viewer/MainFrm.cpp +++ b/src/tool/N3Viewer/MainFrm.cpp @@ -8,7 +8,6 @@ #include "N3Base/N3Scene.h" #include "MainFrm.h" -#include "DlgBrowsePath.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -206,12 +205,13 @@ void CMainFrame::OnUpdateEditPmesh(CCmdUI * pCmdUI) { } void CMainFrame::OnProjectSet() { - CDlgBrowsePath dlg; - if (IDCANCEL == dlg.DoModal()) { + CFolderPickerDialog dlg; + dlg.m_ofn.lpstrTitle = "Select resource path"; + if (dlg.DoModal() == IDCANCEL) { return; } - CN3Base::PathSet(dlg.GetPath().GetString()); + CN3Base::PathSet(dlg.GetPathName().GetString()); } void CMainFrame::OnAddLod() { diff --git a/src/tool/N3Viewer/N3Viewer.vcxproj b/src/tool/N3Viewer/N3Viewer.vcxproj index f40d685c..783b6fe9 100644 --- a/src/tool/N3Viewer/N3Viewer.vcxproj +++ b/src/tool/N3Viewer/N3Viewer.vcxproj @@ -162,7 +162,6 @@ - @@ -222,7 +221,6 @@ - diff --git a/src/tool/N3Viewer/N3Viewer.vcxproj.filters b/src/tool/N3Viewer/N3Viewer.vcxproj.filters index 71cc6a44..dbd58a33 100644 --- a/src/tool/N3Viewer/N3Viewer.vcxproj.filters +++ b/src/tool/N3Viewer/N3Viewer.vcxproj.filters @@ -18,9 +18,6 @@ - - Source Files - Source Files @@ -173,9 +170,6 @@ - - Header Files - Header Files diff --git a/src/tool/UIE/DlgBar.cpp b/src/tool/UIE/DlgBar.cpp index b85b1541..e67b98a8 100644 --- a/src/tool/UIE/DlgBar.cpp +++ b/src/tool/UIE/DlgBar.cpp @@ -45,30 +45,19 @@ void CDlgBar::OnButtonBasepath() { return; } - CWnd * pWnd = GetDlgItem(IDC_EDIT_BASEPATH); - CString strPath; - if (pWnd) { - pWnd->GetWindowText(strPath); - } - char szFolder[_MAX_PATH] = ""; - char szTitle[] = "리소스 base경로를 선택해주세요."; + std::string szCurDir = CN3Base::PathGet(); - BROWSEINFO bi; - LPCITEMIDLIST lpidl; - bi.hwndOwner = pFrm->m_hWnd; - bi.pidlRoot = NULL; - bi.pszDisplayName = szFolder; - bi.lpszTitle = szTitle; - bi.ulFlags = BIF_RETURNONLYFSDIRS; - bi.lpfn = NULL; - bi.lParam = 0; + CFolderPickerDialog dlg; + dlg.m_ofn.lpstrTitle = "Please select the resource base path."; + dlg.m_ofn.lpstrInitialDir = szCurDir.c_str(); + if (dlg.DoModal() == IDCANCEL) { + return; + } - lpidl = SHBrowseForFolder(&bi); - if (lpidl && SHGetPathFromIDList(lpidl, szFolder)) { - pFrm->SetBasePath(szFolder); + std::string szDir = dlg.GetPathName().GetString(); + pFrm->SetBasePath(szDir.c_str()); - CWinApp * pApp = AfxGetApp(); - ASSERT(pApp); - pApp->WriteProfileString("Work", "Path", szFolder); - } + CWinApp * pApp = AfxGetApp(); + ASSERT(pApp); + pApp->WriteProfileString("Work", "Path", szDir.c_str()); } diff --git a/src/tool/UIE/UIEDoc.cpp b/src/tool/UIE/UIEDoc.cpp index 0f9df61c..3ae24c32 100644 --- a/src/tool/UIE/UIEDoc.cpp +++ b/src/tool/UIE/UIEDoc.cpp @@ -1209,12 +1209,12 @@ void CUIEDoc::OnBatchToolChangeFont() { } void CUIEDoc::OnBatchToolGatherImageFileName() { + std::string szDlgInitialDir = CN3Base::PathGet(); + char szBuff[102400] = ""; DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_ALLOWMULTISELECT; CFileDialog dlg(TRUE, "uif", NULL, dwFlags, "UI Files(*.uif)|*.uif;||", NULL); - char szCurPath[256]; - GetCurrentDirectory(256, szCurPath); - dlg.m_ofn.lpstrInitialDir = szCurPath; + dlg.m_ofn.lpstrInitialDir = szDlgInitialDir.c_str(); dlg.m_ofn.nMaxFile = 102400; dlg.m_ofn.lpstrFile = szBuff; @@ -1231,48 +1231,42 @@ void CUIEDoc::OnBatchToolGatherImageFileName() { base.GatherImageFileName(setImgFNs); } - // 폴더 선택하기.. - char szFolder[_MAX_PATH] = ""; - BROWSEINFO bi; - LPCITEMIDLIST lpidl; - bi.hwndOwner = AfxGetMainWnd()->m_hWnd; - bi.pidlRoot = NULL; - bi.pszDisplayName = szFolder; - bi.lpszTitle = "파일이름을 비교할 폴더를 선택해주세요"; - bi.ulFlags = BIF_RETURNONLYFSDIRS; - bi.lpfn = NULL; - bi.lParam = 0; - - lpidl = SHBrowseForFolder(&bi); - if (lpidl && SHGetPathFromIDList(lpidl, szFolder)) { - char szPathOld[256]; - ::GetCurrentDirectory(_MAX_PATH, szPathOld); - ::SetCurrentDirectory(szFolder); - - CFileFind ff; - if (ff.FindFile("*.dxt")) { - CDlgUnusedFileList dlg2; - CString szBasePath = CN3Base::PathGet().c_str(); - while (ff.FindNextFile()) { - CString szPath = ff.GetFilePath(); - CString szFN; - szPath.MakeLower(); - int ii = szPath.Find(szBasePath); - if (ii >= 0) { - szFN = szPath.Mid(ii + szBasePath.GetLength()); - } + CFolderPickerDialog dlgFolderPick; + dlgFolderPick.m_ofn.lpstrTitle = "Please select the folder to compare file names."; + dlgFolderPick.m_ofn.lpstrInitialDir = szDlgInitialDir.c_str(); + if (dlgFolderPick.DoModal() == IDCANCEL) { + return; + } - if (szFN.GetLength() >= 0) { - std::set::iterator it = setImgFNs.find((const char *)szFN); - if (it == setImgFNs.end()) { - dlg2.m_szFileNames.Add(szPath); - } - } + std::string szCompareDir = dlgFolderPick.GetPathName().GetString(); + + char szPathOld[256]; + ::GetCurrentDirectory(_MAX_PATH, szPathOld); + ::SetCurrentDirectory(szCompareDir.c_str()); + + CFileFind ff; + if (ff.FindFile("*.dxt")) { + CDlgUnusedFileList dlg2; + CString szBasePath = CN3Base::PathGet().c_str(); + while (ff.FindNextFile()) { + CString szPath = ff.GetFilePath(); + CString szFN; + szPath.MakeLower(); + int ii = szPath.Find(szBasePath); + if (ii >= 0) { + szFN = szPath.Mid(ii + szBasePath.GetLength()); } - dlg2.DoModal(); + if (szFN.GetLength() >= 0) { + std::set::iterator it = setImgFNs.find((const char *)szFN); + if (it == setImgFNs.end()) { + dlg2.m_szFileNames.Add(szPath); + } + } } - ::SetCurrentDirectory(szPathOld); + dlg2.DoModal(); } + + ::SetCurrentDirectory(szPathOld); } From aa8cf34bcf01ae8e8a1e6dedcfa2145cdb883cfa Mon Sep 17 00:00:00 2001 From: Steve Williams <90905675+stevewgr@users.noreply.github.com> Date: Mon, 11 Nov 2024 22:11:12 -0500 Subject: [PATCH 6/7] Fix warnings by replacing large stack buffers with dynamic allocation. Replaced `char buff[size]` with `std::vector`, enabling dynamic memory allocation for large buffers used in multi-file selection dialogs via `dlg.m_ofn.lpstrFile`. A 512 KB buffer size is used, which should accommodate even very long file paths. --- src/server/LoginServer/SettingDlg.cpp | 17 +++++++----- src/tool/N3CE/FormViewTool.cpp | 22 +++++++-------- src/tool/N3ME/N3MEDoc.cpp | 7 +++-- src/tool/N3TexViewer/MainFrm.cpp | 40 +++++++++++++-------------- src/tool/N3Viewer/MainFrm.cpp | 13 ++++----- src/tool/N3Viewer/N3ViewerDoc.cpp | 14 ++++++---- src/tool/RscTables/RscTablesDlg.cpp | 8 +++--- src/tool/UIE/UIEDoc.cpp | 28 +++++++++---------- src/tool/Widget/PropertyList.cpp | 6 ++-- 9 files changed, 77 insertions(+), 78 deletions(-) diff --git a/src/server/LoginServer/SettingDlg.cpp b/src/server/LoginServer/SettingDlg.cpp index 4642c321..a5833a7d 100644 --- a/src/server/LoginServer/SettingDlg.cpp +++ b/src/server/LoginServer/SettingDlg.cpp @@ -71,12 +71,10 @@ void CSettingDlg::OnOK() { } void CSettingDlg::OnAddfile() { - CFileDialog dlg(TRUE); std::string addfilename, addfullpath, defaultpath; char tempstr1[_MAX_PATH]; memset(tempstr1, 0x00, _MAX_PATH); - char szFileName[512000]; - int strsize = 0; + int strsize = 0; UpdateData(TRUE); @@ -90,13 +88,18 @@ void CSettingDlg::OnAddfile() { return; } - ::SetCurrentDirectory(m_strDefaultPath); + fs::current_path(m_strDefaultPath); - szFileName[0] = 0x00; + CFileDialog dlg(TRUE); dlg.m_ofn.lpstrInitialDir = m_strDefaultPath; dlg.m_ofn.Flags |= OFN_ALLOWMULTISELECT | OFN_EXPLORER; - dlg.m_ofn.lpstrFile = (LPTSTR)szFileName; - dlg.m_ofn.nMaxFile = 512000; + + std::vector vFilesBuff(512000); + dlg.m_ofn.lpstrFile = vFilesBuff.data(); + dlg.m_ofn.nMaxFile = static_cast(vFilesBuff.size()); + if (dlg.DoModal() == IDCANCEL) { + return; + } if (dlg.DoModal() == IDOK) { POSITION pos = dlg.GetStartPosition(); diff --git a/src/tool/N3CE/FormViewTool.cpp b/src/tool/N3CE/FormViewTool.cpp index 45042cdd..7edbe52d 100644 --- a/src/tool/N3CE/FormViewTool.cpp +++ b/src/tool/N3CE/FormViewTool.cpp @@ -132,15 +132,14 @@ void CFormViewTool::OnSelchangeCbLod() { } void CFormViewTool::OnBAddTestSound0() { - char szBuff[10240] = ""; DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_ALLOWMULTISELECT; CFileDialog dlg(TRUE, "wav", NULL, dwFlags, "Wave files(*.wav)|*.wav||", NULL); - char szCurPath[256]; - GetCurrentDirectory(256, szCurPath); - dlg.m_ofn.lpstrInitialDir = szCurPath; - dlg.m_ofn.nMaxFile = 10240; - dlg.m_ofn.lpstrFile = szBuff; + std::string szCurDir = fs::current_path().string(); + dlg.m_ofn.lpstrInitialDir = szCurDir.c_str(); + std::vector vFilesBuff(512000); + dlg.m_ofn.lpstrFile = vFilesBuff.data(); + dlg.m_ofn.nMaxFile = static_cast(vFilesBuff.size()); if (dlg.DoModal() == IDCANCEL) { return; } @@ -183,15 +182,14 @@ void CFormViewTool::OnSelchangeListSound0() { } void CFormViewTool::OnBAddTestSound1() { - char szBuff[10240] = ""; DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_ALLOWMULTISELECT; CFileDialog dlg(TRUE, "wav", NULL, dwFlags, "Wave files(*.wav)|*.wav||", NULL); - char szCurPath[256]; - GetCurrentDirectory(256, szCurPath); - dlg.m_ofn.lpstrInitialDir = szCurPath; - dlg.m_ofn.nMaxFile = 10240; - dlg.m_ofn.lpstrFile = szBuff; + std::string szCurDir = fs::current_path().string(); + dlg.m_ofn.lpstrInitialDir = szCurDir.c_str(); + std::vector vFilesBuff(512000); + dlg.m_ofn.lpstrFile = vFilesBuff.data(); + dlg.m_ofn.nMaxFile = static_cast(vFilesBuff.size()); if (dlg.DoModal() == IDCANCEL) { return; } diff --git a/src/tool/N3ME/N3MEDoc.cpp b/src/tool/N3ME/N3MEDoc.cpp index 6aaf6e80..46f75584 100644 --- a/src/tool/N3ME/N3MEDoc.cpp +++ b/src/tool/N3ME/N3MEDoc.cpp @@ -140,11 +140,12 @@ void CN3MEDoc::OnFileImportShapes() { return; } - char szBuff[256000] = ""; DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_ALLOWMULTISELECT; CFileDialog dlg(TRUE, "n3shape", NULL, dwFlags, "Shape files(*.N3Shape)|*.N3Shape||", NULL); - dlg.m_ofn.nMaxFile = 25600; - dlg.m_ofn.lpstrFile = szBuff; + + std::vector vFilesBuff(512000); + dlg.m_ofn.lpstrFile = vFilesBuff.data(); + dlg.m_ofn.nMaxFile = static_cast(vFilesBuff.size()); if (dlg.DoModal() == IDCANCEL) { return; } diff --git a/src/tool/N3TexViewer/MainFrm.cpp b/src/tool/N3TexViewer/MainFrm.cpp index 7abceeab..9c9a4bb7 100644 --- a/src/tool/N3TexViewer/MainFrm.cpp +++ b/src/tool/N3TexViewer/MainFrm.cpp @@ -164,15 +164,14 @@ void CMainFrame::OnFileConvert() { } void CMainFrame::OnToolConvertFilesAutomaticaly() { - char szBuff[102400] = ""; DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_ALLOWMULTISELECT; CFileDialog dlg(TRUE, "dxt", NULL, dwFlags, "Generic Image Files(*.bmp, *.tga, *.jpg)|*.bmp;*.tga;*.jpg||", NULL); - char szCurPath[256]; - GetCurrentDirectory(256, szCurPath); - dlg.m_ofn.lpstrInitialDir = szCurPath; - dlg.m_ofn.nMaxFile = 102400; - dlg.m_ofn.lpstrFile = szBuff; + std::string szCurDir = fs::current_path().string(); + dlg.m_ofn.lpstrInitialDir = szCurDir.c_str(); + std::vector vFilesBuff(512000); + dlg.m_ofn.lpstrFile = vFilesBuff.data(); + dlg.m_ofn.nMaxFile = static_cast(vFilesBuff.size()); if (dlg.DoModal() == IDCANCEL) { return; } @@ -200,18 +199,20 @@ void CMainFrame::OnToolConvertFilesAutomaticaly() { } void CMainFrame::OnToolConvertFilesManually() { - char szBuff[102400] = ""; DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_ALLOWMULTISELECT; CFileDialog dlg(TRUE, "dxt", NULL, dwFlags, - "Generic Image Files(*.dxt, *.bmp, *.tga, *.jpg)|*.dxt;*.bmp;*.tga;*.jpg|BitmapFile " - "File(*.bmp)|*.bmp|Targa File(*.tga)|*.bmp|DXT File(*.dxt)|*.dxt||", + "Generic Image Files(*.dxt, *.bmp, *.tga, *.jpg)|*.dxt;*.bmp;*.tga;*.jpg|" + "BitmapFile File(*.bmp)|*.bmp|" + "Targa File(*.tga)|*.tga|" + "DXT File(*.dxt)|*.dxt||", NULL); - char szCurPath[256]; - GetCurrentDirectory(256, szCurPath); - dlg.m_ofn.lpstrInitialDir = szCurPath; - dlg.m_ofn.nMaxFile = 102400; - dlg.m_ofn.lpstrFile = szBuff; + std::string szCurDir = fs::current_path().string(); + dlg.m_ofn.lpstrInitialDir = szCurDir.c_str(); + + std::vector vFilesBuff(512000); + dlg.m_ofn.lpstrFile = vFilesBuff.data(); + dlg.m_ofn.nMaxFile = static_cast(vFilesBuff.size()); if (dlg.DoModal() == IDCANCEL) { return; } @@ -548,15 +549,14 @@ void CMainFrame::OnFileOpenLast() { } void CMainFrame::OnToolSaveRepeat() { - char szBuff[102400] = ""; DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_ALLOWMULTISELECT; CFileDialog dlg(TRUE, "dxt", NULL, dwFlags, "Noah Texture Files(*.dxt)|*.dxt||", NULL); - char szCurPath[256]; - GetCurrentDirectory(256, szCurPath); - dlg.m_ofn.lpstrInitialDir = szCurPath; - dlg.m_ofn.nMaxFile = 102400; - dlg.m_ofn.lpstrFile = szBuff; + std::string szCurDir = fs::current_path().string(); + dlg.m_ofn.lpstrInitialDir = szCurDir.c_str(); + std::vector vFilesBuff(512000); + dlg.m_ofn.lpstrFile = vFilesBuff.data(); + dlg.m_ofn.nMaxFile = static_cast(vFilesBuff.size()); if (dlg.DoModal() == IDCANCEL) { return; } diff --git a/src/tool/N3Viewer/MainFrm.cpp b/src/tool/N3Viewer/MainFrm.cpp index 913cca57..1f421c8c 100644 --- a/src/tool/N3Viewer/MainFrm.cpp +++ b/src/tool/N3Viewer/MainFrm.cpp @@ -241,21 +241,20 @@ void CMainFrame::OnToolFixProgressiveMesh() { CString szExt; CString szFilter = "N3 Progressive Mesh File(*.N3PMesh)|*.N3PMesh||"; - CString FileName; - char * pBuff = new char[2048000]; - memset(pBuff, 0, 2048000); DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_ALLOWMULTISELECT; CFileDialog dlg(TRUE, szExt, NULL, dwFlags, szFilter, NULL); - dlg.m_ofn.nMaxFile = 2048000; - dlg.m_ofn.lpstrFile = pBuff; + + std::vector vFilesBuff(512000); + dlg.m_ofn.lpstrFile = vFilesBuff.data(); + dlg.m_ofn.nMaxFile = static_cast(vFilesBuff.size()); if (dlg.DoModal() == IDCANCEL) { - delete[] pBuff; return; } CFile file; file.Open("프로그레시브 메쉬 처리 안된 리스트.txt", CFile::modeWrite | CFile::modeCreate); + CString FileName; CN3PMesh PM; POSITION pos = dlg.GetStartPosition(); for (int i = 0; pos != NULL; i++) { @@ -275,6 +274,4 @@ void CMainFrame::OnToolFixProgressiveMesh() { MessageBox( "프로그레시브 처리가 안된 파일리스트는 \"프로그레시브 메쉬 처리 안된 리스트.txt\" 파일에 기록되었습니다."); file.Close(); - - delete[] pBuff; } diff --git a/src/tool/N3Viewer/N3ViewerDoc.cpp b/src/tool/N3Viewer/N3ViewerDoc.cpp index bca560b9..4dcb3889 100644 --- a/src/tool/N3Viewer/N3ViewerDoc.cpp +++ b/src/tool/N3Viewer/N3ViewerDoc.cpp @@ -131,22 +131,24 @@ BOOL CN3ViewerDoc::OnSaveDocument(LPCTSTR lpszPathName) { void CN3ViewerDoc::OnFileImport() { CString szExt = ""; - // CString szFilter = "N3D Object File|*.*|카메라 Data(*.N3Camera)|*.N3Camera|Light Data(*.N3Light)|*.N3Light|Shape Data(*.N3Shape)|*.N3Shape|\ -// Progressive Mesh Data(*.N3PMesh)|*.N3Mesh|Indexed Mesh Data(*.N3IMesh)|*.N3IMesh|Joint Data(*.N3Joint)|*.N3Joint|Skinning Data(*.N3Skin)|*.N3Skin|Character Data(*.N3Chr)|*.N3Chr||"; + //CString szFilter = + // "N3D Object File|*.*|카메라 Data(*.N3Camera)|*.N3Camera|Light Data(*.N3Light)|*.N3Light|Shape Data(*.N3Shape)|*.N3Shape|\ +// Progressive Mesh Data(*.N3PMesh)|*.N3Mesh|Indexed Mesh Data(*.N3IMesh)|*.N3IMesh|Joint Data(*.N3Joint)|*.N3Joint|Skinning Data(*.N3Skin)|*.N3Skin|Character Data(*.N3Chr)|*.N3Chr||"; CString szFilter = "N3D Object File|*.*|카메라(*.N3Camera)|*.N3Camera|Light(*.N3Light)|*.N3Light|Progressive " "Mesh(*.N3PMesh)|*.N3PMesh|Shape(*.N3Shape)|*.N3Shape|Character(*.N3Chr)|*.N3Chr|Plug(*.N3CPlug)|*.N3CPlug||"; - CString FileName; - char szBuff[512000] = ""; DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_ALLOWMULTISELECT; CFileDialog dlg(TRUE, szExt, NULL, dwFlags, szFilter, NULL); - dlg.m_ofn.nMaxFile = 512000; - dlg.m_ofn.lpstrFile = szBuff; + + std::vector vFilesBuff(512000); + dlg.m_ofn.lpstrFile = vFilesBuff.data(); + dlg.m_ofn.nMaxFile = static_cast(vFilesBuff.size()); if (dlg.DoModal() == IDCANCEL) { return; } + CString FileName; POSITION pos = dlg.GetStartPosition(); for (int i = 0; pos != NULL; i++) { FileName = dlg.GetNextPathName(pos); diff --git a/src/tool/RscTables/RscTablesDlg.cpp b/src/tool/RscTables/RscTablesDlg.cpp index 3ce53097..1f432bd6 100644 --- a/src/tool/RscTables/RscTablesDlg.cpp +++ b/src/tool/RscTables/RscTablesDlg.cpp @@ -284,12 +284,12 @@ void CRscTablesDlg::OnConvertText2bin() { return; } - char szBuff[10240] = ""; - CString FileName; DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_ALLOWMULTISELECT; CFileDialog dlg(TRUE, "txt", NULL, dwFlags, "txt(탭으로 분리)(*.txt)|*.txt||", NULL); - dlg.m_ofn.nMaxFile = 10240; - dlg.m_ofn.lpstrFile = szBuff; + + std::vector vFilesBuff(512000); + dlg.m_ofn.lpstrFile = vFilesBuff.data(); + dlg.m_ofn.nMaxFile = static_cast(vFilesBuff.size()); if (dlg.DoModal() == IDCANCEL) { return; } diff --git a/src/tool/UIE/UIEDoc.cpp b/src/tool/UIE/UIEDoc.cpp index 3ae24c32..26f34347 100644 --- a/src/tool/UIE/UIEDoc.cpp +++ b/src/tool/UIE/UIEDoc.cpp @@ -1141,15 +1141,14 @@ void CUIEDoc::OnInsertGroup() { } void CUIEDoc::OnBatchToolChangeImagePath() { - char szBuff[102400] = ""; DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_ALLOWMULTISELECT; CFileDialog dlg(TRUE, "uif", NULL, dwFlags, "UI Files(*.uif)|*.uif;||", NULL); - char szCurPath[256]; - GetCurrentDirectory(256, szCurPath); - dlg.m_ofn.lpstrInitialDir = szCurPath; - dlg.m_ofn.nMaxFile = 102400; - dlg.m_ofn.lpstrFile = szBuff; + std::string szCurDir = fs::current_path().string(); + dlg.m_ofn.lpstrInitialDir = szCurDir.c_str(); + std::vector vFilesBuff(512000); + dlg.m_ofn.lpstrFile = vFilesBuff.data(); + dlg.m_ofn.nMaxFile = static_cast(vFilesBuff.size()); if (dlg.DoModal() == IDCANCEL) { return; } @@ -1176,15 +1175,14 @@ void CUIEDoc::OnBatchToolChangeImagePath() { } void CUIEDoc::OnBatchToolChangeFont() { - char szBuff[102400] = ""; DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_ALLOWMULTISELECT; CFileDialog dlg(TRUE, "uif", NULL, dwFlags, "UI Files(*.uif)|*.uif;||", NULL); - char szCurPath[256]; - GetCurrentDirectory(256, szCurPath); - dlg.m_ofn.lpstrInitialDir = szCurPath; - dlg.m_ofn.nMaxFile = 102400; - dlg.m_ofn.lpstrFile = szBuff; + std::string szCurDir = fs::current_path().string(); + dlg.m_ofn.lpstrInitialDir = szCurDir.c_str(); + std::vector vFilesBuff(512000); + dlg.m_ofn.lpstrFile = vFilesBuff.data(); + dlg.m_ofn.nMaxFile = static_cast(vFilesBuff.size()); if (dlg.DoModal() == IDCANCEL) { return; } @@ -1211,13 +1209,13 @@ void CUIEDoc::OnBatchToolChangeFont() { void CUIEDoc::OnBatchToolGatherImageFileName() { std::string szDlgInitialDir = CN3Base::PathGet(); - char szBuff[102400] = ""; DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_ALLOWMULTISELECT; CFileDialog dlg(TRUE, "uif", NULL, dwFlags, "UI Files(*.uif)|*.uif;||", NULL); dlg.m_ofn.lpstrInitialDir = szDlgInitialDir.c_str(); - dlg.m_ofn.nMaxFile = 102400; - dlg.m_ofn.lpstrFile = szBuff; + std::vector vFilesBuff(512000); + dlg.m_ofn.lpstrFile = vFilesBuff.data(); + dlg.m_ofn.nMaxFile = static_cast(vFilesBuff.size()); if (dlg.DoModal() == IDCANCEL) { return; } diff --git a/src/tool/Widget/PropertyList.cpp b/src/tool/Widget/PropertyList.cpp index 226d30bc..e912619f 100644 --- a/src/tool/Widget/PropertyList.cpp +++ b/src/tool/Widget/PropertyList.cpp @@ -375,12 +375,12 @@ void CPropertyList::OnButton() { } } else if (pItem->m_nItemType == PIT_FILE_MULTI) { - char szBuff[10240] = ""; DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_ALLOWMULTISELECT; CFileDialog dlg(TRUE, NULL, NULL, dwFlags, pItem->m_szCBItemsOrFilter.GetAt(0)); - dlg.m_ofn.nMaxFile = 10240; - dlg.m_ofn.lpstrFile = szBuff; + std::vector vFilesBuff(512000); + dlg.m_ofn.lpstrFile = vFilesBuff.data(); + dlg.m_ofn.nMaxFile = static_cast(vFilesBuff.size()); if (IDOK == dlg.DoModal()) { POSITION pos = dlg.GetStartPosition(); CStringArray szFNs; From dc0412d50c167ef07e23bc40fee4071f171ed794 Mon Sep 17 00:00:00 2001 From: Steve Williams <90905675+stevewgr@users.noreply.github.com> Date: Mon, 11 Nov 2024 22:18:22 -0500 Subject: [PATCH 7/7] Fix inconsistent header includes for better portability and consistency. Standardized header includes to address inconsistencies in case usage (some were lower-case, others upper-case), which impacts portability across platforms. Also corrected cases where system headers were included with quotes ("") instead of angle brackets (<>). Long-term, this issue could be further addressed by integrating tools like clang-tidy or include-what-you-use (iwyu). --- src/engine/N3Base/DFont.h | 8 +------ src/engine/N3Base/JpegFile.cpp | 2 +- src/engine/N3Base/My_3DStruct.h | 2 +- src/engine/N3Base/N3Base.cpp | 3 ++- src/engine/N3Base/N3EngTool.h | 2 +- src/engine/N3Base/N3FXBundle.cpp | 4 ++-- src/engine/N3Base/N3PMeshCreate.cpp | 2 +- src/engine/N3Base/N3SkyMng.cpp | 4 ++-- src/engine/N3Base/N3SndObj2D.cpp | 2 +- src/engine/N3Base/N3Texture.cpp | 2 +- src/engine/N3Base/Pick.h | 2 +- src/engine/N3Base/StreamSoundObj.cpp | 2 +- src/engine/N3Base/WaveFile.h | 2 +- src/game/Compress.cpp | 2 +- src/game/GameProcMain.cpp | 2 +- src/game/GameProcedure.cpp | 6 ++--- src/game/N3FXMgr.cpp | 2 +- src/game/UIClassChange.cpp | 2 +- src/game/UICmd.cpp | 2 +- src/game/UIDroppedItemDlg.cpp | 2 +- src/game/UIMessageBox.cpp | 3 +-- src/game/UIPerTradeDlg.cpp | 2 +- src/server/AIServer/AIServerDlg.cpp | 8 +------ src/server/AIServer/AIServerDlg.h | 9 +++----- src/server/AIServer/Compress.cpp | 2 +- src/server/AIServer/GameSocket.cpp | 4 ++-- src/server/AIServer/N3BASE/My_3DStruct.h | 2 +- src/server/AIServer/N3BASE/StdAfxBase.h | 3 +-- src/server/AIServer/Npc.cpp | 4 ++-- src/server/AIServer/Npc.h | 4 ++-- src/server/AIServer/NpcInfoTable.cpp | 2 +- src/server/AIServer/NpcMagicProcess.h | 2 +- src/server/AIServer/NpcPosTable.cpp | 2 +- src/server/AIServer/NpcThread.cpp | 3 ++- src/server/AIServer/PathFind.cpp | 2 +- src/server/AIServer/RoomEvent.cpp | 2 +- src/server/AIServer/StdAfx.h | 10 ++++---- src/server/AIServer/User.cpp | 4 ++-- src/server/AIServer/User.h | 4 ++-- src/server/Aujard/AujardDlg.cpp | 2 +- src/server/Aujard/AujardDlg.h | 2 +- src/server/Aujard/DBAgent.h | 2 +- src/server/Aujard/DBPool.cpp | 2 +- src/server/Aujard/Global.cpp | 2 +- src/server/Aujard/SharedMem.h | 2 +- src/server/Ebenezer/AISocket.cpp | 6 ++--- src/server/Ebenezer/BaseItemTableSet.cpp | 2 +- .../Ebenezer/CharBaseAbilityTableSet.cpp | 2 +- src/server/Ebenezer/Compress.cpp | 2 +- src/server/Ebenezer/EbenezerDlg.cpp | 2 +- src/server/Ebenezer/EbenezerDlg.h | 4 ++-- src/server/Ebenezer/GameEvent.cpp | 2 +- src/server/Ebenezer/Global.cpp | 3 ++- src/server/Ebenezer/IOCPSocket2.cpp | 4 ++-- src/server/Ebenezer/ItemGroupSet.cpp | 2 +- src/server/Ebenezer/ItemLevelTableSet.cpp | 2 +- src/server/Ebenezer/Knights.cpp | 2 +- src/server/Ebenezer/Knights.h | 4 ++-- src/server/Ebenezer/KnightsManager.cpp | 2 +- src/server/Ebenezer/LOGIC_ELSE.cpp | 2 +- src/server/Ebenezer/MagicProcess.cpp | 4 ++-- src/server/Ebenezer/N3BASE/My_3DStruct.h | 2 +- src/server/Ebenezer/N3BASE/StdAfxBase.h | 3 +-- src/server/Ebenezer/Npc.h | 2 +- src/server/Ebenezer/PreFix1TableSet.cpp | 2 +- src/server/Ebenezer/PreFix2TableSet.cpp | 2 +- src/server/Ebenezer/Region.h | 2 +- src/server/Ebenezer/SharedMem.h | 2 +- src/server/Ebenezer/SkillTableSet.cpp | 2 +- src/server/Ebenezer/StoreInfoTableSet.cpp | 2 +- src/server/Ebenezer/UdpSocket.cpp | 8 +++---- src/server/Ebenezer/User.cpp | 2 +- src/server/Ebenezer/User.h | 2 +- src/server/ItemManager/DBAgent.h | 2 +- src/server/ItemManager/ItemManagerDlg.h | 2 +- src/server/ItemManager/SharedMem.h | 2 +- src/server/LoginServer/DBProcess.cpp | 2 +- src/server/LoginServer/LoginServerDlg.h | 4 ++-- src/tool/Launcher/LauncherDlg.h | 5 ++-- src/tool/N3CE/FormViewAnimation.cpp | 2 +- src/tool/N3CE/FormViewTool.cpp | 2 +- src/tool/N3CE/N3CEView.cpp | 3 ++- src/tool/N3CE/PosDummy.cpp | 3 ++- src/tool/N3CE/TransDummy.cpp | 2 +- src/tool/N3FXE/DlgEditFxg.cpp | 2 +- src/tool/N3FXE/DlgEditPartGround.cpp | 2 +- src/tool/N3FXE/DlgPercent.cpp | 2 +- src/tool/N3FXE/DlgPutColor.cpp | 2 +- src/tool/N3FXE/MainFrm.cpp | 2 +- src/tool/N3Indoor/PortalVol.cpp | 2 +- src/tool/N3Indoor/PortalVolume.cpp | 2 +- src/tool/N3Indoor/PortalWall.cpp | 2 +- src/tool/N3Indoor/PvsBase.cpp | 2 +- src/tool/N3Indoor/PvsMgr.cpp | 2 +- src/tool/N3Indoor/PvsObjFactory.cpp | 2 +- src/tool/N3ME/BrushDlg.cpp | 2 +- src/tool/N3ME/DTex.cpp | 2 +- src/tool/N3ME/DTexGroup.cpp | 2 +- src/tool/N3ME/DTexGroupMng.cpp | 2 +- src/tool/N3ME/DTexMng.cpp | 2 +- src/tool/N3ME/DlgAddSoundGroup.cpp | 2 +- src/tool/N3ME/DlgBar.cpp | 2 +- src/tool/N3ME/DlgCtrlHeightScale.cpp | 2 +- src/tool/N3ME/DlgDTexGroupView.cpp | 2 +- src/tool/N3ME/DlgDelGroup.cpp | 2 +- src/tool/N3ME/DlgEditEvent.cpp | 2 +- src/tool/N3ME/DlgEditEventAttr.cpp | 2 +- src/tool/N3ME/DlgEditWarp.cpp | 2 +- src/tool/N3ME/DlgInputAttr.cpp | 2 +- src/tool/N3ME/DlgInputGroup.cpp | 2 +- src/tool/N3ME/DlgLight.cpp | 2 +- src/tool/N3ME/DlgMakeNPCPath.cpp | 4 ++-- src/tool/N3ME/DlgMakeWall.cpp | 2 +- src/tool/N3ME/DlgMapView.cpp | 4 ++-- src/tool/N3ME/DlgModifyDTex.cpp | 2 +- src/tool/N3ME/DlgPondProperty.cpp | 2 +- src/tool/N3ME/DlgRegenUser.cpp | 2 +- src/tool/N3ME/DlgRiverProperty.cpp | 2 +- src/tool/N3ME/DlgSaveDivision.cpp | 2 +- src/tool/N3ME/DlgSetDTex.cpp | 2 +- src/tool/N3ME/DlgSetLightMap.cpp | 2 +- src/tool/N3ME/DlgSetSound.cpp | 2 +- src/tool/N3ME/DlgShapeList.cpp | 2 +- src/tool/N3ME/DlgSowSeed.cpp | 2 +- src/tool/N3ME/DlgTerrainSize.cpp | 2 +- src/tool/N3ME/DlgUnusedFiles.cpp | 2 +- src/tool/N3ME/Dlg_River.cpp | 2 +- src/tool/N3ME/EventCell.cpp | 2 +- src/tool/N3ME/EventMgr.cpp | 2 +- src/tool/N3ME/LightObjMgr.cpp | 2 +- src/tool/N3ME/MapMng.cpp | 2 +- src/tool/N3ME/NPCPath.cpp | 2 +- src/tool/N3ME/NPCPathMgr.cpp | 2 +- src/tool/N3ME/PondMesh.cpp | 2 +- src/tool/N3ME/PondMng.cpp | 2 +- src/tool/N3ME/PosDummy.cpp | 2 +- src/tool/N3ME/ProgressBar.cpp | 2 +- src/tool/N3ME/RegenUser.cpp | 2 +- src/tool/N3ME/RiverMesh.cpp | 2 +- src/tool/N3ME/RiverMng.cpp | 2 +- src/tool/N3ME/RiverMng2.cpp | 2 +- src/tool/N3ME/RotDummy.cpp | 2 +- src/tool/N3ME/ScaleDummy.cpp | 2 +- src/tool/N3ME/SoundCell.cpp | 2 +- src/tool/N3ME/SoundMgr.cpp | 2 +- src/tool/N3ME/ToolDlg.cpp | 2 +- src/tool/N3ME/TransDummy.cpp | 2 +- src/tool/N3ME/VtxPosDummy.cpp | 2 +- src/tool/N3ME/Wall.cpp | 2 +- src/tool/N3ME/WallMgr.cpp | 2 +- src/tool/N3ME/WarpMgr.cpp | 2 +- src/tool/N3TexViewer/DlgFormat.cpp | 2 +- src/tool/N3TexViewer/N3TexViewerDoc.cpp | 2 +- src/tool/N3Viewer/DlgPMeshEdit.cpp | 2 +- src/tool/PlugIn_Max/N3DExp.h | 22 +++++++++--------- src/tool/PlugIn_Maya/N3E2Wrapper.cpp | 23 ++++++++++--------- src/tool/PlugIn_Maya/N3E2Wrapper.h | 4 ++-- src/tool/UIE/DlgChangeImage.cpp | 2 +- src/tool/UIE/DlgReplace.cpp | 2 +- src/tool/UIE/DlgUnusedFileList.cpp | 2 +- src/tool/UIE/UIEDoc.cpp | 2 +- 161 files changed, 217 insertions(+), 228 deletions(-) diff --git a/src/engine/N3Base/DFont.h b/src/engine/N3Base/DFont.h index 8dbd183e..3fbc9d03 100644 --- a/src/engine/N3Base/DFont.h +++ b/src/engine/N3Base/DFont.h @@ -12,13 +12,7 @@ #pragma once -// TODO: Note that there is some weird mixture of files between engine and game. -// This file is specifically being used by the game's UIs that these UIs not necessarly -// belongs in engine and could be abstracted better, since they all together not being built -// when building the engine as a library. -// I added TODO instead of doing it now to avoid complications during refactoring of -// the directory structure. -#include "N3Base/N3Base.h" +#include "N3Base.h" // Font creation flags #define D3DFONT_BOLD 0x0001 diff --git a/src/engine/N3Base/JpegFile.cpp b/src/engine/N3Base/JpegFile.cpp index e094184e..324b003e 100644 --- a/src/engine/N3Base/JpegFile.cpp +++ b/src/engine/N3Base/JpegFile.cpp @@ -13,7 +13,7 @@ //////////////////////////////////////////////////////////// #include "StdAfx.h" #include "JpegFile.h" -#include "N3Base/My_3DStruct.h" +#include "My_3DStruct.h" #include diff --git a/src/engine/N3Base/My_3DStruct.h b/src/engine/N3Base/My_3DStruct.h index d9134bf1..132b291d 100644 --- a/src/engine/N3Base/My_3DStruct.h +++ b/src/engine/N3Base/My_3DStruct.h @@ -1378,7 +1378,7 @@ const DWORD OBJ_DUMMY = 0x10000000; const DWORD OBJ_EFFECT = 0x20000000; const DWORD OBJ_ANIM_CONTROL = 0x40000000; -#include "CrtDbg.h" +#include #ifndef _DEBUG #define __ASSERT(expr, expMessage) void(0) diff --git a/src/engine/N3Base/N3Base.cpp b/src/engine/N3Base/N3Base.cpp index 73da0526..6ee46a42 100644 --- a/src/engine/N3Base/N3Base.cpp +++ b/src/engine/N3Base/N3Base.cpp @@ -2,6 +2,7 @@ // ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" +#include "N3Base.h" #include "N3Mesh.h" #include "N3VMesh.h" @@ -9,7 +10,7 @@ #include "N3FXPMesh.h" #include "N3FXShape.h" #include "N3Chr.h" -#include "N3Base.h" + #include ////////////////////////////////////////////////////////////////////// diff --git a/src/engine/N3Base/N3EngTool.h b/src/engine/N3Base/N3EngTool.h index 467421db..e52de4de 100644 --- a/src/engine/N3Base/N3EngTool.h +++ b/src/engine/N3Base/N3EngTool.h @@ -4,7 +4,7 @@ #pragma once -#include "N3Base/N3Eng.h" +#include "N3Eng.h" struct __EXPORT_OPTION { char szID[8]; // ID "N3Scene1" diff --git a/src/engine/N3Base/N3FXBundle.cpp b/src/engine/N3Base/N3FXBundle.cpp index 5d4809d7..c835b5a5 100644 --- a/src/engine/N3Base/N3FXBundle.cpp +++ b/src/engine/N3Base/N3FXBundle.cpp @@ -9,8 +9,8 @@ #include "N3FXPartMesh.h" #include "N3FXPartBottomBoard.h" -#include "N3Base/N3SndMgr.h" -#include "N3Base/N3SndObj.h" +#include "N3SndMgr.h" +#include "N3SndObj.h" ////////////////////////////////////////////////////////////////////// // Construction/Destruction diff --git a/src/engine/N3Base/N3PMeshCreate.cpp b/src/engine/N3Base/N3PMeshCreate.cpp index 639a5cc3..54b59393 100644 --- a/src/engine/N3Base/N3PMeshCreate.cpp +++ b/src/engine/N3Base/N3PMeshCreate.cpp @@ -5,7 +5,7 @@ #include "N3PMeshCreate.h" #include "N3PMesh.h" #include "N3PMeshInstance.h" -#include "N3Base/N3Mesh.h" +#include "N3Mesh.h" // Maximum buffer sizes. For greater flexibility, the buffers should reallocate dynamically. #define MAX_COLLAPSES 5000 diff --git a/src/engine/N3Base/N3SkyMng.cpp b/src/engine/N3Base/N3SkyMng.cpp index 32f146d5..842e9d63 100644 --- a/src/engine/N3Base/N3SkyMng.cpp +++ b/src/engine/N3Base/N3SkyMng.cpp @@ -9,9 +9,7 @@ #include "N3Sun.h" #include "N3Cloud.h" #include "N3Star.h" -#include "mmsystem.h" #include "N3Texture.h" - #include "N3GERain.h" #include "N3GESnow.h" @@ -20,6 +18,8 @@ #include "N3SndMgr.h" #endif // #ifdef _N3GAME +#include + typedef typename std::vector<__SKY_DAYCHANGE>::iterator it_SDC; ////////////////////////////////////////////////////////////////////// diff --git a/src/engine/N3Base/N3SndObj2D.cpp b/src/engine/N3Base/N3SndObj2D.cpp index f66c317c..45196b95 100644 --- a/src/engine/N3Base/N3SndObj2D.cpp +++ b/src/engine/N3Base/N3SndObj2D.cpp @@ -5,7 +5,7 @@ #include "StdAfx.h" #include "N3SndMgr.h" #include "N3SndObj.h" -#include "N3Base/N3Base.h" +#include "N3Base.h" #include ////////////////////////////////////////////////////////////////////// diff --git a/src/engine/N3Base/N3Texture.cpp b/src/engine/N3Base/N3Texture.cpp index 126a71ef..fcb4db1a 100644 --- a/src/engine/N3Base/N3Texture.cpp +++ b/src/engine/N3Base/N3Texture.cpp @@ -5,7 +5,7 @@ #include "N3Texture.h" #ifdef _N3TOOL -#include "BitmapFile.h" +#include "BitMapFile.h" #endif // #ifdef _N3TOOL ////////////////////////////////////////////////////////////////////// diff --git a/src/engine/N3Base/Pick.h b/src/engine/N3Base/Pick.h index 7ed140cd..791fae21 100644 --- a/src/engine/N3Base/Pick.h +++ b/src/engine/N3Base/Pick.h @@ -4,7 +4,7 @@ #pragma once -#include "N3Base/N3Mesh.h" +#include "N3Mesh.h" class CPick { public: diff --git a/src/engine/N3Base/StreamSoundObj.cpp b/src/engine/N3Base/StreamSoundObj.cpp index 0ebd2b62..f3f43052 100644 --- a/src/engine/N3Base/StreamSoundObj.cpp +++ b/src/engine/N3Base/StreamSoundObj.cpp @@ -10,7 +10,7 @@ #include "N3SndEng.h" #include "StreamSoundObj.h" #include "N3SndMgr.h" -#include "N3Base/N3Base.h" +#include "N3Base.h" CStreamSoundObj::CStreamSoundObj() { m_WaveSize = NULL; diff --git a/src/engine/N3Base/WaveFile.h b/src/engine/N3Base/WaveFile.h index 3859107d..02530f0c 100644 --- a/src/engine/N3Base/WaveFile.h +++ b/src/engine/N3Base/WaveFile.h @@ -13,7 +13,7 @@ #pragma once -#include +#include #include #include diff --git a/src/game/Compress.cpp b/src/game/Compress.cpp index 1cf390fd..d73e9e44 100644 --- a/src/game/Compress.cpp +++ b/src/game/Compress.cpp @@ -1,7 +1,7 @@ // Compress.cpp : implementation of the CMainFrame class // #include "StdAfx.h" -#include "implode.h" +#include "Implode.h" #include "Compress.h" #define DO_CRC_INSTREAM 1 diff --git a/src/game/GameProcMain.cpp b/src/game/GameProcMain.cpp index db35bc1d..85c9b3e2 100644 --- a/src/game/GameProcMain.cpp +++ b/src/game/GameProcMain.cpp @@ -37,7 +37,7 @@ #include "UISkillTreeDlg.h" #include "UIHotKeyDlg.h" #include "UIClassChange.h" -#include "UINpcEvent.h" +#include "UINPCEvent.h" #include "UIItemExchange.h" #include "UIRepairTooltipDlg.h" #include "UINpcTalk.h" diff --git a/src/game/GameProcedure.cpp b/src/game/GameProcedure.cpp index 3d08531a..1063802f 100644 --- a/src/game/GameProcedure.cpp +++ b/src/game/GameProcedure.cpp @@ -7,7 +7,7 @@ #include "GameDef.h" #include "GameEng.h" -#include "packetdef.h" +#include "PacketDef.h" #include "LocalInput.h" #include "APISocket.h" #include "UIMessageBox.h" @@ -15,7 +15,7 @@ #include "UIManager.h" #include "N3FXMgr.h" -#include "PlayerMyself.h" +#include "PlayerMySelf.h" #include "GameProcedure.h" #include "GameProcLogIn.h" //#include "GameProcStart.h" @@ -40,7 +40,7 @@ #include "N3Base/N3TableBase.h" #include "N3Base/N3FXBundle.h" -#include "N3Base/BitmapFile.h" +#include "N3Base/BitMapFile.h" #include "N3Base/Jpeg.h" #include "N3Base/JpegFile.h" diff --git a/src/game/N3FXMgr.cpp b/src/game/N3FXMgr.cpp index d70763ab..38316238 100644 --- a/src/game/N3FXMgr.cpp +++ b/src/game/N3FXMgr.cpp @@ -6,7 +6,7 @@ #include "StdAfx.h" #include "N3FXMgr.h" #include "GameBase.h" -#include "GameProcmain.h" +#include "GameProcMain.h" #include "GameProcedure.h" #include "PlayerOtherMgr.h" #include "PlayerNPC.h" diff --git a/src/game/UIClassChange.cpp b/src/game/UIClassChange.cpp index fe6a89d5..d6839f9d 100644 --- a/src/game/UIClassChange.cpp +++ b/src/game/UIClassChange.cpp @@ -17,7 +17,7 @@ #include "APISocket.h" #include "UIVarious.h" -#include "UIHotkeyDlg.h" +#include "UIHotKeyDlg.h" ////////////////////////////////////////////////////////////////////// // Construction/Destruction diff --git a/src/game/UICmd.cpp b/src/game/UICmd.cpp index 43ad216b..70162bd8 100644 --- a/src/game/UICmd.cpp +++ b/src/game/UICmd.cpp @@ -8,7 +8,7 @@ #include "GameProcMain.h" #include "PlayerOtherMgr.h" //#include "GameProcLogIn.h" -#include "PlayerMyself.h" +#include "PlayerMySelf.h" #include "UITransactionDlg.h" #include "N3Base/N3UIButton.h" #include "UIManager.h" diff --git a/src/game/UIDroppedItemDlg.cpp b/src/game/UIDroppedItemDlg.cpp index 2797b7fc..e3e5551e 100644 --- a/src/game/UIDroppedItemDlg.cpp +++ b/src/game/UIDroppedItemDlg.cpp @@ -9,7 +9,7 @@ #include "LocalInput.h" #include "APISocket.h" #include "GameProcMain.h" -#include "PlayerMyself.h" +#include "PlayerMySelf.h" #include "N3UIWndBase.h" #include "UIImageTooltipDlg.h" diff --git a/src/game/UIMessageBox.cpp b/src/game/UIMessageBox.cpp index 25b6cb6b..94c1ce9a 100644 --- a/src/game/UIMessageBox.cpp +++ b/src/game/UIMessageBox.cpp @@ -12,11 +12,10 @@ #include "UIPartyBBS.h" #include "GameEng.h" #include "GameProcedure.h" -#include "GameProcLogin.h" +#include "GameProcLogIn.h" #include "LocalInput.h" #include "UIMessageBoxManager.h" #include "SubProcPerTrade.h" -#include "ShellApi.h" #include "N3Base/N3UIButton.h" #include "N3Base/N3UIString.h" diff --git a/src/game/UIPerTradeDlg.cpp b/src/game/UIPerTradeDlg.cpp index 856a3e0f..207b80fd 100644 --- a/src/game/UIPerTradeDlg.cpp +++ b/src/game/UIPerTradeDlg.cpp @@ -8,7 +8,7 @@ #include "LocalInput.h" #include "APISocket.h" #include "GameProcMain.h" -#include "PlayerMyself.h" +#include "PlayerMySelf.h" #include "N3UIWndBase.h" #include "UIImageTooltipDlg.h" diff --git a/src/server/AIServer/AIServerDlg.cpp b/src/server/AIServer/AIServerDlg.cpp index fc423af7..258609d5 100644 --- a/src/server/AIServer/AIServerDlg.cpp +++ b/src/server/AIServer/AIServerDlg.cpp @@ -1,11 +1,7 @@ -// ServerDlg.cpp : implementation file -// - #include "StdAfx.h" #include "AIServer.h" #include "AIServerDlg.h" #include "GameSocket.h" -#include "math.h" #include "MagicTableSet.h" #include "MagicType1Set.h" #include "MagicType2Set.h" @@ -22,9 +18,7 @@ #include "MakeGradeItemTableSet.h" #include "MakeLareItemTableSet.h" #include "Region.h" -#include "ini.h" - -//#include "extern.h" // 전역 객체 +#include "Ini.h" #ifdef _DEBUG #define new DEBUG_NEW diff --git a/src/server/AIServer/AIServerDlg.h b/src/server/AIServer/AIServerDlg.h index 18d62bbf..5c85af7d 100644 --- a/src/server/AIServer/AIServerDlg.h +++ b/src/server/AIServer/AIServerDlg.h @@ -1,6 +1,3 @@ -// ServerDlg.h : header file -// - #pragma once #pragma warning(disable : 4786) @@ -8,10 +5,10 @@ #include "IOCPort.h" #include "GameSocket.h" -#include "MAP.h" +#include "Map.h" #include "NpcTable.h" #include "NpcItem.h" -#include "Pathfind.h" +#include "PathFind.h" #include "User.h" #include "Npc.h" #include "NpcThread.h" @@ -19,7 +16,7 @@ #include "Compress.h" #include "Party.h" -#include "extern.h" // 전역 객체 +#include "Extern.h" // 전역 객체 #include "STLMap.h" #include diff --git a/src/server/AIServer/Compress.cpp b/src/server/AIServer/Compress.cpp index a14da624..ac976d03 100644 --- a/src/server/AIServer/Compress.cpp +++ b/src/server/AIServer/Compress.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" //#include "AIServer.h" -#include "implode.h" +#include "Implode.h" #include "Compress.h" #define DO_CRC_INSTREAM 1 diff --git a/src/server/AIServer/GameSocket.cpp b/src/server/AIServer/GameSocket.cpp index 72c2661c..c8f70e47 100644 --- a/src/server/AIServer/GameSocket.cpp +++ b/src/server/AIServer/GameSocket.cpp @@ -8,10 +8,10 @@ #include "GameSocket.h" #include "User.h" #include "Map.h" -#include "region.h" +#include "Region.h" #include "Party.h" -#include "extern.h" +#include "Extern.h" #ifdef _DEBUG #undef THIS_FILE diff --git a/src/server/AIServer/N3BASE/My_3DStruct.h b/src/server/AIServer/N3BASE/My_3DStruct.h index f8ed834d..864bc3a3 100644 --- a/src/server/AIServer/N3BASE/My_3DStruct.h +++ b/src/server/AIServer/N3BASE/My_3DStruct.h @@ -1237,7 +1237,7 @@ const DWORD OBJ_ANIM_CONTROL = 0x40000000; #define g_EPSILON (1.0e-5f) -#include "CrtDbg.h" +#include #ifndef _DEBUG #define __ASSERT(expr, expMessage) void(0) diff --git a/src/server/AIServer/N3BASE/StdAfxBase.h b/src/server/AIServer/N3BASE/StdAfxBase.h index 44c84ce5..8f0adf7b 100644 --- a/src/server/AIServer/N3BASE/StdAfxBase.h +++ b/src/server/AIServer/N3BASE/StdAfxBase.h @@ -1,7 +1,6 @@ #pragma once -// TODO: reference additional headers your program requires here -#include "AfxVer_.h" +#include #include "My_3DStruct.h" diff --git a/src/server/AIServer/Npc.cpp b/src/server/AIServer/Npc.cpp index 10bb0b24..f8443794 100644 --- a/src/server/AIServer/Npc.cpp +++ b/src/server/AIServer/Npc.cpp @@ -1,5 +1,5 @@ #include "StdAfx.h" -#include "math.h" +#include #include "Npc.h" #include "AIServerDlg.h" #include "Gamesocket.h" @@ -12,7 +12,7 @@ int surround_z[8] = {0, -1, -1, -1, 0, 1, 1, 1}; int test_id = 1056; int cur_test = 0; // 1 = test중 , 0이면 정상 -#include "extern.h" +#include "Extern.h" //BOOL g_bDebug = TRUE; #define ATROCITY_ATTACK_TYPE 1 // 선공 diff --git a/src/server/AIServer/Npc.h b/src/server/AIServer/Npc.h index c32be9f6..e35bb761 100644 --- a/src/server/AIServer/Npc.h +++ b/src/server/AIServer/Npc.h @@ -4,11 +4,11 @@ #pragma once -#include "iocport.h" +#include "IOCPort.h" #include "N3Base/My_3DStruct.h" #include "Map.h" #include "PathFind.h" -#include "user.h" +#include "User.h" #include "NpcMagicProcess.h" #define MAX_MAP_SIZE 10000 diff --git a/src/server/AIServer/NpcInfoTable.cpp b/src/server/AIServer/NpcInfoTable.cpp index be371bf9..43844871 100644 --- a/src/server/AIServer/NpcInfoTable.cpp +++ b/src/server/AIServer/NpcInfoTable.cpp @@ -5,7 +5,7 @@ #include "StdAfx.h" #include "AIServer.h" #include "NpcInfoTable.h" -#include "ini.h" +#include "Ini.h" #ifdef _DEBUG #undef THIS_FILE diff --git a/src/server/AIServer/NpcMagicProcess.h b/src/server/AIServer/NpcMagicProcess.h index 995fd442..4ae8a48d 100644 --- a/src/server/AIServer/NpcMagicProcess.h +++ b/src/server/AIServer/NpcMagicProcess.h @@ -4,7 +4,7 @@ #pragma once -#include "iocport.h" +#include "IOCPort.h" class CServerDlg; class CNpc; diff --git a/src/server/AIServer/NpcPosTable.cpp b/src/server/AIServer/NpcPosTable.cpp index d9b6dc17..6f9d7046 100644 --- a/src/server/AIServer/NpcPosTable.cpp +++ b/src/server/AIServer/NpcPosTable.cpp @@ -5,7 +5,7 @@ #include "StdAfx.h" #include "AIServer.h" #include "NpcPosTable.h" -#include "ini.h" +#include "Ini.h" #ifdef _DEBUG #undef THIS_FILE diff --git a/src/server/AIServer/NpcThread.cpp b/src/server/AIServer/NpcThread.cpp index 2c332396..3665aa3b 100644 --- a/src/server/AIServer/NpcThread.cpp +++ b/src/server/AIServer/NpcThread.cpp @@ -8,7 +8,8 @@ #include "NpcThread.h" #include "Npc.h" #include "Extern.h" -#include "Mmsystem.h" + +#include ////////////////////////////////////////////////////////////////////// // Construction/Destruction diff --git a/src/server/AIServer/PathFind.cpp b/src/server/AIServer/PathFind.cpp index 16a97e35..3e342d60 100644 --- a/src/server/AIServer/PathFind.cpp +++ b/src/server/AIServer/PathFind.cpp @@ -6,7 +6,7 @@ #include "AIServer.h" #include "AIServerDlg.h" #include "PathFind.h" -#include "math.h" +#include //#include "Extern.h" diff --git a/src/server/AIServer/RoomEvent.cpp b/src/server/AIServer/RoomEvent.cpp index 7ffa977e..c9b151c4 100644 --- a/src/server/AIServer/RoomEvent.cpp +++ b/src/server/AIServer/RoomEvent.cpp @@ -6,7 +6,7 @@ #include "AIServer.h" #include "AIServerDlg.h" #include "RoomEvent.h" -#include "define.h" +#include "Define.h" //#include "Npc.h" #ifdef _DEBUG diff --git a/src/server/AIServer/StdAfx.h b/src/server/AIServer/StdAfx.h index ea1611ae..2ea45246 100644 --- a/src/server/AIServer/StdAfx.h +++ b/src/server/AIServer/StdAfx.h @@ -19,11 +19,11 @@ #include "StdBase.h" #include "N3Utils.h" -//#include "Mmsystem.h" -//#include "Imm.h" +//#include +//#include //#include "N3Base/My_3DStruct.h" -#include "packet.h" // packet 정의 +#include "Packet.h" // packet 정의 #include "global.h" // 전역 funtion -#include "define.h" // define -//#include "extern.h" // 전역 객체 +#include "Define.h" // define +//#include "Extern.h" // 전역 객체 diff --git a/src/server/AIServer/User.cpp b/src/server/AIServer/User.cpp index ec08c5a4..2b01a88e 100644 --- a/src/server/AIServer/User.cpp +++ b/src/server/AIServer/User.cpp @@ -6,7 +6,7 @@ #include "AIServer.h" #include "AIServerDlg.h" #include "User.h" -#include "define.h" +#include "Define.h" #include "Region.h" #include "GameSocket.h" @@ -16,7 +16,7 @@ static char THIS_FILE[] = __FILE__; #define new DEBUG_NEW #endif -#include "extern.h" +#include "Extern.h" ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// diff --git a/src/server/AIServer/User.h b/src/server/AIServer/User.h index a9bb758d..6a629da5 100644 --- a/src/server/AIServer/User.h +++ b/src/server/AIServer/User.h @@ -4,11 +4,11 @@ #pragma once -#include "iocport.h" +#include "IOCPort.h" #include "MagicProcess.h" class CServerDlg; -#include "extern.h" +#include "Extern.h" #include "STLMap.h" #include diff --git a/src/server/Aujard/AujardDlg.cpp b/src/server/Aujard/AujardDlg.cpp index 129a9612..e238a956 100644 --- a/src/server/Aujard/AujardDlg.cpp +++ b/src/server/Aujard/AujardDlg.cpp @@ -4,7 +4,7 @@ #include "StdAfx.h" #include "Aujard.h" #include "AujardDlg.h" -#include "ItemTableset.h" +#include "ItemTableSet.h" #include #ifdef _DEBUG diff --git a/src/server/Aujard/AujardDlg.h b/src/server/Aujard/AujardDlg.h index 7dc081d8..3c6cd749 100644 --- a/src/server/Aujard/AujardDlg.h +++ b/src/server/Aujard/AujardDlg.h @@ -5,7 +5,7 @@ #include "SharedMem.h" #include "DBAgent.h" -#include "define.h" +#include "Define.h" #include "STLMap.h" #include "Resource.h" diff --git a/src/server/Aujard/DBAgent.h b/src/server/Aujard/DBAgent.h index 270cde44..51966d23 100644 --- a/src/server/Aujard/DBAgent.h +++ b/src/server/Aujard/DBAgent.h @@ -6,7 +6,7 @@ #pragma warning(disable : 4786) -#include "define.h" +#include "Define.h" #include typedef std::vector<_USER_DATA *> UserDataArray; diff --git a/src/server/Aujard/DBPool.cpp b/src/server/Aujard/DBPool.cpp index cb8f352c..9d42b203 100644 --- a/src/server/Aujard/DBPool.cpp +++ b/src/server/Aujard/DBPool.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "aujard.h" +#include "Aujard.h" #include "DBPool.h" #ifdef _DEBUG diff --git a/src/server/Aujard/Global.cpp b/src/server/Aujard/Global.cpp index 0be7f3fc..edd3b050 100644 --- a/src/server/Aujard/Global.cpp +++ b/src/server/Aujard/Global.cpp @@ -1,5 +1,5 @@ #include "StdAfx.h" -#include "define.h" +#include "Define.h" void GetString(char * tBuf, char * sBuf, int len, int & index) { memcpy(tBuf, sBuf + index, len); diff --git a/src/server/Aujard/SharedMem.h b/src/server/Aujard/SharedMem.h index dc1ef46a..c3248884 100644 --- a/src/server/Aujard/SharedMem.h +++ b/src/server/Aujard/SharedMem.h @@ -4,7 +4,7 @@ #pragma once -#include "define.h" +#include "Define.h" struct _SMQ_HEADER { LONG Front; diff --git a/src/server/Ebenezer/AISocket.cpp b/src/server/Ebenezer/AISocket.cpp index 8dd68312..7ae3a826 100644 --- a/src/server/Ebenezer/AISocket.cpp +++ b/src/server/Ebenezer/AISocket.cpp @@ -6,11 +6,11 @@ #include "Ebenezer.h" #include "AISocket.h" #include "EbenezerDlg.h" -#include "define.h" +#include "Define.h" #include "PacketDefine.h" -#include "AiPacket.h" +#include "AIPacket.h" #include "Npc.h" -#include "user.h" +#include "User.h" #include "Map.h" #include "Compress.h" diff --git a/src/server/Ebenezer/BaseItemTableSet.cpp b/src/server/Ebenezer/BaseItemTableSet.cpp index aafe1046..22c46ae6 100644 --- a/src/server/Ebenezer/BaseItemTableSet.cpp +++ b/src/server/Ebenezer/BaseItemTableSet.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "ebenezer.h" +#include "Ebenezer.h" #include "BaseItemTableSet.h" #ifdef _DEBUG diff --git a/src/server/Ebenezer/CharBaseAbilityTableSet.cpp b/src/server/Ebenezer/CharBaseAbilityTableSet.cpp index 5b49e45b..d258f617 100644 --- a/src/server/Ebenezer/CharBaseAbilityTableSet.cpp +++ b/src/server/Ebenezer/CharBaseAbilityTableSet.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "ebenezer.h" +#include "Ebenezer.h" #include "CharBaseAbilityTableSet.h" #ifdef _DEBUG diff --git a/src/server/Ebenezer/Compress.cpp b/src/server/Ebenezer/Compress.cpp index 1cf390fd..d73e9e44 100644 --- a/src/server/Ebenezer/Compress.cpp +++ b/src/server/Ebenezer/Compress.cpp @@ -1,7 +1,7 @@ // Compress.cpp : implementation of the CMainFrame class // #include "StdAfx.h" -#include "implode.h" +#include "Implode.h" #include "Compress.h" #define DO_CRC_INSTREAM 1 diff --git a/src/server/Ebenezer/EbenezerDlg.cpp b/src/server/Ebenezer/EbenezerDlg.cpp index 0930b49a..819bc45f 100644 --- a/src/server/Ebenezer/EbenezerDlg.cpp +++ b/src/server/Ebenezer/EbenezerDlg.cpp @@ -5,7 +5,7 @@ #include "Ebenezer.h" #include "EbenezerDlg.h" #include "User.h" -#include "AiPacket.h" +#include "AIPacket.h" #include "PacketDefine.h" #include "ItemTableSet.h" diff --git a/src/server/Ebenezer/EbenezerDlg.h b/src/server/Ebenezer/EbenezerDlg.h index 34070c46..03dcfa0c 100644 --- a/src/server/Ebenezer/EbenezerDlg.h +++ b/src/server/Ebenezer/EbenezerDlg.h @@ -5,14 +5,14 @@ #pragma warning(disable : 4786) -#include "Iocport.h" +#include "IOCPort.h" #include "Map.h" #include "Define.h" #include "GameDefine.h" #include "AISocket.h" #include "Npc.h" #include "SharedMem.h" -#include "ini.h" +#include "Ini.h" #include "Compress.h" #include "Knights.h" #include "KnightsManager.h" diff --git a/src/server/Ebenezer/GameEvent.cpp b/src/server/Ebenezer/GameEvent.cpp index 11a8077a..a66f87a8 100644 --- a/src/server/Ebenezer/GameEvent.cpp +++ b/src/server/Ebenezer/GameEvent.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "ebenezer.h" +#include "Ebenezer.h" #include "GameEvent.h" #include "User.h" #include "GameDefine.h" diff --git a/src/server/Ebenezer/Global.cpp b/src/server/Ebenezer/Global.cpp index 9d5617c5..8f68fc7b 100644 --- a/src/server/Ebenezer/Global.cpp +++ b/src/server/Ebenezer/Global.cpp @@ -1,5 +1,6 @@ #include "StdAfx.h" -#include "define.h" +#include "Define.h" + #include // sungyong 2001.11.06 diff --git a/src/server/Ebenezer/IOCPSocket2.cpp b/src/server/Ebenezer/IOCPSocket2.cpp index 237a19bf..2f4fc6a7 100644 --- a/src/server/Ebenezer/IOCPSocket2.cpp +++ b/src/server/Ebenezer/IOCPSocket2.cpp @@ -6,8 +6,8 @@ #include "IOCPSocket2.h" #include "CircularBuffer.h" #include "Compress.h" -#include "Packetdefine.h" -#include "define.h" +#include "PacketDefine.h" +#include "Define.h" #ifdef _DEBUG #undef THIS_FILE diff --git a/src/server/Ebenezer/ItemGroupSet.cpp b/src/server/Ebenezer/ItemGroupSet.cpp index 6ea1b23e..1c226045 100644 --- a/src/server/Ebenezer/ItemGroupSet.cpp +++ b/src/server/Ebenezer/ItemGroupSet.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "ebenezer.h" +#include "Ebenezer.h" #include "ItemGroupSet.h" #ifdef _DEBUG diff --git a/src/server/Ebenezer/ItemLevelTableSet.cpp b/src/server/Ebenezer/ItemLevelTableSet.cpp index 5d3c4fb3..ff92d80a 100644 --- a/src/server/Ebenezer/ItemLevelTableSet.cpp +++ b/src/server/Ebenezer/ItemLevelTableSet.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "ebenezer.h" +#include "Ebenezer.h" #include "ItemLevelTableSet.h" #ifdef _DEBUG diff --git a/src/server/Ebenezer/Knights.cpp b/src/server/Ebenezer/Knights.cpp index fd1d1225..4a1146bd 100644 --- a/src/server/Ebenezer/Knights.cpp +++ b/src/server/Ebenezer/Knights.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "ebenezer.h" +#include "Ebenezer.h" #include "Knights.h" #include "User.h" #include "GameDefine.h" diff --git a/src/server/Ebenezer/Knights.h b/src/server/Ebenezer/Knights.h index 915d6f6a..53229f5f 100644 --- a/src/server/Ebenezer/Knights.h +++ b/src/server/Ebenezer/Knights.h @@ -4,8 +4,8 @@ #pragma once -#include "define.h" -#include "gamedefine.h" +#include "Define.h" +#include "GameDefine.h" class CUser; class CEbenezerDlg; diff --git a/src/server/Ebenezer/KnightsManager.cpp b/src/server/Ebenezer/KnightsManager.cpp index fea1da05..663c7cf1 100644 --- a/src/server/Ebenezer/KnightsManager.cpp +++ b/src/server/Ebenezer/KnightsManager.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "ebenezer.h" +#include "Ebenezer.h" #include "KnightsManager.h" //#include "Knights.h" #include "User.h" diff --git a/src/server/Ebenezer/LOGIC_ELSE.cpp b/src/server/Ebenezer/LOGIC_ELSE.cpp index d0e78657..7bcebfee 100644 --- a/src/server/Ebenezer/LOGIC_ELSE.cpp +++ b/src/server/Ebenezer/LOGIC_ELSE.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "ebenezer.h" +#include "Ebenezer.h" #include "Define.h" #include "LOGIC_ELSE.h" diff --git a/src/server/Ebenezer/MagicProcess.cpp b/src/server/Ebenezer/MagicProcess.cpp index 52c9a2f0..c506140b 100644 --- a/src/server/Ebenezer/MagicProcess.cpp +++ b/src/server/Ebenezer/MagicProcess.cpp @@ -3,13 +3,13 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "ebenezer.h" +#include "Ebenezer.h" #include "MagicProcess.h" #include "EbenezerDlg.h" #include "User.h" #include "Npc.h" #include "PacketDefine.h" -#include "AiPacket.h" +#include "AIPacket.h" #include "GameDefine.h" #ifdef _DEBUG diff --git a/src/server/Ebenezer/N3BASE/My_3DStruct.h b/src/server/Ebenezer/N3BASE/My_3DStruct.h index f8ed834d..864bc3a3 100644 --- a/src/server/Ebenezer/N3BASE/My_3DStruct.h +++ b/src/server/Ebenezer/N3BASE/My_3DStruct.h @@ -1237,7 +1237,7 @@ const DWORD OBJ_ANIM_CONTROL = 0x40000000; #define g_EPSILON (1.0e-5f) -#include "CrtDbg.h" +#include #ifndef _DEBUG #define __ASSERT(expr, expMessage) void(0) diff --git a/src/server/Ebenezer/N3BASE/StdAfxBase.h b/src/server/Ebenezer/N3BASE/StdAfxBase.h index 44c84ce5..8f0adf7b 100644 --- a/src/server/Ebenezer/N3BASE/StdAfxBase.h +++ b/src/server/Ebenezer/N3BASE/StdAfxBase.h @@ -1,7 +1,6 @@ #pragma once -// TODO: reference additional headers your program requires here -#include "AfxVer_.h" +#include #include "My_3DStruct.h" diff --git a/src/server/Ebenezer/Npc.h b/src/server/Ebenezer/Npc.h index eaabb073..dc463bc1 100644 --- a/src/server/Ebenezer/Npc.h +++ b/src/server/Ebenezer/Npc.h @@ -4,7 +4,7 @@ #pragma once -#include "define.h" +#include "Define.h" class CEbenezerDlg; diff --git a/src/server/Ebenezer/PreFix1TableSet.cpp b/src/server/Ebenezer/PreFix1TableSet.cpp index e895a3a3..156547d8 100644 --- a/src/server/Ebenezer/PreFix1TableSet.cpp +++ b/src/server/Ebenezer/PreFix1TableSet.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "ebenezer.h" +#include "Ebenezer.h" #include "PreFix1TableSet.h" #ifdef _DEBUG diff --git a/src/server/Ebenezer/PreFix2TableSet.cpp b/src/server/Ebenezer/PreFix2TableSet.cpp index 82b153bd..ab0e8ce9 100644 --- a/src/server/Ebenezer/PreFix2TableSet.cpp +++ b/src/server/Ebenezer/PreFix2TableSet.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "ebenezer.h" +#include "Ebenezer.h" #include "PreFix2TableSet.h" #ifdef _DEBUG diff --git a/src/server/Ebenezer/Region.h b/src/server/Ebenezer/Region.h index 067ac4cb..008eaed5 100644 --- a/src/server/Ebenezer/Region.h +++ b/src/server/Ebenezer/Region.h @@ -4,7 +4,7 @@ #pragma once -#include "define.h" +#include "Define.h" #include "GameDefine.h" #include "STLMap.h" diff --git a/src/server/Ebenezer/SharedMem.h b/src/server/Ebenezer/SharedMem.h index f4222f90..06aec5d9 100644 --- a/src/server/Ebenezer/SharedMem.h +++ b/src/server/Ebenezer/SharedMem.h @@ -4,7 +4,7 @@ #pragma once -#include "define.h" +#include "Define.h" struct _SMQ_HEADER { LONG Front; diff --git a/src/server/Ebenezer/SkillTableSet.cpp b/src/server/Ebenezer/SkillTableSet.cpp index 35793911..26fd0039 100644 --- a/src/server/Ebenezer/SkillTableSet.cpp +++ b/src/server/Ebenezer/SkillTableSet.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "ebenezer.h" +#include "Ebenezer.h" #include "SkillTableSet.h" #ifdef _DEBUG diff --git a/src/server/Ebenezer/StoreInfoTableSet.cpp b/src/server/Ebenezer/StoreInfoTableSet.cpp index 1f705d10..6500c601 100644 --- a/src/server/Ebenezer/StoreInfoTableSet.cpp +++ b/src/server/Ebenezer/StoreInfoTableSet.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "ebenezer.h" +#include "Ebenezer.h" #include "StoreInfoTableSet.h" #ifdef _DEBUG diff --git a/src/server/Ebenezer/UdpSocket.cpp b/src/server/Ebenezer/UdpSocket.cpp index 96bdd9af..153a9071 100644 --- a/src/server/Ebenezer/UdpSocket.cpp +++ b/src/server/Ebenezer/UdpSocket.cpp @@ -3,12 +3,12 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "ebenezer.h" +#include "Ebenezer.h" #include "UdpSocket.h" -#include "define.h" -#include "packetdefine.h" +#include "Define.h" +#include "PacketDefine.h" #include "EbenezerDlg.h" -#include "AiPacket.h" +#include "AIPacket.h" #include "Knights.h" #include "User.h" diff --git a/src/server/Ebenezer/User.cpp b/src/server/Ebenezer/User.cpp index 4678006f..c353be86 100644 --- a/src/server/Ebenezer/User.cpp +++ b/src/server/Ebenezer/User.cpp @@ -6,7 +6,7 @@ #include "Ebenezer.h" #include "EbenezerDlg.h" #include "User.h" -#include "AiPacket.h" +#include "AIPacket.h" #include "Map.h" #include "PacketDefine.h" diff --git a/src/server/Ebenezer/User.h b/src/server/Ebenezer/User.h index 8641c32c..f68c9e5f 100644 --- a/src/server/Ebenezer/User.h +++ b/src/server/Ebenezer/User.h @@ -7,7 +7,7 @@ #pragma warning(disable : 4786) #include "IOCPSocket2.h" -#include "define.h" +#include "Define.h" #include "GameDefine.h" #include "MagicProcess.h" #include "Npc.h" diff --git a/src/server/ItemManager/DBAgent.h b/src/server/ItemManager/DBAgent.h index eb4bb762..1ef15277 100644 --- a/src/server/ItemManager/DBAgent.h +++ b/src/server/ItemManager/DBAgent.h @@ -6,7 +6,7 @@ #pragma warning(disable : 4786) -#include "define.h" +#include "Define.h" #include class CItemManagerDlg; diff --git a/src/server/ItemManager/ItemManagerDlg.h b/src/server/ItemManager/ItemManagerDlg.h index 608830b5..3ad6ca04 100644 --- a/src/server/ItemManager/ItemManagerDlg.h +++ b/src/server/ItemManager/ItemManagerDlg.h @@ -5,7 +5,7 @@ #include "SharedMem.h" #include "DBAgent.h" -#include "define.h" +#include "Define.h" #include "STLMap.h" ///////////////////////////////////////////////////////////////////////////// diff --git a/src/server/ItemManager/SharedMem.h b/src/server/ItemManager/SharedMem.h index dc1ef46a..c3248884 100644 --- a/src/server/ItemManager/SharedMem.h +++ b/src/server/ItemManager/SharedMem.h @@ -4,7 +4,7 @@ #pragma once -#include "define.h" +#include "Define.h" struct _SMQ_HEADER { LONG Front; diff --git a/src/server/LoginServer/DBProcess.cpp b/src/server/LoginServer/DBProcess.cpp index 8e5711d2..4a205042 100644 --- a/src/server/LoginServer/DBProcess.cpp +++ b/src/server/LoginServer/DBProcess.cpp @@ -4,7 +4,7 @@ #include "StdAfx.h" #include "LoginServer.h" -#include "define.h" +#include "Define.h" #include "DBProcess.h" #include "LoginServerDlg.h" diff --git a/src/server/LoginServer/LoginServerDlg.h b/src/server/LoginServer/LoginServerDlg.h index a57f369b..53d8353b 100644 --- a/src/server/LoginServer/LoginServerDlg.h +++ b/src/server/LoginServer/LoginServerDlg.h @@ -3,8 +3,8 @@ #pragma once -#include "define.h" -#include "Iocport.h" +#include "Define.h" +#include "IOCPort.h" #include "DBProcess.h" #include "STLMap.h" #include diff --git a/src/tool/Launcher/LauncherDlg.h b/src/tool/Launcher/LauncherDlg.h index 284b8fdf..f744cc71 100644 --- a/src/tool/Launcher/LauncherDlg.h +++ b/src/tool/Launcher/LauncherDlg.h @@ -6,10 +6,11 @@ #include #include -#include "afxinet.h" +#include + #include "MacProgressCtrl.h" #include "Resource.h" -#include "define.h" +#include "Define.h" #include "ZipArchive.h" //#include "DlgTransparent.h" diff --git a/src/tool/N3CE/FormViewAnimation.cpp b/src/tool/N3CE/FormViewAnimation.cpp index bf7cab04..a9c7e532 100644 --- a/src/tool/N3CE/FormViewAnimation.cpp +++ b/src/tool/N3CE/FormViewAnimation.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3ce.h" +#include "N3CE.h" #include "N3CEDoc.h" #include "N3CEView.h" #include "MainFrm.h" diff --git a/src/tool/N3CE/FormViewTool.cpp b/src/tool/N3CE/FormViewTool.cpp index 7edbe52d..8e8cff71 100644 --- a/src/tool/N3CE/FormViewTool.cpp +++ b/src/tool/N3CE/FormViewTool.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3ce.h" +#include "N3CE.h" #include "FormViewTool.h" #include "N3CEDoc.h" diff --git a/src/tool/N3CE/N3CEView.cpp b/src/tool/N3CE/N3CEView.cpp index 32a5fa77..425e117b 100644 --- a/src/tool/N3CE/N3CEView.cpp +++ b/src/tool/N3CE/N3CEView.cpp @@ -9,12 +9,13 @@ #include "FormViewAnimation.h" #include "FormViewProperty.h" #include "FormViewTool.h" -#include "mmsystem.h" #include "PosDummy.h" #include "N3Base/N3SndObj.h" #include "N3Base/N3FXPlug.h" +#include + #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[] = __FILE__; diff --git a/src/tool/N3CE/PosDummy.cpp b/src/tool/N3CE/PosDummy.cpp index 7c8c8dd6..309adf5e 100644 --- a/src/tool/N3CE/PosDummy.cpp +++ b/src/tool/N3CE/PosDummy.cpp @@ -3,9 +3,10 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -//#include "n3me.h" #include "PosDummy.h" +//#include "N3ME.h" + #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[] = __FILE__; diff --git a/src/tool/N3CE/TransDummy.cpp b/src/tool/N3CE/TransDummy.cpp index bdb2b701..79e9f309 100644 --- a/src/tool/N3CE/TransDummy.cpp +++ b/src/tool/N3CE/TransDummy.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -//#include "n3me.h" +//#include "N3ME.h" #include "TransDummy.h" #include "N3Base/Pick.h" diff --git a/src/tool/N3FXE/DlgEditFxg.cpp b/src/tool/N3FXE/DlgEditFxg.cpp index 946f594a..bc605bdc 100644 --- a/src/tool/N3FXE/DlgEditFxg.cpp +++ b/src/tool/N3FXE/DlgEditFxg.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3fxe.h" +#include "N3FXE.h" #include "MainFrm.h" #include "DlgEditFxg.h" #include "N3Base/N3FXGroup.h" diff --git a/src/tool/N3FXE/DlgEditPartGround.cpp b/src/tool/N3FXE/DlgEditPartGround.cpp index 9ec05f0a..14399eb2 100644 --- a/src/tool/N3FXE/DlgEditPartGround.cpp +++ b/src/tool/N3FXE/DlgEditPartGround.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3fxe.h" +#include "N3FXE.h" #include "MainFrm.h" #include "DlgEditPartGround.h" #include "N3Base/N3FXPartBottomBoard.h" diff --git a/src/tool/N3FXE/DlgPercent.cpp b/src/tool/N3FXE/DlgPercent.cpp index 4599bf7b..2561ac8d 100644 --- a/src/tool/N3FXE/DlgPercent.cpp +++ b/src/tool/N3FXE/DlgPercent.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3fxe.h" +#include "N3FXE.h" #include "DlgPercent.h" #ifdef _DEBUG diff --git a/src/tool/N3FXE/DlgPutColor.cpp b/src/tool/N3FXE/DlgPutColor.cpp index 1cccfeac..a1b2e985 100644 --- a/src/tool/N3FXE/DlgPutColor.cpp +++ b/src/tool/N3FXE/DlgPutColor.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3fxe.h" +#include "N3FXE.h" #include "DlgPutColor.h" #include "DlgPercent.h" diff --git a/src/tool/N3FXE/MainFrm.cpp b/src/tool/N3FXE/MainFrm.cpp index 65d649f3..f6cd2ead 100644 --- a/src/tool/N3FXE/MainFrm.cpp +++ b/src/tool/N3FXE/MainFrm.cpp @@ -15,7 +15,7 @@ #include "DlgEditFxg.h" #include "N3Base/N3FXDef.h" #include "N3Base/N3FXBundle.h" -#include "ground.h" +#include "Ground.h" #ifdef _DEBUG #define new DEBUG_NEW diff --git a/src/tool/N3Indoor/PortalVol.cpp b/src/tool/N3Indoor/PortalVol.cpp index 7673d2e6..a8a38185 100644 --- a/src/tool/N3Indoor/PortalVol.cpp +++ b/src/tool/N3Indoor/PortalVol.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3indoor.h" +#include "N3Indoor.h" #include "PvsObjFactory.h" #include "PortalVol.h" diff --git a/src/tool/N3Indoor/PortalVolume.cpp b/src/tool/N3Indoor/PortalVolume.cpp index 215d693d..55e16448 100644 --- a/src/tool/N3Indoor/PortalVolume.cpp +++ b/src/tool/N3Indoor/PortalVolume.cpp @@ -6,7 +6,7 @@ #include "N3Indoor.h" #include "PortalVolume.h" -#include "PvsManager.h" +#include "PVSManager.h" #include "MainFrm.h" #include "OrganizeView.h" diff --git a/src/tool/N3Indoor/PortalWall.cpp b/src/tool/N3Indoor/PortalWall.cpp index 84b7a3c0..af6c90e8 100644 --- a/src/tool/N3Indoor/PortalWall.cpp +++ b/src/tool/N3Indoor/PortalWall.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3indoor.h" +#include "N3Indoor.h" #include "PvsObjFactory.h" #include "PortalWall.h" diff --git a/src/tool/N3Indoor/PvsBase.cpp b/src/tool/N3Indoor/PvsBase.cpp index 7c211aa4..e77ae815 100644 --- a/src/tool/N3Indoor/PvsBase.cpp +++ b/src/tool/N3Indoor/PvsBase.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3indoor.h" +#include "N3Indoor.h" #include "PvsObjFactory.h" #include "OrganizeView.h" diff --git a/src/tool/N3Indoor/PvsMgr.cpp b/src/tool/N3Indoor/PvsMgr.cpp index b8f0956a..239627bb 100644 --- a/src/tool/N3Indoor/PvsMgr.cpp +++ b/src/tool/N3Indoor/PvsMgr.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3indoor.h" +#include "N3Indoor.h" #include "PvsMgr.h" #include "PvsBase.h" diff --git a/src/tool/N3Indoor/PvsObjFactory.cpp b/src/tool/N3Indoor/PvsObjFactory.cpp index 2f62dc02..c102ccb6 100644 --- a/src/tool/N3Indoor/PvsObjFactory.cpp +++ b/src/tool/N3Indoor/PvsObjFactory.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3indoor.h" +#include "N3Indoor.h" #include "PvsBase.h" #include "PortalWall.h" diff --git a/src/tool/N3ME/BrushDlg.cpp b/src/tool/N3ME/BrushDlg.cpp index 373650d7..9d032065 100644 --- a/src/tool/N3ME/BrushDlg.cpp +++ b/src/tool/N3ME/BrushDlg.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "BrushDlg.h" #include "LyTerrain.h" diff --git a/src/tool/N3ME/DTex.cpp b/src/tool/N3ME/DTex.cpp index 1a5c6335..d8b415ce 100644 --- a/src/tool/N3ME/DTex.cpp +++ b/src/tool/N3ME/DTex.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "LyTerrainDef.h" #include "N3Base/N3Texture.h" diff --git a/src/tool/N3ME/DTexGroup.cpp b/src/tool/N3ME/DTexGroup.cpp index 866e1d18..f8a57e17 100644 --- a/src/tool/N3ME/DTexGroup.cpp +++ b/src/tool/N3ME/DTexGroup.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "LyTerrainDef.h" #include "MainFrm.h" #include "DTexMng.h" diff --git a/src/tool/N3ME/DTexGroupMng.cpp b/src/tool/N3ME/DTexGroupMng.cpp index 29ab2524..46f0e5bc 100644 --- a/src/tool/N3ME/DTexGroupMng.cpp +++ b/src/tool/N3ME/DTexGroupMng.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "DTexGroupMng.h" #include "DTexGroup.h" #include "MainFrm.h" diff --git a/src/tool/N3ME/DTexMng.cpp b/src/tool/N3ME/DTexMng.cpp index 7f28eae1..dd961f72 100644 --- a/src/tool/N3ME/DTexMng.cpp +++ b/src/tool/N3ME/DTexMng.cpp @@ -4,7 +4,7 @@ #include "StdAfx.h" #include "MainFrm.h" -#include "n3me.h" +#include "N3ME.h" #include "LyTerrainDef.h" #include "DTex.h" diff --git a/src/tool/N3ME/DlgAddSoundGroup.cpp b/src/tool/N3ME/DlgAddSoundGroup.cpp index e4983511..b9a7971b 100644 --- a/src/tool/N3ME/DlgAddSoundGroup.cpp +++ b/src/tool/N3ME/DlgAddSoundGroup.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "DlgAddSoundGroup.h" #ifdef _DEBUG diff --git a/src/tool/N3ME/DlgBar.cpp b/src/tool/N3ME/DlgBar.cpp index 662e3b0d..c5648f74 100644 --- a/src/tool/N3ME/DlgBar.cpp +++ b/src/tool/N3ME/DlgBar.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "MainFrm.h" #include "MapMng.h" #include "LyTerrain.h" diff --git a/src/tool/N3ME/DlgCtrlHeightScale.cpp b/src/tool/N3ME/DlgCtrlHeightScale.cpp index 13fd47e2..86e8211c 100644 --- a/src/tool/N3ME/DlgCtrlHeightScale.cpp +++ b/src/tool/N3ME/DlgCtrlHeightScale.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "DlgCtrlHeightScale.h" #ifdef _DEBUG diff --git a/src/tool/N3ME/DlgDTexGroupView.cpp b/src/tool/N3ME/DlgDTexGroupView.cpp index cfd012d4..0f0e96b6 100644 --- a/src/tool/N3ME/DlgDTexGroupView.cpp +++ b/src/tool/N3ME/DlgDTexGroupView.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "LyTerrainDef.h" #include "DTexGroupMng.h" #include "DTexGroup.h" diff --git a/src/tool/N3ME/DlgDelGroup.cpp b/src/tool/N3ME/DlgDelGroup.cpp index 3e620672..5ada3e3c 100644 --- a/src/tool/N3ME/DlgDelGroup.cpp +++ b/src/tool/N3ME/DlgDelGroup.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "DlgDelGroup.h" #include "MainFrm.h" #include "DTexGroupMng.h" diff --git a/src/tool/N3ME/DlgEditEvent.cpp b/src/tool/N3ME/DlgEditEvent.cpp index fbbe6295..57a88265 100644 --- a/src/tool/N3ME/DlgEditEvent.cpp +++ b/src/tool/N3ME/DlgEditEvent.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "DlgEditEvent.h" #include "EventMgr.h" #include "EventCell.h" diff --git a/src/tool/N3ME/DlgEditEventAttr.cpp b/src/tool/N3ME/DlgEditEventAttr.cpp index 5e43ae91..3e98d9c4 100644 --- a/src/tool/N3ME/DlgEditEventAttr.cpp +++ b/src/tool/N3ME/DlgEditEventAttr.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "DlgEditEventAttr.h" #include "EventCell.h" diff --git a/src/tool/N3ME/DlgEditWarp.cpp b/src/tool/N3ME/DlgEditWarp.cpp index 078b58a7..fab7a6b6 100644 --- a/src/tool/N3ME/DlgEditWarp.cpp +++ b/src/tool/N3ME/DlgEditWarp.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "DlgEditWarp.h" #include "WarpMgr.h" diff --git a/src/tool/N3ME/DlgInputAttr.cpp b/src/tool/N3ME/DlgInputAttr.cpp index 193abba0..ae625fd0 100644 --- a/src/tool/N3ME/DlgInputAttr.cpp +++ b/src/tool/N3ME/DlgInputAttr.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "DlgInputAttr.h" #include "MainFrm.h" #include "DTexGroupMng.h" diff --git a/src/tool/N3ME/DlgInputGroup.cpp b/src/tool/N3ME/DlgInputGroup.cpp index d299cbfd..fb30ba9c 100644 --- a/src/tool/N3ME/DlgInputGroup.cpp +++ b/src/tool/N3ME/DlgInputGroup.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "DlgInputGroup.h" #ifdef _DEBUG diff --git a/src/tool/N3ME/DlgLight.cpp b/src/tool/N3ME/DlgLight.cpp index 8d5ad0ca..bb0c78b7 100644 --- a/src/tool/N3ME/DlgLight.cpp +++ b/src/tool/N3ME/DlgLight.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "DlgLight.h" #include "N3Base/N3Light.h" #include "MainFrm.h" diff --git a/src/tool/N3ME/DlgMakeNPCPath.cpp b/src/tool/N3ME/DlgMakeNPCPath.cpp index 0e55a349..7a095721 100644 --- a/src/tool/N3ME/DlgMakeNPCPath.cpp +++ b/src/tool/N3ME/DlgMakeNPCPath.cpp @@ -2,12 +2,12 @@ // #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "DlgMakeNPCPath.h" #include "NPCPathMgr.h" #include "NPCPath.h" #include "DlgLoadNPCPath.h" -#include "dlgSaveNPCPath.h" +#include "DlgSaveNPCPath.h" #ifdef _DEBUG #define new DEBUG_NEW diff --git a/src/tool/N3ME/DlgMakeWall.cpp b/src/tool/N3ME/DlgMakeWall.cpp index b6da4df1..2e133ed1 100644 --- a/src/tool/N3ME/DlgMakeWall.cpp +++ b/src/tool/N3ME/DlgMakeWall.cpp @@ -1,7 +1,7 @@ // DlgMakeWall.cpp : implementation file // #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "DlgMakeWall.h" #include "Wall.h" #include "WallMgr.h" diff --git a/src/tool/N3ME/DlgMapView.cpp b/src/tool/N3ME/DlgMapView.cpp index ea20f10e..4dab277c 100644 --- a/src/tool/N3ME/DlgMapView.cpp +++ b/src/tool/N3ME/DlgMapView.cpp @@ -2,13 +2,13 @@ // #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "DlgMapView.h" #include "MainFrm.h" #include "MapMng.h" #include "N3Base/N3Texture.h" #include "N3Base/N3EngTool.h" -#include "N3Base/n3scene.h" +#include "N3Base/N3Scene.h" #include "QTNode.h" #ifdef _DEBUG diff --git a/src/tool/N3ME/DlgModifyDTex.cpp b/src/tool/N3ME/DlgModifyDTex.cpp index 2c50188d..47e92bf9 100644 --- a/src/tool/N3ME/DlgModifyDTex.cpp +++ b/src/tool/N3ME/DlgModifyDTex.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "DlgModifyDTex.h" #ifdef _DEBUG diff --git a/src/tool/N3ME/DlgPondProperty.cpp b/src/tool/N3ME/DlgPondProperty.cpp index 78f534bc..3b907aed 100644 --- a/src/tool/N3ME/DlgPondProperty.cpp +++ b/src/tool/N3ME/DlgPondProperty.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "DlgPondProperty.h" #include "PondMng.h" diff --git a/src/tool/N3ME/DlgRegenUser.cpp b/src/tool/N3ME/DlgRegenUser.cpp index 8a6ad8d3..86eb6c87 100644 --- a/src/tool/N3ME/DlgRegenUser.cpp +++ b/src/tool/N3ME/DlgRegenUser.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "DlgRegenUser.h" #include "RegenUser.h" diff --git a/src/tool/N3ME/DlgRiverProperty.cpp b/src/tool/N3ME/DlgRiverProperty.cpp index c6852b6d..b61e3f09 100644 --- a/src/tool/N3ME/DlgRiverProperty.cpp +++ b/src/tool/N3ME/DlgRiverProperty.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "DlgRiverProperty.h" #include "RiverMng.h" diff --git a/src/tool/N3ME/DlgSaveDivision.cpp b/src/tool/N3ME/DlgSaveDivision.cpp index 15c099a3..6c1d2575 100644 --- a/src/tool/N3ME/DlgSaveDivision.cpp +++ b/src/tool/N3ME/DlgSaveDivision.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "DlgSaveDivision.h" #include "LyTerrain.h" diff --git a/src/tool/N3ME/DlgSetDTex.cpp b/src/tool/N3ME/DlgSetDTex.cpp index 3366f28d..578a75ac 100644 --- a/src/tool/N3ME/DlgSetDTex.cpp +++ b/src/tool/N3ME/DlgSetDTex.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "DTex.h" #include "DTexMng.h" #include "DTexGroupMng.h" diff --git a/src/tool/N3ME/DlgSetLightMap.cpp b/src/tool/N3ME/DlgSetLightMap.cpp index c2697697..8b5eeb5c 100644 --- a/src/tool/N3ME/DlgSetLightMap.cpp +++ b/src/tool/N3ME/DlgSetLightMap.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "DlgSetLightMap.h" #include "MainFrm.h" #include "N3Base/N3EngTool.h" diff --git a/src/tool/N3ME/DlgSetSound.cpp b/src/tool/N3ME/DlgSetSound.cpp index 18c68b50..17988c25 100644 --- a/src/tool/N3ME/DlgSetSound.cpp +++ b/src/tool/N3ME/DlgSetSound.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "DlgSetSound.h" #include "SoundMgr.h" #include "SoundCell.h" diff --git a/src/tool/N3ME/DlgShapeList.cpp b/src/tool/N3ME/DlgShapeList.cpp index 4f31775d..381374d5 100644 --- a/src/tool/N3ME/DlgShapeList.cpp +++ b/src/tool/N3ME/DlgShapeList.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "DlgShapeList.h" #include "MainFrm.h" diff --git a/src/tool/N3ME/DlgSowSeed.cpp b/src/tool/N3ME/DlgSowSeed.cpp index 9e021105..566b6375 100644 --- a/src/tool/N3ME/DlgSowSeed.cpp +++ b/src/tool/N3ME/DlgSowSeed.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "DlgSowSeed.h" #include "DlgShapeList.h" #include "MainFrm.h" diff --git a/src/tool/N3ME/DlgTerrainSize.cpp b/src/tool/N3ME/DlgTerrainSize.cpp index 47a6e8c5..98f7f72d 100644 --- a/src/tool/N3ME/DlgTerrainSize.cpp +++ b/src/tool/N3ME/DlgTerrainSize.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "DlgTerrainSize.h" #ifdef _DEBUG diff --git a/src/tool/N3ME/DlgUnusedFiles.cpp b/src/tool/N3ME/DlgUnusedFiles.cpp index 003e5d15..daaf51cf 100644 --- a/src/tool/N3ME/DlgUnusedFiles.cpp +++ b/src/tool/N3ME/DlgUnusedFiles.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "DlgUnusedFiles.h" #include diff --git a/src/tool/N3ME/Dlg_River.cpp b/src/tool/N3ME/Dlg_River.cpp index e2040e30..3573cb36 100644 --- a/src/tool/N3ME/Dlg_River.cpp +++ b/src/tool/N3ME/Dlg_River.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "Dlg_River.h" #ifdef _DEBUG diff --git a/src/tool/N3ME/EventCell.cpp b/src/tool/N3ME/EventCell.cpp index 0eb0f7ac..ac5a3cb0 100644 --- a/src/tool/N3ME/EventCell.cpp +++ b/src/tool/N3ME/EventCell.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "EventCell.h" #include "N3Base/N3Base.h" #include "LyTerrainDef.h" diff --git a/src/tool/N3ME/EventMgr.cpp b/src/tool/N3ME/EventMgr.cpp index b777b43e..ecbc8e89 100644 --- a/src/tool/N3ME/EventMgr.cpp +++ b/src/tool/N3ME/EventMgr.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "EventMgr.h" #include "MapMng.h" #include "EventCell.h" diff --git a/src/tool/N3ME/LightObjMgr.cpp b/src/tool/N3ME/LightObjMgr.cpp index 5582c41c..cde9cbc6 100644 --- a/src/tool/N3ME/LightObjMgr.cpp +++ b/src/tool/N3ME/LightObjMgr.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "LightObjMgr.h" #include "DlgLight.h" #include "LyTerrainDef.h" diff --git a/src/tool/N3ME/MapMng.cpp b/src/tool/N3ME/MapMng.cpp index 1a9089b6..98485f02 100644 --- a/src/tool/N3ME/MapMng.cpp +++ b/src/tool/N3ME/MapMng.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "MapMng.h" #include "MainFrm.h" diff --git a/src/tool/N3ME/NPCPath.cpp b/src/tool/N3ME/NPCPath.cpp index f009286e..12ef84d8 100644 --- a/src/tool/N3ME/NPCPath.cpp +++ b/src/tool/N3ME/NPCPath.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "NPCPath.h" #include "LyTerrain.h" diff --git a/src/tool/N3ME/NPCPathMgr.cpp b/src/tool/N3ME/NPCPathMgr.cpp index 2bca8a48..67eb6ced 100644 --- a/src/tool/N3ME/NPCPathMgr.cpp +++ b/src/tool/N3ME/NPCPathMgr.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "NPCPathMgr.h" #include "NPCPath.h" #include "DlgMakeNPCPath.h" diff --git a/src/tool/N3ME/PondMesh.cpp b/src/tool/N3ME/PondMesh.cpp index ebb9a985..218ad9d8 100644 --- a/src/tool/N3ME/PondMesh.cpp +++ b/src/tool/N3ME/PondMesh.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "PondMesh.h" #include "LyTerrain.h" #include "N3Base/N3Texture.h" diff --git a/src/tool/N3ME/PondMng.cpp b/src/tool/N3ME/PondMng.cpp index 532304a6..84c8a013 100644 --- a/src/tool/N3ME/PondMng.cpp +++ b/src/tool/N3ME/PondMng.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "PondMng.h" #include "PondMesh.h" #include "DlgPondProperty.h" diff --git a/src/tool/N3ME/PosDummy.cpp b/src/tool/N3ME/PosDummy.cpp index a0a89cf9..7eb95de7 100644 --- a/src/tool/N3ME/PosDummy.cpp +++ b/src/tool/N3ME/PosDummy.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "PosDummy.h" #include "LyTerrain.h" diff --git a/src/tool/N3ME/ProgressBar.cpp b/src/tool/N3ME/ProgressBar.cpp index 53b47055..811bddc3 100644 --- a/src/tool/N3ME/ProgressBar.cpp +++ b/src/tool/N3ME/ProgressBar.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "ProgressBar.h" #ifdef _DEBUG diff --git a/src/tool/N3ME/RegenUser.cpp b/src/tool/N3ME/RegenUser.cpp index 02d89724..34641f01 100644 --- a/src/tool/N3ME/RegenUser.cpp +++ b/src/tool/N3ME/RegenUser.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "RegenUser.h" #include "DlgRegenUser.h" #include "LyTerrainDef.h" diff --git a/src/tool/N3ME/RiverMesh.cpp b/src/tool/N3ME/RiverMesh.cpp index 73d2dc9a..52eefe3d 100644 --- a/src/tool/N3ME/RiverMesh.cpp +++ b/src/tool/N3ME/RiverMesh.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "RiverMesh.h" #include "N3Base/N3Texture.h" diff --git a/src/tool/N3ME/RiverMng.cpp b/src/tool/N3ME/RiverMng.cpp index 106605b2..5d9f2f57 100644 --- a/src/tool/N3ME/RiverMng.cpp +++ b/src/tool/N3ME/RiverMng.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "RiverMng.h" #include "RiverMesh.h" #include "DlgRiverProperty.h" diff --git a/src/tool/N3ME/RiverMng2.cpp b/src/tool/N3ME/RiverMng2.cpp index 34917e4a..8a8a1453 100644 --- a/src/tool/N3ME/RiverMng2.cpp +++ b/src/tool/N3ME/RiverMng2.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "RiverMng2.h" #include "N3Base/N3Texture.h" diff --git a/src/tool/N3ME/RotDummy.cpp b/src/tool/N3ME/RotDummy.cpp index 4843b29e..6d753c06 100644 --- a/src/tool/N3ME/RotDummy.cpp +++ b/src/tool/N3ME/RotDummy.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "RotDummy.h" #ifdef _DEBUG diff --git a/src/tool/N3ME/ScaleDummy.cpp b/src/tool/N3ME/ScaleDummy.cpp index 9e56ffaa..309aef53 100644 --- a/src/tool/N3ME/ScaleDummy.cpp +++ b/src/tool/N3ME/ScaleDummy.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "ScaleDummy.h" #ifdef _DEBUG diff --git a/src/tool/N3ME/SoundCell.cpp b/src/tool/N3ME/SoundCell.cpp index 8329aaaf..828f9afb 100644 --- a/src/tool/N3ME/SoundCell.cpp +++ b/src/tool/N3ME/SoundCell.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "SoundCell.h" #include "N3Base/N3Base.h" #include "LyTerrainDef.h" diff --git a/src/tool/N3ME/SoundMgr.cpp b/src/tool/N3ME/SoundMgr.cpp index f1390370..a424bdab 100644 --- a/src/tool/N3ME/SoundMgr.cpp +++ b/src/tool/N3ME/SoundMgr.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "SoundMgr.h" #include "MapMng.h" #include "SoundCell.h" diff --git a/src/tool/N3ME/ToolDlg.cpp b/src/tool/N3ME/ToolDlg.cpp index 46f80a29..93393508 100644 --- a/src/tool/N3ME/ToolDlg.cpp +++ b/src/tool/N3ME/ToolDlg.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "ToolDlg.h" #include "N3Base/N3Transform.h" diff --git a/src/tool/N3ME/TransDummy.cpp b/src/tool/N3ME/TransDummy.cpp index 1d3b9389..50b84787 100644 --- a/src/tool/N3ME/TransDummy.cpp +++ b/src/tool/N3ME/TransDummy.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "TransDummy.h" #include "N3Base/Pick.h" diff --git a/src/tool/N3ME/VtxPosDummy.cpp b/src/tool/N3ME/VtxPosDummy.cpp index acf4c988..1bc604f0 100644 --- a/src/tool/N3ME/VtxPosDummy.cpp +++ b/src/tool/N3ME/VtxPosDummy.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "VtxPosDummy.h" #ifdef _DEBUG diff --git a/src/tool/N3ME/Wall.cpp b/src/tool/N3ME/Wall.cpp index d7d2a573..11575c5f 100644 --- a/src/tool/N3ME/Wall.cpp +++ b/src/tool/N3ME/Wall.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "Wall.h" #ifdef _DEBUG diff --git a/src/tool/N3ME/WallMgr.cpp b/src/tool/N3ME/WallMgr.cpp index 2e82a7fa..62638779 100644 --- a/src/tool/N3ME/WallMgr.cpp +++ b/src/tool/N3ME/WallMgr.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "WallMgr.h" #include "Wall.h" #include "MapMng.h" diff --git a/src/tool/N3ME/WarpMgr.cpp b/src/tool/N3ME/WarpMgr.cpp index 05ddd2e7..2928875f 100644 --- a/src/tool/N3ME/WarpMgr.cpp +++ b/src/tool/N3ME/WarpMgr.cpp @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #include "StdAfx.h" -#include "n3me.h" +#include "N3ME.h" #include "WarpMgr.h" #include "DlgEditWarp.h" #include "LyTerrainDef.h" diff --git a/src/tool/N3TexViewer/DlgFormat.cpp b/src/tool/N3TexViewer/DlgFormat.cpp index 80f76a02..9aabca82 100644 --- a/src/tool/N3TexViewer/DlgFormat.cpp +++ b/src/tool/N3TexViewer/DlgFormat.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3texviewer.h" +#include "N3TexViewer.h" #include "DlgFormat.h" #ifdef _DEBUG diff --git a/src/tool/N3TexViewer/N3TexViewerDoc.cpp b/src/tool/N3TexViewer/N3TexViewerDoc.cpp index 1988d5ea..f156eab2 100644 --- a/src/tool/N3TexViewer/N3TexViewerDoc.cpp +++ b/src/tool/N3TexViewer/N3TexViewerDoc.cpp @@ -5,7 +5,7 @@ #include "N3TexViewer.h" #include "N3TexViewerDoc.h" -#include "N3Base/BitmapFile.h" +#include "N3Base/BitMapFile.h" #ifdef _DEBUG #define new DEBUG_NEW diff --git a/src/tool/N3Viewer/DlgPMeshEdit.cpp b/src/tool/N3Viewer/DlgPMeshEdit.cpp index 2b2ba639..3b612f96 100644 --- a/src/tool/N3Viewer/DlgPMeshEdit.cpp +++ b/src/tool/N3Viewer/DlgPMeshEdit.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "n3viewer.h" +#include "N3Viewer.h" #include "MainFrm.h" #include "DlgPMeshCreateOption.h" #include "DlgPMeshEdit.h" diff --git a/src/tool/PlugIn_Max/N3DExp.h b/src/tool/PlugIn_Max/N3DExp.h index 321527fc..847421fb 100644 --- a/src/tool/PlugIn_Max/N3DExp.h +++ b/src/tool/PlugIn_Max/N3DExp.h @@ -14,31 +14,31 @@ #include "StdAfx.h" +#include "Resource.h" #include "N3Base/N3EngTool.h" #include "N3Base/N3Scene.h" -#include "Bipexp.h" // biped -#include "Phyexp.h" // physique +#include // biped +#include // physique -#include "Max.h" -#include "Resource.h" +#include -#include "istdplug.h" -#include "iparamb2.h" -#include "iparamm2.h" +#include +#include +#include -#include "decomp.h" +#include #include #include -#include "stdmat.h" -#include "bitmap.h" +#include +#include #include #include -//#include "ISkin.h" +//#include //--Name : Plugin Unique ID---------------------------------------- #define CN3DEXP_CLASS_ID Class_ID(0x4fc463a7, 0x3b1a661e) diff --git a/src/tool/PlugIn_Maya/N3E2Wrapper.cpp b/src/tool/PlugIn_Maya/N3E2Wrapper.cpp index 9c86ec1a..118eca7b 100644 --- a/src/tool/PlugIn_Maya/N3E2Wrapper.cpp +++ b/src/tool/PlugIn_Maya/N3E2Wrapper.cpp @@ -22,26 +22,27 @@ // // -#ifdef WIN32 -#include -#endif +#include "StdAfx.h" -#ifdef WIN32 -#define MAXPATHLEN 1024 -#endif +#include "Resource.h" -#include #include "N3E2Wrapper.h" -#include "IFFReader.h" #include "N3Base/N3Eng.h" #include "N3Base/N3Scene.h" #include "N3Base/N3PMeshCreate.h" -extern const char * objectName(MObject object); +#ifdef WIN32 +#include +#define MAXPATHLEN 1024 +#endif -#include "CommCtrl.h" -#include "Resource.h" +#include +#include +#include +#include + +extern const char * objectName(MObject object); BOOL CN3E2Wrapper::m_bCancelExport = FALSE; __EXPORT_OPTION CN3E2Wrapper::m_Option; diff --git a/src/tool/PlugIn_Maya/N3E2Wrapper.h b/src/tool/PlugIn_Maya/N3E2Wrapper.h index b17a1d72..564f342d 100644 --- a/src/tool/PlugIn_Maya/N3E2Wrapper.h +++ b/src/tool/PlugIn_Maya/N3E2Wrapper.h @@ -68,8 +68,8 @@ const float N3_PI = 3.141592f; #endif #endif -#include "MAYA/MString.h" // Added by ClassView -#include "MAYA/MObject.h" // Added by ClassView +#include // Added by ClassView +#include // Added by ClassView #include "N3Base/My_3DStruct.h" #include "N3Base/N3EngTool.h" diff --git a/src/tool/UIE/DlgChangeImage.cpp b/src/tool/UIE/DlgChangeImage.cpp index 18bfbedd..a109e915 100644 --- a/src/tool/UIE/DlgChangeImage.cpp +++ b/src/tool/UIE/DlgChangeImage.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "uie.h" +#include "UIE.h" #include "DlgChangeImage.h" #include "MainFrm.h" diff --git a/src/tool/UIE/DlgReplace.cpp b/src/tool/UIE/DlgReplace.cpp index 15fe9dc2..7f7c02d6 100644 --- a/src/tool/UIE/DlgReplace.cpp +++ b/src/tool/UIE/DlgReplace.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "uie.h" +#include "UIE.h" #include "DlgReplace.h" #ifdef _DEBUG diff --git a/src/tool/UIE/DlgUnusedFileList.cpp b/src/tool/UIE/DlgUnusedFileList.cpp index ad357d5c..e48eeb78 100644 --- a/src/tool/UIE/DlgUnusedFileList.cpp +++ b/src/tool/UIE/DlgUnusedFileList.cpp @@ -2,7 +2,7 @@ // #include "StdAfx.h" -#include "uie.h" +#include "UIE.h" #include "DlgUnusedFileList.h" #ifdef _DEBUG diff --git a/src/tool/UIE/UIEDoc.cpp b/src/tool/UIE/UIEDoc.cpp index 26f34347..28f6152a 100644 --- a/src/tool/UIE/UIEDoc.cpp +++ b/src/tool/UIE/UIEDoc.cpp @@ -13,7 +13,7 @@ #include "N3Base/N3UIEdit.h" #include "N3Base/N3UIProgress.h" #include "N3Base/N3UITrackBar.h" -#include "N3Base/N3UIToolTip.h" +#include "N3Base/N3UITooltip.h" #include "N3Base/N3UIScrollBar.h" #include "N3Base/N3Texture.h" #include "N3Base/N3UIArea.h"