28 #include "../../idlib/precompiled.h"
39 #define TAB_CONTROL 0x1006
49 ON_NOTIFY(TCN_SELCHANGE,
TAB_CONTROL, OnTcnSelChange)
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 )
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 )
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)
82 ON_UPDATE_COMMAND_UI(ID_ME_EDIT_UNDO, OnEditUndoUpdate )
83 ON_UPDATE_COMMAND_UI(ID_ME_EDIT_REDO, OnEditRedoUpdate )
90 static
UINT indicators[] =
129 if( !CFrameWnd::PreCreateWindow(cs) )
132 cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
133 cs.lpszClass = AfxRegisterWndClass(0);
143 CCreateContext consoleContext;
144 consoleContext.m_pNewViewClass = RUNTIME_CLASS(
ConsoleView);
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");
160 TRACE0(
"Failed to create material list pane\n");
165 TRACE0(
"Failed to create stage property pane\n");
173 TRACE0(
"Failed to create preview property pane\n");
178 TRACE0(
"Failed to create preview pane\n");
252 return CFrameWnd::OnCreateClient(lpcs, pContext);
261 if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
265 if (!
m_wndToolBar.CreateEx(
this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
268 TRACE0(
"Failed to create toolbar\n");
276 sizeof(indicators)/
sizeof(
UINT)))
278 TRACE0(
"Failed to create status bar\n");
293 CFrameWnd::OnDestroy();
324 AfxGetApp()->ExitInstance();
334 CFrameWnd::OnSize(nType, cx, cy);
343 m_tabs.GetItemRect(0, tabRect);
345 int tabHeight = tabRect.Height()+5;
347 m_splitterWnd.MoveWindow(0, toolbarRect.Height(), cx, cy-statusRect.Height()-toolbarRect.Height()-tabHeight);
349 m_tabs.MoveWindow(0, cy-statusRect.Height()-tabHeight, cx, tabHeight);
351 m_consoleView->MoveWindow(0, toolbarRect.Height(), cx, cy-statusRect.Height()-toolbarRect.Height()-tabHeight);
360 int sel =
m_tabs.GetCurSel();
384 PostMessage(WM_DESTROY, 0, 0);
403 if(filename.
Length() > 0) {
422 if(pCmdUI->m_pMenu ==
NULL) {
423 pCmdUI->Enable(
TRUE);
428 pCmdUI->Enable(
TRUE);
431 pCmdUI->Enable(
FALSE);
440 if(pCmdUI->m_pMenu ==
NULL) {
441 pCmdUI->Enable(
TRUE);
446 pCmdUI->Enable(
TRUE);
448 pCmdUI->Enable(
FALSE);
457 if(pCmdUI->m_pMenu ==
NULL) {
458 pCmdUI->Enable(
TRUE);
463 pCmdUI->Enable(
TRUE);
465 pCmdUI->Enable(
FALSE);
485 if(filename.
Length() > 0) {
503 if(pCmdUI->m_pMenu ==
NULL) {
504 pCmdUI->Enable(
TRUE);
509 pCmdUI->Enable(
TRUE);
511 pCmdUI->Enable(
FALSE);
521 if(pCmdUI->m_pMenu ==
NULL) {
522 pCmdUI->Enable(
TRUE);
529 pCmdUI->Enable(
TRUE);
531 pCmdUI->Enable(
FALSE);
541 if(pCmdUI->m_pMenu ==
NULL) {
542 pCmdUI->Enable(
TRUE);
547 pCmdUI->Enable(
TRUE);
549 pCmdUI->Enable(
FALSE);
557 CWnd* focus = GetFocus();
569 CWnd* focus = GetFocus();
571 if (focus->IsKindOf(RUNTIME_CLASS(
StageView))) {
583 CWnd* focus = GetFocus();
586 if (focus->IsKindOf(RUNTIME_CLASS(
StageView))) {
598 CWnd* focus = GetFocus();
600 if (focus->IsKindOf(RUNTIME_CLASS(
StageView))) {
612 CWnd* focus = GetFocus();
614 if (focus->IsKindOf(RUNTIME_CLASS(
StageView))) {
628 if(pCmdUI->m_pMenu ==
NULL) {
629 pCmdUI->Enable(
TRUE);
635 CWnd* focus = GetFocus();
637 if (focus->IsKindOf(RUNTIME_CLASS(
StageView))) {
645 }
else if (focus->IsKindOf(RUNTIME_CLASS(CRichEditCtrl))) {
650 pCmdUI->Enable(enable);
658 if(pCmdUI->m_pMenu ==
NULL) {
659 pCmdUI->Enable(
TRUE);
665 CWnd* focus = GetFocus();
667 if (focus->IsKindOf(RUNTIME_CLASS(
StageView))) {
675 }
else if (focus->IsKindOf(RUNTIME_CLASS(CRichEditCtrl))) {
680 pCmdUI->Enable(enable);
688 if(pCmdUI->m_pMenu ==
NULL) {
689 pCmdUI->Enable(
TRUE);
695 CWnd* focus = GetFocus();
697 if (focus->IsKindOf(RUNTIME_CLASS(
StageView))) {
705 }
else if (focus->IsKindOf(RUNTIME_CLASS(CRichEditCtrl))) {
710 pCmdUI->Enable(enable);
718 if(pCmdUI->m_pMenu ==
NULL) {
719 pCmdUI->Enable(
TRUE);
725 CWnd* focus = GetFocus();
727 if (focus->IsKindOf(RUNTIME_CLASS(
StageView))) {
735 }
else if (focus->IsKindOf(RUNTIME_CLASS(CRichEditCtrl))) {
741 pCmdUI->Enable(enable);
749 if(pCmdUI->m_pMenu ==
NULL) {
750 pCmdUI->Enable(
TRUE);
756 CWnd* focus = GetFocus();
758 if (focus->IsKindOf(RUNTIME_CLASS(
StageView))) {
768 pCmdUI->Enable(enable);
780 m_find->ShowWindow(SW_SHOW);
783 m_find->SetActiveWindow();
799 CWnd* focus = GetFocus();
801 if (focus->IsKindOf(RUNTIME_CLASS(CRichEditCtrl))) {
816 CWnd* focus = GetFocus();
818 if (focus->IsKindOf(RUNTIME_CLASS(CRichEditCtrl))) {
832 if(pCmdUI->m_pMenu ==
NULL) {
833 pCmdUI->Enable(
TRUE);
837 CWnd* focus = GetFocus();
839 if (focus->IsKindOf(RUNTIME_CLASS(CRichEditCtrl))) {
853 if(pCmdUI->m_pMenu ==
NULL) {
854 pCmdUI->Enable(
TRUE);
858 CWnd* focus = GetFocus();
860 if (focus->IsKindOf(RUNTIME_CLASS(CRichEditCtrl))) {
874 CMenu* mmenu = GetMenu();
877 ASSERT(state != 0xFFFFFFFF);
879 if (state & MF_CHECKED) {
CSplitterWnd m_previewSplitter
CSplitterWnd * m_materialEditSplitter
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct)
Called by the framework while the window is being created.
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.
afx_msg void OnPaste()
Performs a paste operation when the user selects the menu option.
void CloseFind()
Called by the find dialog when it is closing.
void SetWindowPlacement(const char *name, HWND hwnd)
const char * GetFileName(void) const
void InitializePropTree(void)
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
MaterialPropTreeView * m_materialPropertyView
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
void SaveAllMaterials()
Saves all materials that have been changed.
CONST PIXELFORMATDESCRIPTOR UINT
afx_msg void OnViewIncludeFile()
Toggles between including the file into the material list and not.
void SetMaterialTreeWidth(int width)
afx_msg void OnFileSaveAll()
Saves all modified materials.
#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.
afx_msg void OnEditDelete()
Performs a delete operation on the selected material or stage.
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.
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.
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.
afx_msg void OnSize(UINT nType, int cx, int cy)
Called by the MFC framework when the window size is changed.
afx_msg void OnEditFindNext()
Performs a search with the previously selected search parameters.
ConsoleView * m_consoleView
virtual ~MEMainFrame()
Destructor for MEMainFrame.
MaterialPreviewView * m_materialPreviewView
int GetPreviewPropHeadingWidth()
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.
afx_msg void OnFileSaveMaterial()
Saves the selected material.
Responsible for managing a single material that is being viewed and/or edited.
#define ID_VIEW_INCLUDEFILENAME
bool FindNextMaterial(MaterialSearchData_t *searchData)
Searches for a material given the supplied search parameters.
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.
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.
void SetColumn(LONG nColumn)
MaterialTreeView * m_materialTreeView
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.
bool CanSaveFile()
Returns true if the currently selected file needs to be saved.
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)
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)
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)
int GetMaterialPropHeadingWidth()
MaterialEditView * m_materialEditView
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)
afx_msg void OnFileSaveFileUpdate(CCmdUI *pCmdUI)
Enables the Save File menu item if the current file contains a modified material. ...
int GetMaterialEditHeight()
CPropTree & GetPropertyTreeCtrl()
MEMainFrame()
Constructor for MEMainFrame.
void SetStageWidth(int width)
BOOL Create()
Creates and instance of the find dialog.
afx_msg void OnDeleteMaterial()
Deletes a material or material folder.
int GetMaterialTreeWidth()
afx_msg void OnDeleteStage()
Deletes the selected stage when the user selects the delete menu option.
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
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.
CSplitterWnd m_editSplitter
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.
afx_msg void OnRenameStage()
Begins a label edit when the user selects the rename menu option.
static void InitializeMaterialDefLists()
Loads the material definition file instatiates MaterialDef objects for each definition and groups the...
bool DoesAnyNeedApply()
Returns true if any material needs to be applied.
void SetMaterialPropertyView(MaterialPropTreeView *propView)
const char * c_str(void) const
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.
afx_msg void OnFileExit()
Shuts down the material editor.
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,...)
MaterialPropTreeView * m_materialPropertyView
MaterialDoc * GetCurrentMaterialDoc()
CSplitterWnd m_splitterWnd
MaterialSearchData_t searchData
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
afx_msg void OnApplyFile()
Applies all modified materials in the selected file.
#define ID_ME_PREVIEW_APPLYALL
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.
afx_msg void OnRenameMaterial()
Begins a label edit to rename a material or material folder.
int GetPreviewPropertiesWidth()
#define ID_ME_FILE_SAVEMATERIAL
bool CanCopy()
Returns true if the current state of the stage view will allow a copy operation.
CSyntaxRichEditCtrl m_textView
bool CanCut()
Cut is not supported for stages.
bool CanRename()
Returns true if the user can rename the selected item.
bool GetWindowPlacement(const char *name, HWND hwnd)
void AddText(const char *msg)
Adds text to the end of the console output window.
The main window for the material editor.
bool CanPaste()
Returns true if the current state of the stage view will allow a paste operation. ...