ReactOS  0.4.15-dev-4869-g35a816a
main.cpp File Reference
#include "precomp.h"
Include dependency graph for main.cpp:

Go to the source code of this file.

Functions

static BOOL FileExtFromFilter (LPTSTR pExt, LPCTSTR pTitle, OPENFILENAME *pOFN)
 
static UINT_PTR APIENTRY OFNHookProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
int WINAPI _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR lpszArgument, int nFunsterStil)
 

Variables

POINT start
 
POINT last
 
ToolsModel toolsModel
 
SelectionModel selectionModel
 
LOGFONT lfTextFont
 
HFONT hfontTextFont
 
HWND hwndEditCtl
 
LPTSTR textToolText = NULL
 
int textToolTextMaxLen = 0
 
PaletteModel paletteModel
 
RegistrySettings registrySettings
 
ImageModel imageModel
 
BOOL askBeforeEnlarging = FALSE
 
HWND hStatusBar
 
CHOOSECOLOR choosecolor
 
OPENFILENAME ofn
 
OPENFILENAME sfn
 
HICON hNontranspIcon
 
HICON hTranspIcon
 
HCURSOR hCurFill
 
HCURSOR hCurColor
 
HCURSOR hCurZoom
 
HCURSOR hCurPen
 
HCURSOR hCurAirbrush
 
HWND hToolBtn [16]
 
HINSTANCE hProgInstance
 
TCHAR filepathname [1000]
 
BOOL isAFile = FALSE
 
BOOL imageSaved = FALSE
 
int fileSize
 
int fileHPPM = 2834
 
int fileVPPM = 2834
 
SYSTEMTIME fileTime
 
BOOL showGrid = FALSE
 
BOOL showMiniature = FALSE
 
CMainWindow mainWindow
 
CFullscreenWindow fullscreenWindow
 
CMiniatureWindow miniature
 
CToolBox toolBoxContainer
 
CToolSettingsWindow toolSettingsWindow
 
CPaletteWindow paletteWindow
 
CScrollboxWindow scrollboxWindow
 
CScrollboxWindow scrlClientWindow
 
CSelectionWindow selectionWindow
 
CImgAreaWindow imageArea
 
CSizeboxWindow sizeboxLeftTop
 
CSizeboxWindow sizeboxCenterTop
 
CSizeboxWindow sizeboxRightTop
 
CSizeboxWindow sizeboxLeftCenter
 
CSizeboxWindow sizeboxRightCenter
 
CSizeboxWindow sizeboxLeftBottom
 
CSizeboxWindow sizeboxCenterBottom
 
CSizeboxWindow sizeboxRightBottom
 
CTextEditWindow textEditWindow
 

Function Documentation

◆ _tWinMain()

int WINAPI _tWinMain ( HINSTANCE  hThisInstance,
HINSTANCE  hPrevInstance,
LPTSTR  lpszArgument,
int  nFunsterStil 
)

Definition at line 146 of file main.cpp.

