ReactOS  0.4.14-dev-1233-gf5658fd
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
 
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 145 of file main.cpp.

146 {
147  HWND hwnd; /* This is the handle for our window */
148  MSG messages; /* Here messages to the application are saved */
149 
150  HMENU menu;
151  HACCEL haccel;
152 
153  TCHAR sfnFilename[1000];
154  TCHAR sfnFiletitle[256];
155  TCHAR ofnFilename[1000];
156  TCHAR ofnFiletitle[256];
157  TCHAR miniaturetitle[100];
158  static COLORREF custColors[16] = {
159  0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff,
160  0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff
161  };
162 
163  /* init font for text tool */
164  ZeroMemory(&lfTextFont, sizeof(lfTextFont));
165  lfTextFont.lfHeight = 0;
169 
170  hProgInstance = hThisInstance;
171 
172  /* initialize common controls library */
174 
176  CPath pathFileName(filepathname);
177  pathFileName.StripPath();
178  CString strTitle;
179  strTitle.Format(IDS_WINDOWTITLE, (LPCTSTR)pathFileName);
180  LoadString(hThisInstance, IDS_MINIATURETITLE, miniaturetitle, SIZEOF(miniaturetitle));
181 
182  /* load settings from registry */
186 
187  /* create main window */
188  RECT mainWindowPos = {0, 0, 544, 375}; // FIXME: use equivalent of CW_USEDEFAULT for position
189  hwnd = mainWindow.Create(HWND_DESKTOP, mainWindowPos, strTitle, WS_OVERLAPPEDWINDOW);
190 
191  RECT fullscreenWindowPos = {0, 0, 100, 100};
192  fullscreenWindow.Create(HWND_DESKTOP, fullscreenWindowPos, NULL, WS_POPUPWINDOW | WS_MAXIMIZE);
193 
197  miniature.Create(hwnd, miniaturePos, miniaturetitle,
199  miniature.ShowWindow(showMiniature ? SW_SHOW : SW_HIDE);
200 
201  /* loading and setting the window menu from resource */
202  menu = LoadMenu(hThisInstance, MAKEINTRESOURCE(ID_MENU));
203  SetMenu(hwnd, menu);
204  haccel = LoadAccelerators(hThisInstance, MAKEINTRESOURCE(800));
205 
206  /* preloading the draw transparent/nontransparent icons for later use */
209  hTranspIcon =
211 
212  hCurFill = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_FILL));
213  hCurColor = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_COLOR));
214  hCurZoom = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_ZOOM));
215  hCurPen = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_PEN));
217 
218  CreateWindowEx(0, _T("STATIC"), NULL, WS_CHILD | WS_VISIBLE | SS_ETCHEDHORZ, 0, 0, 5000, 2, hwnd, NULL,
219  hThisInstance, NULL);
220 
221  RECT toolBoxContainerPos = {2, 2, 2 + 52, 2 + 350};
222  toolBoxContainer.Create(hwnd, toolBoxContainerPos, NULL, WS_CHILD | WS_VISIBLE);
223  /* creating the tool settings child window */
224  RECT toolSettingsWindowPos = {5, 208, 5 + 42, 208 + 140};
225  toolSettingsWindow.Create(toolBoxContainer.m_hWnd, toolSettingsWindowPos, NULL, WS_CHILD | WS_VISIBLE);
226 
227  /* creating the palette child window */
228  RECT paletteWindowPos = {56, 9, 56 + 255, 9 + 32};
229  paletteWindow.Create(hwnd, paletteWindowPos, NULL, WS_CHILD | WS_VISIBLE);
230 
231  /* creating the scroll box */
232  RECT scrollboxWindowPos = {56, 49, 56 + 472, 49 + 248};
233  scrollboxWindow.Create(hwnd, scrollboxWindowPos, NULL,
235 
236  /* creating the status bar */
237  hStatusBar =
239  NULL, hThisInstance, NULL);
241 
242  RECT scrlClientWindowPos = {0, 0, 0 + 500, 0 + 500};
243  scrlClientWindow.Create(scrollboxWindow.m_hWnd, scrlClientWindowPos, NULL, WS_CHILD | WS_VISIBLE);
244 
245  /* create selection window (initially hidden) */
246  RECT selectionWindowPos = {350, 0, 350 + 100, 0 + 100};
247  selectionWindow.Create(scrlClientWindow.m_hWnd, selectionWindowPos, NULL, WS_CHILD | BS_OWNERDRAW);
248 
249  /* creating the window inside the scroll box, on which the image in hDrawingDC's bitmap is drawn */
250  RECT imageAreaPos = {3, 3, 3 + imageModel.GetWidth(), 3 + imageModel.GetHeight()};
251  imageArea.Create(scrlClientWindow.m_hWnd, imageAreaPos, NULL, WS_CHILD | WS_VISIBLE);
252 
253  if (__argc >= 2)
254  {
256  HANDLE hFind = FindFirstFileW(__targv[1], &find);
257  if (hFind != INVALID_HANDLE_VALUE)
258  {
259  FindClose(hFind);
260 
261  // check the file size
262  if (find.nFileSizeHigh || find.nFileSizeLow)
263  {
264  // load it now
265  HBITMAP bmNew = NULL;
267  if (bmNew)
268  {
269  // valid bitmap file
271  imageModel.Insert(bmNew);
272  CPath pathFileName(filepathname);
273  pathFileName.StripPath();
274 
275  CString strTitle;
276  strTitle.Format(IDS_WINDOWTITLE, (LPCTSTR)pathFileName);
277  mainWindow.SetWindowText(strTitle);
278 
280 
281  isAFile = TRUE;
283  }
284  else
285  {
286  // cannot open and not empty
287  CStringW strText;
288  strText.Format(IDS_LOADERRORTEXT, __targv[1]);
289  MessageBoxW(NULL, strText, NULL, MB_ICONERROR);
290  }
291  }
292  else
293  {
294  // open the empty file
296  CPath pathFileName(filepathname);
297  pathFileName.StripPath();
298 
299  CString strTitle;
300  strTitle.Format(IDS_WINDOWTITLE, (LPCTSTR)pathFileName);
301  mainWindow.SetWindowText(strTitle);
302 
304 
305  isAFile = TRUE;
307  }
308  }
309  else
310  {
311  // does not exist
312  CStringW strText;
313  strText.Format(IDS_LOADERRORTEXT, __targv[1]);
314  MessageBoxW(NULL, strText, NULL, MB_ICONERROR);
315  }
316  }
317 
318  /* initializing the CHOOSECOLOR structure for use with ChooseColor */
322  choosecolor.rgbResult = 0x00ffffff;
323  choosecolor.lpCustColors = custColors;
324 
325  /* initializing the OPENFILENAME structure for use with GetOpenFileName and GetSaveFileName */
326  CopyMemory(ofnFilename, filepathname, sizeof(filepathname));
327  CString strImporters;
328  CSimpleArray<GUID> aguidFileTypesI;
329  CString strAllPictureFiles;
330  strAllPictureFiles.LoadString(hThisInstance, IDS_ALLPICTUREFILES);
331  CImage::GetImporterFilterString(strImporters, aguidFileTypesI, strAllPictureFiles, CImage::excludeDefaultLoad, _T('\0'));
332 // CAtlStringW strAllFiles;
333 // strAllFiles.LoadString(hThisInstance, IDS_ALLFILES);
334 // strImporters = strAllFiles + CAtlStringW(_T("|*.*|")).Replace('|', '\0') + strImporters;
335  ZeroMemory(&ofn, sizeof(OPENFILENAME));
336  ofn.lStructSize = sizeof(OPENFILENAME);
337  ofn.hwndOwner = hwnd;
338  ofn.hInstance = hThisInstance;
339  ofn.lpstrFilter = strImporters;
340  ofn.lpstrFile = ofnFilename;
341  ofn.nMaxFile = SIZEOF(ofnFilename);
342  ofn.lpstrFileTitle = ofnFiletitle;
343  ofn.nMaxFileTitle = SIZEOF(ofnFiletitle);
345  ofn.lpstrDefExt = L"bmp";
346 
347  CopyMemory(sfnFilename, filepathname, sizeof(filepathname));
348  CString strExporters;
349  CSimpleArray<GUID> aguidFileTypesE;
350  CImage::GetExporterFilterString(strExporters, aguidFileTypesE, NULL, CImage::excludeDefaultSave, _T('\0'));
351  ZeroMemory(&sfn, sizeof(OPENFILENAME));
352  sfn.lStructSize = sizeof(OPENFILENAME);
353  sfn.hwndOwner = hwnd;
354  sfn.hInstance = hThisInstance;
355  sfn.lpstrFilter = strExporters;
356  sfn.lpstrFile = sfnFilename;
357  sfn.nMaxFile = SIZEOF(sfnFilename);
358  sfn.lpstrFileTitle = sfnFiletitle;
359  sfn.nMaxFileTitle = SIZEOF(sfnFiletitle);
362  sfn.lpstrDefExt = L"bmp";
363 
364  /* creating the size boxes */
365  RECT sizeboxPos = {0, 0, 0 + 3, 0 + 3};
366  sizeboxLeftTop.Create(scrlClientWindow.m_hWnd, sizeboxPos, NULL, WS_CHILD | WS_VISIBLE);
367  sizeboxCenterTop.Create(scrlClientWindow.m_hWnd, sizeboxPos, NULL, WS_CHILD | WS_VISIBLE);
368  sizeboxRightTop.Create(scrlClientWindow.m_hWnd, sizeboxPos, NULL, WS_CHILD | WS_VISIBLE);
369  sizeboxLeftCenter.Create(scrlClientWindow.m_hWnd, sizeboxPos, NULL, WS_CHILD | WS_VISIBLE);
370  sizeboxRightCenter.Create(scrlClientWindow.m_hWnd, sizeboxPos, NULL, WS_CHILD | WS_VISIBLE);
371  sizeboxLeftBottom.Create(scrlClientWindow.m_hWnd, sizeboxPos, NULL, WS_CHILD | WS_VISIBLE);
372  sizeboxCenterBottom.Create(scrlClientWindow.m_hWnd, sizeboxPos, NULL, WS_CHILD | WS_VISIBLE);
373  sizeboxRightBottom.Create(scrlClientWindow.m_hWnd, sizeboxPos, NULL, WS_CHILD | WS_VISIBLE);
374  /* placing the size boxes around the image */
376 
377  /* by moving the window, the things in WM_SIZE are done */
379 
380  /* creating the text editor window for the text tool */
381  RECT textEditWindowPos = {300, 0, 300 + 300, 0 + 200};
382  textEditWindow.Create(hwnd, textEditWindowPos, NULL, WS_OVERLAPPEDWINDOW);
383 
384  /* Make the window visible on the screen */
385  ShowWindow (hwnd, nFunsterStil);
386 
387  /* inform the system, that the main window accepts dropped files */
389 
390  /* Run the message loop. It will run until GetMessage() returns 0 */
391  while (GetMessage(&messages, NULL, 0, 0))
392  {
394 
395  /* Translate virtual-key messages into character messages */
397  /* Send message to WindowProcedure */
399  }
400 
401  /* write back settings to registry */
406 
407  /* The program return-value is 0 - The value that PostQuitMessage() gave */
408  return messages.wParam;
409 }
#define WS_GROUP
Definition: pedump.c:633
#define OFN_EXPLORER
Definition: commdlg.h:104
#define WS_POPUPWINDOW
Definition: pedump.c:638
#define IDS_ALLPICTUREFILES
Definition: definitions.h:230
DWORD ThumbXPos
Definition: registry.h:25
#define WS_THICKFRAME
Definition: pedump.c:630
#define TranslateAccelerator
Definition: winuser.h:5835
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define DispatchMessage
Definition: winuser.h:5740
#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
#define TRUE
Definition: types.h:120
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
CToolSettingsWindow toolSettingsWindow
Definition: main.cpp:66
#define IMAGE_ICON
Definition: winuser.h:212
#define IDS_MINIATURETITLE
Definition: definitions.h:210
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 SW_HIDE
Definition: winuser.h:762
CHOOSECOLORA CHOOSECOLOR
Definition: commdlg.h:654
ImageModel imageModel
Definition: main.cpp:32
#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:1631
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:527
SYSTEMTIME fileTime
Definition: main.cpp:57
CSizeboxWindow sizeboxRightCenter
Definition: main.cpp:76
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
HCURSOR hCurColor
Definition: main.cpp:43
int fileVPPM
Definition: main.cpp:56
#define ZeroMemory
Definition: winbase.h:1648
LPCSTR lpstrDefExt
Definition: commdlg.h:345
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:688
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
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL SetWindowText(LPCTSTR lpszString)
Definition: atlwin.h:1232
#define DEFAULT_CHARSET
Definition: wingdi.h:383
#define STATUSCLASSNAME
Definition: commctrl.h:1935
COLORREF rgbResult
Definition: commdlg.h:242
DWORD nMaxFile
Definition: commdlg.h:337
static UINT_PTR APIENTRY OFNHookProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: main.cpp:110
CSizeboxWindow sizeboxCenterBottom
Definition: main.cpp:78
DWORD BMPHeight
Definition: registry.h:17
#define IDC_PEN
Definition: definitions.h:40
void Crop(int nWidth, int nHeight, int nOffsetX=0, int nOffsetY=0)
Definition: history.cpp:124
CToolBox toolBoxContainer
Definition: main.cpp:65
void SetMostRecentFile(LPCTSTR szPathName)
Definition: registry.cpp:146
CPaletteWindow paletteWindow
Definition: main.cpp:67
CHOOSECOLOR choosecolor
Definition: main.cpp:36
void LoadDIBFromFile(HBITMAP *hBitmap, LPCTSTR name, LPSYSTEMTIME time, int *size, int *hRes, int *vRes)
Definition: dib.cpp:84
CSizeboxWindow sizeboxLeftBottom
Definition: main.cpp:77
#define LoadAccelerators
Definition: winuser.h:5785
CFullscreenWindow fullscreenWindow
Definition: main.cpp:63
#define SIZEOF(_ar)
Definition: calc.h:97
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:347
void ClearHistory(void)
Definition: history.cpp:102
long LONG
Definition: pedump.c:60
LONG lfHeight
Definition: dimm.idl:42
#define IDS_LOADERRORTEXT
Definition: definitions.h:238
#define OFN_ENABLEHOOK
Definition: commdlg.h:99
#define CreateWindowEx
Definition: winuser.h:5730
#define IDC_COLOR
Definition: definitions.h:38
LONG lfWeight
Definition: dimm.idl:46
smooth NULL
Definition: ftsmooth.c:416
#define ID_MENU
Definition: definitions.h:48
#define IDI_NONTRANSPARENT
Definition: definitions.h:35
HFONT hfontTextFont
Definition: main.cpp:23
DWORD ShowThumbnail
Definition: registry.h:21
CSizeboxWindow sizeboxRightTop
Definition: main.cpp:74
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
void Insert(HBITMAP hbm)
Definition: history.cpp:108
HICON hTranspIcon
Definition: main.cpp:40
#define IDC_AIRBRUSH
Definition: definitions.h:41
BOOL SetWindowPlacement(const WINDOWPLACEMENT *lpwndpl)
Definition: atlwin.h:1214
WINDOWPLACEMENT WindowPlacement
Definition: registry.h:28
#define WS_CAPTION
Definition: pedump.c:624
char TCHAR
Definition: xmlstorage.h:189
CMiniatureWindow miniature
Definition: main.cpp:64
CMainWindow mainWindow
Definition: main.cpp:62
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
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
#define SBARS_SIZEGRIP
Definition: commctrl.h:1919
#define WM_SIZE
Definition: winuser.h:1593
HINSTANCE hProgInstance
Definition: main.cpp:50
BOOL WINAPI SetMenu(_In_ HWND, _In_opt_ HMENU)
DWORD COLORREF
Definition: windef.h:300
TCHAR filepathname[1000]
Definition: main.cpp:52
DWORD ThumbWidth
Definition: registry.h:24
DWORD lStructSize
Definition: commdlg.h:329
#define CopyMemory
Definition: winbase.h:1646
CSelectionWindow selectionWindow
Definition: main.cpp:70
#define IDC_FILL
Definition: definitions.h:37
BOOL showMiniature
Definition: main.cpp:60
CSizeboxWindow sizeboxRightBottom
Definition: main.cpp:79
#define WS_HSCROLL
Definition: pedump.c:628
BOOL isAFile
Definition: main.cpp:53
int GetWidth()
Definition: history.cpp:195
int GetHeight()
Definition: history.cpp:200
static const WCHAR L[]
Definition: oid.c:1250
HWND Create()
Definition: gui.cpp:1837
#define IDI_TRANSPARENT
Definition: definitions.h:34
#define MB_ICONERROR
Definition: winuser.h:781
CSizeboxWindow sizeboxCenterTop
Definition: main.cpp:73
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
HWND m_hWnd
Definition: atlwin.h:268
#define GetFullPathName
Definition: winbase.h:3661
DWORD ThumbYPos
Definition: registry.h:26
int fileHPPM
Definition: main.cpp:55
DWORD lStructSize
Definition: commdlg.h:239
CTextEditWindow textEditWindow
Definition: main.cpp:80
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define LoadMenu
Definition: winuser.h:5792
LPSTR lpstrFile
Definition: commdlg.h:336
int fileSize
Definition: main.cpp:54
#define OFN_OVERWRITEPROMPT
Definition: commdlg.h:116
HICON hNontranspIcon
Definition: main.cpp:39
HCURSOR hCurZoom
Definition: main.cpp:44
LPCSTR lpstrFilter
Definition: commdlg.h:332
#define HWND_DESKTOP
Definition: winuser.h:1195
OPENFILENAME sfn
Definition: main.cpp:38
HWND hwndOwner
Definition: commdlg.h:240
#define CreateFontIndirect
Definition: wingdi.h:4443
#define WS_VSCROLL
Definition: pedump.c:627
#define GetMessage
Definition: winuser.h:5765
LOGFONT lfTextFont
Definition: main.cpp:22
#define FW_NORMAL
Definition: wingdi.h:372
static TAGID TAGID find
Definition: db.cpp:153
_CRTIMP int __argc
Definition: getargs.c:21
#define SendMessage
Definition: winuser.h:5818
CImgAreaWindow imageArea
Definition: main.cpp:71
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1048
BOOL LoadString(_In_ UINT nID)
Definition: cstringt.h:526
CSizeboxWindow sizeboxLeftTop
Definition: main.cpp:72
#define LoadImage
Definition: winuser.h:5790
static HBITMAP
Definition: button.c:44
VOID WINAPI InitCommonControls(void)
Definition: commctrl.c:863
#define LoadIcon
Definition: winuser.h:5788
#define SB_SETMINHEIGHT
Definition: commctrl.h:1953
CScrollboxWindow scrlClientWindow
Definition: main.cpp:69
#define LR_DEFAULTCOLOR
Definition: winuser.h:1077
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_SYSMENU
Definition: pedump.c:629
CSizeboxWindow sizeboxLeftCenter
Definition: main.cpp:75
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define IDS_WINDOWTITLE
Definition: definitions.h:204
COLORREF * lpCustColors
Definition: commdlg.h:243
#define LoadString
Definition: winuser.h:5794
DWORD nMaxFileTitle
Definition: commdlg.h:339
CScrollboxWindow scrollboxWindow
Definition: main.cpp:68
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
#define IDS_DEFAULTFILENAME
Definition: definitions.h:209
#define WS_MAXIMIZE
Definition: pedump.c:623
DWORD Flags
Definition: commdlg.h:342
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502

