doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MEMainFrame.cpp
Go to the documentation of this file.
1 /*
2 ===========================================================================
3 
4 Doom 3 GPL Source Code
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
6 
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
8 
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13 
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
21 
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
23 
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
25 
26 ===========================================================================
27 */
28 #include "../../idlib/precompiled.h"
29 #pragma hdrstop
30 
31 #include "MaterialEditor.h"
32 #include "MEMainFrame.h"
33 #include "MaterialDef.h"
34 
35 #ifdef _DEBUG
36 #define new DEBUG_NEW
37 #endif
38 
39 #define TAB_CONTROL 0x1006
40 
41 IMPLEMENT_DYNAMIC(MEMainFrame, CFrameWnd)
42 
43 BEGIN_MESSAGE_MAP(MEMainFrame, CFrameWnd)
44  ON_WM_CREATE()
45  ON_WM_SETFOCUS()
46  ON_WM_DESTROY()
47  ON_WM_SIZE()
48 
49  ON_NOTIFY(TCN_SELCHANGE, TAB_CONTROL, OnTcnSelChange)
50 
51  ON_COMMAND(ID_ME_FILE_EXIT, OnFileExit)
52  ON_COMMAND(ID_ME_FILE_SAVEMATERIAL, OnFileSaveMaterial)
53  ON_COMMAND(ID_ME_FILE_SAVEFILE, OnFileSaveFile)
54  ON_COMMAND(ID_ME_FILE_SAVE, OnFileSaveAll)
55  ON_UPDATE_COMMAND_UI(ID_ME_FILE_SAVEMATERIAL, OnFileSaveMaterialUpdate )
56  ON_UPDATE_COMMAND_UI(ID_ME_FILE_SAVEFILE, OnFileSaveFileUpdate )
57  ON_UPDATE_COMMAND_UI(ID_ME_FILE_SAVE, OnFileSaveAllUpdate )
58 
59  ON_COMMAND(ID_ME_PREVIEW_APPLYCHANGES, OnApplyMaterial)
60  ON_COMMAND(ID_ME_PREVIEW_APPLYFILE, OnApplyFile)
61  ON_COMMAND(ID_ME_PREVIEW_APPLYALL, OnApplyAll)
62  ON_UPDATE_COMMAND_UI(ID_ME_PREVIEW_APPLYCHANGES, OnApplyMaterialUpdate )
63  ON_UPDATE_COMMAND_UI(ID_ME_PREVIEW_APPLYFILE, OnApplyFileUpdate )
64  ON_UPDATE_COMMAND_UI(ID_ME_PREVIEW_APPLYALL, OnApplyAllUpdate )
65 
66  ON_COMMAND(ID_ME_EDIT_CUT, OnEditCut)
67  ON_COMMAND(ID_ME_EDIT_COPY, OnEditCopy)
68  ON_COMMAND(ID_ME_EDIT_PASTE, OnEditPaste)
69  ON_COMMAND(ID_ME_EDIT_DELETE, OnEditDelete)
70  ON_COMMAND(ID_ME_EDIT_RENAME, OnEditRename)
71  ON_UPDATE_COMMAND_UI(ID_ME_EDIT_CUT, OnEditCutUpdate)
72  ON_UPDATE_COMMAND_UI(ID_ME_EDIT_COPY, OnEditCopyUpdate)
73  ON_UPDATE_COMMAND_UI(ID_ME_EDIT_PASTE, OnEditPasteUpdate)
74  ON_UPDATE_COMMAND_UI(ID_ME_EDIT_DELETE, OnEditDeleteUpdate)
75  ON_UPDATE_COMMAND_UI(ID_ME_EDIT_RENAME, OnEditRenameUpdate)
76 
77  ON_COMMAND(ID_ME_EDIT_FIND, OnEditFind)
78  ON_COMMAND(ID_ME_EDIT_FIND_NEXT, OnEditFindNext)
79 
80  ON_COMMAND(ID_ME_EDIT_UNDO, OnEditUndo)
81  ON_COMMAND(ID_ME_EDIT_REDO, OnEditRedo)
82  ON_UPDATE_COMMAND_UI(ID_ME_EDIT_UNDO, OnEditUndoUpdate )
83  ON_UPDATE_COMMAND_UI(ID_ME_EDIT_REDO, OnEditRedoUpdate )
84 
85  ON_COMMAND(ID_VIEW_INCLUDEFILENAME, OnViewIncludeFile)
86  ON_COMMAND(ID_PREVIEW_RELOADARBPROGRAMS, OnReloadArbPrograms)
87  ON_COMMAND(ID_PREVIEW_RELOADIMAGES, OnReloadImages )
88 END_MESSAGE_MAP()
89 
90 static UINT indicators[] =
91 {
92  ID_SEPARATOR, // status line indicator
93  ID_INDICATOR_CAPS,
94  ID_INDICATOR_NUM,
95  ID_INDICATOR_SCRL,
96 };
97 
102 
103  currentDoc = NULL;
104  m_find = NULL;
105 
106  searchData.searched = false;
107 
108  options.Load();
109 }
110 
115 }
116 
121 void MEMainFrame::PrintConsoleMessage(const char *msg) {
122  m_consoleView->AddText(msg);
123 }
124 
129  if( !CFrameWnd::PreCreateWindow(cs) )
130  return FALSE;
131 
132  cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
133  cs.lpszClass = AfxRegisterWndClass(0);
134 
135  return TRUE;
136 }
137 
142 BOOL MEMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) {
143  CCreateContext consoleContext;
144  consoleContext.m_pNewViewClass = RUNTIME_CLASS(ConsoleView);
145 
146  m_consoleView = (ConsoleView*)CreateView(&consoleContext);
147  m_consoleView->ShowWindow(SW_HIDE);
148 
149  m_tabs.Create(TCS_BOTTOM | TCS_FLATBUTTONS | WS_CHILD | WS_VISIBLE, CRect(0, 0, 0, 0), this, TAB_CONTROL);
150  m_tabs.InsertItem(0, "Editor");
151  m_tabs.InsertItem(1, "Console");
152  m_tabs.SetFont(materialEditorFont);
153 
154  m_splitterWnd.CreateStatic(this, 2, 1);
155 
156 
157  m_editSplitter.CreateStatic(&m_splitterWnd, 1, 2, WS_CHILD | WS_VISIBLE | WS_BORDER, m_splitterWnd.IdFromRowCol(0, 0));
158 
159  if(!m_editSplitter.CreateView(0, 0, RUNTIME_CLASS(MaterialTreeView), CSize(300, 200), pContext)) {
160  TRACE0("Failed to create material list pane\n");
161  return FALSE;
162  }
163 
164  if(!m_editSplitter.CreateView(0, 1, RUNTIME_CLASS(MaterialEditView), CSize(200, 200), pContext)) {
165  TRACE0("Failed to create stage property pane\n");
166  return FALSE;
167  }
168 
169 
170  m_previewSplitter.CreateStatic(&m_splitterWnd, 1, 2, WS_CHILD | WS_VISIBLE | WS_BORDER, m_splitterWnd.IdFromRowCol(1, 0));
171 
172  if(!m_previewSplitter.CreateView(0, 0, RUNTIME_CLASS(MaterialPreviewPropView), CSize(300, 200), pContext)) {
173  TRACE0("Failed to create preview property pane\n");
174  return FALSE;
175  }
176 
177  if(!m_previewSplitter.CreateView(0, 1, RUNTIME_CLASS(MaterialPreviewView), CSize(100, 200), pContext)) {
178  TRACE0("Failed to create preview pane\n");
179  return FALSE;
180  }
181 
182  //Get references to all of the views
186 
191 
192  //Load the splitter positions from the registry
193  int val = options.GetMaterialEditHeight();
194  if(val <= 0)
195  val = 300;
196  m_splitterWnd.SetRowInfo(0, val, 0);
197 
199  if(val <= 0)
200  val = 300;
201  m_editSplitter.SetColumnInfo(0, val, 0);
202 
203  val = options.GetStageWidth();
204  if(val <= 0)
205  val = 200;
206  m_materialEditSplitter->SetColumnInfo(0, val, 0);
207 
209  if(val <= 0)
210  val = 300;
211  m_previewSplitter.SetColumnInfo(0, val, 0);
212 
213 
214 
215  //Register the views with the document manager
222 
223  //Let the stage window know about the prop window
225 
226  //Let the preview props now about the preview window
230 
232 
233  //Some prop tree initialization
234  //m_materialPropertyView->InitializePropTreeDefs();
236  if(val <= 0)
237  val = 200;
240 
241 
243  if(val <= 0)
244  val = 120;
246 
247  //Build the material list
249 
250  SetActiveView(m_materialTreeView);
251 
252  return CFrameWnd::OnCreateClient(lpcs, pContext);
253 }
254 
260 int MEMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) {
261  if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
262  return -1;
263 
264 
265  if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
266  !m_wndToolBar.LoadToolBar(IDR_ME_MAINFRAME))
267  {
268  TRACE0("Failed to create toolbar\n");
269  return -1; // fail to create
270  }
271 
272 
273 
274  if (!m_wndStatusBar.Create(this) ||
275  !m_wndStatusBar.SetIndicators(indicators,
276  sizeof(indicators)/sizeof(UINT)))
277  {
278  TRACE0("Failed to create status bar\n");
279  return -1; // fail to create
280  }
281 
282  //Load the window placement from the options
283  options.GetWindowPlacement ( "mainframe", m_hWnd );
284 
285  return 0;
286 }
287 
293  CFrameWnd::OnDestroy();
294 
295  int cur;
296  int min;
297 
298  m_splitterWnd.GetRowInfo(0, cur, min);
300 
301  m_editSplitter.GetColumnInfo(0, cur, min);
303 
304  m_materialEditSplitter->GetColumnInfo(0, cur, min);
305  options.SetStageWidth(cur);
306 
307  m_previewSplitter.GetColumnInfo(0, cur, min);
309 
310 
313 
316 
317  options.SetWindowPlacement ( "mainframe", m_hWnd );
318  options.Save();
319 
321 
323 
324  AfxGetApp()->ExitInstance();
325 }
326 
332 void MEMainFrame::OnSize(UINT nType, int cx, int cy)
333 {
334  CFrameWnd::OnSize(nType, cx, cy);
335 
336  CRect statusRect;
337  m_wndStatusBar.GetWindowRect(statusRect);
338 
339  CRect toolbarRect;
340  m_wndToolBar.GetWindowRect(toolbarRect);
341 
342  CRect tabRect;
343  m_tabs.GetItemRect(0, tabRect);
344 
345  int tabHeight = tabRect.Height()+5;
346 
347  m_splitterWnd.MoveWindow(0, toolbarRect.Height(), cx, cy-statusRect.Height()-toolbarRect.Height()-tabHeight);
348 
349  m_tabs.MoveWindow(0, cy-statusRect.Height()-tabHeight, cx, tabHeight);
350 
351  m_consoleView->MoveWindow(0, toolbarRect.Height(), cx, cy-statusRect.Height()-toolbarRect.Height()-tabHeight);
352 }
353 
358 void MEMainFrame::OnTcnSelChange(NMHDR *pNMHDR, LRESULT *pResult) {
359 
360  int sel = m_tabs.GetCurSel();
361 
362  switch(sel) {
363  case 0:
364  m_splitterWnd.ShowWindow(SW_SHOW);
365  m_consoleView->ShowWindow(SW_HIDE);
366 
367  break;
368  case 1:
369  m_splitterWnd.ShowWindow(SW_HIDE);
370  m_consoleView->ShowWindow(SW_SHOW);
371 
372  CRect rect;
373  GetWindowRect(rect);
374  MoveWindow(rect);
375  break;
376  }
377 }
378 
384  PostMessage(WM_DESTROY, 0, 0);
385 }
386 
392  if(material) {
394  }
395 }
396 
401 
403  if(filename.Length() > 0) {
404  materialDocManager.SaveFile(filename);
405  }
406 }
407 
413 }
414 
419 
421 
422  if(pCmdUI->m_pMenu == NULL) {
423  pCmdUI->Enable(TRUE);
424  return;
425  }
426 
427  if(pDoc && pDoc->modified) {
428  pCmdUI->Enable(TRUE);
429 
430  } else {
431  pCmdUI->Enable(FALSE);
432  }
433 }
434 
438 void MEMainFrame::OnFileSaveFileUpdate(CCmdUI *pCmdUI) {
439 
440  if(pCmdUI->m_pMenu == NULL) {
441  pCmdUI->Enable(TRUE);
442  return;
443  }
444 
446  pCmdUI->Enable(TRUE);
447  } else {
448  pCmdUI->Enable(FALSE);
449  }
450 }
451 
455 void MEMainFrame::OnFileSaveAllUpdate(CCmdUI *pCmdUI) {
456 
457  if(pCmdUI->m_pMenu == NULL) {
458  pCmdUI->Enable(TRUE);
459  return;
460  }
461 
463  pCmdUI->Enable(TRUE);
464  } else {
465  pCmdUI->Enable(FALSE);
466  }
467 }
468 
474  if(material) {
476  }
477 }
478 
483 
485  if(filename.Length() > 0) {
486  materialDocManager.ApplyFile(filename);
487  }
488 }
489 
495 }
496 
502 
503  if(pCmdUI->m_pMenu == NULL) {
504  pCmdUI->Enable(TRUE);
505  return;
506  }
507 
508  if(pDoc && pDoc->applyWaiting) {
509  pCmdUI->Enable(TRUE);
510  } else {
511  pCmdUI->Enable(FALSE);
512  }
513 }
514 
519 void MEMainFrame::OnApplyFileUpdate(CCmdUI *pCmdUI) {
520 
521  if(pCmdUI->m_pMenu == NULL) {
522  pCmdUI->Enable(TRUE);
523  return;
524  }
525 
527 
529  pCmdUI->Enable(TRUE);
530  } else {
531  pCmdUI->Enable(FALSE);
532  }
533 }
534 
539 void MEMainFrame::OnApplyAllUpdate(CCmdUI *pCmdUI) {
540 
541  if(pCmdUI->m_pMenu == NULL) {
542  pCmdUI->Enable(TRUE);
543  return;
544  }
545 
547  pCmdUI->Enable(TRUE);
548  } else {
549  pCmdUI->Enable(FALSE);
550  }
551 }
552 
557  CWnd* focus = GetFocus();
558  if(focus) {
559  if (focus->IsKindOf(RUNTIME_CLASS(MaterialTreeView))) {
561  }
562  }
563 }
564 
569  CWnd* focus = GetFocus();
570  if(focus) {
571  if (focus->IsKindOf(RUNTIME_CLASS(StageView))) {
572  m_stageView->OnCopy();
573  } else if (focus->IsKindOf(RUNTIME_CLASS(MaterialTreeView))) {
575  }
576  }
577 }
578 
583  CWnd* focus = GetFocus();
584 
585  if(focus) {
586  if (focus->IsKindOf(RUNTIME_CLASS(StageView))) {
587  m_stageView->OnPaste();
588  } else if (focus->IsKindOf(RUNTIME_CLASS(MaterialTreeView))) {
590  }
591  }
592 }
593 
598  CWnd* focus = GetFocus();
599  if(focus) {
600  if (focus->IsKindOf(RUNTIME_CLASS(StageView))) {
602  } else if (focus->IsKindOf(RUNTIME_CLASS(MaterialTreeView))) {
604  }
605  }
606 }
607 
612  CWnd* focus = GetFocus();
613  if(focus) {
614  if (focus->IsKindOf(RUNTIME_CLASS(StageView))) {
616  } else if (focus->IsKindOf(RUNTIME_CLASS(MaterialTreeView))) {
618  }
619  }
620 }
621 
622 
626 void MEMainFrame::OnEditCutUpdate(CCmdUI *pCmdUI) {
627 
628  if(pCmdUI->m_pMenu == NULL) {
629  pCmdUI->Enable(TRUE);
630  return;
631  }
632 
633  BOOL enable = FALSE;
634 
635  CWnd* focus = GetFocus();
636  if(focus) {
637  if (focus->IsKindOf(RUNTIME_CLASS(StageView))) {
638  if(m_stageView->CanCut()) {
639  enable = TRUE;
640  }
641  } else if (focus->IsKindOf(RUNTIME_CLASS(MaterialTreeView))) {
642  if(m_materialTreeView->CanCut()) {
643  enable = TRUE;
644  }
645  } else if (focus->IsKindOf(RUNTIME_CLASS(CRichEditCtrl))) {
646  enable = TRUE;
647  }
648  }
649 
650  pCmdUI->Enable(enable);
651 }
652 
656 void MEMainFrame::OnEditCopyUpdate(CCmdUI *pCmdUI) {
657 
658  if(pCmdUI->m_pMenu == NULL) {
659  pCmdUI->Enable(TRUE);
660  return;
661  }
662 
663  BOOL enable = FALSE;
664 
665  CWnd* focus = GetFocus();
666  if(focus) {
667  if (focus->IsKindOf(RUNTIME_CLASS(StageView))) {
668  if(m_stageView->CanCopy()) {
669  enable = TRUE;
670  }
671  } else if (focus->IsKindOf(RUNTIME_CLASS(MaterialTreeView))) {
672  if(m_materialTreeView->CanCopy()) {
673  enable = TRUE;
674  }
675  } else if (focus->IsKindOf(RUNTIME_CLASS(CRichEditCtrl))) {
676  enable = TRUE;
677  }
678  }
679 
680  pCmdUI->Enable(enable);
681 }
682 
686 void MEMainFrame::OnEditPasteUpdate(CCmdUI *pCmdUI) {
687 
688  if(pCmdUI->m_pMenu == NULL) {
689  pCmdUI->Enable(TRUE);
690  return;
691  }
692 
693  BOOL enable = FALSE;
694 
695  CWnd* focus = GetFocus();
696  if(focus) {
697  if (focus->IsKindOf(RUNTIME_CLASS(StageView))) {
698  if(m_stageView->CanPaste()) {
699  enable = TRUE;
700  }
701  } else if (focus->IsKindOf(RUNTIME_CLASS(MaterialTreeView))) {
703  enable = TRUE;
704  }
705  } else if (focus->IsKindOf(RUNTIME_CLASS(CRichEditCtrl))) {
706  enable = TRUE;
707  }
708  }
709 
710  pCmdUI->Enable(enable);
711 }
712 
716 void MEMainFrame::OnEditDeleteUpdate(CCmdUI *pCmdUI) {
717 
718  if(pCmdUI->m_pMenu == NULL) {
719  pCmdUI->Enable(TRUE);
720  return;
721  }
722 
723  BOOL enable = FALSE;
724 
725  CWnd* focus = GetFocus();
726  if(focus) {
727  if (focus->IsKindOf(RUNTIME_CLASS(StageView))) {
728  if(m_stageView->CanDelete()) {
729  enable = TRUE;
730  }
731  } else if (focus->IsKindOf(RUNTIME_CLASS(MaterialTreeView))) {
733  enable = TRUE;
734  }
735  } else if (focus->IsKindOf(RUNTIME_CLASS(CRichEditCtrl))) {
736  enable = TRUE;
737  }
738 
739  }
740 
741  pCmdUI->Enable(enable);
742 }
743 
747 void MEMainFrame::OnEditRenameUpdate(CCmdUI *pCmdUI) {
748 
749  if(pCmdUI->m_pMenu == NULL) {
750  pCmdUI->Enable(TRUE);
751  return;
752  }
753 
754  BOOL enable = FALSE;
755 
756  CWnd* focus = GetFocus();
757  if(focus) {
758  if (focus->IsKindOf(RUNTIME_CLASS(StageView))) {
759  if(m_stageView->CanRename()) {
760  enable = TRUE;
761  }
762  } else if (focus->IsKindOf(RUNTIME_CLASS(MaterialTreeView))) {
764  enable = TRUE;
765  }
766  }
767  }
768  pCmdUI->Enable(enable);
769 }
770 
775 
776  if (m_find== NULL)
777  {
778  m_find = new FindDialog(this);
779  m_find->Create();
780  m_find->ShowWindow(SW_SHOW);
781  }
782  else
783  m_find->SetActiveWindow();
784 }
785 
790  FindNext(NULL);
791 }
792 
797 
798  //Check for undo operation on special windows
799  CWnd* focus = GetFocus();
800  if(focus) {
801  if (focus->IsKindOf(RUNTIME_CLASS(CRichEditCtrl))) {
803  return;
804  }
805  }
806 
808 }
809 
814 
815  //Check for redo operation on special windows
816  CWnd* focus = GetFocus();
817  if(focus) {
818  if (focus->IsKindOf(RUNTIME_CLASS(CRichEditCtrl))) {
820  return;
821  }
822  }
823 
825 }
826 
830 void MEMainFrame::OnEditUndoUpdate(CCmdUI *pCmdUI) {
831 
832  if(pCmdUI->m_pMenu == NULL) {
833  pCmdUI->Enable(TRUE);
834  return;
835  }
836 
837  CWnd* focus = GetFocus();
838  if(focus) {
839  if (focus->IsKindOf(RUNTIME_CLASS(CRichEditCtrl))) {
840  pCmdUI->Enable(m_materialEditView->m_textView.CanUndo());
841  return;
842  }
843  }
844 
845  pCmdUI->Enable(materialDocManager.IsUndoAvailable());
846 }
847 
851 void MEMainFrame::OnEditRedoUpdate(CCmdUI *pCmdUI) {
852 
853  if(pCmdUI->m_pMenu == NULL) {
854  pCmdUI->Enable(TRUE);
855  return;
856  }
857 
858  CWnd* focus = GetFocus();
859  if(focus) {
860  if (focus->IsKindOf(RUNTIME_CLASS(CRichEditCtrl))) {
861  pCmdUI->Enable(m_materialEditView->m_textView.CanRedo());
862  return;
863  }
864  }
865 
866  pCmdUI->Enable(materialDocManager.IsRedoAvailable());
867 }
868 
873 
874  CMenu* mmenu = GetMenu();
875 
876  UINT state = mmenu->GetMenuState(ID_VIEW_INCLUDEFILENAME, MF_BYCOMMAND);
877  ASSERT(state != 0xFFFFFFFF);
878 
879  if (state & MF_CHECKED) {
880  mmenu->CheckMenuItem(ID_VIEW_INCLUDEFILENAME, MF_UNCHECKED | MF_BYCOMMAND);
882  } else {
883  mmenu->CheckMenuItem(ID_VIEW_INCLUDEFILENAME, MF_CHECKED | MF_BYCOMMAND);
885  }
886 }
887 
892  cmdSystem->BufferCommandText(CMD_EXEC_NOW, "reloadARBprograms");
893 }
894 
900  cmdSystem->BufferCommandText(CMD_EXEC_NOW, "reloadImages");
901 }
902 
907  m_find = NULL;
908 }
909 
915 
916  if(search) {
917  searchData = *search;
918  } else {
919  if(!searchData.searched) {
920  return;
921  }
922  }
923 
924  //The material tree controls the searching
926  MessageBox(va("Unable to find '%s'.", searchData.searchText.c_str()), "Find");
927  }
928  searchData.searched = true;
929 }
930 
936 
937 }
CSplitterWnd m_previewSplitter
Definition: MEMainFrame.h:128
CSplitterWnd * m_materialEditSplitter
Definition: MEMainFrame.h:129
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct)
Called by the framework while the window is being created.
LONG GetColumn()
Definition: PropTree.cpp:391
bool IsRedoAvailable()
Returns true if a redo operation is available.
afx_msg void OnApplyAllUpdate(CCmdUI *pCmdUI)
Enables the apply all menu item if there are any materials that need to be applied.
afx_msg void OnEditCopyUpdate(CCmdUI *pCmdUI)
Enables the copy menu item if a material or stage is selected.
#define min(a, b)
afx_msg void OnPaste()
Performs a paste operation when the user selects the menu option.
Definition: StageView.cpp:583
void CloseFind()
Called by the find dialog when it is closing.
void SetWindowPlacement(const char *name, HWND hwnd)
Definition: MEOptions.h:92
const char * GetFileName(void) const
Definition: DeclManager.h:171
MEOptions options
Definition: MEMainFrame.h:150
bool modified
Definition: MaterialDoc.h:75
afx_msg void OnReloadImages()
Executes the reloadImages command to reload images that have been changed outside of the editor...
#define ID_ME_FILE_SAVEFILE
CStatusBar m_wndStatusBar
Definition: MEMainFrame.h:121
MaterialPropTreeView * m_materialPropertyView
Definition: MEMainFrame.h:134
void ApplyAll()
Applies all materials that have been changed.
afx_msg void OnEditPasteUpdate(CCmdUI *pCmdUI)
Enables a paste operation when a material or stage has been copied.
idMaterial * renderMaterial
Definition: MaterialDoc.h:72
void SaveAllMaterials()
Saves all materials that have been changed.
CONST PIXELFORMATDESCRIPTOR UINT
Definition: win_qgl.cpp:47
afx_msg void OnViewIncludeFile()
Toggles between including the file into the material list and not.
#define ID_ME_EDIT_FIND
void SetMaterialTreeWidth(int width)
Definition: MEOptions.h:100
afx_msg void OnFileSaveAll()
Saves all modified materials.
int Length(void) const
Definition: Str.h:702
CTabCtrl m_tabs
Definition: MEMainFrame.h:125
#define ID_PREVIEW_RELOADIMAGES
void RegisterMaterialView(MaterialView *view)
Registers an object to receive notifications about changes made to materials.
bool Load(void)
Loads the material editor options from the registry.
Definition: MEOptions.cpp:73
afx_msg void OnEditDelete()
Performs a delete operation on the selected material or stage.
StageView * m_stageView
CSplitterWnd m_editSplitter
void SaveSettings()
Saves the property view settings to the registry.
void InitializeMaterialList(bool includeFile=true, const char *filename=NULL)
Clears the tree and rebuilds it.
bool CanDelete()
Returns true if the current state of the stage view will allow a delete operation.
Definition: StageView.cpp:228
virtual BOOL PreCreateWindow(CREATESTRUCT &cs)
Sets a few window styles for the main window during the creation process.
void Undo()
Performs the first available undo operation.
idCmdSystem * cmdSystem
Definition: CmdSystem.cpp:116
afx_msg void OnEditDeleteUpdate(CCmdUI *pCmdUI)
Enables a delete operation when a material or stage is selected.
afx_msg void OnFileSaveAllUpdate(CCmdUI *pCmdUI)
Enables the Save All menu item if there are any materials that have been modified.
void PrintConsoleMessage(const char *msg)
Called to add console text to the console view.
bool applyWaiting
Definition: MaterialDoc.h:76
afx_msg void OnSize(UINT nType, int cx, int cy)
Called by the MFC framework when the window size is changed.
#define IDR_ME_MAINFRAME
afx_msg void OnEditFindNext()
Performs a search with the previously selected search parameters.
#define BOOL
Definition: mprintf.c:71
ConsoleView * m_consoleView
Definition: MEMainFrame.h:137
int GetStageWidth()
Definition: MEOptions.h:114
virtual ~MEMainFrame()
Destructor for MEMainFrame.
MaterialPreviewView * m_materialPreviewView
Definition: MEMainFrame.h:135
int GetPreviewPropHeadingWidth()
Definition: MEOptions.h:150
bool DoesFileNeedApply(const char *filename)
Returns true if the specified file needs to be applied and false otherwise.
static void DestroyMaterialDefLists()
Destroys all MaterialDef instances and clears the material attribute grouping lists.
#define ID_ME_EDIT_RENAME
afx_msg void OnFileSaveMaterialUpdate(CCmdUI *pCmdUI)
Enables the save material menu item if a material is selected and has been modified.
afx_msg void OnApplyFileUpdate(CCmdUI *pCmdUI)
Enables the apply file menu item if the current file contains any materials that need to be applied...
void LoadSettings()
Loads the property view settings from the registry.
virtual void BufferCommandText(cmdExecution_t exec, const char *text)=0
void RegisterPreviewView(MaterialPreviewView *view)
afx_msg void OnCopy()
Performs a copy operation when the user selects the menu option.
Definition: StageView.cpp:564
afx_msg void OnFileSaveMaterial()
Saves the selected material.
#define ID_ME_EDIT_COPY
Responsible for managing a single material that is being viewed and/or edited.
Definition: MaterialDoc.h:67
#define ID_VIEW_INCLUDEFILENAME
bool FindNextMaterial(MaterialSearchData_t *searchData)
Searches for a material given the supplied search parameters.
friend FindDialog
Definition: MEMainFrame.h:112
void FindNext(MaterialSearchData_t *search)
Begins a search based on the provided parameters or the previously used parameters.
afx_msg void OnPaste()
Performs a paste operation.
bool CanPaste()
Returns true if the user can paste an item in the copy buffer.
afx_msg void OnCut()
Performs a cut operation.
View that contains the material edit controls.
View that handles managing the material stages.
Definition: StageView.h:41
afx_msg void OnReloadArbPrograms()
Executes the reloadARBPrograms console command for convinience.
afx_msg void OnEditCopy()
Performs a copy operation on the selected material or stage.
afx_msg void OnEditCutUpdate(CCmdUI *pCmdUI)
Enable the cut menu item if a material is selected.
#define NULL
Definition: Lib.h:88
void SetColumn(LONG nColumn)
Definition: PropTree.cpp:397
MaterialTreeView * m_materialTreeView
Definition: MEMainFrame.h:132
void SaveFile(const char *filename)
Saves all materials in the specified file.
afx_msg void OnEditRename()
Performs a rename operation on the selected material or stage.
#define ID_ME_FILE_EXIT
bool CanSaveFile()
Returns true if the currently selected file needs to be saved.
FindDialog * m_find
Definition: MEMainFrame.h:142
afx_msg void OnEditRedoUpdate(CCmdUI *pCmdUI)
Enables the redo menu item if a redo is available.
bool CanCut()
Returns true if the user can cut the selected item.
virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext *pContext)
Called by the MFC framework to allow the window to create any client windows.
void SetMaterialEditHeight(int height)
Definition: MEOptions.h:127
void SaveMaterial(MaterialDoc *material)
Saves a single material.
void Redo()
Performs the first available redo operation.
#define ID_ME_PREVIEW_APPLYFILE
void SetMaterialPropHeadingWidth(int width)
Definition: MEOptions.h:136
idStr GetSaveFilename()
Returns the filename of currently selected file.
bool CanCopy()
Returns true if the user can copy the selected item.
void SetPreviewPropertiesWidth(int width)
Definition: MEOptions.h:118
int GetMaterialPropHeadingWidth()
Definition: MEOptions.h:141
MaterialEditView * m_materialEditView
Definition: MEMainFrame.h:139
void ApplyMaterial(MaterialDoc *materialDoc)
Applys changes to a material.
Structure used to store the user defined search parameters.
#define ID_ME_EDIT_FIND_NEXT
afx_msg void OnEditFind()
Opens the find dialog.
afx_msg void OnEditUndo()
Performs an undo operation.
void SetPreviewPropHeadingWidth(int width)
Definition: MEOptions.h:145
afx_msg void OnFileSaveFileUpdate(CCmdUI *pCmdUI)
Enables the Save File menu item if the current file contains a modified material. ...
int GetMaterialEditHeight()
Definition: MEOptions.h:132
CPropTree & GetPropertyTreeCtrl()
Definition: PropTreeView.h:26
#define ID_ME_EDIT_UNDO
#define ID_ME_EDIT_CUT
CToolBar m_wndToolBar
Definition: MEMainFrame.h:122
MEMainFrame()
Constructor for MEMainFrame.
void SetStageWidth(int width)
Definition: MEOptions.h:109
BOOL Create()
Creates and instance of the find dialog.
Definition: FindDialog.cpp:60
afx_msg void OnDeleteMaterial()
Deletes a material or material folder.
int GetMaterialTreeWidth()
Definition: MEOptions.h:105
afx_msg void OnDeleteStage()
Deletes the selected stage when the user selects the delete menu option.
Definition: StageView.cpp:498
#define TAB_CONTROL
Definition: MEMainFrame.cpp:39
afx_msg void OnTcnSelChange(NMHDR *pNMHDR, LRESULT *pResult)
Called when the user changes the editor/console tab selection.
A tree view of all the materials that have been defined.
afx_msg void OnApplyMaterial()
Apply the selected material.
#define ID_ME_PREVIEW_APPLYCHANGES
MaterialPreviewPropView * m_previewPropertyView
Definition: MEMainFrame.h:136
afx_msg void OnEditCut()
Performs a cut operation on the selected material.
afx_msg void OnApplyAll()
Applies all modified materials.
View in the Material Editor that functions as a Doom III console.
Definition: ConsoleView.h:37
CSplitterWnd m_editSplitter
Definition: MEMainFrame.h:127
afx_msg void OnEditPaste()
Performs a paste operation on the selected material or stage.
#define ID_ME_EDIT_DELETE
afx_msg void OnCopy()
Performs a copy operation.
Definition: Str.h:116
#define ID_ME_EDIT_PASTE
afx_msg void OnRenameStage()
Begins a label edit when the user selects the rename menu option.
Definition: StageView.cpp:484
static void InitializeMaterialDefLists()
Loads the material definition file instatiates MaterialDef objects for each definition and groups the...
Definition: MaterialDef.cpp:73
bool DoesAnyNeedApply()
Returns true if any material needs to be applied.
#define ID_ME_EDIT_REDO
void SetMaterialPropertyView(MaterialPropTreeView *propView)
Definition: StageView.h:57
const char * c_str(void) const
Definition: Str.h:487
#define FALSE
Definition: mprintf.c:70
CFont * materialEditorFont
afx_msg void OnEditUndoUpdate(CCmdUI *pCmdUI)
Enables the undo menu item if an undo is available.
afx_msg void OnFileSaveFile()
Saves the selected file.
bool CanDelete()
Returns true if the user can delete the selected item.
afx_msg void OnDestroy()
Called by the MFC framework while the window is being destroyed.
bool Save(void)
Saves the material editor options to the registry.
Definition: MEOptions.cpp:58
afx_msg void OnFileExit()
Shuts down the material editor.
#define TRUE
Definition: mprintf.c:69
#define ID_ME_FILE_SAVE
afx_msg void OnEditRedo()
Performs a redo operation.
void ApplyFile(const char *filename)
Applies all materials in the specified filename.
bool IsUndoAvailable()
Returns true if an undo operation is available.
virtual void MV_OnMaterialSelectionChange(MaterialDoc *pMaterial)
Called when the selected material has changed.
char * va(const char *fmt,...)
Definition: Str.cpp:1568
MaterialPropTreeView * m_materialPropertyView
MaterialDoc * GetCurrentMaterialDoc()
CSplitterWnd m_splitterWnd
Definition: MEMainFrame.h:126
StageView * m_stageView
Definition: MEMainFrame.h:133
MaterialSearchData_t searchData
Definition: MEMainFrame.h:143
afx_msg void OnApplyMaterialUpdate(CCmdUI *pCmdUI)
Enables the Apply Material menu item if the current material has an apply waiting.
#define ID_PREVIEW_RELOADARBPROGRAMS
afx_msg void OnEditRenameUpdate(CCmdUI *pCmdUI)
Enables a rename operation when a material, folder or stage is selected.
MaterialDocManager materialDocManager
Definition: MEMainFrame.h:146
afx_msg void OnApplyFile()
Applies all modified materials in the selected file.
#define ID_ME_PREVIEW_APPLYALL
MaterialDoc * currentDoc
Definition: MEMainFrame.h:147
bool IsAnyModified()
Returns true if any material has been modified.
bool CanRename()
Returns true if the current state of the stage view will allow a rename operation.
Definition: StageView.cpp:245
afx_msg void OnRenameMaterial()
Begins a label edit to rename a material or material folder.
int GetPreviewPropertiesWidth()
Definition: MEOptions.h:123
#define ID_ME_FILE_SAVEMATERIAL
bool CanCopy()
Returns true if the current state of the stage view will allow a copy operation.
Definition: StageView.cpp:195
CSyntaxRichEditCtrl m_textView
bool CanCut()
Cut is not supported for stages.
Definition: StageView.cpp:220
bool CanRename()
Returns true if the user can rename the selected item.
bool GetWindowPlacement(const char *name, HWND hwnd)
Definition: MEOptions.h:96
void AddText(const char *msg)
Adds text to the end of the console output window.
Definition: ConsoleView.cpp:65
The main window for the material editor.
Definition: MEMainFrame.h:47
bool CanPaste()
Returns true if the current state of the stage view will allow a paste operation. ...
Definition: StageView.cpp:213