147 {
148  HWND hwnd; /* This is the handle for our window */
149  MSG messages; /* Here messages to the application are saved */
150 
151  HMENU menu;
152  HACCEL haccel;
153 
154  TCHAR sfnFilename[1000];
155  TCHAR sfnFiletitle[256];
156  TCHAR ofnFilename[1000];
157  TCHAR ofnFiletitle[256];
158  TCHAR miniaturetitle[100];
159  static COLORREF custColors[16] = {
160  0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff,
161  0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff
162  };
163 
164  /* init font for text tool */
165  ZeroMemory(&lfTextFont, sizeof(lfTextFont));
166  lfTextFont.lfHeight = 0;
170 
171  hProgInstance = hThisInstance;
172 
173  /* initialize common controls library */
175  iccx.dwSize = sizeof(iccx);
177  InitCommonControlsEx(&iccx);
178 
180  CPath pathFileName(filepathname);
181  pathFileName.StripPath();
182  CString strTitle;
183  strTitle.Format(IDS_WINDOWTITLE, (LPCTSTR)pathFileName);
184  LoadString(hThisInstance, IDS_MINIATURETITLE, miniaturetitle, _countof(miniaturetitle));
185 
186  /* load settings from registry */
190 
191  /* create main window */
192  RECT mainWindowPos = {0, 0, 544, 375}; // FIXME: use equivalent of CW_USEDEFAULT for position
193  hwnd = mainWindow.Create(HWND_DESKTOP, mainWindowPos, strTitle, WS_OVERLAPPEDWINDOW);
194 
195  RECT fullscreenWindowPos = {0, 0, 100, 100};
196  fullscreenWindow.Create(HWND_DESKTOP, fullscreenWindowPos, NULL, WS_POPUPWINDOW | WS_MAXIMIZE);
197 
201  miniature.Create(hwnd, miniaturePos, miniaturetitle,
203  miniature.ShowWindow(showMiniature ? SW_SHOW : SW_HIDE);
204 
205  /* loading and setting the window menu from resource */
206  menu = LoadMenu(hThisInstance, MAKEINTRESOURCE(ID_MENU));
207  SetMenu(hwnd, menu);
208  haccel = LoadAccelerators(hThisInstance, MAKEINTRESOURCE(800));
209 
210  /* preloading the draw transparent/nontransparent icons for later use */
213  hTranspIcon =
215 
216  hCurFill = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_FILL));
217  hCurColor = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_COLOR));
218  hCurZoom = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_ZOOM));
219  hCurPen = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_PEN));
221 
222  CreateWindowEx(0, _T("STATIC"), NULL, WS_CHILD | WS_VISIBLE | SS_ETCHEDHORZ, 0, 0, 5000, 2, hwnd, NULL,
223  hThisInstance, NULL);
224 
225  RECT toolBoxContainerPos = {2, 2, 2 + 52, 2 + 350};
226  toolBoxContainer.Create(hwnd, toolBoxContainerPos, NULL, WS_CHILD | WS_VISIBLE);
227  /* creating the tool settings child window */
228  RECT toolSettingsWindowPos = {5, 208, 5 + 42, 208 + 140};
229  toolSettingsWindow.Create(toolBoxContainer.m_hWnd, toolSettingsWindowPos, NULL, WS_CHILD | WS_VISIBLE);
230 
231  /* creating the palette child window */
232  RECT paletteWindowPos = {56, 9, 56 + 255, 9 + 32};
233  paletteWindow.Create(hwnd, paletteWindowPos, NULL, WS_CHILD | WS_VISIBLE);
234 
235  /* creating the scroll box */
236  RECT scrollboxWindowPos = {56, 49, 56 + 472, 49 + 248};
237  scrollboxWindow.Create(hwnd, scrollboxWindowPos, NULL,
239 
240  /* creating the status bar */
241  hStatusBar =
243  NULL, hThisInstance, NULL);
245 
246  RECT scrlClientWindowPos = {0, 0, 0 + 500, 0 + 500};
247  scrlClientWindow.Create(scrollboxWindow.m_hWnd, scrlClientWindowPos, NULL, WS_CHILD | WS_VISIBLE);
248 
249  /* create selection window (initially hidden) */
250  RECT selectionWindowPos = {350, 0, 350 + 100, 0 + 100};
251  selectionWindow.Create(scrlClientWindow.m_hWnd, selectionWindowPos, NULL, WS_CHILD | BS_OWNERDRAW);
252 
253  /* creating the window inside the scroll box, on which the image in hDrawingDC's bitmap is drawn */
255  imageArea.Create(scrlClientWindow.m_hWnd, imageAreaPos, NULL, WS_CHILD | WS_VISIBLE);
256 
257  if (__argc >= 2)
258  {
260  }
261 
263 
264  /* initializing the CHOOSECOLOR structure for use with ChooseColor */
268  choosecolor.rgbResult = 0x00ffffff;
269  choosecolor.lpCustColors = custColors;
270 
271  /* initializing the OPENFILENAME structure for use with GetOpenFileName and GetSaveFileName */
272  ofnFilename[0] = 0;
273  CString strImporters;
274  CSimpleArray<GUID> aguidFileTypesI;
275  CString strAllPictureFiles;
276  strAllPictureFiles.LoadString(hThisInstance, IDS_ALLPICTUREFILES);
277  CImage::GetImporterFilterString(strImporters, aguidFileTypesI, strAllPictureFiles, CImage::excludeDefaultLoad, _T('\0'));
278 // CAtlStringW strAllFiles;
279 // strAllFiles.LoadString(hThisInstance, IDS_ALLFILES);
280 // strImporters = strAllFiles + CAtlStringW(_T("|*.*|")).Replace('|', '\0') + strImporters;
281  ZeroMemory(&ofn, sizeof(OPENFILENAME));
282  ofn.lStructSize = sizeof(OPENFILENAME);
283  ofn.hwndOwner = hwnd;
284  ofn.hInstance = hThisInstance;
285  ofn.lpstrFilter = strImporters;
286  ofn.lpstrFile = ofnFilename;
287  ofn.nMaxFile = _countof(ofnFilename);
288  ofn.lpstrFileTitle = ofnFiletitle;
289  ofn.nMaxFileTitle = _countof(ofnFiletitle);
291  ofn.lpstrDefExt = L"png";
292 
293  CopyMemory(sfnFilename, filepathname, sizeof(filepathname));
294  CString strExporters;
295  CSimpleArray<GUID> aguidFileTypesE;
296  CImage::GetExporterFilterString(strExporters, aguidFileTypesE, NULL, CImage::excludeDefaultSave, _T('\0'));
297  ZeroMemory(&sfn, sizeof(OPENFILENAME));
298  sfn.lStructSize = sizeof(OPENFILENAME);
299  sfn.hwndOwner = hwnd;
300  sfn.hInstance = hThisInstance;
301  sfn.lpstrFilter = strExporters;
302  sfn.lpstrFile = sfnFilename;
303  sfn.nMaxFile = _countof(sfnFilename);
304  sfn.lpstrFileTitle = sfnFiletitle;
305  sfn.nMaxFileTitle = _countof(sfnFiletitle);
308  sfn.lpstrDefExt = L"png";
309  // Choose PNG
310  for (INT i = 0; i < aguidFileTypesE.GetSize(); ++i)
311  {
312  if (aguidFileTypesE[i] == Gdiplus::ImageFormatPNG)
313  {
314  sfn.nFilterIndex = i + 1;
315  break;
316  }
317  }
318 
319  /* creating the size boxes */
320  RECT sizeboxPos = {0, 0, GRIP_SIZE, GRIP_SIZE};
321  sizeboxLeftTop.Create(scrlClientWindow.m_hWnd, sizeboxPos, NULL, WS_CHILD | WS_VISIBLE);
322  sizeboxCenterTop.Create(scrlClientWindow.m_hWnd, sizeboxPos, NULL, WS_CHILD | WS_VISIBLE);
323  sizeboxRightTop.Create(scrlClientWindow.m_hWnd, sizeboxPos, NULL, WS_CHILD | WS_VISIBLE);
324  sizeboxLeftCenter.Create(scrlClientWindow.m_hWnd, sizeboxPos, NULL, WS_CHILD | WS_VISIBLE);
325  sizeboxRightCenter.Create(scrlClientWindow.m_hWnd, sizeboxPos, NULL, WS_CHILD | WS_VISIBLE);
326  sizeboxLeftBottom.Create(scrlClientWindow.m_hWnd, sizeboxPos, NULL, WS_CHILD | WS_VISIBLE);
327  sizeboxCenterBottom.Create(scrlClientWindow.m_hWnd, sizeboxPos, NULL, WS_CHILD | WS_VISIBLE);
328  sizeboxRightBottom.Create(scrlClientWindow.m_hWnd, sizeboxPos, NULL, WS_CHILD | WS_VISIBLE);
329  /* placing the size boxes around the image */
331 
332  /* by moving the window, the things in WM_SIZE are done */
334 
335  /* Make the window visible on the screen */
336  ShowWindow (hwnd, nFunsterStil);
337 
338  /* inform the system, that the main window accepts dropped files */
340 
341  /* Run the message loop. It will run until GetMessage() returns 0 */
342  while (GetMessage(&messages, NULL, 0, 0))
343  {
344  if (fontsDialog.IsWindow() && IsDialogMessage(fontsDialog, &messages))
345  continue;
346 
347  if (TranslateAccelerator(hwnd, haccel, &messages))
348  continue;
349 
350  /* Translate virtual-key messages into character messages */
352  /* Send message to WindowProcedure */
354  }
355 
356  /* write back settings to registry */
361 
362  /* The program return-value is 0 - The value that PostQuitMessage() gave */
363  return messages.wParam;
364 }
#define WS_GROUP
Definition: pedump.c:633
#define ID_MENU
Definition: resource.h:32
#define OFN_EXPLORER
Definition: commdlg.h:104
#define WS_POPUPWINDOW
Definition: pedump.c:638
DWORD ThumbXPos
Definition: registry.h:25
#define WS_THICKFRAME
Definition: pedump.c:630
#define TranslateAccelerator
Definition: winuser.h:5840
#define IDC_FILL
Definition: resource.h:21
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define DispatchMessage
Definition: winuser.h:5745
#define IDC_ZOOM
Definition: resource.h:16
#define BS_OWNERDRAW
Definition: pedump.c:661
BOOL WINAPI TranslateMessage(_In_ const MSG *)
static HICON
Definition: imagelist.c:84
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
CToolSettingsWindow toolSettingsWindow
Definition: main.cpp:67
#define IMAGE_ICON
Definition: winuser.h:212
DWORD ThumbHeight
Definition: registry.h:23
HCURSOR hCurFill
Definition: main.cpp:42
LPSTR lpstrFileTitle
Definition: commdlg.h:338
HWND hwndOwner
Definition: commdlg.h:330
#define TRUE
Definition: types.h:120
#define SW_HIDE
Definition: winuser.h:762
CHOOSECOLORA CHOOSECOLOR
Definition: commdlg.h:654
ImageModel imageModel
Definition: main.cpp:32
#define IDC_AIRBRUSH
Definition: resource.h:25
#define WS_EX_PALETTEWINDOW
Definition: winuser.h:399
HWND Create(HWND hWndParent, _U_RECT rect=NULL, LPCTSTR szWindowName=NULL, DWORD dwStyle=0, DWORD dwExStyle=0, _U_MENUorID MenuOrID=0U, LPVOID lpCreateParam=NULL)
Definition: atlwin.h:1700
OPENFILENAME ofn
Definition: main.cpp:37
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
void WINAPI DragAcceptFiles(HWND hWnd, BOOL b)
Definition: shellole.c:522
CSizeboxWindow sizeboxRightCenter
Definition: main.cpp:77
HCURSOR hCurColor
Definition: main.cpp:43
#define ZeroMemory
Definition: winbase.h:1667
LPCSTR lpstrDefExt
Definition: commdlg.h:345
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:753
BYTE lfCharSet
Definition: dimm.idl:50
HCURSOR hCurPen
Definition: main.cpp:45
#define __targv
Definition: tchar.h:504
#define WS_CHILD
Definition: pedump.c:617
#define IDI_TRANSPARENT
Definition: resource.h:18
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IsDialogMessage
Definition: winuser.h:5789
#define DEFAULT_CHARSET
Definition: wingdi.h:384
#define STATUSCLASSNAME
Definition: commctrl.h:1939
#define IDS_DEFAULTFILENAME
Definition: resource.h:185
COLORREF rgbResult
Definition: commdlg.h:242
int32_t INT
Definition: typedefs.h:58
DWORD nMaxFile
Definition: commdlg.h:337
static UINT_PTR APIENTRY OFNHookProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: main.cpp:111
CSizeboxWindow sizeboxCenterBottom
Definition: main.cpp:79
DWORD BMPHeight
Definition: registry.h:17
void Crop(int nWidth, int nHeight, int nOffsetX=0, int nOffsetY=0)
Definition: history.cpp:131
CToolBox toolBoxContainer
Definition: main.cpp:66
CPaletteWindow paletteWindow
Definition: main.cpp:68
CHOOSECOLOR choosecolor
Definition: main.cpp:36
CSizeboxWindow sizeboxLeftBottom
Definition: main.cpp:78
#define LoadAccelerators
Definition: winuser.h:5790
#define L(x)
Definition: ntvdm.h:50
CFullscreenWindow fullscreenWindow
Definition: main.cpp:64
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:347
void ClearHistory(void)
Definition: history.cpp:109
long LONG
Definition: pedump.c:60
LONG lfHeight
Definition: dimm.idl:42
#define OFN_ENABLEHOOK
Definition: commdlg.h:99
#define CreateWindowEx
Definition: winuser.h:5735
LONG lfWeight
Definition: dimm.idl:46
HFONT hfontTextFont
Definition: main.cpp:23
DWORD ShowThumbnail
Definition: registry.h:21
#define ICC_USEREX_CLASSES
Definition: commctrl.h:68
CSizeboxWindow sizeboxRightTop
Definition: main.cpp:75
HINSTANCE hInstance
Definition: commdlg.h:331
OPENFILENAMEA OPENFILENAME
Definition: commdlg.h:657
#define SW_SHOW
Definition: winuser.h:769
HWND hStatusBar
Definition: main.cpp:35
HICON hTranspIcon
Definition: main.cpp:40
BOOL SetWindowPlacement(const WINDOWPLACEMENT *lpwndpl)
Definition: atlwin.h:1248
WINDOWPLACEMENT WindowPlacement
Definition: registry.h:28
int GetWidth() const
Definition: history.cpp:215
#define WS_CAPTION
Definition: pedump.c:624
char TCHAR
Definition: xmlstorage.h:189
CMiniatureWindow miniature
Definition: main.cpp:65
CMainWindow mainWindow
Definition: main.cpp:63
#define ICC_BAR_CLASSES
Definition: commctrl.h:60
HCURSOR hCurAirbrush
Definition: main.cpp:46
#define SS_ETCHEDHORZ
Definition: winuser.h:343
#define _T(x)
Definition: vfdio.h:22
DWORD BMPWidth
Definition: registry.h:18
RegistrySettings registrySettings
Definition: main.cpp:30
#define WS_OVERLAPPED
Definition: pedump.c:615
#define IDC_PEN
Definition: resource.h:24
#define SBARS_SIZEGRIP
Definition: commctrl.h:1923
#define WM_SIZE
Definition: winuser.h:1598
HINSTANCE hProgInstance
Definition: main.cpp:50
BOOL WINAPI SetMenu(_In_ HWND, _In_opt_ HMENU)
DWORD COLORREF
Definition: windef.h:300
#define _countof(array)
Definition: sndvol32.h:68
TCHAR filepathname[1000]
Definition: main.cpp:52
DWORD ThumbWidth
Definition: registry.h:24
DWORD lStructSize
Definition: commdlg.h:329
#define CopyMemory
Definition: winbase.h:1665
CSelectionWindow selectionWindow
Definition: main.cpp:71
#define IDS_ALLPICTUREFILES
Definition: resource.h:206
BOOL showMiniature
Definition: main.cpp:61
CSizeboxWindow sizeboxRightBottom
Definition: main.cpp:80
#define WS_HSCROLL
Definition: pedump.c:628
#define IDS_WINDOWTITLE
Definition: resource.h:180
#define IDI_NONTRANSPARENT
Definition: resource.h:19
#define GRIP_SIZE
Definition: common.h:13
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
HWND Create()
Definition: gui.cpp:744
CSizeboxWindow sizeboxCenterTop
Definition: main.cpp:74
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
HWND m_hWnd
Definition: atlwin.h:267
DWORD ThumbYPos
Definition: registry.h:26
DWORD lStructSize
Definition: commdlg.h:239
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define LoadMenu
Definition: winuser.h:5797
int GetHeight() const
Definition: history.cpp:220
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
LPSTR lpstrFile
Definition: commdlg.h:336
CFontsDialog fontsDialog
Definition: dialogs.cpp:22
#define OFN_OVERWRITEPROMPT
Definition: commdlg.h:116
HICON hNontranspIcon
Definition: main.cpp:39
HBITMAP DoLoadImageFile(HWND hwnd, LPCTSTR name, BOOL fIsMainFile)
Definition: dib.cpp:160
HCURSOR hCurZoom
Definition: main.cpp:44
LPCSTR lpstrFilter
Definition: commdlg.h:332
#define HWND_DESKTOP
Definition: winuser.h:1199
OPENFILENAME sfn
Definition: main.cpp:38
HWND hwndOwner
Definition: commdlg.h:240
#define CreateFontIndirect
Definition: wingdi.h:4444
#define NULL
Definition: types.h:112
#define WS_VSCROLL
Definition: pedump.c:627
#define GetMessage
Definition: winuser.h:5770
LOGFONT lfTextFont
Definition: main.cpp:22
#define FW_NORMAL
Definition: wingdi.h:373
_CRTIMP int __argc
Definition: getargs.c:21
#define SendMessage
Definition: winuser.h:5823
CImgAreaWindow imageArea
Definition: main.cpp:72
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1082
#define IDS_MINIATURETITLE
Definition: resource.h:186
BOOL LoadString(_In_ UINT nID)
Definition: cstringt.h:591
CSizeboxWindow sizeboxLeftTop
Definition: main.cpp:73
#define ICC_STANDARD_CLASSES
Definition: commctrl.h:73
#define LoadImage
Definition: winuser.h:5795
#define LoadIcon
Definition: winuser.h:5793
DWORD nFilterIndex
Definition: commdlg.h:335
#define IDC_COLOR
Definition: resource.h:22
#define SB_SETMINHEIGHT
Definition: commctrl.h:1957
CScrollboxWindow scrlClientWindow
Definition: main.cpp:70
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define LR_DEFAULTCOLOR
Definition: winuser.h:1081
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_SYSMENU
Definition: pedump.c:629
CSizeboxWindow sizeboxLeftCenter
Definition: main.cpp:76
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
COLORREF * lpCustColors
Definition: commdlg.h:243
#define LoadString
Definition: winuser.h:5799
DWORD nMaxFileTitle
Definition: commdlg.h:339
CScrollboxWindow scrollboxWindow
Definition: main.cpp:69
#define WS_MAXIMIZE
Definition: pedump.c:623
DWORD Flags
Definition: commdlg.h:342