◆ FileExtFromFilter()

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

Definition at line 84 of file main.cpp.

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

111 {
112  HWND hParent;
113  OFNOTIFY *pon;
114  switch (uMsg)
115  {
116  case WM_NOTIFY:
117  pon = (OFNOTIFY *)lParam;
118  if (pon->hdr.code == CDN_TYPECHANGE)
119  {
123  LPTSTR pchTitle = _tcsrchr(Path, _T('\\'));
124  if (pchTitle == NULL)
125  pchTitle = _tcsrchr(Path, _T('/'));
126 
127  LPTSTR pch = _tcsrchr((pchTitle ? pchTitle : Path), _T('.'));
128  if (pch && pchTitle)
129  {
130  pchTitle++;
131  *pch = 0;
132  FileExtFromFilter(pch, pchTitle, pon->lpOFN);
133  SendMessage(hParent, CDM_SETCONTROLTEXT, 0x047c, (LPARAM)pchTitle);
134  lstrcpyn(pon->lpOFN->lpstrFile, Path, pon->lpOFN->nMaxFile);
135  }
136  }
137  break;
138  }
139  return 0;
140 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define pch(ap)
Definition: match.c:418
DWORD nMaxFile
Definition: commdlg.h:337
UINT code
Definition: winuser.h:3134
#define SIZEOF(_ar)
Definition: calc.h:97
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
static BOOL FileExtFromFilter(LPTSTR pExt, LPCTSTR pTitle, OPENFILENAME *pOFN)
Definition: main.cpp:84
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 CDM_GETFILEPATH
Definition: commdlg.h:44
#define MAX_PATH
Definition: compat.h:26
const DOCKBAR PVOID HWND hParent
Definition: tooldock.h:22
#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 SendMessage
Definition: winuser.h:5818
_TCHAR * _tcsrchr(const _TCHAR *s, _XINT c)
Definition: tcsrchr.h:4
LPARAM lParam
Definition: combotst.c:139
#define WM_NOTIFY
Definition: richedit.h:61
#define lstrcpyn
Definition: winbase.h:3715

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 63 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(), and SelectionModel::DrawTextToolText().

◆ 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

◆ 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.

Referenced by SelectionModel::DrawTextToolText(), and CTextEditWindow::OnCommand().

◆ textToolTextMaxLen

int textToolTextMaxLen = 0

Definition at line 26 of file main.cpp.

Referenced by CTextEditWindow::OnCommand().

◆ toolBoxContainer

◆ toolSettingsWindow

◆ toolsModel