diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2015-06-15 03:00:00 +0300 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:16:54 +0300 |
commit | 54490d51d5c6b0d794dcbad2d634d4c95fc25b6c (patch) | |
tree | c3c413656432c0ef87b2841c80e42b55ad17d4e8 /CPP/7zip/UI/FileManager/FM.cpp | |
parent | 0713a3ab803e57401f18432148b4139e5fe6e5dd (diff) |
15.0515.05
Diffstat (limited to 'CPP/7zip/UI/FileManager/FM.cpp')
-rw-r--r-- | CPP/7zip/UI/FileManager/FM.cpp | 48 |
1 files changed, 40 insertions, 8 deletions
diff --git a/CPP/7zip/UI/FileManager/FM.cpp b/CPP/7zip/UI/FileManager/FM.cpp index 537103ae..00b152c8 100644 --- a/CPP/7zip/UI/FileManager/FM.cpp +++ b/CPP/7zip/UI/FileManager/FM.cpp @@ -49,6 +49,9 @@ static UString g_MainPath; static UString g_ArcFormat; static bool g_Maximized = false; +// HRESULT LoadGlobalCodecs(); +void FreeGlobalCodecs(); + #ifndef UNDER_CE DWORD g_ComCtl32Version; @@ -568,6 +571,13 @@ static int WINAPI WinMain2(int nCmdShow) if (!InitInstance (nCmdShow)) return FALSE; + // we will load Global_Codecs at first use instead. + /* + OutputDebugStringW(L"Before LoadGlobalCodecs"); + LoadGlobalCodecs(); + OutputDebugStringW(L"After LoadGlobalCodecs"); + */ + #ifndef _UNICODE if (g_IsNT) { @@ -597,6 +607,10 @@ static int WINAPI WinMain2(int nCmdShow) } } + // Destructor of g_CodecsReleaser can release DLLs. + // But we suppose that it's better to release DLLs here (before destructor). + FreeGlobalCodecs(); + g_HWND = 0; #ifndef UNDER_CE OleUninitialize(); @@ -780,35 +794,45 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) xSizes[1] = 0; g_App.CreateDragTarget(); + bool archiveIsOpened; bool encrypted; bool needOpenFile = false; - if (!g_MainPath.IsEmpty() /* && g_OpenArchive */) + + UString fullPath = g_MainPath; + if (!fullPath.IsEmpty() /* && g_OpenArchive */) { - if (NFile::NFind::DoesFileExist(us2fs(g_MainPath))) + if (!NFile::NName::IsAbsolutePath(fullPath)) + { + FString fullPathF; + if (NFile::NName::GetFullPath(us2fs(fullPath), fullPathF)) + fullPath = fs2us(fullPathF); + } + if (NFile::NFind::DoesFileExist(us2fs(fullPath))) needOpenFile = true; } - HRESULT res = g_App.Create(hWnd, g_MainPath, g_ArcFormat, xSizes, archiveIsOpened, encrypted); + + HRESULT res = g_App.Create(hWnd, fullPath, g_ArcFormat, xSizes, archiveIsOpened, encrypted); if (res == E_ABORT) - { return -1; - } + if (needOpenFile && !archiveIsOpened || res != S_OK) { UString message = L"Error"; if (res == S_FALSE || res == S_OK) { message = MyFormatNew(encrypted ? - IDS_CANT_OPEN_ENCRYPTED_ARCHIVE : - IDS_CANT_OPEN_ARCHIVE, - g_MainPath); + IDS_CANT_OPEN_ENCRYPTED_ARCHIVE : + IDS_CANT_OPEN_ARCHIVE, + fullPath); } else if (res != S_OK) message = HResultToMessage(res); ErrorMessage(message); return -1; } + // g_SplitterPos = 0; // ::DragAcceptFiles(hWnd, TRUE); @@ -816,6 +840,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) break; } + case WM_DESTROY: { // ::DragAcceptFiles(hWnd, FALSE); @@ -839,11 +864,13 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) g_StartCaptureSplitterPos = g_Splitter.GetPos(); ::SetCapture(hWnd); break; + case WM_LBUTTONUP: { ::ReleaseCapture(); break; } + case WM_MOUSEMOVE: { if ((wParam & MK_LBUTTON) != 0 && ::GetCapture() == hWnd) @@ -880,10 +907,12 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) return 0; break; } + case WM_SETFOCUS: // g_App.SetFocus(g_App.LastFocusedPanel); g_App.SetFocusToLastItem(); break; + /* case WM_ACTIVATE: { @@ -900,6 +929,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) break; } */ + /* case kLangWasChangedMessage: MyLoadMenu(); @@ -910,11 +940,13 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_SETTINGCHANGE: break; */ + case WM_NOTIFY: { g_App.OnNotify((int)wParam, (LPNMHDR)lParam); break; } + /* case WM_DROPFILES: { |