ReactOS 0.4.16-dev-981-g80eb313
shimgvw.h
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#pragma once
10
11#define WIN32_NO_STATUS
12#define _INC_WINDOWS
13#define COM_NO_WINDOWS_H
14#define INITGUID
15#define COBJMACROS
16
17#include <windef.h>
18#include <winbase.h>
19#include <winnls.h>
20#include <winreg.h>
21#include <wingdi.h>
22#include <wincon.h>
23#include <objbase.h>
24#include <gdiplus.h>
25#include <shlwapi.h>
26#include <strsafe.h>
27#include <shobjidl.h>
28
29#include <debug.h>
30
31#include "resource.h"
32
33#define WM_UPDATECOMMANDSTATE (WM_APP + 0)
34
36extern GpImage *g_pImage;
37
38typedef struct
39{
46
47typedef struct tagSHIMGVW_FILENODE
48{
53
54#define WC_PREVIEW L"ShImgVw:CPreviewWnd"
55#define WC_ZOOM L"ShImgVw:CZoomWnd"
56
57/* Animation */
58typedef struct tagANIME
59{
67
68void Anime_FreeInfo(PANIME pAnime);
70void Anime_SetTimerWnd(PANIME pAnime, HWND hwndTimer);
71void Anime_SetFrameIndex(PANIME pAnime, UINT nFrameIndex);
72void Anime_Start(PANIME pAnime, DWORD dwDelay);
73void Anime_Pause(PANIME pAnime);
75
81
82static inline LPVOID QuickAlloc(SIZE_T cbSize, BOOL bZero)
83{
84 return HeapAlloc(GetProcessHeap(), (bZero ? HEAP_ZERO_MEMORY : 0), cbSize);
85}
86
87static inline VOID QuickFree(LPVOID ptr)
88{
90}
91
92static inline WORD Swap16(WORD v)
93{
94 return MAKEWORD(HIBYTE(v), LOBYTE(v));
95}
96
97static inline UINT Swap32(UINT v)
98{
99 return MAKELONG(Swap16(HIWORD(v)), Swap16(LOWORD(v)));
100}
101
102#ifdef _WIN32
103#define BigToHost32 Swap32
104#endif
105
107{
109 ret.QuadPart = value;
110 return ret;
111}
112
114{
115 // HRESULT_FROM_WIN32 will evaluate its parameter twice, this function will not.
116 return HRESULT_FROM_WIN32(hr);
117}
118
120{
121 switch ((UINT)status)
122 {
123 case Ok: return S_OK;
124 case InvalidParameter: return E_INVALIDARG;
125 case OutOfMemory: return E_OUTOFMEMORY;
131 }
132 return E_FAIL;
133}
unsigned long long UINT64
BOOL Error
Definition: chkdsk.c:66
Definition: File.h:16
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_FAIL
Definition: ddrawi.h:102
#define GetProcessHeap()
Definition: compat.h:736
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#define HeapAlloc
Definition: compat.h:733
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
Status
Definition: gdiplustypes.h:25
@ Ok
Definition: gdiplustypes.h:26
@ FileNotFound
Definition: gdiplustypes.h:36
@ AccessDenied
Definition: gdiplustypes.h:38
@ InvalidParameter
Definition: gdiplustypes.h:28
@ OutOfMemory
Definition: gdiplustypes.h:29
@ Win32Error
Definition: gdiplustypes.h:33
@ NotImplemented
Definition: gdiplustypes.h:32
@ UnknownImageFormat
Definition: gdiplustypes.h:39
const GLdouble * v
Definition: gl.h:2040
#define S_OK
Definition: intsafe.h:52
#define LOBYTE(W)
Definition: jmemdos.c:487
#define HIBYTE(W)
Definition: jmemdos.c:486
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static PVOID ptr
Definition: dispmode.c:27
unsigned int UINT
Definition: ndis.h:50
#define LOWORD(l)
Definition: pedump.c:82
BOOL Anime_LoadInfo(PANIME pAnime)
Definition: anime.c:89
void EnableCommandIfVerbExists(UINT ImageId, HWND hwnd, UINT CmdId, PCWSTR Verb, PCWSTR File)
Definition: util.c:209
void Anime_Start(PANIME pAnime, DWORD dwDelay)
Definition: anime.c:35
static HRESULT HResultFromGdiplus(Status status)
Definition: shimgvw.h:119
void ShellExecuteVerb(HWND hwnd, PCWSTR Verb, PCWSTR File, BOOL Quit)
Definition: util.c:225
void DoShellContextMenuOnFile(HWND hwnd, PCWSTR File, LPARAM lParam)
Definition: util.c:152
static LPVOID QuickAlloc(SIZE_T cbSize, BOOL bZero)
Definition: shimgvw.h:82
void DisplayHelp(HWND hwnd)
Definition: util.c:253
static VOID QuickFree(LPVOID ptr)
Definition: shimgvw.h:87
struct tagSHIMGVW_FILENODE SHIMGVW_FILENODE
static UINT Swap32(UINT v)
Definition: shimgvw.h:97
BOOL Anime_OnTimer(PANIME pAnime, WPARAM wParam)
Definition: anime.c:76
void Anime_SetTimerWnd(PANIME pAnime, HWND hwndTimer)
Definition: anime.c:25
UINT ErrorBox(HWND hwnd, UINT Error)
Definition: misc.cpp:16
struct tagANIME ANIME
HINSTANCE g_hInstance
Definition: MainWindow.cpp:18
struct tagANIME * PANIME
void Anime_FreeInfo(PANIME pAnime)
Definition: anime.c:12
void Anime_Pause(PANIME pAnime)
Definition: anime.c:30
static HRESULT SHIMGVW_HResultFromWin32(DWORD hr)
Definition: shimgvw.h:113
void Anime_SetFrameIndex(PANIME pAnime, UINT nFrameIndex)
Definition: anime.c:144
static ULARGE_INTEGER MakeULargeInteger(UINT64 value)
Definition: shimgvw.h:106
GpImage * g_pImage
Definition: shimgvw.c:35
static WORD Swap16(WORD v)
Definition: shimgvw.h:92
HRESULT hr
Definition: shlfolder.c:183
BOOL Maximized
Definition: shimgvw.h:40
Definition: ps.c:97
UINT m_nLoopCount
Definition: shimgvw.h:63
UINT m_nFrameIndex
Definition: shimgvw.h:60
HWND m_hwndTimer
Definition: shimgvw.h:65
UINT m_nLoopIndex
Definition: shimgvw.h:62
PropertyItem * m_pDelayItem
Definition: shimgvw.h:64
UINT m_nFrameCount
Definition: shimgvw.h:61
struct tagSHIMGVW_FILENODE * Next
Definition: shimgvw.h:51
struct tagSHIMGVW_FILENODE * Prev
Definition: shimgvw.h:50
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define MAKEWORD(a, b)
Definition: typedefs.h:248
ULONG_PTR SIZE_T
Definition: typedefs.h:80
int32_t INT
Definition: typedefs.h:58
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define HIWORD(l)
Definition: typedefs.h:247
Definition: pdh_main.c:96
int ret
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define ERROR_BAD_FORMAT
Definition: winerror.h:114
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
__wchar_t WCHAR
Definition: xmlstorage.h:180