◆ FileExtFromFilter()

static BOOL FileExtFromFilter ( LPTSTR  pExt,
LPCTSTR  pTitle,
OPENFILENAME pOFN 
)
static

Definition at line 85 of file main.cpp.

86 {
87  LPTSTR pchExt = pExt;
88  *pchExt = 0;
89 
90  DWORD nIndex = 1;
91  for (LPCTSTR pch = pOFN->lpstrFilter; *pch; ++nIndex)
92  {
93  pch += lstrlen(pch) + 1;
94  if (pOFN->nFilterIndex == nIndex)
95  {
96  for (++pch; *pch && *pch != _T(';'); ++pch)
97  {
98  *pchExt++ = *pch;
99  }
100  *pchExt = 0;
101  CharLower(pExt);
102  return TRUE;
103  }
104  pch += lstrlen(pch) + 1;
105  }
106  return FALSE;
107 }
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
#define TRUE
Definition: types.h:120
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define pch(ap)
Definition: match.c:418
#define FALSE
Definition: types.h:117
#define _T(x)
Definition: vfdio.h:22
unsigned long DWORD
Definition: ntddk_ex.h:95
#define lstrlen
Definition: winbase.h:3737
LPCSTR lpstrFilter
Definition: commdlg.h:332
#define CharLower
Definition: winuser.h:5717
DWORD nFilterIndex
Definition: commdlg.h:335

