ReactOS  0.4.14-dev-815-ge410a12
shimgvw.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Picture and Fax Viewer
3  * FILE: dll/win32/shimgvw/shimgvw.c
4  * PURPOSE: shimgvw.dll
5  * PROGRAMMERS: Dmitry Chapyshev (dmitry@reactos.org)
6  * Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
7  */
8 
9 #define WIN32_NO_STATUS
10 #define _INC_WINDOWS
11 #define COM_NO_WINDOWS_H
12 #define INITGUID
13 
14 #include <stdarg.h>
15 
16 #include <windef.h>
17 #include <winbase.h>
18 #include <winnls.h>
19 #include <winreg.h>
20 #include <wingdi.h>
21 #include <windowsx.h>
22 #include <objbase.h>
23 #include <commctrl.h>
24 #include <commdlg.h>
25 #include <gdiplus.h>
26 #include <tchar.h>
27 #include <strsafe.h>
28 #include <shlwapi.h>
29 
30 #define NDEBUG
31 #include <debug.h>
32 
33 #include "shimgvw.h"
34 
40 
42 
43 /* zooming */
44 #define MIN_ZOOM 10
45 #define MAX_ZOOM 1600
47 static const UINT ZoomSteps[] =
48 {
49  10, 25, 50, 100, 200, 400, 800, 1600
50 };
51 
52 /* animation */
58 
59 #define ANIME_TIMER_ID 9999
60 
61 static void Anime_FreeInfo(void)
62 {
63  if (m_pDelayItem)
64  {
67  }
68  m_nFrameIndex = 0;
69  m_nFrameCount = 0;
70  m_nLoopIndex = 0;
71  m_nLoopCount = (UINT)-1;
72 }
73 
74 static BOOL Anime_LoadInfo(void)
75 {
76  GUID *dims;
77  UINT nDimCount = 0;
78  UINT cbItem;
79  UINT result;
80  PropertyItem *pItem;
81 
84 
85  if (!image)
86  return FALSE;
87 
89  if (nDimCount)
90  {
91  dims = (GUID *)calloc(nDimCount, sizeof(GUID));
92  if (dims)
93  {
94  GdipImageGetFrameDimensionsList(image, dims, nDimCount);
97  free(dims);
98  }
99  }
100 
101  result = 0;
103  cbItem = result;
104  if (cbItem)
105  {
106  m_pDelayItem = (PropertyItem *)malloc(cbItem);
108  }
109 
110  result = 0;
112  cbItem = result;
113  if (cbItem)
114  {
115  pItem = (PropertyItem *)malloc(cbItem);
116  if (pItem)
117  {
118  if (GdipGetPropertyItem(image, PropertyTagLoopCount, cbItem, pItem) == Ok)
119  {
120  m_nLoopCount = *(WORD *)pItem->value;
121  }
122  free(pItem);
123  }
124  }
125 
126  if (m_pDelayItem)
127  {
129  }
130 
131  return m_pDelayItem != NULL;
132 }
133 
134 static void Anime_SetFrameIndex(UINT nFrameIndex)
135 {
136  if (nFrameIndex < m_nFrameCount)
137  {
138  GUID guid = FrameDimensionTime;
139  if (Ok != GdipImageSelectActiveFrame(image, &guid, nFrameIndex))
140  {
141  guid = FrameDimensionPage;
142  GdipImageSelectActiveFrame(image, &guid, nFrameIndex);
143  }
144  }
145  m_nFrameIndex = nFrameIndex;
146 }
147 
149 {
150  if (nFrameIndex < m_nFrameCount && m_pDelayItem)
151  {
152  return ((DWORD *)m_pDelayItem->value)[m_nFrameIndex] * 10;
153  }
154  return 0;
155 }
156 
158 {
159  *pdwDelay = INFINITE;
160  if (m_nLoopCount == (UINT)-1)
161  return FALSE;
162 
163  if (m_nFrameIndex + 1 < m_nFrameCount)
164  {
165  *pdwDelay = Anime_GetFrameDelay(m_nFrameIndex);
167  ++m_nFrameIndex;
168  return TRUE;
169  }
170 
171  if (m_nLoopCount == 0 || m_nLoopIndex < m_nLoopCount)
172  {
173  *pdwDelay = Anime_GetFrameDelay(m_nFrameIndex);
175  m_nFrameIndex = 0;
176  ++m_nLoopIndex;
177  return TRUE;
178  }
179 
180  return FALSE;
181 }
182 
183 static void ZoomInOrOut(BOOL bZoomIn)
184 {
185  INT i;
186 
187  if (bZoomIn) /* zoom in */
188  {
189  /* find next step */
190  for (i = 0; i < ARRAYSIZE(ZoomSteps); ++i)
191  {
192  if (ZoomPercents < ZoomSteps[i])
193  break;
194  }
195  if (i == ARRAYSIZE(ZoomSteps))
197  else
199 
200  /* update tool bar buttons */
202  if (ZoomPercents >= MAX_ZOOM)
204  else
206  }
207  else /* zoom out */
208  {
209  /* find previous step */
210  for (i = ARRAYSIZE(ZoomSteps); i > 0; )
211  {
212  --i;
213  if (ZoomSteps[i] < ZoomPercents)
214  break;
215  }
216  if (i < 0)
218  else
220 
221  /* update tool bar buttons */
223  if (ZoomPercents <= MIN_ZOOM)
225  else
227  }
228 
229  /* redraw */
231 }
232 
233 static void ResetZoom(void)
234 {
235  RECT Rect;
236  UINT ImageWidth, ImageHeight;
237 
238  /* get disp window size and image size */
240  GdipGetImageWidth(image, &ImageWidth);
241  GdipGetImageHeight(image, &ImageHeight);
242 
243  /* compare two aspect rates. same as
244  (ImageHeight / ImageWidth < Rect.bottom / Rect.right) in real */
245  if (ImageHeight * Rect.right < Rect.bottom * ImageWidth)
246  {
247  if (Rect.right < ImageWidth)
248  {
249  /* it's large, shrink it */
250  ZoomPercents = (Rect.right * 100) / ImageWidth;
251  }
252  else
253  {
254  /* it's small. show as original size */
255  ZoomPercents = 100;
256  }
257  }
258  else
259  {
260  if (Rect.bottom < ImageHeight)
261  {
262  /* it's large, shrink it */
263  ZoomPercents = (Rect.bottom * 100) / ImageHeight;
264  }
265  else
266  {
267  /* it's small. show as original size */
268  ZoomPercents = 100;
269  }
270  }
271 }
272 
273 /* ToolBar Buttons */
274 static const TBBUTTON Buttons [] =
275 { /* iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString */
278  {15, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0},
281  {15, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0},
284  {15, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0},
287 };
288 
289 static void pLoadImage(LPWSTR szOpenFileName)
290 {
291  /* check file presence */
292  if (GetFileAttributesW(szOpenFileName) == 0xFFFFFFFF)
293  {
294  DPRINT1("File %s not found!\n", szOpenFileName);
295  return;
296  }
297 
298  /* load now */
299  GdipLoadImageFromFile(szOpenFileName, &image);
300  if (!image)
301  {
302  DPRINT1("GdipLoadImageFromFile() failed\n");
303  return;
304  }
305  Anime_LoadInfo();
306 
307  /* reset zoom */
308  ResetZoom();
309 
310  /* redraw */
312 }
313 
314 static void pSaveImageAs(HWND hwnd)
315 {
317  ImageCodecInfo *codecInfo;
318  WCHAR szSaveFileName[MAX_PATH];
319  WCHAR *szFilterMask;
320  GUID rawFormat;
321  UINT num;
322  UINT size;
323  size_t sizeRemain;
324  UINT j;
325  WCHAR *c;
326 
328  codecInfo = malloc(size);
329  if (!codecInfo)
330  {
331  DPRINT1("malloc() failed in pSaveImageAs()\n");
332  return;
333  }
334 
335  GdipGetImageEncoders(num, size, codecInfo);
336  GdipGetImageRawFormat(image, &rawFormat);
337 
338  sizeRemain = 0;
339 
340  for (j = 0; j < num; ++j)
341  {
342  // 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.
343  sizeRemain = sizeRemain + (((wcslen(codecInfo[j].FormatDescription) + (wcslen(codecInfo[j].FilenameExtension) * 2) + 5) * sizeof(WCHAR)));
344  }
345 
346  /* Add two more chars for the last terminator */
347  sizeRemain = sizeRemain + (sizeof(WCHAR) * 2);
348 
349  szFilterMask = malloc(sizeRemain);
350  if (!szFilterMask)
351  {
352  DPRINT1("cannot allocate memory for filter mask in pSaveImageAs()");
353  free(codecInfo);
354  return;
355  }
356 
357  ZeroMemory(szSaveFileName, sizeof(szSaveFileName));
358  ZeroMemory(szFilterMask, sizeRemain);
359  ZeroMemory(&sfn, sizeof(sfn));
360  sfn.lStructSize = sizeof(sfn);
361  sfn.hwndOwner = hwnd;
363  sfn.lpstrFile = szSaveFileName;
364  sfn.lpstrFilter = szFilterMask;
367 
368  c = szFilterMask;
369 
370  for (j = 0; j < num; ++j)
371  {
372  StringCbPrintfExW(c, sizeRemain, &c, &sizeRemain, 0, L"%ls (%ls)", codecInfo[j].FormatDescription, codecInfo[j].FilenameExtension);
373 
374  /* Skip the NULL character */
375  c++;
376  sizeRemain -= sizeof(*c);
377 
378  StringCbPrintfExW(c, sizeRemain, &c, &sizeRemain, 0, L"%ls", codecInfo[j].FilenameExtension);
379 
380  /* Skip the NULL character */
381  c++;
382  sizeRemain -= sizeof(*c);
383 
384  if (IsEqualGUID(&rawFormat, &codecInfo[j].FormatID) != FALSE)
385  {
386  sfn.nFilterIndex = j + 1;
387  }
388  }
389 
390  if (GetSaveFileNameW(&sfn))
391  {
392  if (m_pDelayItem)
393  {
394  /* save animation */
396 
397  DPRINT1("FIXME: save animation\n");
398  if (GdipSaveImageToFile(image, szSaveFileName, &codecInfo[sfn.nFilterIndex - 1].Clsid, NULL) != Ok)
399  {
400  DPRINT1("GdipSaveImageToFile() failed\n");
401  }
402 
404  }
405  else
406  {
407  /* save non-animation */
408  if (GdipSaveImageToFile(image, szSaveFileName, &codecInfo[sfn.nFilterIndex - 1].Clsid, NULL) != Ok)
409  {
410  DPRINT1("GdipSaveImageToFile() failed\n");
411  }
412  }
413  }
414 
415  free(szFilterMask);
416  free(codecInfo);
417 }
418 
419 static VOID
421 {
422  WCHAR szTitleBuf[800];
423  WCHAR szResStr[512];
424  WCHAR *c;
425 
426  if (node)
427  {
428  c = wcsrchr(node->FileName, '\\');
429  if (c)
430  {
431  c++;
432  }
433 
434  LoadStringW(hInstance, IDS_APPTITLE, szResStr, ARRAYSIZE(szResStr));
435  StringCbPrintfW(szTitleBuf, sizeof(szTitleBuf), L"%ls%ls%ls", szResStr, L" - ", c);
436  SetWindowTextW(hwnd, szTitleBuf);
437 
438  if (image)
439  {
441  }
442 
443  pLoadImage(node->FileName);
444  }
445 }
446 
447 static SHIMGVW_FILENODE*
448 pBuildFileList(LPWSTR szFirstFile)
449 {
450  HANDLE hFindHandle;
451  WCHAR *extension;
452  WCHAR szSearchPath[MAX_PATH];
453  WCHAR szSearchMask[MAX_PATH];
454  WCHAR szFileTypes[MAX_PATH];
455  WIN32_FIND_DATAW findData;
456  SHIMGVW_FILENODE *currentNode = NULL;
458  SHIMGVW_FILENODE *conductor = NULL;
459  ImageCodecInfo *codecInfo;
460  UINT num;
461  UINT size;
462  UINT j;
463 
464  StringCbCopyW(szSearchPath, sizeof(szSearchPath), szFirstFile);
465  PathRemoveFileSpecW(szSearchPath);
466 
468  codecInfo = malloc(size);
469  if (!codecInfo)
470  {
471  DPRINT1("malloc() failed in pLoadFileList()\n");
472  return NULL;
473  }
474 
475  GdipGetImageDecoders(num, size, codecInfo);
476 
477  root = malloc(sizeof(SHIMGVW_FILENODE));
478  if (!root)
479  {
480  DPRINT1("malloc() failed in pLoadFileList()\n");
481  free(codecInfo);
482  return NULL;
483  }
484 
485  conductor = root;
486 
487  for (j = 0; j < num; ++j)
488  {
489  StringCbCopyW(szFileTypes, sizeof(szFileTypes), codecInfo[j].FilenameExtension);
490 
491  extension = wcstok(szFileTypes, L";");
492  while (extension != NULL)
493  {
494  PathCombineW(szSearchMask, szSearchPath, extension);
495 
496  hFindHandle = FindFirstFileW(szSearchMask, &findData);
497  if (hFindHandle != INVALID_HANDLE_VALUE)
498  {
499  do
500  {
501  PathCombineW(conductor->FileName, szSearchPath, findData.cFileName);
502 
503  // compare the name of the requested file with the one currently found.
504  // if the name matches, the current node is returned by the function.
505  if (wcscmp(szFirstFile, conductor->FileName) == 0)
506  {
507  currentNode = conductor;
508  }
509 
510  conductor->Next = malloc(sizeof(SHIMGVW_FILENODE));
511 
512  // if malloc fails, make circular what we have and return it
513  if (!conductor->Next)
514  {
515  DPRINT1("malloc() failed in pLoadFileList()\n");
516 
517  conductor->Next = root;
518  root->Prev = conductor;
519 
520  FindClose(hFindHandle);
521  free(codecInfo);
522  return conductor;
523  }
524 
525  conductor->Next->Prev = conductor;
526  conductor = conductor->Next;
527  }
528  while (FindNextFileW(hFindHandle, &findData) != 0);
529 
530  FindClose(hFindHandle);
531  }
532 
533  extension = wcstok(NULL, L";");
534  }
535  }
536 
537  // we now have a node too much in the list. In case the requested file was not found,
538  // we use this node to store the name of it, otherwise we free it.
539  if (currentNode == NULL)
540  {
541  StringCchCopyW(conductor->FileName, MAX_PATH, szFirstFile);
542  currentNode = conductor;
543  }
544  else
545  {
546  conductor = conductor->Prev;
547  free(conductor->Next);
548  }
549 
550  // link the last node with the first one to make the list circular
551  conductor->Next = root;
552  root->Prev = conductor;
553  conductor = currentNode;
554 
555  free(codecInfo);
556 
557  return conductor;
558 }
559 
560 static VOID
562 {
563  SHIMGVW_FILENODE *conductor;
564 
565  root->Prev->Next = NULL;
566  root->Prev = NULL;
567 
568  while (root)
569  {
570  conductor = root;
571  root = conductor->Next;
572  free(conductor);
573  }
574 }
575 
576 static VOID
578 {
581 }
582 
584 {
585  static const CHAR pattern[] =
586  "\x28\x00\x00\x00\x10\x00\x00\x00\x10\x00\x00\x00\x01\x00\x04\x00\x00\x00"
587  "\x00\x00\x80\x00\x00\x00\x23\x2E\x00\x00\x23\x2E\x00\x00\x10\x00\x00\x00"
588  "\x00\x00\x00\x00\x99\x99\x99\x00\xCC\xCC\xCC\x00\x00\x00\x00\x00\x00\x00"
589  "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
590  "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
591  "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11\x11\x11"
592  "\x00\x00\x00\x00\x11\x11\x11\x11\x00\x00\x00\x00\x11\x11\x11\x11\x00\x00"
593  "\x00\x00\x11\x11\x11\x11\x00\x00\x00\x00\x11\x11\x11\x11\x00\x00\x00\x00"
594  "\x11\x11\x11\x11\x00\x00\x00\x00\x11\x11\x11\x11\x00\x00\x00\x00\x11\x11"
595  "\x11\x11\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11\x11\x11\x00\x00\x00\x00"
596  "\x11\x11\x11\x11\x00\x00\x00\x00\x11\x11\x11\x11\x00\x00\x00\x00\x11\x11"
597  "\x11\x11\x00\x00\x00\x00\x11\x11\x11\x11\x00\x00\x00\x00\x11\x11\x11\x11"
598  "\x00\x00\x00\x00\x11\x11\x11\x11\x00\x00\x00\x00\x11\x11\x11\x11";
599 
601 }
602 
603 static VOID
605 {
606  GpGraphics *graphics;
607  UINT ImageWidth, ImageHeight;
608  INT ZoomedWidth, ZoomedHeight, x, y;
609  PAINTSTRUCT ps;
610  RECT rect, margin;
611  HDC hdc;
612  HBRUSH white;
613  HGDIOBJ hbrOld;
614  UINT uFlags;
615 
616  hdc = BeginPaint(hwnd, &ps);
617  if (!hdc)
618  {
619  DPRINT1("BeginPaint() failed\n");
620  return;
621  }
622 
623  GdipCreateFromHDC(hdc, &graphics);
624  if (!graphics)
625  {
626  DPRINT1("GdipCreateFromHDC() failed\n");
627  return;
628  }
629 
630  GdipGetImageWidth(image, &ImageWidth);
631  GdipGetImageHeight(image, &ImageHeight);
632 
633  if (GetClientRect(hwnd, &rect))
634  {
635  ZoomedWidth = (ImageWidth * ZoomPercents) / 100;
636  ZoomedHeight = (ImageHeight * ZoomPercents) / 100;
637 
638  x = (rect.right - ZoomedWidth) / 2;
639  y = (rect.bottom - ZoomedHeight) / 2;
640 
641  white = GetStockObject(WHITE_BRUSH);
642  // Fill top part
643  margin = rect;
644  margin.bottom = y - 1;
645  FillRect(hdc, &margin, white);
646  // Fill bottom part
647  margin.top = y + ZoomedHeight + 1;
648  margin.bottom = rect.bottom;
649  FillRect(hdc, &margin, white);
650  // Fill left part
651  margin.top = y - 1;
652  margin.bottom = y + ZoomedHeight + 1;
653  margin.right = x - 1;
654  FillRect(hdc, &margin, white);
655  // Fill right part
656  margin.left = x + ZoomedWidth + 1;
657  margin.right = rect.right;
658  FillRect(hdc, &margin, white);
659 
660  DPRINT("x = %d, y = %d, ImageWidth = %u, ImageHeight = %u\n");
661  DPRINT("rect.right = %ld, rect.bottom = %ld\n", rect.right, rect.bottom);
662  DPRINT("ZoomPercents = %d, ZoomedWidth = %d, ZoomedHeight = %d\n",
663  ZoomPercents, ZoomedWidth, ZoomedWidth);
664 
665  if (ZoomPercents % 100 == 0)
666  {
669  }
670  else
671  {
674  }
675 
676  uFlags = 0;
678 
680  {
681  HBRUSH hbr = CreateCheckerBoardBrush(hdc);
682  hbrOld = SelectObject(hdc, hbr);
683  Rectangle(hdc, x - 1, y - 1, x + ZoomedWidth + 1, y + ZoomedHeight + 1);
684  SelectObject(hdc, hbrOld);
685  DeleteObject(hbr);
686  }
687  else
688  {
690  Rectangle(hdc, x - 1, y - 1, x + ZoomedWidth + 1, y + ZoomedHeight + 1);
691  SelectObject(hdc, hbrOld);
692  }
693 
694  GdipDrawImageRectI(graphics, image, x, y, ZoomedWidth, ZoomedHeight);
695  }
696  GdipDeleteGraphics(graphics);
697  EndPaint(hwnd, &ps);
698 }
699 
700 static BOOL
702 {
703  HKEY hKey;
704  DWORD dwSize;
705 
706  if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\ReactOS\\shimgvw"), 0, KEY_READ, &hKey) == ERROR_SUCCESS)
707  {
708  dwSize = sizeof(SHIMGVW_SETTINGS);
709  if (RegQueryValueEx(hKey, _T("Settings"), NULL, NULL, (LPBYTE)&shiSettings, &dwSize) == ERROR_SUCCESS)
710  {
711  RegCloseKey(hKey);
712  return TRUE;
713  }
714 
715  RegCloseKey(hKey);
716  }
717 
718  return FALSE;
719 }
720 
721 static VOID
723 {
724  WINDOWPLACEMENT wp;
725  HKEY hKey;
726 
728  wp.length = sizeof(WINDOWPLACEMENT);
729  GetWindowPlacement(hwnd, &wp);
730 
736 
737  if (RegCreateKeyEx(HKEY_CURRENT_USER, _T("Software\\ReactOS\\shimgvw"), 0, NULL,
739  {
740  RegSetValueEx(hKey, _T("Settings"), 0, REG_BINARY, (LPBYTE)&shiSettings, sizeof(SHIMGVW_SETTINGS));
741  RegCloseKey(hKey);
742  }
743 }
744 
745 static BOOL
747 {
748  INT numButtons = sizeof(Buttons) / sizeof(Buttons[0]);
749 
752  0, 0, 0, 0, hwnd,
753  0, hInstance, NULL);
754  if(hToolBar != NULL)
755  {
756  HIMAGELIST hImageList;
757 
760 
762  sizeof(Buttons[0]), 0);
763 
765 
768 
771 
774 
777 
780 
783 
786 
789 
790  if (hImageList == NULL) return FALSE;
791 
793  0, (LPARAM)hImageList));
794 
796  numButtons, (LPARAM)Buttons);
797 
798  return TRUE;
799  }
800 
801  return FALSE;
802 }
803 
805 {
806  DWORD dwDelay;
807 
810 
811  if (Anime_Step(&dwDelay))
812  {
813  SetTimer(hwnd, ANIME_TIMER_ID, dwDelay, NULL);
814  }
815 }
816 
819 {
820  switch (Message)
821  {
822  case WM_PAINT:
823  {
825  return 0L;
826  }
827  case WM_TIMER:
828  {
829  if (wParam == ANIME_TIMER_ID)
830  {
832  return 0;
833  }
834  break;
835  }
836  }
838 }
839 
840 static VOID
842 {
846 
848 
851  0, 0, 0, 0, hwnd, NULL, hInstance, NULL);
852 
855 
857 }
858 
859 static VOID
861 {
862  if (zDelta != 0)
863  {
864  ZoomInOrOut(zDelta > 0);
865  }
866 }
867 
870 {
871  switch (Message)
872  {
873  case WM_CREATE:
874  {
876  return 0L;
877  }
878 
879  case WM_KEYDOWN:
880  switch (LOWORD(wParam))
881  {
882  case VK_LEFT:
884  break;
885 
886  case VK_RIGHT:
888  break;
889  }
890  break;
891 
892  case WM_COMMAND:
893  {
894  switch (wParam)
895  {
896  case IDC_PREV:
897  {
900  }
901 
902  break;
903  case IDC_NEXT:
904  {
907  }
908 
909  break;
910  case IDC_ZOOMP:
911  {
912  ZoomInOrOut(TRUE);
913  }
914  break;
915  case IDC_ZOOMM:
916  {
918  }
919  break;
920  case IDC_SAVE:
922 
923  break;
924  case IDC_PRINT:
925 
926  break;
927  case IDC_ROT1:
928  {
931  }
932 
933  break;
934  case IDC_ROT2:
935  {
938  }
939 
940  break;
941  }
942  }
943  break;
944 
945  case WM_MOUSEWHEEL:
949  break;
950 
951  case WM_NOTIFY:
952  {
953  LPNMHDR pnmhdr = (LPNMHDR)lParam;
954 
955  switch (pnmhdr->code)
956  {
957  case TTN_GETDISPINFO:
958  {
959  LPTOOLTIPTEXT lpttt;
960  UINT idButton;
961 
962  lpttt = (LPTOOLTIPTEXT)lParam;
963  idButton = (UINT)lpttt->hdr.idFrom;
964  lpttt->hinst = hInstance;
965 
966  switch (idButton)
967  {
968  case IDC_PREV:
969  lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_PREV_PIC);
970  break;
971  case IDC_NEXT:
972  lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_NEXT_PIC);
973  break;
974  case IDC_ZOOMP:
975  lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_ZOOM_IN);
976  break;
977  case IDC_ZOOMM:
978  lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_ZOOM_OUT);
979  break;
980  case IDC_SAVE:
981  lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_SAVEAS);
982  break;
983  case IDC_PRINT:
984  lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_PRINT);
985  break;
986  case IDC_ROT1:
987  lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_ROT_COUNCW);
988  break;
989  case IDC_ROT2:
990  lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_ROT_CLOCKW);
991  break;
992  }
993  return TRUE;
994  }
995  }
996  break;
997  }
998  case WM_SIZING:
999  {
1000  LPRECT pRect = (LPRECT)lParam;
1001  if (pRect->right-pRect->left < 350)
1002  pRect->right = pRect->left + 350;
1003 
1004  if (pRect->bottom-pRect->top < 290)
1005  pRect->bottom = pRect->top + 290;
1006  return TRUE;
1007  }
1008  case WM_SIZE:
1009  {
1010  RECT rc;
1012  GetWindowRect(hToolBar, &rc);
1013  MoveWindow(hDispWnd, 1, 1, LOWORD(lParam) - 1, HIWORD(lParam) - (rc.bottom - rc.top) - 1, TRUE);
1014  /* is it maximized or restored? */
1016  {
1017  /* reset zoom */
1018  ResetZoom();
1019  }
1020  return 0L;
1021  }
1022  case WM_DESTROY:
1023  {
1026  PostQuitMessage(0);
1027  break;
1028  }
1029  }
1030 
1031  return DefWindowProc(hwnd, Message, wParam, lParam);
1032 }
1033 
1034 LONG WINAPI
1036 {
1037  struct GdiplusStartupInput gdiplusStartupInput;
1039  WNDCLASS WndClass = {0};
1040  TCHAR szBuf[512];
1041  WCHAR szInitialFile[MAX_PATH];
1042  HWND hMainWnd;
1043  MSG msg;
1044 
1045  if (!ImageView_LoadSettings())
1046  {
1048  shiSettings.Left = 0;
1049  shiSettings.Top = 0;
1050  shiSettings.Right = 520;
1051  shiSettings.Bottom = 400;
1052  }
1053 
1054  // Initialize GDI+
1055  gdiplusStartupInput.GdiplusVersion = 1;
1056  gdiplusStartupInput.DebugEventCallback = NULL;
1057  gdiplusStartupInput.SuppressBackgroundThread = FALSE;
1058  gdiplusStartupInput.SuppressExternalCodecs = FALSE;
1059 
1060  GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
1061  pLoadImage(szFileName);
1062 
1063  // Create the window
1064  WndClass.lpszClassName = _T("shimgvw_window");
1065  WndClass.lpfnWndProc = ImageView_WndProc;
1066  WndClass.hInstance = hInstance;
1067  WndClass.style = CS_HREDRAW | CS_VREDRAW;
1069  WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
1070  WndClass.hbrBackground = NULL; /* less flicker */
1071 
1072  if (!RegisterClass(&WndClass)) return -1;
1073 
1074  LoadString(hInstance, IDS_APPTITLE, szBuf, sizeof(szBuf) / sizeof(TCHAR));
1075  hMainWnd = CreateWindow(_T("shimgvw_window"), szBuf,
1078  0, 0, NULL, NULL, hInstance, NULL);
1079 
1080  // make sure the path has no quotes on it
1081  wcscpy(szInitialFile, szFileName);
1082  PathUnquoteSpacesW(szInitialFile);
1083 
1084  currentFile = pBuildFileList(szInitialFile);
1085  if (currentFile)
1086  {
1088  }
1089 
1090  // Show it
1093 
1094  // Message Loop
1095  while(GetMessage(&msg,NULL,0,0))
1096  {
1099  }
1100 
1102 
1103  if (image)
1105 
1106  Anime_FreeInfo();
1107 
1109  return -1;
1110 }
1111 
1112 VOID WINAPI
1114 {
1116 }
1117 
1118 VOID WINAPI
1120 {
1122 }
1123 
1124 VOID WINAPI
1126 {
1127  WCHAR szFile[MAX_PATH];
1128 
1129  if (MultiByteToWideChar(CP_ACP, 0, (char*)path, strlen((char*)path)+1, szFile, MAX_PATH))
1130  {
1132  }
1133 }
1134 
1135 VOID WINAPI
1137 {
1138  DPRINT("ImageView_PrintTo() not implemented\n");
1139 }
1140 
1141 VOID WINAPI
1143 {
1144  DPRINT("ImageView_PrintToA() not implemented\n");
1145 }
1146 
1147 VOID WINAPI
1149 {
1150  DPRINT("ImageView_PrintToW() not implemented\n");
1151 }
1152 
1153 BOOL WINAPI
1155  IN DWORD dwReason,
1157 {
1158  switch (dwReason)
1159  {
1160  case DLL_PROCESS_ATTACH:
1161  case DLL_THREAD_ATTACH:
1162  hInstance = hinstDLL;
1163  break;
1164  }
1165 
1166  return TRUE;
1167 }
VOID WINAPI ImageView_PrintToW(HWND hwnd, HINSTANCE hInst, LPCWSTR path, int nShow)
Definition: shimgvw.c:1148
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define RegQueryValueEx
Definition: winreg.h:524
#define CallWindowProc
Definition: winuser.h:5710
HINSTANCE hInstance
Definition: commdlg.h:362
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define MAKEINTRESOURCE
Definition: winuser.h:591
SHIMGVW_SETTINGS shiSettings
Definition: shimgvw.c:36
#define IN
Definition: typedefs.h:38
#define TBICON_SAVE
Definition: resource.h:33
DWORD Flags
Definition: commdlg.h:373
GpStatus WINGDIPAPI GdipGetImageEncoders(UINT numEncoders, UINT size, ImageCodecInfo *encoders)
Definition: image.c:5021
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI PathRemoveFileSpecW(LPWSTR lpszPath)
Definition: path.c:624
static BOOL ImageView_LoadSettings()
Definition: shimgvw.c:701
#define TB_BUTTONSTRUCTSIZE
Definition: commctrl.h:1130
#define IDS_TOOLTIP_ROT_COUNCW
Definition: resource.h:58
#define TRUE
Definition: types.h:120
#define PropertyTagLoopCount
#define MAKEWPARAM(l, h)
Definition: winuser.h:3984
GpStatus WINGDIPAPI GdipImageGetFrameCount(GpImage *image, GDIPCONST GUID *dimensionID, UINT *count)
Definition: image.c:2865
LPCWSTR lpstrFilter
Definition: commdlg.h:363
#define IDC_ZOOMM
Definition: resource.h:23
static void ResetZoom(void)
Definition: shimgvw.c:233
struct _WINDOWPLACEMENT WINDOWPLACEMENT
#define ERROR_SUCCESS
Definition: deptool.c:10
#define IDB_PRINTICON
Definition: resource.h:15
#define CreateWindow
Definition: winuser.h:5729
WNDPROC PrevProc
Definition: shimgvw.c:39
GpStatus WINGDIPAPI GdipLoadImageFromFile(GDIPCONST WCHAR *filename, GpImage **image)
Definition: image.c:2928
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define TBSTYLE_EX_HIDECLIPPEDBUTTONS
Definition: commctrl.h:1009
#define IDS_APPTITLE
Definition: resource.h:3
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define REG_BINARY
Definition: nt_native.h:1496
#define SIZE_MAXIMIZED
Definition: winuser.h:2482
#define KEY_READ
Definition: nt_native.h:1023
GpStatus WINGDIPAPI GdipGetImageWidth(GpImage *image, UINT *width)
Definition: image.c:2342
#define DLL_THREAD_ATTACH
Definition: compat.h:121
#define SW_HIDE
Definition: winuser.h:762
#define IDS_TOOLTIP_NEXT_PIC
Definition: resource.h:53
#define WM_MOUSEWHEEL
Definition: treelist.c:96
#define CP_ACP
Definition: compat.h:99
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define NULL_BRUSH
Definition: wingdi.h:900
char CHAR
Definition: xmlstorage.h:175
#define free
Definition: debug_ros.c:5
struct _root root
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
GpStatus WINGDIPAPI GdipGetPropertyItemSize(GpImage *image, PROPID propid, UINT *size)
Definition: image.c:2488
#define SIZE_RESTORED
Definition: winuser.h:2480
LPWSTR lpstrFile
Definition: commdlg.h:367
UINT ZoomPercents
Definition: shimgvw.c:46
VOID WINAPI ImageView_FullscreenA(HWND hwnd, HINSTANCE hInst, LPCSTR path, int nShow)
Definition: shimgvw.c:1125
static HDC
Definition: imagelist.c:92
#define IDB_NEXTICON
Definition: resource.h:11
#define CALLBACK
Definition: compat.h:27
BOOL WINAPI UpdateWindow(_In_ HWND)
_Check_return_ _CRTIMP wchar_t *__cdecl wcstok(_Inout_opt_z_ wchar_t *_Str, _In_z_ const wchar_t *_Delim)
LONG top
Definition: windef.h:307
VOID WINAPI ImageView_Fullscreen(HWND hwnd, HINSTANCE hInst, LPCWSTR path, int nShow)
Definition: shimgvw.c:1119
#define GET_X_LPARAM(lp)
Definition: windowsx.h:274
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define VK_LEFT
Definition: winuser.h:2199
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
#define ZeroMemory
Definition: winbase.h:1642
#define CS_HREDRAW
Definition: winuser.h:648
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define IDC_NEXT
Definition: fontview.h:17
#define WHITE_BRUSH
Definition: wingdi.h:901
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
UINT_PTR WPARAM
Definition: windef.h:207
#define WPF_RESTORETOMAXIMIZED
Definition: winuser.h:2507
GpStatus WINGDIPAPI GdipGetImageFlags(GpImage *image, UINT *flags)
Definition: image.c:5266
#define WS_CHILD
Definition: pedump.c:617
UINT m_nLoopIndex
Definition: shimgvw.c:55
#define MAX_ZOOM
Definition: shimgvw.c:45
LONG left
Definition: windef.h:306
UINT uFlags
Definition: api.c:59
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
struct SHIMGVW_FILENODE_INTERNAL * Next
Definition: shimgvw.h:21
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define IDC_ROT2
Definition: resource.h:27
BOOL Anime_Step(DWORD *pdwDelay)
Definition: shimgvw.c:157
GpStatus WINGDIPAPI GdipSaveImageToFile(GpImage *image, GDIPCONST WCHAR *filename, GDIPCONST CLSID *clsidEncoder, GDIPCONST EncoderParameters *encoderParams)
Definition: image.c:4428
LRESULT CALLBACK ImageView_DispWndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
Definition: shimgvw.c:818
LONG right
Definition: windef.h:308
#define IDC_SAVE
Definition: resource.h:16
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define ANIME_TIMER_ID
Definition: shimgvw.c:59
VOID WINAPI ImageView_PrintTo(HWND hwnd, HINSTANCE hInst, LPCWSTR path, int nShow)
Definition: shimgvw.c:1136
int32_t INT
Definition: typedefs.h:56
static const UINT ZoomSteps[]
Definition: shimgvw.c:47
#define SetWindowLongPtr
Definition: treelist.c:70
& rect
Definition: startmenu.cpp:1413
WPARAM wParam
Definition: combotst.c:138
static BOOL ImageView_CreateToolBar(HWND hwnd)
Definition: shimgvw.c:746
static IN DWORD IN LPVOID lpvReserved
BOOL WINAPI GetSaveFileNameW(LPOPENFILENAMEW ofn)
Definition: filedlg.c:4630
struct tagNMHDR * LPNMHDR
DWORD lStructSize
Definition: commdlg.h:360
#define IDS_TOOLTIP_PREV_PIC
Definition: resource.h:54
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define TBICON_ROT2
Definition: resource.h:36
GpStatus WINGDIPAPI GdipGetImageDecodersSize(UINT *numDecoders, UINT *size)
Definition: image.c:4946
UINT code
Definition: winuser.h:3134
#define IDC_ROT1
Definition: resource.h:26
GpStatus WINGDIPAPI GdipImageRotateFlip(GpImage *image, RotateFlipType type)
Definition: image.c:5358
DWORD dwReason
Definition: misc.cpp:154
#define GCL_STYLE
Definition: winuser.h:665
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
#define BTNS_BUTTON
Definition: commctrl.h:994
BOOL Maximized
Definition: shimgvw.h:10
const GUID * guid
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
unsigned char * LPBYTE
Definition: typedefs.h:52
GpStatus WINGDIPAPI GdipGetImageHeight(GpImage *image, UINT *height)
Definition: image.c:2239
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
#define IDS_TOOLTIP_ZOOM_OUT
Definition: resource.h:56
GpStatus WINGDIPAPI GdipSetSmoothingMode(GpGraphics *graphics, SmoothingMode mode)
Definition: graphics.c:6289
#define WC_STATIC
Definition: commctrl.h:4678
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
Definition: graphics.c:2581
#define TB_AUTOSIZE
Definition: commctrl.h:1133
#define TB_IMAGE_HEIGHT
Definition: shimgvw.h:4
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:802
short SHORT
Definition: pedump.c:59
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
#define IDB_PREVICON
Definition: resource.h:10
LRESULT CALLBACK ImageView_WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
Definition: shimgvw.c:869
#define TTN_GETDISPINFO
Definition: commctrl.h:1874
#define CreateWindowEx
Definition: winuser.h:5730
#define TB_ENABLEBUTTON
Definition: commctrl.h:1038
#define CW_USEDEFAULT
Definition: winuser.h:225
#define WM_SIZING
Definition: winuser.h:1789
#define TOOLBARCLASSNAME
Definition: commctrl.h:942
DWORD Anime_GetFrameDelay(UINT nFrameIndex)
Definition: shimgvw.c:148
static SHIMGVW_FILENODE * pBuildFileList(LPWSTR szFirstFile)
Definition: shimgvw.c:448
#define PropertyTagFrameDelay
smooth NULL
Definition: ftsmooth.c:416
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:557
LONG WINAPI ImageView_CreateWindow(HWND hwnd, LPWSTR szFileName)
Definition: shimgvw.c:1035
#define WM_KEYDOWN
Definition: winuser.h:1697
LONG_PTR LPARAM
Definition: windef.h:208
#define LPRECT
Definition: precomp.h:28
GpStatus WINGDIPAPI GdipGetImageRawFormat(GpImage *image, GUID *format)
Definition: image.c:2306
void DPRINT(...)
Definition: polytest.cpp:61
GpStatus WINGDIPAPI GdipGetImageDecoders(UINT numDecoders, UINT size, ImageCodecInfo *decoders)
Definition: image.c:4970
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcsrchr(_In_z_ const wchar_t *_Str, _In_ wchar_t _Ch)
switch(r->id)
Definition: btrfs.c:2904
WCHAR FileName[MAX_PATH]
Definition: shimgvw.h:19
#define SetClassLongPtr
Definition: winuser.h:5823
const char * LPCSTR
Definition: xmlstorage.h:183
static VOID ImageView_UpdateWindow(HWND hwnd)
Definition: shimgvw.c:577
#define SW_SHOW
Definition: winuser.h:769
BOOL WINAPI GetWindowPlacement(_In_ HWND, _Inout_ WINDOWPLACEMENT *)
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define DefWindowProc
Definition: ros2win.h:31
static BOOL Anime_LoadInfo(void)
Definition: shimgvw.c:74
#define WM_DESTROY
Definition: winuser.h:1591
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
DWORD nFilterIndex
Definition: commdlg.h:366
#define PostMessage
Definition: winuser.h:5807
DebugEventProc DebugEventCallback
Definition: gdiplusinit.h:35
#define CCS_BOTTOM
Definition: commctrl.h:2240
SHIMGVW_FILENODE * currentFile
Definition: shimgvw.c:37
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define WS_CAPTION
Definition: pedump.c:624
#define KEY_WRITE
Definition: nt_native.h:1031
#define TB_SETIMAGELIST
Definition: commctrl.h:1146
static void Anime_FreeInfo(void)
Definition: shimgvw.c:61
#define LPTOOLTIPTEXT
Definition: commctrl.h:1886
#define CS_VREDRAW
Definition: winuser.h:653
char TCHAR
Definition: xmlstorage.h:189
#define TBICON_PRINT
Definition: resource.h:34
GpStatus WINGDIPAPI GdipImageSelectActiveFrame(GpImage *image, GDIPCONST GUID *dimensionID, UINT frame)
Definition: image.c:4302
static VOID pLoadImageFromNode(SHIMGVW_FILENODE *node, HWND hwnd)
Definition: shimgvw.c:420
#define IDS_TOOLTIP_ZOOM_IN
Definition: resource.h:55
#define _T(x)
Definition: vfdio.h:22
BOOL SuppressBackgroundThread
Definition: gdiplusinit.h:36
GLsizeiptr size
Definition: glext.h:5919
#define BTNS_SEP
Definition: commctrl.h:995
OPENFILENAMEW sfn
Definition: eventvwr.c:118
GpStatus WINGDIPAPI GdipDrawImageRectI(GpGraphics *graphics, GpImage *image, INT x, INT y, INT width, INT height)
Definition: graphics.c:3561
__wchar_t WCHAR
Definition: xmlstorage.h:180
GpStatus WINGDIPAPI GdipSetInterpolationMode(GpGraphics *graphics, InterpolationMode mode)
Definition: graphics.c:6143
#define WM_SIZE
Definition: winuser.h:1593
GpImage * image
Definition: shimgvw.c:38
#define IDC_PREV
Definition: fontview.h:16
#define ILC_COLOR24
Definition: commctrl.h:353
#define WM_TIMER
Definition: winuser.h:1724
static void ZoomInOrOut(BOOL bZoomIn)
Definition: shimgvw.c:183
#define TBICON_ZOOMM
Definition: resource.h:32
#define RGB(r, g, b)
Definition: wingdi.h:2939
#define MAX_PATH
Definition: compat.h:26
void WINAPI GdiplusShutdown(ULONG_PTR)
#define WINAPI
Definition: msvc.h:6
const GLubyte * c
Definition: glext.h:8905
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
Status WINAPI GdiplusStartup(ULONG_PTR *token, const struct GdiplusStartupInput *input, struct GdiplusStartupOutput *output)
Definition: gdiplus.c:81
unsigned short WORD
Definition: ntddk_ex.h:93
#define BN_CLICKED
Definition: winuser.h:1907
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint num
Definition: glext.h:9618
DWORD nMaxFile
Definition: commdlg.h:368
GpStatus WINGDIPAPI GdipGetPropertyItem(GpImage *image, PROPID propid, UINT size, PropertyItem *buffer)
Definition: image.c:2634
HWND hDispWnd
Definition: shimgvw.c:41
#define TBSTYLE_TOOLTIPS
Definition: commctrl.h:985
VOID WINAPI ImageView_FullscreenW(HWND hwnd, HINSTANCE hInst, LPCWSTR path, int nShow)
Definition: shimgvw.c:1113
#define WM_PAINT
Definition: winuser.h:1602
CHAR Message[80]
Definition: alive.c:5
static ULONG_PTR gdiplusToken
Definition: CImage.cpp:79
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define IDC_ZOOMP
Definition: resource.h:22
HWND hMainWnd
Definition: magnifier.c:32
HWND hwndOwner
Definition: commdlg.h:361
#define TBICON_PREV
Definition: resource.h:29
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define TBICON_ROT1
Definition: resource.h:35
#define TBICON_ZOOMP
Definition: resource.h:31
static const WCHAR L[]
Definition: oid.c:1250
HDC hdc
Definition: main.c:9
#define TB_ADDBUTTONS
Definition: commctrl.h:1267
static VOID ImageView_OnMouseWheel(HWND hwnd, INT x, INT y, INT zDelta, UINT fwKeys)
Definition: shimgvw.c:860
static VOID pFreeFileList(SHIMGVW_FILENODE *root)
Definition: shimgvw.c:561
#define ILC_MASK
Definition: commctrl.h:347
#define IDB_ROT1ICON
Definition: resource.h:16
PropertyItem * m_pDelayItem
Definition: shimgvw.c:57
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
GpStatus WINGDIPAPI GdipGetImageEncodersSize(UINT *numEncoders, UINT *size)
Definition: image.c:4997
#define WM_COMMAND
Definition: winuser.h:1722
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
static void Anime_SetFrameIndex(UINT nFrameIndex)
Definition: shimgvw.c:134
#define IDI_APPICON
Definition: resource.h:166
#define LoadCursor
Definition: winuser.h:5787
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
Definition: image.c:2107
#define GWLP_WNDPROC
Definition: treelist.c:66
#define IDS_TOOLTIP_SAVEAS
Definition: resource.h:60
static VOID ImageView_DrawImage(HWND hwnd)
Definition: shimgvw.c:604
#define IDB_ROT2ICON
Definition: resource.h:17
#define VK_RIGHT
Definition: winuser.h:2201
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2881
static HBRUSH CreateCheckerBoardBrush(HDC hdc)
Definition: shimgvw.c:583
#define MIN_ZOOM
Definition: shimgvw.c:44
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define RegOpenKeyEx
Definition: winreg.h:520
HINSTANCE hInst
Definition: dxdiag.c:13
BOOL WINAPI DllMain(IN HINSTANCE hinstDLL, IN DWORD dwReason, IN LPVOID lpvReserved)
Definition: shimgvw.c:1154
static void ImageView_OnTimer(HWND hwnd)
Definition: shimgvw.c:804
struct SHIMGVW_FILENODE_INTERNAL * Prev
Definition: shimgvw.h:20
#define IDB_ZOOMMICON
Definition: resource.h:13
#define OFN_OVERWRITEPROMPT
Definition: commdlg.h:116
UINT m_nLoopCount
Definition: shimgvw.c:56
VOID WINAPI PathUnquoteSpacesW(LPWSTR lpszPath)
Definition: path.c:1029
GpStatus WINGDIPAPI GdipCreateFromHDC(HDC hdc, GpGraphics **graphics)
Definition: graphics.c:2395
STRSAFEAPI StringCbPrintfExW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:623
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI IsZoomed(_In_ HWND)
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
static void pLoadImage(LPWSTR szOpenFileName)
Definition: shimgvw.c:289
GpStatus WINGDIPAPI GdipImageGetFrameDimensionsCount(GpImage *image, UINT *count)
Definition: image.c:2885
#define IMAGE_BITMAP
Definition: winuser.h:211
#define GetMessage
Definition: winuser.h:5765
HINSTANCE hInstance
Definition: shimgvw.c:35
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define MultiByteToWideChar
Definition: compat.h:100
#define DPRINT1
Definition: precomp.h:8
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:275
RECT rcNormalPosition
Definition: winuser.h:3270
#define msg(x)
Definition: auth_time.c:54
#define IDC_ARROW
Definition: winuser.h:682
#define TBICON_NEXT
Definition: resource.h:30
#define IDB_SAVEICON
Definition: resource.h:14
#define calloc
Definition: rosglue.h:14
#define SendMessage
Definition: winuser.h:5818
#define TB_IMAGE_WIDTH
Definition: shimgvw.h:3
#define TBSTATE_ENABLED
Definition: commctrl.h:970
#define WM_CREATE
Definition: winuser.h:1590
HWND hToolBar
Definition: shimgvw.c:41
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define c
Definition: ke_i.h:80
#define HIWORD(l)
Definition: typedefs.h:246
static void pSaveImageAs(HWND hwnd)
Definition: shimgvw.c:314
LONG bottom
Definition: windef.h:309
GpStatus WINGDIPAPI GdipImageGetFrameDimensionsList(GpImage *image, GUID *dimensionIDs, UINT count)
Definition: image.c:2900
#define malloc
Definition: debug_ros.c:4
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define LoadImage
Definition: winuser.h:5790
static VOID ImageView_InitControls(HWND hwnd)
Definition: shimgvw.c:841
INT WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
Definition: imagelist.c:563
#define RegisterClass
Definition: winuser.h:5811
UINT m_nFrameIndex
Definition: shimgvw.c:53
UINT m_nFrameCount
Definition: shimgvw.c:54
#define LoadIcon
Definition: winuser.h:5788
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LONG_PTR LRESULT
Definition: windef.h:209
#define DIB_RGB_COLORS
Definition: wingdi.h:366
static const TBBUTTON Buttons[]
Definition: shimgvw.c:274
#define IDB_ZOOMPICON
Definition: resource.h:12
static VOID ImageView_SaveSettings(HWND hwnd)
Definition: shimgvw.c:722
#define INFINITE
Definition: serial.h:102
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define LR_DEFAULTCOLOR
Definition: winuser.h:1077
LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
Definition: path.c:189
#define WS_VISIBLE
Definition: pedump.c:620
GLuint64EXT * result
Definition: glext.h:11304
#define SW_MAXIMIZE
Definition: winuser.h:766
HBRUSH WINAPI CreateDIBPatternBrushPt(_In_ const VOID *pvPackedDIB, _In_ UINT uUsage)
#define IDC_PRINT
Definition: fontview.h:14
LPARAM lParam
Definition: combotst.c:139
#define IDS_TOOLTIP_ROT_CLOCKW
Definition: resource.h:57
#define LOWORD(l)
Definition: pedump.c:82
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define RegSetValueEx
Definition: winreg.h:533
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define LoadString
Definition: winuser.h:5794
#define RegCreateKeyEx
Definition: winreg.h:501
VOID WINAPI ImageView_PrintToA(HWND hwnd, HINSTANCE hInst, LPCSTR path, int nShow)
Definition: shimgvw.c:1142
#define TBSTYLE_FLAT
Definition: commctrl.h:988
#define TB_SETEXTENDEDSTYLE
Definition: commctrl.h:1186
#define WM_NOTIFY
Definition: richedit.h:61
#define IDS_TOOLTIP_PRINT
Definition: resource.h:59
struct Rect Rect
WCHAR WndClass[]
Definition: capicon.c:23
GLubyte * pattern
Definition: glext.h:7787
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
Definition: dlist.c:348
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502