@@ -162,11 +162,30 @@ static void LoadDirFiles(const std::wstring &path)
162162 if (_wcsicmp (a.c_str (), b.c_str ()) == 0 ) { g_curIdx = (int )i; break ; }
163163 }
164164}
165+ // 启动 Manager(exe 同目录 qlens_manager.exe;传当前文件夹路径)
166+ static void LaunchManager (HWND hwnd)
167+ {
168+ wchar_t exe[MAX_PATH ];
169+ GetModuleFileNameW (nullptr , exe, MAX_PATH );
170+ wchar_t dir[MAX_PATH ];
171+ wcscpy_s (dir, exe);
172+ PathRemoveFileSpecW (dir);
173+ std::wstring mgr = std::wstring (dir) + L" \\ qlens_manager.exe" ;
174+ // 传当前图片所在文件夹
175+ std::wstring arg;
176+ if (!g_curFile.empty ()) {
177+ wchar_t folder[MAX_PATH ];
178+ wcscpy_s (folder, g_curFile.c_str ());
179+ PathRemoveFileSpecW (folder);
180+ arg = L" \" " + std::wstring (folder) + L" \" " ;
181+ }
182+ ShellExecuteW (nullptr , L" open" , mgr.c_str (), arg.empty () ? nullptr : arg.c_str (), nullptr , SW_SHOWNORMAL );
183+ }
184+
165185void LoadFileByPath (HWND hwnd, const wchar_t *path)
166186{
167187 if (hwnd) g_hwnd = hwnd;
168- g_curFile = path;
169- LoadDirFiles (path);
188+ g_curFile = path; LoadDirFiles (path);
170189 RendererEnsureInit (g_hwnd);
171190 StartAnimationIfGif (g_curFile);
172191 RequestLoadAsync (g_curFile);
@@ -264,9 +283,11 @@ static void CopyCurrentImage()
264283 {
265284 DecodedImage img;
266285 if (DecodeImageFile (g_curFile, img) && img.width > 0 && img.height > 0 ) {
267- // 若最长边 > 1600,降采样( Picasa 风格:粘贴 QQ 不爆大小 )
286+ // 位图 = 当前窗口大小(所见即所得, Picasa 风格——避免超大图爆掉聊天软件位图粘贴上限 )
268287 int w = img.width , h = img.height ;
269- const int MAX_SIDE = 1600 ;
288+ int winW = 0 , winH = 0 ;
289+ if (g_hwnd) { RECT rc; if (GetClientRect (g_hwnd, &rc)) { winW = rc.right ; winH = rc.bottom ; } }
290+ const int MAX_SIDE = (winW > 0 && winH > 0 ) ? (winW > winH ? winW : winH) : 1600 ;
270291 std::vector<unsigned char > buf; // compressed BGRA pixels
271292 if (w > MAX_SIDE || h > MAX_SIDE ) {
272293 float scale = (float )MAX_SIDE / (w > h ? w : h);
@@ -615,6 +636,11 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
615636 }
616637 }
617638 return 0 ;
639+ case WM_LBUTTONDBLCLK : {
640+ // 双击进 Manager(打开当前图片所在文件夹)
641+ LaunchManager (hwnd);
642+ return 0 ;
643+ }
618644 case WM_LBUTTONDOWN : {
619645 int x = (short )LOWORD (lp), y = (short )HIWORD (lp);
620646 RECT rc; GetClientRect (hwnd, &rc);
@@ -624,13 +650,8 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
624650 if (btn == 1 ) { if (g_curIdx > 0 ) NavTo (g_curIdx - 1 , hwnd); return 0 ; }
625651 if (btn == 2 ) { if (g_curIdx < (int )g_files.size ()-1 ) NavTo (g_curIdx + 1 , hwnd); return 0 ; }
626652 if (btn == 3 ) {
627- // 启动 Manager
628- wchar_t exe[MAX_PATH ];
629- GetModuleFileNameW (nullptr , exe, MAX_PATH );
630- wchar_t dir[MAX_PATH ];
631- wcscpy_s (dir, exe);
632- PathRemoveFileSpecW (dir);
633- ShellExecuteW (nullptr , L" open" , (std::wstring (dir) + L" \\ qlens_manager.exe" ).c_str (), nullptr , nullptr , SW_SHOWNORMAL );
653+ // 启动 Manager(复用 LaunchManager)
654+ LaunchManager (hwnd);
634655 return 0 ;
635656 }
636657 int idx = g_strip.hitTest (x, y, rc.bottom );
0 commit comments