Referenced by OFNHookProc().

◆ OFNHookProc()

static UINT_PTR APIENTRY OFNHookProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 111 of file main.cpp.

112 {
113  HWND hParent;
114  OFNOTIFY *pon;
115  switch (uMsg)
116  {
117  case WM_NOTIFY:
118  pon = (OFNOTIFY *)lParam;
119  if (pon->hdr.code == CDN_TYPECHANGE)
120  {
121  hParent = GetParent(hwnd);
124  LPTSTR pchTitle = _tcsrchr(Path, _T('\\'));
125  if (pchTitle == NULL)
126  pchTitle = _tcsrchr(Path, _T('/'));
127 
128  LPTSTR pch = _tcsrchr((pchTitle ? pchTitle : Path), _T('.'));
129  if (pch && pchTitle)
130  {
131  pchTitle++;
132  *pch = 0;
133  FileExtFromFilter(pch, pchTitle, pon->lpOFN);
134  SendMessage(hParent, CDM_SETCONTROLTEXT, 0x047c, (LPARAM)pchTitle);
135  lstrcpyn(pon->lpOFN->lpstrFile, Path, pon->lpOFN->nMaxFile);
136  }
137  }
138  break;
139  }
140  return 0;
141 }
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define pch(ap)
Definition: match.c:418
DWORD nMaxFile
Definition: commdlg.h:337
UINT code
Definition: winuser.h:3139
LONG_PTR LPARAM
Definition: windef.h:208
static BOOL FileExtFromFilter(LPTSTR pExt, LPCTSTR pTitle, OPENFILENAME *pOFN)
Definition: main.cpp:85
LPOPENFILENAMEA lpOFN
Definition: commdlg.h:407
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
NMHDR hdr
Definition: commdlg.h:406
#define _countof(array)
Definition: sndvol32.h:68
#define CDM_GETFILEPATH
Definition: commdlg.h:44
#define MAX_PATH
Definition: compat.h:34
#define CDN_TYPECHANGE
Definition: commdlg.h:39
HWND WINAPI GetParent(_In_ HWND)
PRTL_UNICODE_STRING_BUFFER Path
#define CDM_SETCONTROLTEXT
Definition: commdlg.h:47
LPSTR lpstrFile
Definition: commdlg.h:336
#define NULL
Definition: types.h:112
#define SendMessage
Definition: winuser.h:5823
_TCHAR * _tcsrchr(const _TCHAR *s, _XINT c)
Definition: tcsrchr.h:4
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
LPARAM lParam
Definition: combotst.c:139
#define WM_NOTIFY
Definition: richedit.h:61
#define lstrcpyn
Definition: winbase.h:3736

