ReactOS  0.4.14-dev-614-gbfd8a84
mainwnd.c
Go to the documentation of this file.
1 #include <precomp.h>
2 
3 static const TCHAR szMainWndClass[] = TEXT("ImageSoftWndClass");
4 
5 #define ID_MDI_FIRSTCHILD 50000
6 #define ID_MDI_WINDOWMENU 5
7 #define NUM_FLT_WND 3
8 
9 /* toolbar buttons */
11 /* iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString */
12  {TBICON_NEW, ID_NEW, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* new */
13  {TBICON_OPEN, ID_OPEN, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* open */
14  {TBICON_SAVE, ID_SAVE, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* save */
15 
16  {10, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */
17 
18  {TBICON_PRINT, ID_PRINTPRE, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* print */
19  {TBICON_PRINTPRE, ID_PRINT, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* print preview */
20 
21  {10, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */
22 
23  {TBICON_CUT, ID_CUT, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* cut */
24  {TBICON_COPY, ID_COPY, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* copy */
25  {TBICON_PASTE, ID_PASTE, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* paste */
26 
27  {10, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */
28 
29  {TBICON_UNDO, ID_UNDO, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* undo */
30  {TBICON_REDO, ID_REDO, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* redo */
31 
32  {10, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0},
33 };
34 
36  {10, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */
37 
38  {TBICON_BOLD, ID_BOLD, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_CHECK, {0}, 0, 0}, /* bold */
39  {TBICON_ITALIC, ID_ITALIC, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_CHECK, {0}, 0, 0}, /* italic */
40  {TBICON_ULINE, ID_ULINE, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_CHECK, {0}, 0, 0}, /* underline */
41 
42  {10, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */
43 
46  {TBICON_TXTRIGHT, ID_TXTRIGHT, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0 }, /* right justified */
47 
48  {10, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */
49 };
50 
51 
52 
53 /* menu hints */
54 static const MENU_HINT MainMenuHintTable[] = {
55  /* File Menu */
67 
68  /* view menu */
73 
74  /* Window Menu */
80 };
81 
82 static const MENU_HINT SystemMenuHintTable[] = {
90 };
91 
92 
93 /* Toolbars */
94 #define ID_TOOLBAR_STANDARD 0
95 #define ID_TOOLBAR_TEXT 1
96 static const TCHAR szToolbarStandard[] = TEXT("STANDARD");
97 static const TCHAR szToolbarText[] = TEXT("TEXT");
98 
99 
100 /* Test Toolbar */
101 #define ID_TOOLBAR_TEST 5
102 static const TCHAR szToolbarTest[] = TEXT("TEST");
103 
104 /* Toolbars table */
105 static const DOCKBAR MainDockBars[] = {
109 };
110 
111 
112 static BOOL CALLBACK
114  const DOCKBAR *Dockbar,
115  PVOID Context,
116  HWND hParent,
117  HWND *hwnd)
118 {
119  const TBBUTTON *Buttons = NULL;
120  UINT NumButtons = 0;
121  UINT StartImageRes = 0;
122  HWND hWndClient = NULL;
123 
125 
126  switch (Dockbar->BarId)
127  {
128  case ID_TOOLBAR_STANDARD:
129  {
131  NumButtons = sizeof(StdButtons) / sizeof(StdButtons[0]);
132  StartImageRes = IDB_MAINNEWICON;
133  break;
134  }
135 
136  case ID_TOOLBAR_TEXT:
137  {
139  NumButtons = sizeof(TextButtons) / sizeof(TextButtons[0]);
140  StartImageRes = IDB_TEXTBOLD;
141  break;
142  }
143 
144  case ID_TOOLBAR_TEST:
145  {/*
146  hWndClient = CreateWindowEx(WS_EX_TOOLWINDOW,
147  TEXT("BUTTON"),
148  TEXT("Test Button"),
149  WS_CHILD | WS_VISIBLE,
150  0,
151  0,
152  150,
153  25,
154  hParent,
155  NULL,
156  hInstance,
157  NULL);*/
158  break;
159  }
160  }
161 
162  if (Buttons != NULL)
163  {
164  hWndClient = CreateWindowEx(0,
166  NULL,
170  0,
171  0,
172  0,
173  0,
174  hParent,
175  NULL,
176  hInstance,
177  NULL);
178  if (hWndClient != NULL)
179  {
180  HIMAGELIST hImageList;
181 
182  SendMessage(hWndClient,
184  0,
186 
187  SendMessage(hWndClient,
189  sizeof(Buttons[0]),
190  0);
191 
192  SendMessage(hWndClient,
194  0,
196 
197  hImageList = InitImageList(NumButtons,
198  StartImageRes);
199 
202  0,
203  (LPARAM)hImageList));
204 
205  SendMessage(hWndClient,
207  NumButtons,
208  (LPARAM)Buttons);
209 
210  }
211  }
212 
213  switch (Dockbar->BarId)
214  {
215  case ID_TOOLBAR_TEXT:
216  {
217  HWND hFontType;
218  HWND hFontSize;
219 
220  /* font selection combo */
221  hFontType = CreateWindowEx(0,
222  WC_COMBOBOX,
223  NULL,
225  CBS_DROPDOWN | CBS_SORT | CBS_HASSTRINGS, //| CBS_OWNERDRAWFIXED,
226  0, 0, 120, 0,
227  hParent,
228  NULL,
229  hInstance,
230  NULL);
231 
232  if (hFontType != NULL)
233  {
234  MakeFlatCombo(hFontType);
235 
236  SetParent(hFontType,
237  hWndClient);
238 
239  if (!ToolbarInsertSpaceForControl(hWndClient,
240  hFontType,
241  0,
243  TRUE))
244  {
245  DestroyWindow(hFontType);
246  }
247 
248  /* Create the list of fonts */
249  FillFontStyleComboList(hFontType);
250  }
251 
252  /* font size combo */
253  hFontSize = CreateWindowEx(0,
254  WC_COMBOBOX,
255  NULL,
257  0, 0, 50, 0,
258  hParent,
259  NULL,
260  hInstance,
261  NULL);
262  if (hFontSize != NULL)
263  {
264  MakeFlatCombo(hFontSize);
265 
266  SetParent(hFontSize,
267  hWndClient);
268 
269  if (!ToolbarInsertSpaceForControl(hWndClient,
270  hFontSize,
271  1,
273  TRUE))
274  {
275  DestroyWindow(hFontSize);
276  }
277 
278  /* Update the font-size-list */
279  FillFontSizeComboList(hFontSize);
280  }
281  break;
282  }
283  }
284 
285  if (hWndClient != NULL)
286  {
287  *hwnd = hWndClient;
288  return TRUE;
289  }
290 
291  return FALSE;
292 }
293 
294 static BOOL CALLBACK
296  const DOCKBAR *Dockbar,
297  PVOID Context,
298  HWND hwnd)
299 {
300  UNREFERENCED_PARAMETER(TbDocks);
303 
305  return TRUE;
306 }
307 
308 static BOOL CALLBACK
310  const DOCKBAR *Dockbar,
311  PVOID Context,
312  UINT *Index,
313  LPREBARBANDINFO rbi)
314 {
315  switch (rbi->wID)
316  {
317  case ID_TOOLBAR_TEXT:
318  case ID_TOOLBAR_STANDARD:
319  {
320  SIZE Size;
321 
322  if (SendMessage(rbi->hwndChild,
324  0,
325  (LPARAM)&Size))
326  {
327  rbi->fStyle |= RBBS_USECHEVRON | RBBS_HIDETITLE;
328  rbi->fMask |= RBBIM_SIZE | RBBIM_CHILDSIZE | RBBIM_IDEALSIZE;
329  rbi->cx = rbi->cxIdeal = Size.cx;
330  rbi->cxMinChild = 0;
331  rbi->cyMinChild = Size.cy;
332  }
333  break;
334  }
335 
336  case ID_TOOLBAR_TEST:
337  {
338  RECT rcBtn;
339 
340  if (GetWindowRect(rbi->hwndChild,
341  &rcBtn))
342  {
343  rbi->fStyle |= RBBS_HIDETITLE;
344  rbi->fMask |= RBBIM_SIZE | RBBIM_CHILDSIZE;
345  rbi->cx = rcBtn.right - rcBtn.left;
346  rbi->cxMinChild = 0;
347  rbi->cyMinChild = rcBtn.bottom - rcBtn.top;
348  }
349  break;
350  }
351  }
352  return TRUE;
353 }
354 
355 static VOID
357  HWND hWndControl,
358  BOOL Vert)
359 {
360  /* the toolbar changed from horizontal to vertical or vice versa... */
361  return;
362 }
363 
364 static VOID CALLBACK
366  const DOCKBAR *Dockbar,
367  PVOID Context,
368  DOCK_POSITION DockFrom,
369  DOCK_POSITION DockTo,
370  LPREBARBANDINFO rbi)
371 {
372  if (rbi->fMask & RBBIM_CHILD && rbi->hwndChild != NULL)
373  {
374  switch (rbi->wID)
375  {
376  case ID_TOOLBAR_TEXT:
377  case ID_TOOLBAR_STANDARD:
378  {
379  SIZE Size;
380  BOOL Vert;
381  DWORD dwStyle = (DWORD)SendMessage(rbi->hwndChild,
382  TB_GETSTYLE,
383  0,
384  0);
385  switch (DockTo)
386  {
387  case LEFT_DOCK:
388  case RIGHT_DOCK:
389  dwStyle |= CCS_VERT | TBSTYLE_WRAPABLE;
390  Vert = TRUE;
391  break;
392 
393  default:
394  dwStyle &= ~(CCS_VERT | TBSTYLE_WRAPABLE);
395  Vert = FALSE;
396  break;
397  }
398 
399  SendMessage(rbi->hwndChild,
400  TB_SETSTYLE,
401  0,
402  (LPARAM)dwStyle);
403 
404  ToolbarUpdateControlSpaces(rbi->hwndChild,
406 
407  if (SendMessage(rbi->hwndChild,
409  0,
410  (LPARAM)&Size))
411  {
412  rbi->fMask |= RBBIM_SIZE | RBBIM_CHILDSIZE | RBBIM_IDEALSIZE;
413  rbi->cx = rbi->cxIdeal = (Vert ? Size.cy : Size.cx);
414  rbi->cxMinChild = 0;
415  rbi->cyMinChild = (Vert ? Size.cx : Size.cy);
416  }
417  break;
418  }
419 
420  case ID_TOOLBAR_TEST:
421  {
422  if (DockTo == NO_DOCK)
423  {
424  rbi->fMask |= RBBIM_SIZE | RBBIM_CHILDSIZE | RBBIM_IDEALSIZE;
425  rbi->cx = rbi->cxIdeal = 150;
426  rbi->cxMinChild = 0;
427  rbi->cyMinChild = 40;
428  }
429  break;
430  }
431  }
432  }
433 }
434 
435 static VOID CALLBACK
437  const DOCKBAR *Dockbar,
438  PVOID Context,
439  HWND hwndChild,
440  LPNMREBARCHEVRON lpnm)
441 {
442  switch (lpnm->wID)
443  {
444  case ID_TOOLBAR_STANDARD:
445  {
447  HWND_DESKTOP,
448  (LPPOINT)&lpnm->rc,
449  2);
450  /* Create a popup menu for all toolbar icons hidden */
451  break;
452  }
453  }
454 }
455 
456 static VOID
458  PRECT wndOldPos)
459 {
460  RECT wndNewPos, TbRect;
461  INT i, xMoved, yMoved;
462  PFLT_WND WndArr[NUM_FLT_WND];
463 
464  if (GetWindowRect(Info->hSelf,
465  &wndNewPos))
466  {
467 
468  xMoved = wndNewPos.left - wndOldPos->left;
469  yMoved = wndNewPos.top - wndOldPos->top;
470 
471  /* store the pointers in an array */
472  WndArr[0] = Info->fltTools;
473  WndArr[1] = Info->fltColors;
474  WndArr[2] = Info->fltHistory;
475 
476  for (i = 0; i < NUM_FLT_WND; i++)
477  {
478  GetWindowRect(WndArr[i]->hSelf,
479  &TbRect);
480 
481  WndArr[i]->x = TbRect.left + xMoved;
482  WndArr[i]->y = TbRect.top + yMoved;
483 
484  MoveWindow(WndArr[i]->hSelf,
485  WndArr[i]->x,
486  WndArr[i]->y,
487  WndArr[i]->Width,
488  WndArr[i]->Height,
489  TRUE);
490  }
491 
492  CopyMemory(wndOldPos,
493  &wndNewPos,
494  sizeof(RECT));
495  }
496 }
497 
498 
499 static VOID
501 {
502  RECT rect;
503 
504  if (GetWindowRect(Info->hMdiClient,
505  &rect))
506  {
507 
508  /* tools datum */
509  MoveWindow(Info->fltTools->hSelf,
510  rect.left + 5,
511  rect.top + 5,
512  Info->fltTools->Width,
513  Info->fltTools->Height,
514  TRUE);
515 
516  /* colors datum */
517  MoveWindow(Info->fltColors->hSelf,
518  rect.left + 5,
519  rect.bottom - Info->fltColors->Height - 5,
520  Info->fltColors->Width,
521  Info->fltColors->Height,
522  TRUE);
523 
524  /* history datum */
525  MoveWindow(Info->fltHistory->hSelf,
526  rect.right - Info->fltHistory->Width - 5,
527  rect.top + 5,
528  Info->fltHistory->Width,
529  Info->fltHistory->Height,
530  TRUE);
531  }
532 }
533 
534 static VOID
536 {
537  RECT rect;
538  HMENU hMenu;
539  UINT Res;
540  PFLT_WND WndArr[NUM_FLT_WND]; /* temp array for looping */
541  INT i;
542 
543  Info->fltTools = HeapAlloc(ProcessHeap,
545  sizeof(FLT_WND));
546  Info->fltColors = HeapAlloc(ProcessHeap,
548  sizeof(FLT_WND));
549  Info->fltHistory = HeapAlloc(ProcessHeap,
551  sizeof(FLT_WND));
552 
553  /* set window dimensions */
554  Info->fltTools->Width = 53;
555  Info->fltTools->Height = 300;
556  Info->fltColors->Width = 200;
557  Info->fltColors->Height = 200;
558  Info->fltHistory->Width = 150;
559  Info->fltHistory->Height = 150;
560 
561  if (! GetWindowRect(Info->hMdiClient,
562  &rect))
563  {
564  return;
565  }
566 
567  /* Set window datums */
568  Info->fltTools->x = rect.left + 5;
569  Info->fltTools->y = rect.top + 5;
570 
571  Info->fltColors->x = rect.left + 5;
572  Info->fltColors->y = rect.bottom - Info->fltColors->Height - 5;
573 
574  Info->fltHistory->x = rect.right - Info->fltHistory->Width - 5;
575  Info->fltHistory->y = rect.top + 5;
576 
577  /* save pointers into array incrementing within the loop*/
578  WndArr[0] = Info->fltTools;
579  WndArr[1] = Info->fltColors;
580  WndArr[2] = Info->fltHistory;
581 
582  for (i = 0, Res = IDS_FLT_TOOLS; Res < IDS_FLT_TOOLS + NUM_FLT_WND; Res++, i++)
583  {
584  if (! AllocAndLoadString(&WndArr[i]->lpName,
585  hInstance,
586  Res))
587  {
588  WndArr[i]->lpName = NULL;
589  }
590 
592  TEXT("ImageSoftFloatWndClass"),
593  WndArr[i]->lpName,
595  WndArr[i]->x,
596  WndArr[i]->y,
597  WndArr[i]->Width,
598  WndArr[i]->Height,
599  Info->hSelf,
600  NULL,
601  hInstance,
602  WndArr[i]);
603  ShowWindow(WndArr[i]->hSelf, SW_HIDE);
604  }
605 
606  hMenu = GetMenu(Info->hSelf);
607 
608  if (Info->fltTools->hSelf != NULL)
609  {
611  {
612  CheckMenuItem(hMenu,
613  ID_TOOLS,
614  MF_CHECKED);
615 
616  ShowHideWindow(Info->fltTools->hSelf);
617  }
618  }
619 
620  if (Info->fltColors->hSelf != NULL)
621  {
623  {
624 
625  }
626  }
627 
628  if (Info->fltHistory->hSelf != NULL)
629  {
631  {
632 
633  }
634  }
635 
636 }
637 
638 static VOID
640 {
641  if (Info->fltTools != NULL)
642  HeapFree(ProcessHeap, 0, Info->fltTools);
643 
644  if (Info->fltColors != NULL)
645  HeapFree(ProcessHeap, 0, Info->fltColors);
646 
647  if (Info->fltHistory != NULL)
648  HeapFree(ProcessHeap, 0, Info->fltHistory);
649 }
650 
651 
652 
659 };
660 
661 static VOID
663 {
664  UINT i;
665 
666  for (i = 0; i < sizeof(MainDockBars) / sizeof(MainDockBars[0]); i++)
667  {
668  /* FIXME - lookup whether to display the toolbar */
669  TbdAddToolbar(&Info->ToolDocks,
670  &MainDockBars[i],
671  Info,
673  }
674 
676 }
677 
678 static VOID CALLBACK
680  LONG cx,
681  LONG cy)
682 {
683  RECT rcClient = {0};
684  RECT rcStatus = {0};
685  HDWP dwp;
686  INT DocksVisible;
688 
689  /* Calculate the MDI client rectangle */
690  rcClient.right = cx;
691  rcClient.bottom = cy;
692 
693  if (Info->hStatus != NULL)
694  {
695  GetWindowRect(Info->hStatus,
696  &rcStatus);
697  rcClient.bottom -= (rcStatus.bottom - rcStatus.top);
698  }
699 
700  /* Adjust the client rect if docked toolbars are visible */
701  DocksVisible = TbdAdjustUpdateClientRect(&Info->ToolDocks,
702  &rcClient);
703 
704  dwp = BeginDeferWindowPos(2 + DocksVisible);
705  if (dwp != NULL)
706  {
707  /* Update the toolbar docks */
708  if (DocksVisible != 0)
709  {
710  dwp = TbdDeferDocks(dwp,
711  &Info->ToolDocks);
712  if (dwp == NULL)
713  return;
714  }
715 
716  /* Update the MDI client */
717  if (Info->hMdiClient != NULL)
718  {
719  dwp = DeferWindowPos(dwp,
720  Info->hMdiClient,
721  NULL,
722  rcClient.left,
723  rcClient.top,
724  rcClient.right - rcClient.left,
725  rcClient.bottom - rcClient.top,
726  SWP_NOZORDER);
727  if (dwp == NULL)
728  return;
729  }
730 
731  /* Update the status bar */
732  if (Info->hStatus != NULL)
733  {
734  dwp = DeferWindowPos(dwp,
735  Info->hStatus,
736  NULL,
737  0,
738  cy - (rcStatus.bottom - rcStatus.top),
739  cx,
740  rcStatus.bottom - rcStatus.top,
741  SWP_NOZORDER);
742  if (dwp == NULL)
743  return;
744  }
745 
746  EndDeferWindowPos(dwp);
747  }
748 }
749 
750 static VOID
752 {
753  CLIENTCREATESTRUCT ccs;
754  INT statwidths[] = {110, -1};
755 
756  /* FIXME - create controls and initialize the application */
757 
758  /* create the status bar */
759  Info->hStatus = CreateWindowEx(0,
761  NULL,
763  0,
764  0,
765  0,
766  0,
767  Info->hSelf,
769  hInstance,
770  NULL);
771 
772  if (Info->hStatus != NULL)
773  SendMessage(Info->hStatus,
774  SB_SETPARTS,
775  sizeof(statwidths)/sizeof(int),
776  (LPARAM)statwidths);
777 
778  /* create the MDI client window */
779  ccs.hWindowMenu = GetSubMenu(GetMenu(Info->hSelf),
783  TEXT("MDICLIENT"),
784  NULL,
786  0,
787  0,
788  0,
789  0,
790  Info->hSelf,
791  NULL,
792  hInstance,
793  &ccs);
794 
795  TbdInitializeDocks(&Info->ToolDocks,
796  Info->hSelf,
797  Info,
798  MainWndResize);
799 
801 
802  /* initialize file open/save structure */
803  FileInitialize(Info->hSelf);
804 }
805 
806 static VOID
808  WORD CmdId,
809  HWND hControl)
810 {
811  static TCHAR szFileName[MAX_PATH];
812  static TCHAR szImageName[MAX_PATH];
813 
814  UNREFERENCED_PARAMETER(hControl);
815 
816  switch (CmdId)
817  {
818  case ID_NEW:
819  {
820  MessageBox(NULL, _T("Not yet implemented"), NULL, 0);
821  }
822  break;
823 
824  case ID_OPEN:
825  {
826  OPEN_IMAGE_EDIT_INFO OpenInfo;
827 
828  if (DoOpenFile(Info->hSelf,
829  szFileName, /* full file path */
830  szImageName)) /* file name */
831  {
832  OpenInfo.CreateNew = FALSE;
833 
834  OpenInfo.Open.lpImagePath = szFileName;
835  OpenInfo.lpImageName = szImageName;
836 
838  &OpenInfo);
839 
840  /* FIXME: move flt wnd's if scroll bars show
841  MainWndResetFloatingWindows(Info->hMdiClient); */
842  }
843 
844  }
845  break;
846 
847  case ID_TOOLS:
848  {
849  HMENU hMenu = GetMenu(Info->hSelf);
850 
851  if (hMenu != NULL)
852  {
853  UINT uCheck = MF_CHECKED;
854 
855  if (ShowHideWindow(Info->fltTools->hSelf))
856  uCheck = MF_UNCHECKED;
857 
858  CheckMenuItem(hMenu,
859  ID_TOOLS,
860  uCheck);
861  }
862  }
863  break;
864 
865  case ID_COLOR:
866  {
867  HMENU hMenu = GetMenu(Info->hSelf);
868 
869  if (hMenu != NULL)
870  {
871  UINT uCheck = MF_CHECKED;
872 
873  if (ShowHideWindow(Info->fltColors->hSelf))
874  uCheck = MF_UNCHECKED;
875 
876  CheckMenuItem(hMenu,
877  ID_COLOR,
878  uCheck);
879  }
880  }
881  break;
882 
883  case ID_HISTORY:
884  {
885  HMENU hMenu = GetMenu(Info->hSelf);
886 
887  if (hMenu != NULL)
888  {
889  UINT uCheck = MF_CHECKED;
890 
891  if (ShowHideWindow(Info->fltHistory->hSelf))
892  uCheck = MF_UNCHECKED;
893 
894  CheckMenuItem(hMenu,
895  ID_HISTORY,
896  uCheck);
897  }
898  }
899  break;
900 
901  case ID_BRIGHTNESS:
904  Info->hSelf,
906  (LPARAM)Info);
907  break;
908 
909  case ID_CONTRAST:
910  /* FIXME : Create a window for contrast */
911  break;
912 
913  case ID_BLACKANDWHITE:
914  {
915  if (Info->ImageEditors)
916  {
917  DisplayBlackAndWhite(Info->ImageEditors->hSelf,
918  Info->ImageEditors->hDCMem,
919  Info->ImageEditors->hBitmap);
920  }
921  }
922  break;
923 
924  case ID_INVERTCOLORS:
925  {
926  if (Info->ImageEditors)
927  {
928  DisplayInvertedColors(Info->ImageEditors->hSelf,
929  Info->ImageEditors->hDCMem,
930  Info->ImageEditors->hBitmap);
931  }
932  }
933  break;
934 
935  case ID_BLUR:
936  {
937  if (Info->ImageEditors)
938  {
939  DisplayBlur(Info->ImageEditors->hSelf,
940  Info->ImageEditors->hDCMem,
941  Info->ImageEditors->hBitmap);
942  }
943  }
944  break;
945 
946  case ID_SHARPEN:
947  {
948  if (Info->ImageEditors)
949  {
950  DisplaySharpness(Info->ImageEditors->hSelf,
951  Info->ImageEditors->hDCMem,
952  Info->ImageEditors->hBitmap);
953  }
954  }
955  break;
956 
957  case ID_EXIT:
958  SendMessage(Info->hSelf,
959  WM_CLOSE,
960  0,
961  0);
962  break;
963 
964  /* Window Menu */
965  case ID_WINDOW_TILE_HORZ:
966  SendMessage(Info->hMdiClient,
967  WM_MDITILE,
969  0);
970  break;
971 
972  case ID_WINDOW_TILE_VERT:
973  SendMessage(Info->hMdiClient,
974  WM_MDITILE,
976  0);
977  break;
978 
979  case ID_WINDOW_CASCADE:
980  SendMessage(Info->hMdiClient,
982  0,
983  0);
984  break;
985 
986  case ID_WINDOW_ARRANGE:
987  SendMessage(Info->hMdiClient,
989  0,
990  0);
991  break;
992 
993  case ID_WINDOW_NEXT:
994  SendMessage(Info->hMdiClient,
995  WM_MDINEXT,
996  0,
997  0);
998  break;
999 
1000  /* Help Menu */
1001  case ID_ABOUT:
1004  Info->hSelf,
1005  AboutDialogProc);
1006  break;
1007  }
1008 }
1009 
1010 static VOID
1012 {
1013  /* FIXME - cleanup allocated resources */
1014 
1016 }
1017 
1018 
1019 static VOID
1021 {
1022  if (Info->hStatus != NULL)
1023  {
1024  SendMessage(Info->hStatus,
1025  SB_SIMPLE,
1026  (WPARAM)Info->InMenuLoop,
1027  0);
1028  }
1029 }
1030 
1031 static BOOL
1033  WORD CmdId,
1034  const MENU_HINT *HintArray,
1035  DWORD HintsCount,
1036  UINT DefHintId)
1037 {
1038  BOOL Found = FALSE;
1039  const MENU_HINT *LastHint;
1040  UINT HintId = DefHintId;
1041 
1042  LastHint = HintArray + HintsCount;
1043  while (HintArray != LastHint)
1044  {
1045  if (HintArray->CmdId == CmdId)
1046  {
1047  HintId = HintArray->HintId;
1048  Found = TRUE;
1049  break;
1050  }
1051  HintArray++;
1052  }
1053 
1054  StatusBarLoadString(Info->hStatus,
1055  SB_SIMPLEID,
1056  hInstance,
1057  HintId);
1058 
1059  return Found;
1060 }
1061 
1062 static LRESULT CALLBACK
1064  UINT uMsg,
1065  WPARAM wParam,
1066  LPARAM lParam)
1067 {
1069  LRESULT Ret = 0;
1070  static BOOL bLBMouseDown = FALSE;
1071  static RECT wndOldPos;
1072 
1073  /* Get the window context */
1075  GWLP_USERDATA);
1076  if (Info == NULL && uMsg != WM_CREATE)
1077  {
1078  goto HandleDefaultMessage;
1079  }
1080 
1081  switch (uMsg)
1082  {
1083  case WM_SIZE:
1084  {
1086  LOWORD(lParam),
1087  HIWORD(lParam));
1088  /* NOTE - do *not* forward this message to DefFrameProc! Otherwise the MDI client
1089  will attempt to resize itself */
1090 
1091  /* reposition the floating toolbars */
1092  if ((wParam == SIZE_MAXIMIZED) || (wParam == SIZE_RESTORED))
1094 
1095  break;
1096  }
1097 
1098  case WM_NCLBUTTONDOWN:
1099  bLBMouseDown = TRUE;
1101  uMsg,
1102  wParam,
1103  lParam);
1104  break;
1105 
1106  case WM_NCLBUTTONUP:
1107 
1108  bLBMouseDown = FALSE;
1110  uMsg,
1111  wParam,
1112  lParam);
1113  break;
1114 
1115  case WM_MOVE:
1116  {
1117  /* if the main window is moved, move the toolbars too */
1118  if (bLBMouseDown)
1119  MainWndMoveFloatingWindows(Info, &wndOldPos);
1120  }
1121  break;
1122 
1123  case WM_NOTIFY:
1124  {
1125  UINT BarId;
1126  LPNMHDR pnmhdr = (LPNMHDR)lParam;
1127  if (!TbdHandleNotifications(&Info->ToolDocks,
1128  pnmhdr,
1129  &Ret))
1130  {
1131  if (TbdDockBarIdFromClientWindow(&Info->ToolDocks,
1132  pnmhdr->hwndFrom,
1133  &BarId))
1134  {
1135  switch (BarId)
1136  {
1137  case ID_TOOLBAR_TEXT:
1138  switch (pnmhdr->code)
1139  {
1140  case TBN_DELETINGBUTTON:
1141  {
1142  LPNMTOOLBAR lpnmtb = (LPNMTOOLBAR)lParam;
1143 
1145  &lpnmtb->tbButton);
1146  break;
1147  }
1148  }
1149  break;
1150  }
1151  }
1152  }
1153  break;
1154  }
1155 
1156  case WM_COMMAND:
1157  {
1159  LOWORD(wParam),
1160  (HWND)lParam);
1161  goto HandleDefaultMessage;
1162  }
1163 
1164  case WM_MENUSELECT:
1165  {
1166  if (Info->hStatus != NULL)
1167  {
1168  if (!MainWndMenuHint(Info,
1169  LOWORD(wParam),
1171  sizeof(MainMenuHintTable) / sizeof(MainMenuHintTable[0]),
1172  IDS_HINT_BLANK))
1173  {
1175  LOWORD(wParam),
1177  sizeof(SystemMenuHintTable) / sizeof(SystemMenuHintTable[0]),
1178  IDS_HINT_BLANK);
1179  }
1180  }
1181  break;
1182  }
1183 
1184  case WM_ENTERMENULOOP:
1185  {
1186  Info->InMenuLoop = TRUE;
1188  break;
1189  }
1190 
1191  case WM_EXITMENULOOP:
1192  {
1193  Info->InMenuLoop = FALSE;
1195  break;
1196  }
1197 
1198  case WM_CLOSE:
1199  {
1201  break;
1202  }
1203 
1204  case WM_ENABLE:
1205  {
1206  TbdHandleEnabling(&Info->ToolDocks,
1207  hwnd,
1208  (BOOL)wParam);
1209  goto HandleDefaultMessage;
1210  }
1211 
1212  case WM_NCACTIVATE:
1213  {
1214  TbdHandleActivation(&Info->ToolDocks,
1215  hwnd,
1216  &wParam,
1217  &lParam);
1218  goto HandleDefaultMessage;
1219  }
1220 
1221  case WM_ACTIVATEAPP:
1222  {
1223  //TbdShowFloatingToolbars(&Info->ToolDocks,
1224  // (BOOL)wParam);
1225  goto HandleDefaultMessage;
1226  }
1227 
1228  case WM_CREATE:
1229  {
1230  Info = (PMAIN_WND_INFO)(((LPCREATESTRUCT)lParam)->lpCreateParams);
1231 
1232  /* Initialize the main window context */
1233  Info->hSelf = hwnd;
1234 
1236  GWLP_USERDATA,
1237  (LONG_PTR)Info);
1238 
1239  InitMainWnd(Info);
1240 
1241  /* Show the window */
1242  ShowWindow(hwnd,
1243  Info->nCmdShow);
1244  /* get the windows position */
1246  &wndOldPos);
1247 
1248  break;
1249  }
1250 
1251  case WM_DESTROY:
1252  {
1254 
1256  0,
1257  Info);
1259  GWLP_USERDATA,
1260  0);
1261 
1262  /* Break the message queue loop */
1263  PostQuitMessage(0);
1264  break;
1265  }
1266 
1267  default:
1268  {
1269 HandleDefaultMessage:
1270  if (Info != NULL && Info->hMdiClient != NULL)
1271  {
1272  Ret = DefFrameProc(hwnd,
1273  Info->hMdiClient,
1274  uMsg,
1275  wParam,
1276  lParam);
1277  }
1278  else
1279  {
1280  Ret = DefWindowProc(hwnd,
1281  uMsg,
1282  wParam,
1283  lParam);
1284  }
1285  break;
1286  }
1287  }
1288 
1289  return Ret;
1290 }
1291 
1294  PVOID *Info)
1295 {
1296  MDI_EDITOR_TYPE EditorType;
1297 
1298  if (MainWnd->ActiveEditor != NULL)
1299  {
1300  EditorType = *((PMDI_EDITOR_TYPE)MainWnd->ActiveEditor);
1301  *Info = MainWnd->ActiveEditor;
1302  }
1303  else
1304  {
1305  EditorType = metUnknown;
1306  *Info = NULL;
1307  }
1308 
1309  return EditorType;
1310 }
1311 
1312 VOID
1314  HWND hDeactivate,
1315  HWND hActivate)
1316 {
1317  PMDI_EDITOR_TYPE EditorType;
1318 
1319  /* FIXME - optimize light weight switching
1320  when switching from and to an editor of same type */
1321 
1322  if (hDeactivate != NULL)
1323  {
1324  EditorType = (PMDI_EDITOR_TYPE)GetWindowLongPtr(hDeactivate,
1325  GWLP_USERDATA);
1326  if (EditorType != NULL)
1327  {
1328  switch (*EditorType)
1329  {
1330  case metImageEditor:
1332  FALSE);
1333  break;
1334 
1335  default:
1336  break;
1337  }
1338 
1339  Info->ActiveEditor = NULL;
1340  }
1341  }
1342 
1343  if (hActivate != NULL)
1344  {
1345  EditorType = (PMDI_EDITOR_TYPE)GetWindowLongPtr(hActivate,
1346  GWLP_USERDATA);
1347  if (EditorType != NULL)
1348  {
1349  Info->ActiveEditor = EditorType;
1350 
1351  switch (*EditorType)
1352  {
1353  case metImageEditor:
1355  TRUE);
1356  break;
1357 
1358  default:
1359  break;
1360  }
1361  }
1362  }
1363 }
1364 
1365 HWND
1367  int nCmdShow)
1368 {
1370  HWND hMainWnd = NULL;
1371 
1373  0,
1374  sizeof(MAIN_WND_INFO));
1375  if (Info != NULL)
1376  {
1377  ZeroMemory(Info,
1378  sizeof(MAIN_WND_INFO));
1379  Info->nCmdShow = nCmdShow;
1380 
1381  /* FIXME - load the window position from the registry */
1382 
1385  lpCaption,
1387  CW_USEDEFAULT,
1388  CW_USEDEFAULT,
1389  CW_USEDEFAULT,
1390  CW_USEDEFAULT,
1391  NULL,
1392  NULL,
1393  hInstance,
1394  Info);
1395  if (hMainWnd == NULL)
1396  {
1398  0,
1399  Info);
1400  }
1401  }
1402 
1403  return hMainWnd;
1404 }
1405 
1406 BOOL
1408  LPMSG lpMsg)
1409 {
1411 
1412  /* Get the window context */
1414  GWLP_USERDATA);
1415  if (Info != NULL && Info->hMdiClient != NULL)
1416  {
1417  return TranslateMDISysAccel(Info->hMdiClient,
1418  lpMsg);
1419  }
1420 
1421  return FALSE;
1422 }
1423 
1424 BOOL
1426 {
1427  WNDCLASSEX wc = {0};
1428 
1429  wc.cbSize = sizeof(WNDCLASSEX);
1430  wc.lpfnWndProc = MainWndProc;
1431  wc.hInstance = hInstance;
1432  wc.hIcon = LoadIcon(hInstance,
1434  wc.hCursor = LoadCursor(NULL,
1435  IDC_ARROW);
1436  wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
1441  IMAGE_ICON,
1442  16,
1443  16,
1444  LR_SHARED);
1445 
1446  return RegisterClassEx(&wc) != (ATOM)0;
1447 }
1448 
1449 VOID
1451 {
1453  hInstance);
1454 }
#define IDS_TOOLBAR_TEXT
Definition: resource.h:296
#define ID_MDI_WINDOWMENU
Definition: mainwnd.c:6
#define WM_NCLBUTTONDOWN
Definition: winuser.h:1674
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define IDS_HINT_EXIT
Definition: resource.h:96
#define WS_POPUPWINDOW
Definition: pedump.c:638
#define ID_STATUSBAR
Definition: resource.h:42
#define IDS_HINT_BLANK
Definition: resource.h:94
#define ID_TOOLBAR_TEST
Definition: mainwnd.c:101
#define ID_TXTLEFT
Definition: resource.h:53
#define CBS_SORT
Definition: winuser.h:292
#define ID_TXTRIGHT
Definition: resource.h:55
#define LPNMTOOLBAR
Definition: commctrl.h:1453
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
HWND hSelf
Definition: precomp.h:46
#define IDR_MAINMENU
Definition: resource.h:40
#define TBICON_SAVE
Definition: resource.h:33
MDI_EDITOR_TYPE MainWndGetCurrentEditor(PMAIN_WND_INFO MainWnd, PVOID *Info)
Definition: mainwnd.c:1293
static HICON
Definition: imagelist.c:84
HDWP WINAPI BeginDeferWindowPos(_In_ int)
#define TB_BUTTONSTRUCTSIZE
Definition: commctrl.h:1130
LPCSTR lpszMenuName
Definition: winuser.h:3185
#define TRUE
Definition: types.h:120
#define IDS_HINT_STATUS
Definition: resource.h:115
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
#define LR_SHARED
Definition: winuser.h:1090
#define IMAGE_ICON
Definition: winuser.h:212
#define IDC_STATUSBAR
Definition: resource.h:14
#define IDD_BRIGHTNESS
Definition: resource.h:254
#define RegisterClassEx
Definition: winuser.h:5812
#define RBBIM_CHILD
Definition: commctrl.h:1502
static const TCHAR szToolbarTest[]
Definition: mainwnd.c:102
static VOID CALLBACK MainWndResize(PVOID Context, LONG cx, LONG cy)
Definition: mainwnd.c:679
#define SC_RESTORE
Definition: winuser.h:2573
UINT HintId
Definition: precomp.h:87
#define IDS_HINT_TOOLS
Definition: resource.h:112
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
HCURSOR hCursor
Definition: winuser.h:3183
WNDPROC lpfnWndProc
Definition: winuser.h:3178
#define TBSTYLE_EX_HIDECLIPPEDBUTTONS
Definition: commctrl.h:1009
#define ID_TXTFONTSIZE
Definition: resource.h:57
#define IDS_TOOLBAR_STANDARD
Definition: resource.h:294
BOOL FloatToolbarCreateHistoryGui(PMAIN_WND_INFO Info)
Definition: floatwindow.c:278
LPCSTR lpszClassName
Definition: winuser.h:3186
WORD ATOM
Definition: dimm.idl:113
#define SIZE_MAXIMIZED
Definition: winuser.h:2482
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define ID_BLACKANDWHITE
Definition: resource.h:84
TBBUTTON TextButtons[]
Definition: mainwnd.c:35
#define SW_HIDE
Definition: winuser.h:762
#define TBICON_BOLD
Definition: resource.h:198
HWND WINAPI SetParent(_In_ HWND, _In_opt_ HWND)
INT y
Definition: precomp.h:49
struct _OPEN_IMAGE_EDIT_INFO::@1520::@1523 Open
static VOID MainWndCreateFloatWindows(PMAIN_WND_INFO Info)
Definition: mainwnd.c:535
#define ID_COPY
Definition: resource.h:31
#define TB_SETSTYLE
Definition: commctrl.h:1154
#define SIZE_RESTORED
Definition: winuser.h:2480
#define WM_MDICASCADE
Definition: winuser.h:1801
PVOID ActiveEditor
Definition: mainwnd.h:25
#define CALLBACK
Definition: compat.h:27
_In_ LPCSTR lpName
Definition: winbase.h:2746
VOID ToolbarUpdateControlSpaces(HWND hWndToolbar, ToolbarChangeControlCallback ChangeCallback)
Definition: misc.c:240
#define ID_BOLD
Definition: resource.h:50
BOOL ToolbarInsertSpaceForControl(HWND hWndToolbar, HWND hWndControl, INT Index, INT iCmd, BOOL HideVertical)
Definition: misc.c:297
LONG top
Definition: windef.h:307
#define WS_DLGFRAME
Definition: pedump.c:626
#define IDS_HINT_SAVE
Definition: resource.h:105
#define ZeroMemory
Definition: winbase.h:1642
#define WM_MOVE
Definition: winuser.h:1592
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define TBICON_PASTE
Definition: resource.h:194
#define TBICON_REDO
Definition: resource.h:196
UINT_PTR WPARAM
Definition: windef.h:207
#define ID_WINDOW_TILE_VERT
Definition: resource.h:49
#define WS_CHILD
Definition: pedump.c:617
HICON hIconSm
Definition: winuser.h:3187
LONG left
Definition: windef.h:306
#define SWP_NOZORDER
Definition: winuser.h:1232
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define TB_GETMAXSIZE
Definition: commctrl.h:1185
static BOOL CALLBACK MainWndToolbarInsertBand(struct _TOOLBAR_DOCKS *TbDocks, const DOCKBAR *Dockbar, PVOID Context, UINT *Index, LPREBARBANDINFO rbi)
Definition: mainwnd.c:309
static INT AllocAndLoadString(OUT LPTSTR *lpTarget, IN HINSTANCE hInst, IN UINT uID)
Definition: misc.c:60
#define WS_CLIPCHILDREN
Definition: pedump.c:619
LONG right
Definition: windef.h:308
BOOL DisplayBlur(HWND hwnd, HDC hdcMem, HBITMAP hBitmap)
Definition: adjust.c:196
#define STATUSCLASSNAME
Definition: commctrl.h:1935
BOOL WINAPI DestroyWindow(_In_ HWND)
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define DWORD
Definition: nt_native.h:44
int32_t INT
Definition: typedefs.h:56
#define SetWindowLongPtr
Definition: treelist.c:70
& rect
Definition: startmenu.cpp:1413
WPARAM wParam
Definition: combotst.c:138
#define ID_PRINTPRE
Definition: resource.h:27
BOOL FloatToolbarCreateColorsGui(PMAIN_WND_INFO Info)
Definition: floatwindow.c:170
struct TraceInfo Info
#define IDS_HINT_SYS_MINIMIZE
Definition: resource.h:123
struct tagNMHDR * LPNMHDR
#define WM_ENABLE
Definition: winuser.h:1597
#define DefFrameProc
Definition: ros2win.h:32
#define CCS_VERT
Definition: commctrl.h:2245
#define TBICON_OPEN
Definition: resource.h:188
#define ID_UNDO
Definition: resource.h:34
VOID FileInitialize(IN HWND hwnd)
Definition: opensave.c:13
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
#define IDS_HINT_OPEN
Definition: resource.h:102
static VOID FillFontStyleComboList(HWND hwndCombo)
Definition: charmap.c:77
UINT code
Definition: winuser.h:3134
static const TCHAR szMainWndClass[]
Definition: mainwnd.c:3
#define DialogBox
Definition: winuser.h:5736
#define RBBIM_SIZE
Definition: commctrl.h:1504
#define CCS_NODIVIDER
Definition: commctrl.h:2244
#define WM_MDIICONARRANGE
Definition: winuser.h:1802
static VOID MainWndCommand(PMAIN_WND_INFO Info, WORD CmdId, HWND hControl)
Definition: mainwnd.c:807
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
static VOID CALLBACK MainWndToolbarDockBand(struct _TOOLBAR_DOCKS *TbDocks, const DOCKBAR *Dockbar, PVOID Context, DOCK_POSITION DockFrom, DOCK_POSITION DockTo, LPREBARBANDINFO rbi)
Definition: mainwnd.c:365
#define WM_NCACTIVATE
Definition: winuser.h:1670
HINSTANCE hInstance
Definition: winuser.h:3181
#define ID_SHARPEN
Definition: resource.h:87
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
static VOID DoOpenFile(PINFO pInfo)
Definition: connectdialog.c:34
#define ID_BLANK
Definition: resource.h:43
#define WM_ENTERMENULOOP
Definition: winuser.h:1786
#define IDD_ABOUTBOX
Definition: resource.h:8
#define MDITILE_HORIZONTAL
Definition: winuser.h:2163
#define ID_TXTCENTER
Definition: resource.h:54
BOOL WINAPI EndDeferWindowPos(_In_ HDWP)
#define WM_MENUSELECT
Definition: winuser.h:1729
#define SB_SIMPLEID
Definition: precomp.h:15
#define CreateWindowEx
Definition: winuser.h:5730
#define SC_MAXIMIZE
Definition: winuser.h:2563
#define CW_USEDEFAULT
Definition: winuser.h:225
#define GWLP_USERDATA
Definition: treelist.c:63
#define TBICON_NEW
Definition: resource.h:187
#define SB_SIMPLE
Definition: commctrl.h:1954
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
#define IDB_MAINNEWICON
Definition: resource.h:136
#define TOOLBARCLASSNAME
Definition: commctrl.h:942
#define IDI_IMAGESOFTICON
Definition: resource.h:13
#define MAKELONG(a, b)
Definition: typedefs.h:248
WORD CmdId
Definition: precomp.h:86
#define WM_EXITMENULOOP
Definition: winuser.h:1787
#define TBICON_COPY
Definition: resource.h:193
static const TCHAR szToolbarStandard[]
Definition: mainwnd.c:96
smooth NULL
Definition: ftsmooth.c:416
#define WM_MDINEXT
Definition: winuser.h:1798
LONG_PTR LPARAM
Definition: windef.h:208
UINT cbSize
Definition: winuser.h:3176
#define CCS_NOPARENTALIGN
Definition: commctrl.h:2242
static const DOCKBAR MainDockBars[]
Definition: mainwnd.c:105
DOCK_POSITION
Definition: tooldock.h:2
#define ID_ABOUT
Definition: charmap.c:18
static INT_PTR CALLBACK AboutDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: about.c:15
#define RBBS_HIDETITLE
return Found
Definition: dirsup.c:1270
BOOL CreateImageEditWindow(PMAIN_WND_INFO MainWnd, POPEN_IMAGE_EDIT_INFO OpenInfo)
Definition: imgedwnd.c:459
#define WC_COMBOBOX
Definition: commctrl.h:4714
#define IDS_HINT_PRINT
Definition: resource.h:107
#define ID_SAVEAS
Definition: resource.h:26
#define TBICON_CUT
Definition: resource.h:192
#define CBS_HASSTRINGS
Definition: winuser.h:285
HBRUSH hbrBackground
Definition: winuser.h:3184
VOID TbdInitializeDocks(PTOOLBAR_DOCKS TbDocks, HWND hWndParent, PVOID Context, PDOCKBAR_PARENTRESIZE ParentResizeProc)
Definition: tooldock.c:1064
#define DefWindowProc
Definition: ros2win.h:31
#define WM_DESTROY
Definition: winuser.h:1591
UINT BarId
Definition: tooldock.h:13
#define ID_WINDOW_CASCADE
Definition: resource.h:79
#define MF_CHECKED
Definition: winuser.h:132
#define TB_SETIMAGELIST
Definition: commctrl.h:1146
char TCHAR
Definition: xmlstorage.h:189
#define IDS_HINT_SYS_MOVE
Definition: resource.h:121
#define TBICON_PRINT
Definition: resource.h:34
BOOL MainWndTranslateMDISysAccel(HWND hwnd, LPMSG lpMsg)
Definition: mainwnd.c:1407
#define _T(x)
Definition: vfdio.h:22
#define ID_CLOSE
Definition: resource.h:23
HDWP WINAPI DeferWindowPos(_In_ HDWP, _In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
INT_PTR CALLBACK BrightnessProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: brightness.c:313
#define BTNS_SEP
Definition: commctrl.h:995
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static VOID MainWndMoveFloatingWindows(PMAIN_WND_INFO Info, PRECT wndOldPos)
Definition: mainwnd.c:457
static BOOL CALLBACK MainWndDestroyToolbarClient(struct _TOOLBAR_DOCKS *TbDocks, const DOCKBAR *Dockbar, PVOID Context, HWND hwnd)
Definition: mainwnd.c:295
HDWP TbdDeferDocks(HDWP hWinPosInfo, PTOOLBAR_DOCKS TbDocks)
Definition: tooldock.c:71
#define SBARS_SIZEGRIP
Definition: commctrl.h:1919
#define TB_BMP_WIDTH
Definition: precomp.h:20
#define WM_SIZE
Definition: winuser.h:1593
#define MDITILE_VERTICAL
Definition: winuser.h:2164
#define IDS_HINT_NEXT
Definition: resource.h:121
#define IDS_HINT_CLOSE
Definition: resource.h:103
static VOID TbCustomControlChange(HWND hWndToolbar, HWND hWndControl, BOOL Vert)
Definition: mainwnd.c:356
#define ID_OPEN
Definition: resource.h:22
#define TBICON_ITALIC
Definition: resource.h:199
#define IDS_HINT_CLOSEALL
Definition: resource.h:104
TBBUTTON StdButtons[]
Definition: mainwnd.c:10
BOOL FloatToolbarCreateToolsGui(PMAIN_WND_INFO Info)
Definition: floatwindow.c:55
#define WM_CLOSE
Definition: winuser.h:1603
#define ID_HISTORY
Definition: resource.h:41
VOID FillFontSizeComboList(HWND hwndCombo)
Definition: font.c:83
#define MAX_PATH
Definition: compat.h:26
struct _MAIN_WND_INFO * PMAIN_WND_INFO
#define CopyMemory
Definition: winbase.h:1640
static const UCHAR Index[8]
Definition: usbohci.c:18
static const TCHAR szToolbarText[]
Definition: mainwnd.c:97
unsigned short WORD
Definition: ntddk_ex.h:93
#define IDS_HINT_SYS_RESTORE
Definition: resource.h:120
static VOID CALLBACK MainWndToolbarChevronPushed(struct _TOOLBAR_DOCKS *TbDocks, const DOCKBAR *Dockbar, PVOID Context, HWND hwndChild, LPNMREBARCHEVRON lpnm)
Definition: mainwnd.c:436
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ID_ITALIC
Definition: resource.h:51
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
static VOID InitMainWnd(PMAIN_WND_INFO Info)
Definition: mainwnd.c:751
#define TBSTYLE_TOOLTIPS
Definition: commctrl.h:985
#define ID_COLOR
Definition: definitions.h:121
#define RBBIM_CHILDSIZE
Definition: commctrl.h:1503
#define IDS_HINT_PROP
Definition: resource.h:108
VOID UninitMainWindowImpl(VOID)
Definition: mainwnd.c:987
#define ID_SAVE
Definition: resource.h:25
#define WS_HSCROLL
Definition: pedump.c:628
#define TB_BMP_HEIGHT
Definition: precomp.h:21
#define CCS_NORESIZE
Definition: commctrl.h:2241
#define ID_CONTRAST
Definition: resource.h:83
BOOL DisplayInvertedColors(HWND hwnd, HDC hdcMem, HBITMAP hBitmap)
Definition: adjust.c:102
#define IDS_HINT_CASCADE
Definition: resource.h:117
#define IDS_HINT_SYS_SIZE
Definition: resource.h:122
#define DialogBoxParam
Definition: winuser.h:5739
#define ID_WINDOW_TILE_HORZ
Definition: resource.h:48
HWND hMainWnd
Definition: magnifier.c:32
#define NUM_FLT_WND
Definition: mainwnd.c:7
static VOID DestroyMainWnd(PMAIN_WND_INFO Info)
Definition: mainwnd.c:1011
#define LPREBARBANDINFO
Definition: commctrl.h:1566
HICON hIcon
Definition: winuser.h:3182
INT TbdAdjustUpdateClientRect(PTOOLBAR_DOCKS TbDocks, PRECT rcClient)
Definition: tooldock.c:44
enum _MDI_EDITOR_TYPE MDI_EDITOR_TYPE
VOID TbdHandleActivation(PTOOLBAR_DOCKS TbDocks, HWND hWnd, WPARAM *wParam, LPARAM *lParam)
Definition: tooldock.c:992
#define COLOR_BTNFACE
Definition: winuser.h:918
HIMAGELIST InitImageList(UINT StartResource, UINT EndResource, UINT Width, UINT Height, ULONG type)
Definition: misc.c:219
#define IDS_HINT_COLORS
Definition: resource.h:113
#define TB_ADDBUTTONS
Definition: commctrl.h:1267
const DOCKBAR PVOID HWND hParent
Definition: tooldock.h:22
#define IDS_HINT_PRINTPRE
Definition: resource.h:108
#define TB_SETBITMAPSIZE
Definition: commctrl.h:1132
#define IDS_HINT_ARRANGE
Definition: resource.h:120
#define ID_NEW
Definition: resource.h:21
#define RBBS_USECHEVRON
Definition: commctrl.h:1494
#define MessageBox
Definition: winuser.h:5797
BOOL ShowHideWindow(HWND hwnd)
Definition: floatwindow.c:45
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define IDB_TEXTBOLD
Definition: resource.h:147
#define WM_COMMAND
Definition: winuser.h:1722
static const MENU_HINT MainMenuHintTable[]
Definition: mainwnd.c:54
#define ID_REDO
Definition: resource.h:35
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
VOID MakeFlatCombo(HWND hwndCombo)
Definition: custcombo.c:199
HWND hwndFrom
Definition: winuser.h:3132
#define MF_UNCHECKED
Definition: winuser.h:204
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
#define ID_WINDOW_ARRANGE
Definition: resource.h:52
#define TBICON_PRINTPRE
Definition: resource.h:191
#define LoadCursor
Definition: winuser.h:5787
#define ID_ULINE
Definition: resource.h:52
#define ID_EXIT
Definition: resource.h:10
static VOID MainWndDestroyFloatWindows(PMAIN_WND_INFO Info)
Definition: mainwnd.c:639
#define ID_TOOLS
Definition: resource.h:39
HANDLE ProcessHeap
Definition: servman.c:15
#define ID_BLUR
Definition: resource.h:86
#define SC_MINIMIZE
Definition: winuser.h:2561
#define IDS_FLT_TOOLS
Definition: resource.h:8
#define ID_BRIGHTNESS
Definition: resource.h:82
#define TEXT(s)
Definition: k32.h:26
#define ID_PRINT
Definition: wordpad.h:39
#define WM_ACTIVATEAPP
Definition: winuser.h:1614
#define IDS_HINT_SAVEAS
Definition: resource.h:106
#define ID_TXTFONTNAME
Definition: resource.h:56
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define TBSTATE_CHECKED
Definition: commctrl.h:968
#define TBICON_TXTRIGHT
Definition: resource.h:203
static const DOCKBAR_ITEM_CALLBACKS MainWndDockBarCallbacks
Definition: mainwnd.c:653
#define ID_WINDOW_NEXT
Definition: resource.h:51
static const MENU_HINT SystemMenuHintTable[]
Definition: mainwnd.c:82
#define IDS_HINT_TILE_VERT
Definition: resource.h:119
HINSTANCE hInstance
Definition: mainwnd.c:15
#define CBS_DROPDOWN
Definition: winuser.h:283
#define SC_SIZE
Definition: winuser.h:2559
static BOOL MainWndMenuHint(PMAIN_WND_INFO Info, WORD CmdId, const MENU_HINT *HintArray, DWORD HintsCount, UINT DefHintId)
Definition: mainwnd.c:1032
BOOL TbdHandleNotifications(PTOOLBAR_DOCKS TbDocks, LPNMHDR pnmh, LRESULT *Result)
Definition: tooldock.c:291
#define ID_PROP
Definition: resource.h:17
BOOL TbdDockBarIdFromClientWindow(PTOOLBAR_DOCKS TbDocks, HWND hWndClient, UINT *Id)
Definition: tooldock.c:267
#define ID_PASTE
Definition: resource.h:32
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define TBICON_TXTCENTER
Definition: resource.h:202
#define HWND_DESKTOP
Definition: winuser.h:1195
unsigned int UINT
Definition: ndis.h:50
#define WS_VSCROLL
Definition: pedump.c:627
static VOID UpdateMainStatusBar(PMAIN_WND_INFO Info)
Definition: mainwnd.c:1020
static VOID MainWndResetFloatingWindows(PMAIN_WND_INFO Info)
Definition: mainwnd.c:500
#define IDS_HINT_SYS_MAXIMIZE
Definition: resource.h:124
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define SB_SETPARTS
Definition: commctrl.h:1950
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
VOID TbdHandleEnabling(PTOOLBAR_DOCKS TbDocks, HWND hWnd, BOOL Enable)
Definition: tooldock.c:972
#define TBICON_TXTLEFT
Definition: resource.h:201
#define ID_TOOLBAR_STANDARD
Definition: mainwnd.c:94
#define IDS_TOOLBAR_TEST
Definition: resource.h:295
static VOID CreateToolbars(PMAIN_WND_INFO Info)
Definition: mainwnd.c:662
#define IDC_ARROW
Definition: winuser.h:682
#define SC_MOVE
Definition: winuser.h:2560
_Out_opt_ int * cx
Definition: commctrl.h:581
#define SC_CLOSE
Definition: winuser.h:2567
#define TBICON_ULINE
Definition: resource.h:200
#define SendMessage
Definition: winuser.h:5818
#define IDS_HINT_HISTORY
Definition: resource.h:114
#define TBSTYLE_GROUP
Definition: commctrl.h:980
#define TBSTATE_ENABLED
Definition: commctrl.h:970
#define WM_CREATE
Definition: winuser.h:1590
#define CCS_NOMOVEY
Definition: commctrl.h:2239
#define TBSTYLE_WRAPABLE
Definition: commctrl.h:986
#define ID_TOOLBAR_TEXT
Definition: mainwnd.c:95
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define WM_NCLBUTTONUP
Definition: winuser.h:1675
#define HIWORD(l)
Definition: typedefs.h:246
static LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: mainwnd.c:1063
#define ID_CLOSEALL
Definition: resource.h:24
#define ID_INVERTCOLORS
Definition: resource.h:85
LONG bottom
Definition: windef.h:309
#define TBSTYLE_CHECK
Definition: commctrl.h:979
BOOL DisplaySharpness(HWND hwnd, HDC hdcMem, HBITMAP hBitmap)
Definition: adjust.c:357
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define LoadImage
Definition: winuser.h:5790
#define TB_GETSTYLE
Definition: commctrl.h:1155
#define IDS_HINT_TILE_HORZ
Definition: resource.h:118
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5694
#define SC_NEXTWINDOW
Definition: winuser.h:2565
#define LoadIcon
Definition: winuser.h:5788
#define GetWindowLongPtr
Definition: treelist.c:73
BOOL TbdAddToolbar(PTOOLBAR_DOCKS TbDocks, const DOCKBAR *Dockbar, PVOID Context, const DOCKBAR_ITEM_CALLBACKS *Callbacks)
Definition: tooldock.c:585
#define ID_MDI_FIRSTCHILD
Definition: mainwnd.c:5
enum _MDI_EDITOR_TYPE * PMDI_EDITOR_TYPE
BOOL InitMainWindowImpl(VOID)
Definition: mainwnd.c:961
#define WS_EX_ACCEPTFILES
Definition: pedump.c:648
LONG_PTR LRESULT
Definition: windef.h:209
INT x
Definition: precomp.h:48
VOID SetImageEditorEnvironment(PEDIT_WND_INFO Info, BOOL Setup)
Definition: imgedwnd.c:445
#define TBICON_UNDO
Definition: resource.h:195
#define WS_VISIBLE
Definition: pedump.c:620
#define UnregisterClass
Definition: winuser.h:5836
static BOOL CALLBACK MainWndCreateToolbarClient(struct _TOOLBAR_DOCKS *TbDocks, const DOCKBAR *Dockbar, PVOID Context, HWND hParent, HWND *hwnd)
Definition: mainwnd.c:113
HMENU WINAPI GetMenu(_In_ HWND)
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
BOOL ToolbarDeleteControlSpace(HWND hWndToolbar, const TBBUTTON *ptbButton)
Definition: misc.c:220
LPARAM lParam
Definition: combotst.c:139
#define ID_CUT
Definition: resource.h:30
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:402
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
VOID MainWndSwitchEditorContext(PMAIN_WND_INFO Info, HWND hDeactivate, HWND hActivate)
Definition: mainwnd.c:1313
LPTSTR lpName
Definition: precomp.h:47
static const TBBUTTON Buttons[]
Definition: mainwnd.c:17
BOOL WINAPI TranslateMDISysAccel(_In_ HWND, _In_ LPMSG)
#define RBBIM_IDEALSIZE
Definition: commctrl.h:1507
#define TBN_DELETINGBUTTON
Definition: commctrl.h:1334
#define TBSTYLE_FLAT
Definition: commctrl.h:988
#define TB_SETEXTENDEDSTYLE
Definition: commctrl.h:1186
#define WM_NOTIFY
Definition: richedit.h:61
BOOL StatusBarLoadString(IN HWND hStatusBar, IN INT PartId, IN HINSTANCE hInstance, IN UINT uID)
Definition: misc.c:150
HWND CreateMainWindow(LPCTSTR lpCaption, int nCmdShow)
Definition: mainwnd.c:920
#define WM_MDITILE
Definition: winuser.h:1800
#define IDS_HINT_NEW
Definition: resource.h:101
BOOL DisplayBlackAndWhite(HWND hwnd, HDC hdcMem, HBITMAP hBitmap)
Definition: adjust.c:5