ReactOS 0.4.16-dev-329-g9223134
shimgvw.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Picture and Fax Viewer
3 * LICENSE: GPL-2.0 (https://spdx.org/licenses/GPL-2.0)
4 * PURPOSE: Image file browsing and manipulation
5 * COPYRIGHT: Copyright Dmitry Chapyshev (dmitry@reactos.org)
6 * Copyright 2018-2023 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
7 */
8
9#include "shimgvw.h"
10#include <windowsx.h>
11#include <commctrl.h>
12#include <commdlg.h>
13#include <shlobj.h>
14#include <shellapi.h>
15
16/* Toolbar image size */
17#define TB_IMAGE_WIDTH 16
18#define TB_IMAGE_HEIGHT 16
19
20/* Slide show timer */
21#define SLIDESHOW_TIMER_ID 0xFACE
22#define SLIDESHOW_TIMER_INTERVAL 5000 /* 5 seconds */
23
30
31static const UINT s_ZoomSteps[] =
32{
33 5, 10, 25, 50, 100, 200, 300, 500, 1000, 2000, 4000
34};
35
36#define MIN_ZOOM s_ZoomSteps[0]
37#define MAX_ZOOM s_ZoomSteps[_countof(s_ZoomSteps) - 1]
38
39 /* iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString */
40#define DEFINE_BTN_INFO(_name) \
41 { TBICON_##_name, IDC_##_name, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }
42
43#define DEFINE_BTN_SEPARATOR \
44 { -1, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0 }
45
46/* ToolBar Buttons */
47static const TBBUTTON s_Buttons[] =
48{
49 DEFINE_BTN_INFO(PREV_PIC),
50 DEFINE_BTN_INFO(NEXT_PIC),
52 DEFINE_BTN_INFO(BEST_FIT),
53 DEFINE_BTN_INFO(REAL_SIZE),
56 DEFINE_BTN_INFO(ZOOM_IN),
57 DEFINE_BTN_INFO(ZOOM_OUT),
59 DEFINE_BTN_INFO(ROT_CLOCKW),
60 DEFINE_BTN_INFO(ROT_COUNCW),
62 DEFINE_BTN_INFO(ROT_CWSAVE),
63 DEFINE_BTN_INFO(ROT_CCWSAVE),
66 DEFINE_BTN_INFO(PRINT),
67 DEFINE_BTN_INFO(SAVEAS),
70 DEFINE_BTN_INFO(HELP_TOC)
71};
72
73/* ToolBar Button configuration */
74typedef struct
75{
76 DWORD idb; /* Index to bitmap */
77 DWORD ids; /* Index to tooltip */
79
80#define DEFINE_BTN_CONFIG(_name) { IDB_##_name, IDS_TOOLTIP_##_name }
81
83{
84 DEFINE_BTN_CONFIG(PREV_PIC),
85 DEFINE_BTN_CONFIG(NEXT_PIC),
86 DEFINE_BTN_CONFIG(BEST_FIT),
87 DEFINE_BTN_CONFIG(REAL_SIZE),
89 DEFINE_BTN_CONFIG(ZOOM_IN),
90 DEFINE_BTN_CONFIG(ZOOM_OUT),
91 DEFINE_BTN_CONFIG(ROT_CLOCKW),
92 DEFINE_BTN_CONFIG(ROT_COUNCW),
93 DEFINE_BTN_CONFIG(ROT_CWSAVE),
94 DEFINE_BTN_CONFIG(ROT_CCWSAVE),
96 DEFINE_BTN_CONFIG(PRINT),
97 DEFINE_BTN_CONFIG(SAVEAS),
99 DEFINE_BTN_CONFIG(HELP_TOC),
100};
101
102typedef struct tagPREVIEW_DATA
103{
108 ANIME m_Anime; /* Animation */
116
117static inline PPREVIEW_DATA
119{
121}
122
123static inline BOOL
125{
126 return hwnd == g_hMainWnd;
127}
128
129static VOID
131{
133 {
136 }
137}
138
139static VOID
141{
142 RECT rcClient;
143 UINT ImageWidth, ImageHeight, ZoomedWidth, ZoomedHeight;
144 SCROLLINFO si;
145 BOOL bShowHorz, bShowVert;
146
147 if (bResetPos)
148 pData->m_xScrollOffset = pData->m_yScrollOffset = 0;
149
150 if (!g_pImage)
151 {
154 return;
155 }
156
157 GdipGetImageWidth(g_pImage, &ImageWidth);
158 GdipGetImageHeight(g_pImage, &ImageHeight);
159
160 ZoomedWidth = (ImageWidth * pData->m_nZoomPercents) / 100;
161 ZoomedHeight = (ImageHeight * pData->m_nZoomPercents) / 100;
162
163 GetClientRect(hwnd, &rcClient);
164
165 bShowHorz = (rcClient.right < ZoomedWidth);
166 bShowVert = (rcClient.bottom < ZoomedHeight);
167 ShowScrollBar(hwnd, SB_HORZ, bShowHorz);
168 ShowScrollBar(hwnd, SB_VERT, bShowVert);
169
170 GetClientRect(hwnd, &rcClient);
171
172 ZeroMemory(&si, sizeof(si));
173 si.cbSize = sizeof(si);
174 si.fMask = SIF_ALL;
175
176 if (bShowHorz)
177 {
179 si.nPage = rcClient.right;
180 si.nMin = 0;
181 si.nMax = ZoomedWidth;
182 si.nPos = (ZoomedWidth - rcClient.right) / 2 + pData->m_xScrollOffset;
183 si.nPos = max(min(si.nPos, si.nMax - (INT)si.nPage), si.nMin);
185 pData->m_xScrollOffset = si.nPos - (ZoomedWidth - rcClient.right) / 2;
186 }
187 else
188 {
189 pData->m_xScrollOffset = 0;
190 }
191
192 if (bShowVert)
193 {
195 si.nPage = rcClient.bottom;
196 si.nMin = 0;
197 si.nMax = ZoomedHeight;
198 si.nPos = (ZoomedHeight - rcClient.bottom) / 2 + pData->m_yScrollOffset;
199 si.nPos = max(min(si.nPos, si.nMax - (INT)si.nPage), si.nMin);
201 pData->m_yScrollOffset = si.nPos - (ZoomedHeight - rcClient.bottom) / 2;
202 }
203 else
204 {
205 pData->m_yScrollOffset = 0;
206 }
207
209}
210
211static VOID
212Preview_UpdateZoom(PPREVIEW_DATA pData, UINT NewZoom, BOOL bEnableBestFit, BOOL bEnableRealSize)
213{
214 BOOL bEnableZoomIn, bEnableZoomOut;
215 HWND hToolBar = pData->m_hwndToolBar;
216
217 pData->m_nZoomPercents = NewZoom;
218
219 /* Check if a zoom button of the toolbar must be grayed */
220 bEnableZoomIn = (NewZoom < MAX_ZOOM);
221 bEnableZoomOut = (NewZoom > MIN_ZOOM);
222
223 /* Update toolbar buttons */
228
229 /* Redraw the display window */
230 InvalidateRect(pData->m_hwndZoom, NULL, TRUE);
231
232 /* Restart timer if necessary */
234
235 /* Update scroll info */
236 ZoomWnd_UpdateScroll(pData, pData->m_hwndZoom, FALSE);
237}
238
239static VOID
241{
242 UINT i, NewZoom;
243
244 if (g_pImage == NULL)
245 return;
246
247 if (bZoomIn) /* zoom in */
248 {
249 /* find next step */
250 for (i = 0; i < _countof(s_ZoomSteps); ++i)
251 {
252 if (pData->m_nZoomPercents < s_ZoomSteps[i])
253 break;
254 }
255 NewZoom = ((i >= _countof(s_ZoomSteps)) ? MAX_ZOOM : s_ZoomSteps[i]);
256 }
257 else /* zoom out */
258 {
259 /* find previous step */
260 for (i = _countof(s_ZoomSteps); i > 0; )
261 {
262 --i;
263 if (s_ZoomSteps[i] < pData->m_nZoomPercents)
264 break;
265 }
266 NewZoom = ((i < 0) ? MIN_ZOOM : s_ZoomSteps[i]);
267 }
268
269 /* Update toolbar and refresh screen */
270 Preview_UpdateZoom(pData, NewZoom, TRUE, TRUE);
271}
272
273static VOID
275{
276 RECT Rect;
277 UINT ImageWidth, ImageHeight, NewZoom;
278
279 if (g_pImage == NULL)
280 return;
281
282 /* get disp window size and image size */
283 GetClientRect(pData->m_hwndZoom, &Rect);
284 GdipGetImageWidth(g_pImage, &ImageWidth);
285 GdipGetImageHeight(g_pImage, &ImageHeight);
286
287 /* compare two aspect rates. same as
288 (ImageHeight / ImageWidth < Rect.bottom / Rect.right) in real */
289 if (ImageHeight * Rect.right < Rect.bottom * ImageWidth)
290 {
291 if (Rect.right < ImageWidth)
292 {
293 /* it's large, shrink it */
294 NewZoom = (Rect.right * 100) / ImageWidth;
295 }
296 else
297 {
298 /* it's small. show as original size */
299 NewZoom = 100;
300 }
301 }
302 else
303 {
304 if (Rect.bottom < ImageHeight)
305 {
306 /* it's large, shrink it */
307 NewZoom = (Rect.bottom * 100) / ImageHeight;
308 }
309 else
310 {
311 /* it's small. show as original size */
312 NewZoom = 100;
313 }
314 }
315
317}
318
319static VOID
321{
322 WCHAR szText[MAX_PATH + 100];
323 LPWSTR pchFileTitle;
324
325 LoadStringW(g_hInstance, IDS_APPTITLE, szText, _countof(szText));
326
327 pchFileTitle = PathFindFileNameW(FileName);
328 if (pchFileTitle && *pchFileTitle)
329 {
330 StringCchCatW(szText, _countof(szText), L" - ");
331 StringCchCatW(szText, _countof(szText), pchFileTitle);
332 }
333
334 SetWindowTextW(pData->m_hwnd, szText);
335}
336
337static VOID
339{
340 Anime_FreeInfo(&pData->m_Anime);
341
342 if (g_pImage)
343 {
345 g_pImage = NULL;
346 }
347
348 if (pData->m_pMemStream)
349 {
350 pData->m_pMemStream->lpVtbl->Release(pData->m_pMemStream);
351 pData->m_pMemStream = NULL;
352 }
353
354 pData->m_szFile[0] = UNICODE_NULL;
355}
356
358{
360 DWORD dwFileSize, dwRead;
361 LPBYTE pbMemFile = NULL;
362 IStream *pStream;
363
365 OPEN_EXISTING, 0, NULL);
367 return NULL;
368
370 pbMemFile = QuickAlloc(dwFileSize, FALSE);
371 if (!dwFileSize || (dwFileSize == INVALID_FILE_SIZE) || !pbMemFile)
372 {
374 return NULL;
375 }
376
377 if (!ReadFile(hFile, pbMemFile, dwFileSize, &dwRead, NULL) || (dwRead != dwFileSize))
378 {
379 QuickFree(pbMemFile);
381 return NULL;
382 }
383
385 pStream = SHCreateMemStream(pbMemFile, dwFileSize);
386 QuickFree(pbMemFile);
387 return pStream;
388}
389
390static VOID
392{
394
395 pData->m_pMemStream = MemStreamFromFile(szOpenFileName);
396 if (!pData->m_pMemStream)
397 {
398 DPRINT1("MemStreamFromFile() failed\n");
400 return;
401 }
402
403 /* NOTE: GdipLoadImageFromFile locks the file.
404 Avoid file locking by using GdipLoadImageFromStream and memory stream. */
405 GdipLoadImageFromStream(pData->m_pMemStream, &g_pImage);
406 if (!g_pImage)
407 {
408 DPRINT1("GdipLoadImageFromStream() failed\n");
411 return;
412 }
413
414 Anime_LoadInfo(&pData->m_Anime);
415
416 SHAddToRecentDocs(SHARD_PATHW, szOpenFileName);
417 GetFullPathNameW(szOpenFileName, _countof(pData->m_szFile), pData->m_szFile, NULL);
418
419 /* Reset zoom and redraw display */
421
422 Preview_UpdateTitle(pData, szOpenFileName);
423}
424
425static VOID
427{
428 Preview_pLoadImage(pData, (pNode ? pNode->FileName : NULL));
429}
430
431static BOOL
433{
434 ImageCodecInfo *codecInfo;
435 GUID rawFormat;
436 UINT j, num, nFilterIndex, size;
437 BOOL ret = FALSE;
438
439 if (g_pImage == NULL)
440 return FALSE;
441
443 codecInfo = QuickAlloc(size, FALSE);
444 if (!codecInfo)
445 {
446 DPRINT1("QuickAlloc() failed in pSaveImage()\n");
447 return FALSE;
448 }
449 GdipGetImageEncoders(num, size, codecInfo);
450
451 GdipGetImageRawFormat(g_pImage, &rawFormat);
452 if (IsEqualGUID(&rawFormat, &ImageFormatMemoryBMP))
453 rawFormat = ImageFormatBMP;
454
455 nFilterIndex = 0;
456 for (j = 0; j < num; ++j)
457 {
458 if (IsEqualGUID(&rawFormat, &codecInfo[j].FormatID))
459 {
460 nFilterIndex = j + 1;
461 break;
462 }
463 }
464
465 Anime_Pause(&pData->m_Anime);
466
467 ret = (nFilterIndex > 0) &&
468 (GdipSaveImageToFile(g_pImage, pszFile, &codecInfo[nFilterIndex - 1].Clsid, NULL) == Ok);
469 if (!ret)
470 DPRINT1("GdipSaveImageToFile() failed\n");
471
472 Anime_Start(&pData->m_Anime, 0);
473
474 QuickFree(codecInfo);
475 return ret;
476}
477
478static VOID
480{
482 ImageCodecInfo *codecInfo;
483 WCHAR szSaveFileName[MAX_PATH];
484 WCHAR *szFilterMask;
485 GUID rawFormat;
486 UINT num, size, j;
487 size_t sizeRemain;
488 WCHAR *c;
489 HWND hwnd = pData->m_hwnd;
490
491 if (g_pImage == NULL)
492 return;
493
495 codecInfo = QuickAlloc(size, FALSE);
496 if (!codecInfo)
497 {
498 DPRINT1("QuickAlloc() failed in pSaveImageAs()\n");
499 return;
500 }
501
502 GdipGetImageEncoders(num, size, codecInfo);
503
504 GdipGetImageRawFormat(g_pImage, &rawFormat);
505 if (IsEqualGUID(&rawFormat, &ImageFormatMemoryBMP))
506 rawFormat = ImageFormatBMP;
507
508 sizeRemain = 0;
509 for (j = 0; j < num; ++j)
510 {
511 // Every pair needs space for the Description, twice the Extensions, 1 char for the space, 2 for the braces and 2 for the NULL terminators.
512 sizeRemain = sizeRemain + (((wcslen(codecInfo[j].FormatDescription) + (wcslen(codecInfo[j].FilenameExtension) * 2) + 5) * sizeof(WCHAR)));
513 }
514
515 /* Add two more chars for the last terminator */
516 sizeRemain += (sizeof(WCHAR) * 2);
517
518 szFilterMask = QuickAlloc(sizeRemain, FALSE);
519 if (!szFilterMask)
520 {
521 DPRINT1("cannot allocate memory for filter mask in pSaveImageAs()");
522 QuickFree(codecInfo);
523 return;
524 }
525
526 ZeroMemory(szSaveFileName, sizeof(szSaveFileName));
527 ZeroMemory(szFilterMask, sizeRemain);
528 ZeroMemory(&sfn, sizeof(sfn));
529 sfn.lStructSize = sizeof(sfn);
531 sfn.lpstrFile = szSaveFileName;
532 sfn.lpstrFilter = szFilterMask;
533 sfn.nMaxFile = _countof(szSaveFileName);
535 sfn.lpstrDefExt = L"png";
536
537 c = szFilterMask;
538
539 for (j = 0; j < num; ++j)
540 {
541 StringCbPrintfExW(c, sizeRemain, &c, &sizeRemain, 0, L"%ls (%ls)", codecInfo[j].FormatDescription, codecInfo[j].FilenameExtension);
542
543 /* Skip the NULL character */
544 c++;
545 sizeRemain -= sizeof(*c);
546
547 StringCbPrintfExW(c, sizeRemain, &c, &sizeRemain, 0, L"%ls", codecInfo[j].FilenameExtension);
548
549 /* Skip the NULL character */
550 c++;
551 sizeRemain -= sizeof(*c);
552
553 if (IsEqualGUID(&rawFormat, &codecInfo[j].FormatID))
554 {
555 sfn.nFilterIndex = j + 1;
556 }
557 }
558
560 {
561 Anime_Pause(&pData->m_Anime);
562
563 if (GdipSaveImageToFile(g_pImage, szSaveFileName, &codecInfo[sfn.nFilterIndex - 1].Clsid, NULL) != Ok)
564 {
565 DPRINT1("GdipSaveImageToFile() failed\n");
566 }
567
568 Anime_Start(&pData->m_Anime, 0);
569 }
570
571 QuickFree(szFilterMask);
572 QuickFree(codecInfo);
573}
574
575static VOID
577{
578 /* FIXME */
579}
580
581static VOID
583{
584 BOOL bEnable = (g_pImage != NULL);
587}
588
589static VOID
591{
592 if (!Preview_IsMainWnd(pData->m_hwnd))
594
595 ZoomWnd_UpdateScroll(pData, pData->m_hwndZoom, TRUE);
596}
597
598static SHIMGVW_FILENODE*
600{
601 HANDLE hFindHandle;
602 WCHAR *extension;
603 WCHAR szSearchPath[MAX_PATH];
604 WCHAR szSearchMask[MAX_PATH];
605 WCHAR szFileTypes[MAX_PATH];
606 WIN32_FIND_DATAW findData;
607 SHIMGVW_FILENODE *currentNode = NULL;
609 SHIMGVW_FILENODE *conductor = NULL;
610 ImageCodecInfo *codecInfo;
611 UINT num;
612 UINT size;
613 UINT j;
614
615 StringCbCopyW(szSearchPath, sizeof(szSearchPath), szFirstFile);
616 PathRemoveFileSpecW(szSearchPath);
617
619 codecInfo = QuickAlloc(size, FALSE);
620 if (!codecInfo)
621 {
622 DPRINT1("QuickAlloc() failed in pLoadFileList()\n");
623 return NULL;
624 }
625
626 GdipGetImageDecoders(num, size, codecInfo);
627
629 if (!root)
630 {
631 DPRINT1("QuickAlloc() failed in pLoadFileList()\n");
632 QuickFree(codecInfo);
633 return NULL;
634 }
635
636 conductor = root;
637
638 for (j = 0; j < num; ++j)
639 {
640 StringCbCopyW(szFileTypes, sizeof(szFileTypes), codecInfo[j].FilenameExtension);
641
642 extension = wcstok(szFileTypes, L";");
643 while (extension != NULL)
644 {
645 PathCombineW(szSearchMask, szSearchPath, extension);
646
647 hFindHandle = FindFirstFileW(szSearchMask, &findData);
648 if (hFindHandle != INVALID_HANDLE_VALUE)
649 {
650 do
651 {
652 PathCombineW(conductor->FileName, szSearchPath, findData.cFileName);
653
654 // compare the name of the requested file with the one currently found.
655 // if the name matches, the current node is returned by the function.
656 if (_wcsicmp(szFirstFile, conductor->FileName) == 0)
657 {
658 currentNode = conductor;
659 }
660
661 conductor->Next = QuickAlloc(sizeof(SHIMGVW_FILENODE), FALSE);
662
663 // if QuickAlloc fails, make circular what we have and return it
664 if (!conductor->Next)
665 {
666 DPRINT1("QuickAlloc() failed in pLoadFileList()\n");
667
668 conductor->Next = root;
669 root->Prev = conductor;
670
671 FindClose(hFindHandle);
672 QuickFree(codecInfo);
673 return conductor;
674 }
675
676 conductor->Next->Prev = conductor;
677 conductor = conductor->Next;
678 }
679 while (FindNextFileW(hFindHandle, &findData) != 0);
680
681 FindClose(hFindHandle);
682 }
683
684 extension = wcstok(NULL, L";");
685 }
686 }
687
688 // we now have a node too much in the list. In case the requested file was not found,
689 // we use this node to store the name of it, otherwise we free it.
690 if (currentNode == NULL)
691 {
692 StringCchCopyW(conductor->FileName, MAX_PATH, szFirstFile);
693 currentNode = conductor;
694 }
695 else
696 {
697 conductor = conductor->Prev;
698 QuickFree(conductor->Next);
699 }
700
701 // link the last node with the first one to make the list circular
702 conductor->Next = root;
703 root->Prev = conductor;
704 conductor = currentNode;
705
706 QuickFree(codecInfo);
707
708 return conductor;
709}
710
711static VOID
713{
714 SHIMGVW_FILENODE *conductor;
715
716 if (!root)
717 return;
718
719 root->Prev->Next = NULL;
720 root->Prev = NULL;
721
722 while (root)
723 {
724 conductor = root;
725 root = conductor->Next;
726 QuickFree(conductor);
727 }
728}
729
731{
732 static const CHAR pattern[] =
733 "\x28\x00\x00\x00\x10\x00\x00\x00\x10\x00\x00\x00\x01\x00\x04\x00\x00\x00"
734 "\x00\x00\x80\x00\x00\x00\x23\x2E\x00\x00\x23\x2E\x00\x00\x10\x00\x00\x00"
735 "\x00\x00\x00\x00\x99\x99\x99\x00\xCC\xCC\xCC\x00\x00\x00\x00\x00\x00\x00"
736 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
737 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
738 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11\x11\x11"
739 "\x00\x00\x00\x00\x11\x11\x11\x11\x00\x00\x00\x00\x11\x11\x11\x11\x00\x00"
740 "\x00\x00\x11\x11\x11\x11\x00\x00\x00\x00\x11\x11\x11\x11\x00\x00\x00\x00"
741 "\x11\x11\x11\x11\x00\x00\x00\x00\x11\x11\x11\x11\x00\x00\x00\x00\x11\x11"
742 "\x11\x11\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11\x11\x11\x00\x00\x00\x00"
743 "\x11\x11\x11\x11\x00\x00\x00\x00\x11\x11\x11\x11\x00\x00\x00\x00\x11\x11"
744 "\x11\x11\x00\x00\x00\x00\x11\x11\x11\x11\x00\x00\x00\x00\x11\x11\x11\x11"
745 "\x00\x00\x00\x00\x11\x11\x11\x11\x00\x00\x00\x00\x11\x11\x11\x11";
746
748}
749
750static VOID
753 HDC hdc,
754 LPRECT prcPaint,
755 LPRECT prcClient)
756{
757 GpGraphics *graphics;
758 INT ZoomedWidth, ZoomedHeight;
759 RECT rect, rcClient = *prcClient;
760 HDC hdcMem;
761 HBRUSH hBrush;
762 HPEN hPen;
763 HGDIOBJ hbrOld, hbmOld, hPenOld;
764 UINT uFlags;
765 HBITMAP hbmMem;
766 SIZE paintSize = { prcPaint->right - prcPaint->left, prcPaint->bottom - prcPaint->top };
767 COLORREF color0, color1;
768 GpImageAttributes *imageAttributes;
769
770 /* We use a memory bitmap to reduce flickering */
772 hbmMem = CreateCompatibleBitmap(hdc, paintSize.cx, paintSize.cy);
773 hbmOld = SelectObject(hdcMem, hbmMem);
774
775 /* Choose colors */
776 if (Preview_IsMainWnd(pData->m_hwnd))
777 {
778 color0 = GetSysColor(COLOR_WINDOW);
780 }
781 else
782 {
783 color0 = RGB(0, 0, 0);
784 color1 = RGB(255, 255, 255);
785 }
786
787 hBrush = CreateSolidBrush(color0);
788 SetBkColor(hdcMem, color0);
789
790 hPen = CreatePen(PS_SOLID, 1, color1);
791 SetTextColor(hdcMem, color1);
792
793 /* Fill background */
794 SetRect(&rect, 0, 0, paintSize.cx, paintSize.cy);
795 FillRect(hdcMem, &rect, hBrush);
796
797 DeleteObject(hBrush);
798
799 if (g_pImage == NULL)
800 {
801 WCHAR szText[128];
803
805 OffsetRect(&rcClient, -prcPaint->left, -prcPaint->top);
806 DrawTextW(hdcMem, szText, -1, &rcClient, DT_SINGLELINE | DT_CENTER | DT_VCENTER |
808 }
809 else
810 {
811 UINT ImageWidth, ImageHeight;
812
813 GdipGetImageWidth(g_pImage, &ImageWidth);
814 GdipGetImageHeight(g_pImage, &ImageHeight);
815
816 ZoomedWidth = (ImageWidth * pData->m_nZoomPercents) / 100;
817 ZoomedHeight = (ImageHeight * pData->m_nZoomPercents) / 100;
818
819 GdipCreateFromHDC(hdcMem, &graphics);
820 if (!graphics)
821 {
822 DPRINT1("error: GdipCreateFromHDC\n");
823 return;
824 }
825
827
828 if (pData->m_nZoomPercents % 100 == 0)
829 {
832 }
833 else
834 {
837 }
838
839 rect.left = (rcClient.right - ZoomedWidth ) / 2;
840 rect.top = (rcClient.bottom - ZoomedHeight) / 2;
841 rect.right = rect.left + ZoomedWidth;
842 rect.bottom = rect.top + ZoomedHeight;
844 -prcPaint->left - pData->m_xScrollOffset,
845 -prcPaint->top - pData->m_yScrollOffset);
846
847 InflateRect(&rect, +1, +1); /* Add Rectangle() pen width */
848
849 /* Draw a rectangle. Fill by checker board if necessary */
852 else
854 hPenOld = SelectObject(hdcMem, hPen);
855 Rectangle(hdcMem, rect.left, rect.top, rect.right, rect.bottom);
858
859 InflateRect(&rect, -1, -1); /* Subtract Rectangle() pen width */
860
861 /* Image attributes are required to draw image correctly */
862 GdipCreateImageAttributes(&imageAttributes);
864 GetBkColor(hdcMem) | 0xFF000000, TRUE);
865
866 /* Draw image. -0.5f is used for interpolation */
868 rect.left, rect.top,
869 rect.right - rect.left, rect.bottom - rect.top,
870 -0.5f, -0.5f, ImageWidth, ImageHeight,
871 UnitPixel, imageAttributes, NULL, NULL);
872
873 GdipDisposeImageAttributes(imageAttributes);
874 GdipDeleteGraphics(graphics);
875 }
876
877 BitBlt(hdc, prcPaint->left, prcPaint->top, paintSize.cx, paintSize.cy, hdcMem, 0, 0, SRCCOPY);
880}
881
882static VOID
884{
885 PAINTSTRUCT ps;
886 HDC hDC;
887 RECT rcClient;
888
889 hDC = BeginPaint(hwnd, &ps);
890 if (hDC)
891 {
892 GetClientRect(hwnd, &rcClient);
893 ZoomWnd_OnDraw(pData, hDC, &ps.rcPaint, &rcClient);
894 EndPaint(hwnd, &ps);
895 }
896}
897
898static VOID
900{
904 g_Settings.Width = 520;
905 g_Settings.Height = 400;
906}
907
908static BOOL
910{
911 HKEY hKey;
913 LSTATUS nError;
914
915 nError = RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\ReactOS\\shimgvw", 0, KEY_READ, &hKey);
916 if (nError != ERROR_SUCCESS)
917 return FALSE;
918
919 dwSize = sizeof(g_Settings);
920 nError = RegQueryValueExW(hKey, L"Settings", NULL, NULL, (LPBYTE)&g_Settings, &dwSize);
922
923 return ((nError == ERROR_SUCCESS) && (dwSize == sizeof(g_Settings)));
924}
925
926static VOID
928{
929 HKEY hKey;
930 LSTATUS nError;
931
932 nError = RegCreateKeyExW(HKEY_CURRENT_USER, L"Software\\ReactOS\\shimgvw",
933 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL);
934 if (nError != ERROR_SUCCESS)
935 return;
936
937 RegSetValueExW(hKey, L"Settings", 0, REG_BINARY, (LPBYTE)&g_Settings, sizeof(g_Settings));
939}
940
941static BOOL
943{
944 HWND hwndToolBar;
945 HIMAGELIST hImageList, hOldImageList;
947
948 if (!Preview_IsMainWnd(pData->m_hwnd))
949 return TRUE; /* FIXME */
950
951 style |= CCS_BOTTOM;
952 hwndToolBar = CreateWindowExW(0, TOOLBARCLASSNAMEW, NULL, style,
953 0, 0, 0, 0, pData->m_hwnd, NULL, g_hInstance, NULL);
954 if (!hwndToolBar)
955 return FALSE;
956
957 pData->m_hwndToolBar = hwndToolBar;
958
959 SendMessageW(hwndToolBar, TB_BUTTONSTRUCTSIZE, sizeof(s_Buttons[0]), 0);
961
963 if (hImageList == NULL)
964 return FALSE;
965
966 for (UINT n = 0; n < _countof(s_ButtonConfig); n++)
967 {
969 ImageList_AddMasked(hImageList, hBitmap, RGB(255, 255, 255));
971 }
972
973 hOldImageList = (HIMAGELIST)SendMessageW(hwndToolBar, TB_SETIMAGELIST, 0, (LPARAM)hImageList);
974 ImageList_Destroy(hOldImageList);
975
977
978 return TRUE;
979}
980
981static VOID
983{
985 return;
986
991}
992
993static VOID
995{
997 HWND hParent = GetParent(hwnd);
998 if ((uMsg == WM_LBUTTONDOWN) || (uMsg == WM_RBUTTONDOWN))
999 {
1000 if (!Preview_IsMainWnd(hParent))
1001 Preview_EndSlideShow(hParent);
1002 return;
1003 }
1004
1005 pData->m_nMouseDownMsg = uMsg;
1006 pData->m_ptOrigin.x = GET_X_LPARAM(lParam);
1007 pData->m_ptOrigin.y = GET_Y_LPARAM(lParam);
1010}
1011
1012static VOID
1014{
1017
1018 if (pData->m_nMouseDownMsg == WM_MBUTTONDOWN)
1019 {
1020 INT x = GetScrollPos(hwnd, SB_HORZ) - (pt.x - pData->m_ptOrigin.x);
1021 INT y = GetScrollPos(hwnd, SB_VERT) - (pt.y - pData->m_ptOrigin.y);
1024 pData->m_ptOrigin = pt;
1025 }
1026}
1027
1028static BOOL
1030{
1032 if (pData->m_nMouseDownMsg == WM_MBUTTONDOWN)
1033 {
1035 return TRUE;
1036 }
1037 return FALSE;
1038}
1039
1040static VOID
1042{
1044 pData->m_nMouseDownMsg = 0;
1046}
1047
1048static VOID
1050{
1051 UINT ImageWidth, ImageHeight, ZoomedWidth, ZoomedHeight;
1052 RECT rcClient;
1053 UINT nBar = (bVertical ? SB_VERT : SB_HORZ);
1054 SCROLLINFO si = { sizeof(si), SIF_ALL };
1055 GetScrollInfo(hwnd, nBar, &si);
1056
1057 if (!g_pImage)
1058 return;
1059
1060 if (bVertical)
1061 {
1063 return;
1064 }
1065 else
1066 {
1068 return;
1069 }
1070
1071 switch (LOWORD(wParam))
1072 {
1073 case SB_THUMBTRACK:
1074 case SB_THUMBPOSITION:
1075 si.nPos = (SHORT)HIWORD(wParam);
1076 break;
1077 case SB_LINELEFT:
1078 si.nPos -= 48;
1079 break;
1080 case SB_LINERIGHT:
1081 si.nPos += 48;
1082 break;
1083 case SB_PAGELEFT:
1084 si.nPos -= si.nPage;
1085 break;
1086 case SB_PAGERIGHT:
1087 si.nPos += si.nPage;
1088 break;
1089 }
1090
1091 si.fMask = SIF_POS;
1092 SetScrollInfo(hwnd, nBar, &si, TRUE);
1093 GetScrollInfo(hwnd, nBar, &si);
1094
1095 GetClientRect(hwnd, &rcClient);
1096
1097 if (bVertical)
1098 {
1099 GdipGetImageHeight(g_pImage, &ImageHeight);
1100 ZoomedHeight = (ImageHeight * pData->m_nZoomPercents) / 100;
1101 pData->m_yScrollOffset = si.nPos - (ZoomedHeight - rcClient.bottom) / 2;
1102 }
1103 else
1104 {
1105 GdipGetImageWidth(g_pImage, &ImageWidth);
1106 ZoomedWidth = (ImageWidth * pData->m_nZoomPercents) / 100;
1107 pData->m_xScrollOffset = si.nPos - (ZoomedWidth - rcClient.right) / 2;
1108 }
1109
1111}
1112
1113static VOID
1115{
1117 if (zDelta == 0)
1118 return;
1119
1120 if (GetKeyState(VK_CONTROL) < 0)
1121 {
1122 Preview_ZoomInOrOut(pData, zDelta > 0);
1123 }
1124 else if (GetKeyState(VK_SHIFT) < 0)
1125 {
1126 if (zDelta > 0)
1128 else
1130 }
1131 else
1132 {
1133 if (zDelta > 0)
1135 else
1137 }
1138}
1139
1142{
1144 switch (uMsg)
1145 {
1146 case WM_LBUTTONDOWN:
1147 case WM_MBUTTONDOWN:
1148 case WM_RBUTTONDOWN:
1149 {
1151 break;
1152 }
1153 case WM_MOUSEMOVE:
1154 {
1156 break;
1157 }
1158 case WM_SETCURSOR:
1159 {
1160 if (!ZoomWnd_OnSetCursor(hwnd, uMsg, wParam, lParam))
1161 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
1162 }
1163 case WM_LBUTTONUP:
1164 case WM_MBUTTONUP:
1165 case WM_RBUTTONUP:
1166 {
1168 break;
1169 }
1170 case WM_PAINT:
1171 {
1173 break;
1174 }
1175 case WM_MOUSEWHEEL:
1176 {
1179 break;
1180 }
1181 case WM_HSCROLL:
1182 case WM_VSCROLL:
1184 break;
1185 case WM_TIMER:
1186 {
1187 if (Anime_OnTimer(&pData->m_Anime, wParam))
1189 break;
1190 }
1191 default:
1192 {
1193 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
1194 }
1195 }
1196 return 0;
1197}
1198
1199static BOOL
1201{
1202 DWORD exstyle = 0;
1203 HWND hwndZoom;
1205 pData->m_hwnd = hwnd;
1207
1209
1210 if (g_hMainWnd == NULL)
1211 {
1212 g_hMainWnd = hwnd;
1213 exstyle |= WS_EX_CLIENTEDGE;
1214 }
1215 else if (g_hwndFullscreen == NULL)
1216 {
1218 }
1219 else
1220 {
1221 return FALSE;
1222 }
1223
1224 hwndZoom = CreateWindowExW(exstyle, WC_ZOOM, NULL, WS_CHILD | WS_VISIBLE,
1225 0, 0, 0, 0, hwnd, NULL, g_hInstance, NULL);
1226 if (!hwndZoom)
1227 {
1229 return FALSE;
1230 }
1231
1232 pData->m_hwndZoom = hwndZoom;
1234 Anime_SetTimerWnd(&pData->m_Anime, pData->m_hwndZoom);
1235
1237 {
1239 return FALSE;
1240 }
1241
1242 if (pCS && pCS->lpCreateParams)
1243 {
1245 WCHAR szFile[MAX_PATH];
1246
1247 /* Make sure the path has no quotes on it */
1248 StringCchCopyW(szFile, _countof(szFile), pszFileName);
1249 PathUnquoteSpacesW(szFile);
1250
1255 }
1256
1257 return TRUE;
1258}
1259
1260static VOID
1262{
1263 WINDOWPLACEMENT wp;
1264 RECT *prc;
1265
1267 return;
1268
1269 wp.length = sizeof(WINDOWPLACEMENT);
1271
1272 /* Remember window position and size */
1273 prc = &wp.rcNormalPosition;
1274 g_Settings.X = prc->left;
1275 g_Settings.Y = prc->top;
1279}
1280
1281static VOID
1283{
1284 RECT rc, rcClient;
1286 HWND hToolBar = pData->m_hwndToolBar;
1287 INT cx, cy;
1288
1289 /* We want 32-bit values. Don't use WM_SIZE lParam */
1290 GetClientRect(hwnd, &rcClient);
1291 cx = rcClient.right;
1292 cy = rcClient.bottom;
1293
1294 if (Preview_IsMainWnd(pData->m_hwnd))
1295 {
1297 GetWindowRect(hToolBar, &rc);
1298
1299 MoveWindow(pData->m_hwndZoom, 0, 0, cx, cy - (rc.bottom - rc.top), TRUE);
1300
1301 if (!IsIconic(hwnd)) /* Is it not minimized? */
1303
1305 }
1306 else
1307 {
1308 MoveWindow(pData->m_hwndZoom, 0, 0, cx, cy, TRUE);
1309 }
1310}
1311
1312static VOID
1314{
1315 WCHAR szCurFile[MAX_PATH + 1], szNextFile[MAX_PATH];
1316 HWND hwnd = pData->m_hwnd;
1317 SHFILEOPSTRUCTW FileOp = { hwnd, FO_DELETE };
1318
1319 if (!pData->m_szFile[0])
1320 return;
1321
1322 /* FileOp.pFrom must be double-null-terminated */
1323 GetFullPathNameW(pData->m_szFile, _countof(szCurFile) - 1, szCurFile, NULL);
1324 szCurFile[_countof(szCurFile) - 2] = UNICODE_NULL; /* Avoid buffer overrun */
1325 szCurFile[lstrlenW(szCurFile) + 1] = UNICODE_NULL;
1326
1327 szNextFile[0] = UNICODE_NULL;
1328 if (g_pCurrentFile)
1329 {
1330 GetFullPathNameW(g_pCurrentFile->Next->FileName, _countof(szNextFile), szNextFile, NULL);
1331 szNextFile[_countof(szNextFile) - 1] = UNICODE_NULL; /* Avoid buffer overrun */
1332 }
1333
1334 /* Confirm file deletion and delete if allowed */
1335 FileOp.pFrom = szCurFile;
1336 FileOp.fFlags = FOF_ALLOWUNDO;
1337 if (SHFileOperationW(&FileOp) != 0)
1338 {
1339 DPRINT("Preview_Delete: SHFileOperationW() failed or canceled\n");
1340 return;
1341 }
1342
1343 /* Reload the file list and go next file */
1345 g_pCurrentFile = pBuildFileList(szNextFile);
1347}
1348
1349static VOID
1351{
1354
1355 if (!pData->m_szFile[0])
1356 return;
1357
1358 ZeroMemory(&sei, sizeof(sei));
1359 sei.cbSize = sizeof(sei);
1360 sei.lpVerb = L"edit";
1361 sei.lpFile = pData->m_szFile;
1362 sei.nShow = SW_SHOWNORMAL;
1363 if (!ShellExecuteExW(&sei))
1364 {
1365 DPRINT1("Preview_Edit: ShellExecuteExW() failed with code %ld\n", GetLastError());
1366 }
1367 else
1368 {
1369 // Destroy the window to quit the application
1371 }
1372}
1373
1374static VOID
1376{
1378 {
1380 WCHAR szTitle[256];
1383 0, 0, 0, 0, NULL, NULL, g_hInstance, NULL);
1384 }
1385
1387 {
1391 }
1392 else
1393 {
1397 }
1398}
1399
1400static VOID
1402{
1403 Preview_RestartTimer(pData->m_hwnd);
1404 if (g_pCurrentFile)
1405 {
1406 if (bNext)
1408 else
1413 }
1414}
1415
1416static VOID
1418{
1420
1421 switch (nCommandID)
1422 {
1423 case IDC_PREV_PIC:
1425 break;
1426
1427 case IDC_NEXT_PIC:
1429 break;
1430
1431 case IDC_BEST_FIT:
1433 break;
1434
1435 case IDC_REAL_SIZE:
1437 break;
1438
1439 case IDC_SLIDE_SHOW:
1441 break;
1442
1443 case IDC_ZOOM_IN:
1445 break;
1446
1447 case IDC_ZOOM_OUT:
1449 break;
1450
1451 case IDC_ENDSLIDESHOW:
1453 break;
1454
1455 default:
1456 break;
1457 }
1458
1459 if (!Preview_IsMainWnd(hwnd))
1460 return;
1461
1462 // The following commands are for main window only:
1463 switch (nCommandID)
1464 {
1465 case IDC_SAVEAS:
1467 break;
1468
1469 case IDC_PRINT:
1471 break;
1472
1473 case IDC_ROT_CLOCKW:
1474 if (g_pImage)
1475 {
1478 }
1479 break;
1480
1481 case IDC_ROT_COUNCW:
1482 if (g_pImage)
1483 {
1486 }
1487 break;
1488
1489 case IDC_ROT_CWSAVE:
1490 if (g_pImage)
1491 {
1493 Preview_pSaveImage(pData, pData->m_szFile);
1495 }
1496 break;
1497
1498 case IDC_ROT_CCWSAVE:
1499 if (g_pImage)
1500 {
1502 Preview_pSaveImage(pData, pData->m_szFile);
1504 }
1505 break;
1506
1507 case IDC_DELETE:
1511 break;
1512
1513 case IDC_MODIFY:
1515 break;
1516
1517 default:
1518 break;
1519 }
1520}
1521
1522static LRESULT
1524{
1525 switch (pnmhdr->code)
1526 {
1527 case TTN_GETDISPINFOW:
1528 {
1529 LPTOOLTIPTEXTW lpttt = (LPTOOLTIPTEXTW)pnmhdr;
1530 lpttt->hinst = g_hInstance;
1531 lpttt->lpszText = MAKEINTRESOURCEW(s_ButtonConfig[lpttt->hdr.idFrom - IDC_TOOL_BASE].ids);
1532 break;
1533 }
1534 }
1535 return 0;
1536}
1537
1538static VOID
1540{
1542
1544
1547
1549
1550 SetWindowLongPtrW(pData->m_hwndZoom, GWLP_USERDATA, 0);
1551 DestroyWindow(pData->m_hwndZoom);
1552 pData->m_hwndZoom = NULL;
1553
1554 DestroyWindow(pData->m_hwndToolBar);
1555 pData->m_hwndToolBar = NULL;
1556
1559
1560 PostQuitMessage(0);
1561}
1562
1563static VOID
1565{
1566 WCHAR szFile[MAX_PATH];
1568
1569 DragQueryFileW(hDrop, 0, szFile, _countof(szFile));
1570
1574
1575 DragFinish(hDrop);
1576}
1577
1580{
1581 switch (uMsg)
1582 {
1583 case WM_CREATE:
1584 {
1586 return -1;
1587 break;
1588 }
1589 case WM_COMMAND:
1590 {
1592 break;
1593 }
1594 case WM_NOTIFY:
1595 {
1597 }
1598 case WM_GETMINMAXINFO:
1599 {
1600 MINMAXINFO *pMMI = (MINMAXINFO*)lParam;
1601 pMMI->ptMinTrackSize.x = 350;
1602 pMMI->ptMinTrackSize.y = 290;
1603 break;
1604 }
1605 case WM_MOVE:
1606 {
1608 break;
1609 }
1610 case WM_SIZE:
1611 {
1613 break;
1614 }
1615 case WM_DROPFILES:
1616 {
1618 break;
1619 }
1620 case WM_SYSCOLORCHANGE:
1621 {
1623 InvalidateRect(pData->m_hwnd, NULL, TRUE);
1624 InvalidateRect(pData->m_hwndZoom, NULL, TRUE);
1625 break;
1626 }
1627 case WM_DESTROY:
1628 {
1630 break;
1631 }
1632 case WM_TIMER:
1633 {
1635 {
1638 }
1639 break;
1640 }
1641 default:
1642 {
1643 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
1644 }
1645 }
1646
1647 return 0;
1648}
1649
1650LONG
1652{
1653 struct GdiplusStartupInput gdiplusStartupInput;
1654 ULONG_PTR gdiplusToken;
1656 WCHAR szTitle[256];
1657 HWND hMainWnd;
1658 MSG msg;
1659 HACCEL hAccel;
1660 HRESULT hrCoInit;
1661 INITCOMMONCONTROLSEX Icc = { .dwSize = sizeof(Icc), .dwICC = ICC_WIN95_CLASSES };
1662
1664
1665 /* Initialize COM */
1667 if (FAILED(hrCoInit))
1668 DPRINT1("Warning, CoInitializeEx failed with code=%08X\n", (int)hrCoInit);
1669
1672
1673 /* Initialize GDI+ */
1674 ZeroMemory(&gdiplusStartupInput, sizeof(gdiplusStartupInput));
1675 gdiplusStartupInput.GdiplusVersion = 1;
1676 GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
1677
1678 /* Register window classes */
1679 ZeroMemory(&WndClass, sizeof(WndClass));
1680 WndClass.lpszClassName = WC_PREVIEW;
1681 WndClass.lpfnWndProc = PreviewWndProc;
1682 WndClass.hInstance = g_hInstance;
1683 WndClass.style = CS_HREDRAW | CS_VREDRAW;
1686 WndClass.hbrBackground = (HBRUSH)UlongToHandle(COLOR_3DFACE + 1);
1687 if (!RegisterClassW(&WndClass))
1688 return -1;
1689 WndClass.lpszClassName = WC_ZOOM;
1690 WndClass.lpfnWndProc = ZoomWndProc;
1692 WndClass.hbrBackground = GetStockBrush(NULL_BRUSH); /* less flicker */
1693 if (!RegisterClassW(&WndClass))
1694 return -1;
1695
1696 /* Create the main window */
1701 NULL, NULL, g_hInstance, (LPVOID)szFileName);
1702
1703 /* Create accelerator table for keystrokes */
1705
1706 /* Show the main window now */
1709 else
1711
1713
1714 /* Message Loop */
1715 while (GetMessageW(&msg, NULL, 0, 0) > 0)
1716 {
1718 continue;
1720 continue;
1721
1724 }
1725
1726 /* Destroy accelerator table */
1728
1730
1731 GdiplusShutdown(gdiplusToken);
1732
1733 /* Release COM resources */
1734 if (SUCCEEDED(hrCoInit))
1736
1737 return 0;
1738}
1739
1742{
1744}
1745
1748{
1750}
1751
1754{
1755 WCHAR szFile[MAX_PATH];
1756
1757 if (MultiByteToWideChar(CP_ACP, 0, path, -1, szFile, _countof(szFile)))
1758 {
1759 ImageView_Main(hwnd, szFile);
1760 }
1761}
1762
1765{
1766 DPRINT("ImageView_PrintTo() not implemented\n");
1767}
1768
1771{
1772 DPRINT("ImageView_PrintToA() not implemented\n");
1773}
1774
1777{
1778 DPRINT("ImageView_PrintToW() not implemented\n");
1779}
1780
1785{
1786 switch (dwReason)
1787 {
1788 case DLL_PROCESS_ATTACH:
1789 g_hInstance = hinstDLL;
1790 break;
1791 }
1792
1793 return TRUE;
1794}
static HDC hDC
Definition: 3dtext.c:33
#define SLIDE_SHOW
Arabic default style
Definition: afstyles.h:94
BOOL Anime_LoadInfo(PANIME pAnime)
Definition: anime.c:89
void Anime_Start(PANIME pAnime, DWORD dwDelay)
Definition: anime.c:35
BOOL Anime_OnTimer(PANIME pAnime, WPARAM wParam)
Definition: anime.c:76
void Anime_SetTimerWnd(PANIME pAnime, HWND hwndTimer)
Definition: anime.c:25
void Anime_FreeInfo(PANIME pAnime)
Definition: anime.c:12
void Anime_Pause(PANIME pAnime)
Definition: anime.c:30
#define msg(x)
Definition: auth_time.c:54
#define IDS_APPTITLE
Definition: resource.h:3
#define IDC_HANDDRAG
Definition: resource.h:25
#define IDC_SAVEAS
Definition: resource.h:17
#define DPRINT1
Definition: precomp.h:8
DWORD dwReason
Definition: misc.cpp:141
#define UlongToHandle(ul)
Definition: basetsd.h:97
#define RegCloseKey(hKey)
Definition: registry.h:49
struct _root root
WCHAR WndClass[]
Definition: capicon.c:23
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:900
#define OFN_OVERWRITEPROMPT
Definition: commdlg.h:116
#define OFN_EXPLORER
Definition: commdlg.h:104
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
#define ERROR_SUCCESS
Definition: deptool.c:10
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static HBITMAP hBitmap
Definition: timezone.c:26
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
UINT uFlags
Definition: api.c:59
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
INT WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
Definition: imagelist.c:563
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
BOOL WINAPI GetSaveFileNameW(LPOPENFILENAMEW ofn)
Definition: filedlg.c:4801
#define CloseHandle
Definition: compat.h:739
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define CP_ACP
Definition: compat.h:109
#define OPEN_EXISTING
Definition: compat.h:775
#define ReadFile(a, b, c, d, e)
Definition: compat.h:742
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define GENERIC_READ
Definition: compat.h:135
#define MAX_PATH
Definition: compat.h:34
#define CreateFileW
Definition: compat.h:741
#define CALLBACK
Definition: compat.h:35
#define MultiByteToWideChar
Definition: compat.h:110
#define FILE_SHARE_READ
Definition: compat.h:136
#define lstrlenW
Definition: compat.h:750
GpStatus WINGDIPAPI GdipDrawImageRectRect(GpGraphics *graphics, GpImage *image, REAL dstx, REAL dsty, REAL dstwidth, REAL dstheight, REAL srcx, REAL srcy, REAL srcwidth, REAL srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes *imageattr, DrawImageAbort callback, VOID *callbackData)
Definition: graphics.c:3498
GpStatus WINGDIPAPI GdipCreateFromHDC(HDC hdc, GpGraphics **graphics)
Definition: graphics.c:2395
GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
Definition: graphics.c:2581
GpStatus WINGDIPAPI GdipSetInterpolationMode(GpGraphics *graphics, InterpolationMode mode)
Definition: graphics.c:6147
GpStatus WINGDIPAPI GdipSetSmoothingMode(GpGraphics *graphics, SmoothingMode mode)
Definition: graphics.c:6293
GpStatus WINGDIPAPI GdipGetImageRawFormat(GpImage *image, GUID *format)
Definition: image.c:2354
GpStatus WINGDIPAPI GdipGetImageEncodersSize(UINT *numEncoders, UINT *size)
Definition: image.c:5045
GpStatus WINGDIPAPI GdipGetImageFlags(GpImage *image, UINT *flags)
Definition: image.c:5314
GpStatus WINGDIPAPI GdipGetImageWidth(GpImage *image, UINT *width)
Definition: image.c:2390
GpStatus WINGDIPAPI GdipGetImageHeight(GpImage *image, UINT *height)
Definition: image.c:2287
GpStatus WINGDIPAPI GdipGetImageDecodersSize(UINT *numDecoders, UINT *size)
Definition: image.c:4994
GpStatus WINGDIPAPI GdipSaveImageToFile(GpImage *image, GDIPCONST WCHAR *filename, GDIPCONST CLSID *clsidEncoder, GDIPCONST EncoderParameters *encoderParams)
Definition: image.c:4476
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
Definition: image.c:2155
GpStatus WINGDIPAPI GdipLoadImageFromStream(IStream *stream, GpImage **image)
Definition: image.c:4405
GpStatus WINGDIPAPI GdipImageRotateFlip(GpImage *image, RotateFlipType type)
Definition: image.c:5406
GpStatus WINGDIPAPI GdipGetImageEncoders(UINT numEncoders, UINT size, ImageCodecInfo *encoders)
Definition: image.c:5069
GpStatus WINGDIPAPI GdipGetImageDecoders(UINT numDecoders, UINT size, ImageCodecInfo *decoders)
Definition: image.c:5018
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:331
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1106
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:2002
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
void WINAPI DragFinish(HDROP h)
Definition: shellole.c:538
UINT WINAPI DragQueryFileW(HDROP hDrop, UINT lFile, LPWSTR lpszwFile, UINT lLength)
Definition: shellole.c:622
void WINAPI DragAcceptFiles(HWND hWnd, BOOL b)
Definition: shellole.c:522
#define IDC_ZOOM_IN
Definition: resource.h:39
#define IDC_SLIDE_SHOW
Definition: resource.h:38
#define IDC_ROT_COUNCW
Definition: resource.h:42
#define IDC_REAL_SIZE
Definition: resource.h:37
#define IDC_MODIFY
Definition: resource.h:48
#define IDC_ENDSLIDESHOW
Definition: resource.h:50
#define IDC_NEXT_PIC
Definition: resource.h:35
#define IDI_APP_ICON
Definition: resource.h:4
#define IDC_ROT_CWSAVE
Definition: resource.h:43
#define IDC_PREV_PIC
Definition: resource.h:34
#define IDC_BEST_FIT
Definition: resource.h:36
#define IDS_NOPREVIEW
Definition: resource.h:72
#define IDR_ACCELERATOR
Definition: resource.h:103
#define IDC_DELETE
Definition: resource.h:45
#define IDC_ZOOM_OUT
Definition: resource.h:40
#define IDC_ROT_CLOCKW
Definition: resource.h:41
#define IDC_TOOL_BASE
Definition: resource.h:32
#define IDC_ROT_CCWSAVE
Definition: resource.h:44
BOOL WINAPI PathRemoveFileSpecW(LPWSTR lpszPath)
Definition: path.c:629
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:394
VOID WINAPI PathUnquoteSpacesW(LPWSTR lpszPath)
Definition: path.c:1034
#define pt(x, y)
Definition: drawing.c:79
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:57
#define RGB(r, g, b)
Definition: precomp.h:71
HINSTANCE hInst
Definition: dxdiag.c:13
OPENFILENAMEW sfn
Definition: eventvwr.c:101
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDC_PRINT
Definition: fontview.h:14
#define MODIFY(p, i, v)
Definition: check.c:44
FxAutoRegKey hKey
pKey DeleteObject()
Status WINAPI GdiplusStartup(ULONG_PTR *token, const struct GdiplusStartupInput *input, struct GdiplusStartupOutput *output)
Definition: gdiplus.c:81
@ SmoothingModeNone
Definition: gdiplusenums.h:126
@ SmoothingModeHighQuality
Definition: gdiplusenums.h:125
@ ImageFlagsHasTranslucent
Definition: gdiplusenums.h:336
@ ImageFlagsHasAlpha
Definition: gdiplusenums.h:335
@ WrapModeTile
Definition: gdiplusenums.h:207
@ UnitPixel
Definition: gdiplusenums.h:29
@ InterpolationModeHighQualityBilinear
Definition: gdiplusenums.h:149
@ InterpolationModeNearestNeighbor
Definition: gdiplusenums.h:148
@ Rotate270FlipNone
@ Rotate90FlipNone
void WINAPI GdiplusShutdown(ULONG_PTR)
@ Ok
Definition: gdiplustypes.h:26
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLsizeiptr size
Definition: glext.h:5919
GLdouble n
Definition: glext.h:7729
const GLubyte * c
Definition: glext.h:8905
GLubyte * pattern
Definition: glext.h:7787
GLuint GLuint num
Definition: glext.h:9618
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
GpStatus WINGDIPAPI GdipCreateImageAttributes(GpImageAttributes **imageattr)
GpStatus WINGDIPAPI GdipDisposeImageAttributes(GpImageAttributes *imageattr)
GpStatus WINGDIPAPI GdipSetImageAttributesWrapMode(GpImageAttributes *imageAttr, WrapMode wrap, ARGB argb, BOOL clamp)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define c
Definition: ke_i.h:80
static IN DWORD IN LPVOID lpvReserved
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
HWND hMainWnd
Definition: magnifier.c:32
HACCEL hAccel
Definition: main.c:47
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
HDC hdc
Definition: main.c:9
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:88
#define min(a, b)
Definition: monoChain.cc:55
DWORD dwFileSize
Definition: more.c:40
HWND hToolBar
Definition: mplay32.c:23
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
_In_ HANDLE hFile
Definition: mswsock.h:90
unsigned int UINT
Definition: ndis.h:50
#define REG_BINARY
Definition: nt_native.h:1496
#define KEY_READ
Definition: nt_native.h:1023
#define DELETE
Definition: nt_native.h:57
#define KEY_WRITE
Definition: nt_native.h:1031
#define UNICODE_NULL
_Out_ LPRECT prc
Definition: ntgdi.h:1658
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:16
#define L(x)
Definition: ntvdm.h:50
@ COINIT_APARTMENTTHREADED
Definition: objbase.h:278
@ COINIT_DISABLE_OLE1DDE
Definition: objbase.h:280
#define PathCombineW
Definition: pathcch.h:317
#define LOWORD(l)
Definition: pedump.c:82
#define WS_CHILD
Definition: pedump.c:617
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define WS_POPUP
Definition: pedump.c:616
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_VISIBLE
Definition: pedump.c:620
short SHORT
Definition: pedump.c:59
#define WS_EX_TOPMOST
Definition: pedump.c:647
long LONG
Definition: pedump.c:60
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_HSCROLL
Definition: pedump.c:628
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
#define TB_ADDBUTTONS
Definition: commctrl.h:1271
#define TB_SETEXTENDEDSTYLE
Definition: commctrl.h:1190
#define TB_AUTOSIZE
Definition: commctrl.h:1137
#define LPTOOLTIPTEXTW
Definition: commctrl.h:1892
#define TTN_GETDISPINFOW
Definition: commctrl.h:1878
#define TBSTYLE_TOOLTIPS
Definition: commctrl.h:989
#define CCS_BOTTOM
Definition: commctrl.h:2249
struct _IMAGELIST * HIMAGELIST
Definition: commctrl.h:324
#define TB_BUTTONSTRUCTSIZE
Definition: commctrl.h:1134
_Out_opt_ int * cx
Definition: commctrl.h:585
#define TB_SETIMAGELIST
Definition: commctrl.h:1150
#define TBSTYLE_EX_HIDECLIPPEDBUTTONS
Definition: commctrl.h:1013
#define TB_ENABLEBUTTON
Definition: commctrl.h:1042
#define TOOLBARCLASSNAMEW
Definition: commctrl.h:943
#define TBSTYLE_FLAT
Definition: commctrl.h:992
#define ILC_MASK
Definition: commctrl.h:351
#define ICC_WIN95_CLASSES
Definition: commctrl.h:66
#define ILC_COLOR24
Definition: commctrl.h:357
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
IStream *WINAPI SHCreateMemStream(const BYTE *lpbData, UINT dwDataLen)
Definition: regstream.c:652
#define WM_NOTIFY
Definition: richedit.h:61
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_CRT_RESTORE_GCC_WARNINGS _Check_return_ _CRTIMP wchar_t *__cdecl wcstok(_Inout_opt_z_ wchar_t *_Str, _In_z_ const wchar_t *_Delim)
#define FOF_ALLOWUNDO
Definition: shellapi.h:148
#define FO_DELETE
Definition: shellapi.h:139
void WINAPI SHAddToRecentDocs(UINT uFlags, LPCVOID pv)
Definition: shellord.c:1010
static VOID ZoomWnd_UpdateScroll(PPREVIEW_DATA pData, HWND hwnd, BOOL bResetPos)
Definition: shimgvw.c:140
static BOOL Preview_OnCreate(HWND hwnd, LPCREATESTRUCT pCS)
Definition: shimgvw.c:1200
static VOID Preview_ResetZoom(PPREVIEW_DATA pData)
Definition: shimgvw.c:274
static VOID Preview_Delete(PPREVIEW_DATA pData)
Definition: shimgvw.c:1313
static BOOL Preview_IsMainWnd(HWND hwnd)
Definition: shimgvw.c:124
VOID WINAPI ImageView_PrintToW(HWND hwnd, HINSTANCE hInst, LPCWSTR path, int nShow)
Definition: shimgvw.c:1776
static VOID Preview_ToggleSlideShow(PPREVIEW_DATA pData)
Definition: shimgvw.c:1375
#define TB_IMAGE_HEIGHT
Definition: shimgvw.c:18
static VOID ZoomWnd_OnMouseWheel(HWND hwnd, INT x, INT y, INT zDelta, UINT fwKeys)
Definition: shimgvw.c:1114
static BOOL ZoomWnd_OnSetCursor(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: shimgvw.c:1029
static VOID Preview_pFreeImage(PPREVIEW_DATA pData)
Definition: shimgvw.c:338
static VOID ZoomWnd_OnDraw(PPREVIEW_DATA pData, HDC hdc, LPRECT prcPaint, LPRECT prcClient)
Definition: shimgvw.c:751
#define SLIDESHOW_TIMER_INTERVAL
Definition: shimgvw.c:22
static VOID Preview_UpdateImage(PPREVIEW_DATA pData)
Definition: shimgvw.c:590
static VOID Preview_UpdateZoom(PPREVIEW_DATA pData, UINT NewZoom, BOOL bEnableBestFit, BOOL bEnableRealSize)
Definition: shimgvw.c:212
LRESULT CALLBACK ZoomWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: shimgvw.c:1141
LONG ImageView_Main(HWND hwnd, LPCWSTR szFileName)
Definition: shimgvw.c:1651
static VOID Preview_RestartTimer(HWND hwnd)
Definition: shimgvw.c:130
static VOID Preview_GoNextPic(PPREVIEW_DATA pData, BOOL bNext)
Definition: shimgvw.c:1401
static VOID Preview_pPrintImage(PPREVIEW_DATA pData)
Definition: shimgvw.c:576
static const TBBUTTON s_Buttons[]
Definition: shimgvw.c:47
struct tagPREVIEW_DATA * PPREVIEW_DATA
static VOID Preview_OnSize(HWND hwnd)
Definition: shimgvw.c:1282
#define MAX_ZOOM
Definition: shimgvw.c:37
#define MIN_ZOOM
Definition: shimgvw.c:36
static PPREVIEW_DATA Preview_GetData(HWND hwnd)
Definition: shimgvw.c:118
struct tagPREVIEW_DATA PREVIEW_DATA
BOOL WINAPI DllMain(IN HINSTANCE hinstDLL, IN DWORD dwReason, IN LPVOID lpvReserved)
Definition: shimgvw.c:1782
HWND g_hMainWnd
Definition: shimgvw.c:25
#define SLIDESHOW_TIMER_ID
Definition: shimgvw.c:21
SHIMGVW_FILENODE * g_pCurrentFile
Definition: shimgvw.c:27
static VOID ZoomWnd_OnMouseMove(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: shimgvw.c:1013
static BOOL Preview_CreateToolBar(PPREVIEW_DATA pData)
Definition: shimgvw.c:942
static VOID ZoomWnd_OnHVScroll(PPREVIEW_DATA pData, HWND hwnd, WPARAM wParam, BOOL bVertical)
Definition: shimgvw.c:1049
static VOID Preview_pLoadImageFromNode(PPREVIEW_DATA pData, SHIMGVW_FILENODE *pNode)
Definition: shimgvw.c:426
static VOID Preview_EndSlideShow(HWND hwnd)
Definition: shimgvw.c:982
#define DEFINE_BTN_SEPARATOR
Definition: shimgvw.c:43
#define TB_IMAGE_WIDTH
Definition: shimgvw.c:17
SHIMGVW_SETTINGS g_Settings
Definition: shimgvw.c:29
static VOID Preview_pLoadImage(PPREVIEW_DATA pData, LPCWSTR szOpenFileName)
Definition: shimgvw.c:391
static VOID Preview_OnMoveSize(HWND hwnd)
Definition: shimgvw.c:1261
LRESULT CALLBACK PreviewWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: shimgvw.c:1579
static SHIMGVW_FILENODE * pBuildFileList(LPCWSTR szFirstFile)
Definition: shimgvw.c:599
static VOID Preview_OnDropFiles(HWND hwnd, HDROP hDrop)
Definition: shimgvw.c:1564
static const TB_BUTTON_CONFIG s_ButtonConfig[]
Definition: shimgvw.c:82
static LRESULT Preview_OnNotify(HWND hwnd, LPNMHDR pnmhdr)
Definition: shimgvw.c:1523
static BOOL ImageView_LoadSettings(VOID)
Definition: shimgvw.c:909
HWND g_hwndFullscreen
Definition: shimgvw.c:26
static VOID ImageView_SaveSettings(VOID)
Definition: shimgvw.c:927
static VOID ImageView_ResetSettings(VOID)
Definition: shimgvw.c:899
#define DEFINE_BTN_CONFIG(_name)
Definition: shimgvw.c:80
static VOID ZoomWnd_OnPaint(PPREVIEW_DATA pData, HWND hwnd)
Definition: shimgvw.c:883
static VOID Preview_ZoomInOrOut(PPREVIEW_DATA pData, BOOL bZoomIn)
Definition: shimgvw.c:240
static VOID Preview_UpdateUI(PPREVIEW_DATA pData)
Definition: shimgvw.c:582
static VOID Preview_pSaveImageAs(PPREVIEW_DATA pData)
Definition: shimgvw.c:479
static const UINT s_ZoomSteps[]
Definition: shimgvw.c:31
HINSTANCE g_hInstance
Definition: shimgvw.c:24
VOID WINAPI ImageView_Fullscreen(HWND hwnd, HINSTANCE hInst, LPCWSTR path, int nShow)
Definition: shimgvw.c:1747
VOID WINAPI ImageView_FullscreenA(HWND hwnd, HINSTANCE hInst, LPCSTR path, int nShow)
Definition: shimgvw.c:1753
static VOID Preview_OnCommand(HWND hwnd, UINT nCommandID)
Definition: shimgvw.c:1417
static VOID Preview_OnDestroy(HWND hwnd)
Definition: shimgvw.c:1539
static BOOL Preview_pSaveImage(PPREVIEW_DATA pData, LPCWSTR pszFile)
Definition: shimgvw.c:432
VOID WINAPI ImageView_PrintToA(HWND hwnd, HINSTANCE hInst, LPCSTR path, int nShow)
Definition: shimgvw.c:1770
VOID WINAPI ImageView_FullscreenW(HWND hwnd, HINSTANCE hInst, LPCWSTR path, int nShow)
Definition: shimgvw.c:1741
static HBRUSH CreateCheckerBoardBrush(VOID)
Definition: shimgvw.c:730
static VOID ZoomWnd_OnButtonUp(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: shimgvw.c:1041
static VOID Preview_UpdateTitle(PPREVIEW_DATA pData, LPCWSTR FileName)
Definition: shimgvw.c:320
#define DEFINE_BTN_INFO(_name)
Definition: shimgvw.c:40
static VOID ZoomWnd_OnButtonDown(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: shimgvw.c:994
IStream * MemStreamFromFile(LPCWSTR pszFileName)
Definition: shimgvw.c:357
VOID WINAPI ImageView_PrintTo(HWND hwnd, HINSTANCE hInst, LPCWSTR path, int nShow)
Definition: shimgvw.c:1764
static VOID pFreeFileList(SHIMGVW_FILENODE *root)
Definition: shimgvw.c:712
GpImage * g_pImage
Definition: shimgvw.c:28
static VOID Preview_Edit(HWND hwnd)
Definition: shimgvw.c:1350
#define WC_PREVIEW
Definition: shimgvw.h:50
#define WC_ZOOM
Definition: shimgvw.h:51
static LPVOID QuickAlloc(SIZE_T cbSize, BOOL bZero)
Definition: shimgvw.h:72
static VOID QuickFree(LPVOID ptr)
Definition: shimgvw.h:77
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2434
int WINAPI SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp)
Definition: shlfileop.cpp:1990
#define SHARD_PATHW
Definition: shlobj.h:1176
#define DPRINT
Definition: sndvol32.h:73
#define _countof(array)
Definition: sndvol32.h:70
& rect
Definition: startmenu.cpp:1413
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:325
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
STRSAFEAPI StringCbPrintfExW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:623
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
BOOL Maximized
Definition: shimgvw.h:36
LPCWSTR pFrom
Definition: shellapi.h:358
FILEOP_FLAGS fFlags
Definition: shellapi.h:360
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
RECT rcNormalPosition
Definition: winuser.h:3298
LPVOID lpCreateParams
Definition: winuser.h:2943
POINT ptMinTrackSize
Definition: winuser.h:3633
UINT code
Definition: winuser.h:3162
HWND hwndOwner
Definition: commdlg.h:361
DWORD Flags
Definition: commdlg.h:373
LPWSTR lpstrFile
Definition: commdlg.h:367
LPCWSTR lpstrDefExt
Definition: commdlg.h:376
DWORD lStructSize
Definition: commdlg.h:360
DWORD nMaxFile
Definition: commdlg.h:368
LPCWSTR lpstrFilter
Definition: commdlg.h:363
DWORD nFilterIndex
Definition: commdlg.h:366
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
INT m_xScrollOffset
Definition: shimgvw.c:109
POINT m_ptOrigin
Definition: shimgvw.c:112
IStream * m_pMemStream
Definition: shimgvw.c:113
HWND m_hwndToolBar
Definition: shimgvw.c:106
INT m_nZoomPercents
Definition: shimgvw.c:107
HWND m_hwndZoom
Definition: shimgvw.c:105
UINT m_nMouseDownMsg
Definition: shimgvw.c:111
WCHAR m_szFile[MAX_PATH]
Definition: shimgvw.c:114
ANIME m_Anime
Definition: shimgvw.c:108
INT m_yScrollOffset
Definition: shimgvw.c:110
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
WCHAR FileName[MAX_PATH]
Definition: shimgvw.h:45
struct tagSHIMGVW_FILENODE * Next
Definition: shimgvw.h:47
struct tagSHIMGVW_FILENODE * Prev
Definition: shimgvw.h:46
#define max(a, b)
Definition: svc.c:63
#define GWLP_USERDATA
Definition: treelist.c:63
#define WM_MOUSEWHEEL
Definition: treelist.c:96
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
unsigned char * LPBYTE
Definition: typedefs.h:53
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
#define HIWORD(l)
Definition: typedefs.h:247
WORD WORD PSZ PSZ pszFileName
Definition: vdmdbg.h:44
int ret
HDC hdcMem
Definition: welcome.c:104
#define ZeroMemory
Definition: winbase.h:1737
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define INVALID_FILE_SIZE
Definition: winbase.h:574
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
_In_ BOOL bEnable
Definition: winddi.h:3426
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
DWORD COLORREF
Definition: windef.h:300
#define WINAPI
Definition: msvc.h:6
#define GetStockBrush(i)
Definition: windowsx.h:307
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:300
#define GET_X_LPARAM(lp)
Definition: windowsx.h:299
#define GetStockFont(i)
Definition: windowsx.h:308
#define DIB_RGB_COLORS
Definition: wingdi.h:367
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
#define DEFAULT_GUI_FONT
Definition: wingdi.h:909
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define SRCCOPY
Definition: wingdi.h:333
COLORREF WINAPI GetBkColor(_In_ HDC)
Definition: dc.c:978
#define NULL_BRUSH
Definition: wingdi.h:901
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
HBRUSH WINAPI CreateDIBPatternBrushPt(_In_ const VOID *pvPackedDIB, _In_ UINT uUsage)
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
BOOL WINAPI DeleteDC(_In_ HDC)
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
#define PS_SOLID
Definition: wingdi.h:586
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define SW_SHOWNORMAL
Definition: winuser.h:773
#define WM_PAINT
Definition: winuser.h:1623
HWND WINAPI SetCapture(_In_ HWND hWnd)
#define CS_VREDRAW
Definition: winuser.h:658
#define SW_SHOWMAXIMIZED
Definition: winuser.h:776
DWORD WINAPI GetSysColor(_In_ int)
#define MAKEWPARAM(l, h)
Definition: winuser.h:4012
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define SW_HIDE
Definition: winuser.h:771
#define DT_NOPREFIX
Definition: winuser.h:537
#define SB_THUMBTRACK
Definition: winuser.h:573
#define GetWindowLongPtrW
Definition: winuser.h:4832
#define SB_LINEUP
Definition: winuser.h:564
#define WM_HSCROLL
Definition: winuser.h:1746
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define COLOR_WINDOW
Definition: winuser.h:921
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890
#define DT_CENTER
Definition: winuser.h:527
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define COLOR_WINDOWTEXT
Definition: winuser.h:924
#define WM_VSCROLL
Definition: winuser.h:1747
BOOL WINAPI GetWindowPlacement(_In_ HWND, _Inout_ WINDOWPLACEMENT *)
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define WM_CREATE
Definition: winuser.h:1611
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define SB_PAGERIGHT
Definition: winuser.h:571
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define WM_SIZE
Definition: winuser.h:1614
#define SB_VERT
Definition: winuser.h:553
#define WM_DROPFILES
Definition: winuser.h:1828
#define DT_SINGLELINE
Definition: winuser.h:540
#define WM_COMMAND
Definition: winuser.h:1743
#define CS_HREDRAW
Definition: winuser.h:653
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define IDC_ARROW
Definition: winuser.h:687
#define VK_CONTROL
Definition: winuser.h:2206
#define WM_RBUTTONUP
Definition: winuser.h:1783
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define WM_MOUSEMOVE
Definition: winuser.h:1778
#define SB_LINERIGHT
Definition: winuser.h:567
#define CS_DBLCLKS
Definition: winuser.h:651
#define WM_LBUTTONDOWN
Definition: winuser.h:1779
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1629
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2157
BOOL WINAPI IsIconic(_In_ HWND)
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define WM_RBUTTONDOWN
Definition: winuser.h:1782
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
BOOL WINAPI IsZoomed(_In_ HWND)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define SB_LINELEFT
Definition: winuser.h:566
#define WM_GETMINMAXINFO
Definition: winuser.h:1643
#define WM_TIMER
Definition: winuser.h:1745
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
BOOL WINAPI UpdateWindow(_In_ HWND)
#define SIF_ALL
Definition: winuser.h:1235
#define SB_BOTH
Definition: winuser.h:555
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
#define SB_LINEDOWN
Definition: winuser.h:565
#define WM_LBUTTONUP
Definition: winuser.h:1780
#define DT_VCENTER
Definition: winuser.h:543
#define CW_USEDEFAULT
Definition: winuser.h:225
HWND WINAPI GetParent(_In_ HWND)
HACCEL WINAPI LoadAcceleratorsW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
#define WM_MOVE
Definition: winuser.h:1613
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
#define SIF_POS
Definition: winuser.h:1237
int WINAPI TranslateAcceleratorW(_In_ HWND, _In_ HACCEL, _In_ LPMSG)
#define WM_SETCURSOR
Definition: winuser.h:1639
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define VK_SHIFT
Definition: winuser.h:2205
int WINAPI SetScrollInfo(_In_ HWND, _In_ int, _In_ LPCSCROLLINFO, _In_ BOOL)
#define WM_DESTROY
Definition: winuser.h:1612
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
BOOL WINAPI ShowScrollBar(_In_ HWND, _In_ int, _In_ BOOL)
int WINAPI GetScrollPos(_In_ HWND, _In_ int)
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
HBITMAP WINAPI LoadBitmapW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2215
BOOL WINAPI DestroyAcceleratorTable(_In_ HACCEL)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define SetWindowLongPtrW
Definition: winuser.h:5358
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define WM_MBUTTONUP
Definition: winuser.h:1786
struct _WINDOWPLACEMENT WINDOWPLACEMENT
#define GWL_STYLE
Definition: winuser.h:855
BOOL WINAPI GetScrollInfo(_In_ HWND, _In_ int, _Inout_ LPSCROLLINFO)
BOOL WINAPI IsWindowVisible(_In_ HWND)
BOOL WINAPI DestroyWindow(_In_ HWND)
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2127
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
#define WM_MBUTTONDOWN
Definition: winuser.h:1785
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SB_HORZ
Definition: winuser.h:552
SHORT WINAPI GetKeyState(_In_ int)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
#define SB_PAGELEFT
Definition: winuser.h:570
#define COLOR_3DFACE
Definition: winuser.h:932
#define SB_THUMBPOSITION
Definition: winuser.h:572
const char * LPCSTR
Definition: xmlstorage.h:183
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
char CHAR
Definition: xmlstorage.h:175