Referenced by _tWinMain().

Variable Documentation

◆ askBeforeEnlarging

BOOL askBeforeEnlarging = FALSE

Definition at line 33 of file main.cpp.

Referenced by CMainWindow::InsertSelectionFromHBITMAP().

◆ choosecolor

◆ fileHPPM

◆ filepathname

◆ fileSize

◆ fileTime

◆ fileVPPM

◆ fullscreenWindow

CFullscreenWindow fullscreenWindow

Definition at line 64 of file main.cpp.

Referenced by _tWinMain(), CMainWindow::OnCommand(), and CMainWindow::OnKeyDown().

◆ hCurAirbrush

HCURSOR hCurAirbrush

Definition at line 46 of file main.cpp.

Referenced by _tWinMain(), and CImgAreaWindow::OnSetCursor().

◆ hCurColor

HCURSOR hCurColor

Definition at line 43 of file main.cpp.

Referenced by _tWinMain(), and CImgAreaWindow::OnSetCursor().

◆ hCurFill

HCURSOR hCurFill

Definition at line 42 of file main.cpp.

Referenced by _tWinMain(), and CImgAreaWindow::OnSetCursor().

◆ hCurPen

HCURSOR hCurPen

Definition at line 45 of file main.cpp.

Referenced by _tWinMain(), and CImgAreaWindow::OnSetCursor().

◆ hCurZoom

HCURSOR hCurZoom

Definition at line 44 of file main.cpp.

Referenced by _tWinMain(), and CImgAreaWindow::OnSetCursor().

◆ hfontTextFont

HFONT hfontTextFont

Definition at line 23 of file main.cpp.

Referenced by _tWinMain().

◆ hNontranspIcon

HICON hNontranspIcon

Definition at line 39 of file main.cpp.

Referenced by _tWinMain(), and CToolSettingsWindow::OnPaint().

◆ hProgInstance

◆ hStatusBar

HWND hStatusBar

Definition at line 35 of file main.cpp.

Referenced by _tWinMain().

◆ hToolBtn

HWND hToolBtn[16]

Definition at line 48 of file main.cpp.

◆ hTranspIcon

HICON hTranspIcon

Definition at line 40 of file main.cpp.

Referenced by _tWinMain(), and CToolSettingsWindow::OnPaint().

◆ hwndEditCtl

HWND hwndEditCtl

Definition at line 24 of file main.cpp.

◆ imageArea

◆ imageModel

ImageModel imageModel

Definition at line 32 of file main.cpp.

Referenced by _tWinMain(), ToolBase::beginEvent(), SelectionModel::CalculateBoundingBoxAndContents(), CMainWindow::ConfirmSave(), LineTool::draw(), RectTool::draw(), EllipseTool::draw(), RRectTool::draw(), ColorTool::fetchColor(), CSelectionWindow::ForceRefreshSelectionContents(), CMainWindow::InsertSelectionFromHBITMAP(), FreeSelTool::OnButtonDown(), RectSelTool::OnButtonDown(), GenericDrawTool::OnButtonDown(), FillTool::OnButtonDown(), ZoomTool::OnButtonDown(), TextTool::OnButtonDown(), BezierTool::OnButtonDown(), ShapeTool::OnButtonDown(), FreeSelTool::OnButtonUp(), RectSelTool::OnButtonUp(), TextTool::OnButtonUp(), BezierTool::OnButtonUp(), ShapeTool::OnButtonUp(), FreeSelTool::OnCancelDraw(), RectSelTool::OnCancelDraw(), GenericDrawTool::OnCancelDraw(), BezierTool::OnCancelDraw(), ShapeTool::OnCancelDraw(), CMainWindow::OnCommand(), CAttributesDialog::OnDefault(), BezierTool::OnFinishDraw(), ShapeTool::OnFinishDraw(), CScrollboxWindow::OnHScroll(), CAttributesDialog::OnInitDialog(), CMainWindow::OnInitMenuPopup(), CSizeboxWindow::OnLButtonUp(), CSelectionWindow::OnLButtonUp(), CSizeboxWindow::OnMouseMove(), CSelectionWindow::OnMouseMove(), CImgAreaWindow::OnMouseMove(), FreeSelTool::OnMouseMove(), RectSelTool::OnMouseMove(), BezierTool::OnMouseMove(), ShapeTool::OnMouseMove(), CMiniatureWindow::OnPaint(), CFullscreenWindow::OnPaint(), CImgAreaWindow::OnPaint(), CImgAreaWindow::OnSize(), CScrollboxWindow::OnVScroll(), SelectionModel::RotateNTimes90Degrees(), CMainWindow::saveImage(), ToolsModel::selectAll(), SetBitmapAndInfo(), SelectionModel::StretchSkew(), updateCanvasAndScrollbars(), TextTool::UpdatePoint(), and zoomTo().

◆ imageSaved

◆ isAFile

◆ last

POINT last

Definition at line 16 of file main.cpp.

◆ lfTextFont

LOGFONT lfTextFont

Definition at line 22 of file main.cpp.

Referenced by _tWinMain().

◆ mainWindow

◆ miniature

◆ ofn

Definition at line 37 of file main.cpp.

Referenced by _tWinMain().

◆ paletteModel

◆ paletteWindow

◆ registrySettings

◆ scrlClientWindow

◆ scrollboxWindow

◆ selectionModel

◆ selectionWindow

◆ sfn

Definition at line 38 of file main.cpp.

Referenced by _tWinMain().

◆ showGrid

BOOL showGrid = FALSE

◆ showMiniature

BOOL showMiniature = FALSE

◆ sizeboxCenterBottom

◆ sizeboxCenterTop

◆ sizeboxLeftBottom

◆ sizeboxLeftCenter

◆ sizeboxLeftTop

◆ sizeboxRightBottom

◆ sizeboxRightCenter

◆ sizeboxRightTop

◆ start

Definition at line 15 of file main.cpp.

◆ textEditWindow

◆ textToolText

LPTSTR textToolText = NULL

Definition at line 25 of file main.cpp.

◆ textToolTextMaxLen

int textToolTextMaxLen = 0

Definition at line 26 of file main.cpp.

◆ toolBoxContainer

◆ toolSettingsWindow

◆ toolsModel

ToolsModel toolsModel

Definition at line 18 of file main.cpp.

Referenced by CImgAreaWindow::cancelDrawing(), CTextEditWindow::DoFillBack(), RubberTool::draw(), BrushTool::draw(), AirBrushTool::draw(), LineTool::draw(), BezierTool::draw(), RectTool::draw(), ShapeTool::draw(), EllipseTool::draw(), RRectTool::draw(), ImageModel::DrawSelectionBackground(), CImgAreaWindow::finishDrawing(), CSelectionWindow::ForceRefreshSelectionContents(), nearlyEqualPoints(), ZoomTool::OnButtonDown(), ColorTool::OnButtonUp(), TextTool::OnButtonUp(), CSelectionWindow::OnCaptureChanged(), CToolBox::OnCommand(), CMainWindow::OnCommand(), CFontsDialog::OnCommand(), CImgAreaWindow::OnEraseBkGnd(), CTextEditWindow::OnEraseBkGnd(), TextTool::OnFinishDraw(), CFontsDialog::OnFontName(), CFontsDialog::OnFontSize(), CMainWindow::OnInitMenuPopup(), CTextEditWindow::OnKeyDown(), CImgAreaWindow::OnLButtonDblClk(), CScrollboxWindow::OnLButtonDown(), CToolSettingsWindow::OnLButtonDown(), CImgAreaWindow::OnLButtonDown(), CSizeboxWindow::OnLButtonUp(), CSelectionWindow::OnLButtonUp(), CImgAreaWindow::OnLButtonUp(), CImgAreaWindow::OnMouseLeave(), CSelectionWindow::OnMouseMove(), CImgAreaWindow::OnMouseMove(), CMainWindow::OnMouseWheel(), CToolSettingsWindow::OnPaint(), CImgAreaWindow::OnPaint(), CImgAreaWindow::OnRButtonDblClk(), CImgAreaWindow::OnRButtonDown(), CImgAreaWindow::OnRButtonUp(), CImgAreaWindow::OnSetCursor(), CToolBox::OnToolsModelToolChanged(), CToolSettingsWindow::OnToolsModelZoomChanged(), UnZoomed(), Zoomed(), and zoomTo().