doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
MaterialTreeView Class Reference

A tree view of all the materials that have been defined. More...

#include <MaterialTreeView.h>

Inheritance diagram for MaterialTreeView:
MaterialView

Public Member Functions

virtual ~MaterialTreeView ()
 Destructor for MaterialTreeView. More...
 
void InitializeMaterialList (bool includeFile=true, const char *filename=NULL)
 Clears the tree and rebuilds it. More...
 
void BuildMaterialList (bool includeFile=true, const char *filename=NULL)
 Builds the tree of materials. More...
 
virtual void MV_OnMaterialChange (MaterialDoc *pMaterial)
 Called when the material has changed but not applied. More...
 
virtual void MV_OnMaterialApply (MaterialDoc *pMaterial)
 Called when the material changes have been applied. More...
 
virtual void MV_OnMaterialSaved (MaterialDoc *pMaterial)
 Called when the material changes have been saved. More...
 
virtual void MV_OnMaterialAdd (MaterialDoc *pMaterial)
 Called when a material is added. More...
 
virtual void MV_OnMaterialDelete (MaterialDoc *pMaterial)
 Called when a material is deleted. More...
 
virtual void MV_OnMaterialNameChanged (MaterialDoc *pMaterial, const char *oldName)
 Called when the material name has changed. More...
 
virtual void MV_OnFileReload (const char *filename)
 Called when a file has been reloaded. More...
 
bool CanCopy ()
 Returns true if the user can copy the selected item. More...
 
bool CanPaste ()
 Returns true if the user can paste an item in the copy buffer. More...
 
bool CanCut ()
 Returns true if the user can cut the selected item. More...
 
bool CanDelete ()
 Returns true if the user can delete the selected item. More...
 
bool CanRename ()
 Returns true if the user can rename the selected item. More...
 
bool CanSaveFile ()
 Returns true if the currently selected file needs to be saved. More...
 
idStr GetSaveFilename ()
 Returns the filename of currently selected file. More...
 
bool FindNextMaterial (MaterialSearchData_t *searchData)
 Searches for a material given the supplied search parameters. More...
 
HTREEITEM FindNextMaterial (HTREEITEM item, MaterialSearchData_t *searchData)
 Searches for a material given the supplied search parameters. More...
 
HTREEITEM GetNextSeachItem (HTREEITEM item, bool stayInFile)
 Returns the next item to search or NULL if there is nothing else to search. More...
 
void DeleteFolder (HTREEITEM item, bool addUndo=true)
 Deletes a given folder. More...
 
HTREEITEM AddFolder (const char *name, HTREEITEM parent)
 Adds a new material folder. More...
 
void RenameFolder (HTREEITEM item, const char *name)
 Renames a material folder. More...
 
- Public Member Functions inherited from MaterialView
 MaterialView (void)
 Constructor. More...
 
virtual ~MaterialView (void)
 Destructor. More...
 
virtual void SetMaterialDocManager (MaterialDocManager *docManager)
 Sets the material document manager for this view instance. More...
 
virtual void MV_OnMaterialSelectionChange (MaterialDoc *pMaterial)
 Called when the selected material has changed. More...
 
virtual void MV_OnMaterialSaveFile (const char *filename)
 Called when a material file has been saved. More...
 
virtual void MV_OnMaterialStageAdd (MaterialDoc *pMaterial, int stageNum)
 Called when a stage is added. More...
 
virtual void MV_OnMaterialStageDelete (MaterialDoc *pMaterial, int stageNum)
 Called when a stage is deleted. More...
 
virtual void MV_OnMaterialStageMove (MaterialDoc *pMaterial, int from, int to)
 Called when a stage is moved. More...
 
virtual void MV_OnMaterialAttributeChanged (MaterialDoc *pMaterial, int stage, const char *attribName)
 Called when an attribute is changed. More...
 

Protected Types

enum  {
  TYPE_ROOT = 0, TYPE_FOLDER, TYPE_FILE, TYPE_MATERIAL_FOLDER,
  TYPE_MATERIAL
}
 List of tree item types. More...
 

Protected Member Functions

 MaterialTreeView ()
 Constructor for MaterialTreeView. More...
 
virtual BOOL PreTranslateMessage (MSG *pMsg)
 Handles the keyboard shortcut for delete. More...
 
afx_msg int OnCreate (LPCREATESTRUCT lpCreateStruct)
 Called by the MFC framework as the view is being created. More...
 
afx_msg void OnTvnSelchanged (NMHDR *pNMHDR, LRESULT *pResult)
 Changes the selected material when the select tree item changes. More...
 
afx_msg void OnTvnBeginlabeledit (NMHDR *pNMHDR, LRESULT *pResult)
 Determines if a tree item's label can be edited. More...
 
afx_msg void OnTvnEndlabeledit (NMHDR *pNMHDR, LRESULT *pResult)
 Makes sure that a rename operation can be performed after a label edit is complete and performs the folder or material rename. More...
 
afx_msg void OnContextMenu (CWnd *pWnd, CPoint point)
 Displays the popup menu. More...
 
afx_msg void OnNMRclick (NMHDR *pNMHDR, LRESULT *pResult)
 Displays the popup menu. More...
 
afx_msg void OnChar (UINT nChar, UINT nRepCnt, UINT nFlags)
 Handles keyboard shortcut for cut, copy and paste. More...
 
afx_msg void OnTvnBegindrag (NMHDR *pNMHDR, LRESULT *pResult)
 Begins the process of a drag cut/copy. More...
 
afx_msg void OnMouseMove (UINT nFlags, CPoint point)
 Handles mouse movement as an item is being dragged. More...
 
afx_msg void OnLButtonUp (UINT nFlags, CPoint point)
 Handles the end of a drag copy/move when the user releases the left mouse button. More...
 
afx_msg void OnApplyMaterial ()
 Applies the current material. More...
 
afx_msg void OnApplyFile ()
 Applies all materials in the currently selected file. More...
 
afx_msg void OnApplyAll ()
 Applies all materials that need to be applied. More...
 
afx_msg void OnSaveMaterial ()
 Saves the selected material. More...
 
afx_msg void OnSaveFile ()
 Saves all materials in the selected file. More...
 
afx_msg void OnSaveAll ()
 Save all materials that have been changed. More...
 
afx_msg void OnRenameMaterial ()
 Begins a label edit to rename a material or material folder. More...
 
afx_msg void OnAddMaterial ()
 Adds a new material. More...
 
afx_msg void OnAddFolder ()
 Adds a new folder. More...
 
afx_msg void OnDeleteMaterial ()
 Deletes a material or material folder. More...
 
afx_msg void OnReloadFile ()
 Reloads the selected file. More...
 
afx_msg void OnCut ()
 Performs a cut operation. More...
 
afx_msg void OnCopy ()
 Performs a copy operation. More...
 
afx_msg void OnPaste ()
 Performs a paste operation. More...
 
afx_msg LRESULT OnRenameFolderComplete (WPARAM wParam, LPARAM lParam)
 This message is sent after the label edit is complete to actually perform the rename operation. More...
 
afx_msg LRESULT OnRenameMaterialComplete (WPARAM wParam, LPARAM lParam)
 This message is sent after the label edit is complete to ensure that the sorting stays consistent. More...
 
void RenameMaterial (HTREEITEM item, const char *originalName)
 Handles all of the little problems associated with renaming a folder. More...
 
bool GetFileName (HTREEITEM item, idStr &out)
 Returns the filename of the provided item. More...
 
idStr GetMediaPath (HTREEITEM item, DWORD type)
 Returns the Doom III name for the provided item. More...
 
void GetMaterialPaths (HTREEITEM item, idList< MaterialTreeItem_t > *list)
 Creates a list of material paths for all materials under the provided item. More...
 
void AddStrList (const char *root, idStrList *list, bool includeFile)
 Adds a string list of materials to the tree creating the proper hierarchy. More...
 
void PopupMenu (CPoint *pt)
 Displays the popup menu with all of the appropriate menu items enabled. More...
 
void SetItemImage (HTREEITEM item, bool mod, bool apply, bool children)
 Sets the appropriate item image based on the state of the item. More...
 
void CleanLookupTrees (HTREEITEM item)
 Cleans the lookup tables for the provided item and all children. More...
 
void BuildLookupTrees (HTREEITEM item)
 Build the lookup tree for a given item and all of its children. More...
 
idStr GetQuicktreePath (HTREEITEM item)
 Returns the quicktree path for a given item. More...
 

Protected Attributes

CImageList m_image
 
bool treeWithFile
 
idHashTable< HTREEITEM > quickTree
 
idHashTable< HTREEITEM > materialToTree
 
idHashTable< HTREEITEM > fileToTree
 
HTREEITEM renamedFolder
 
idList< MaterialTreeItem_taffectedMaterials
 
CImageList * dragImage
 
bool bDragging
 
CPoint dropPoint
 
HTREEITEM dragItem
 
HTREEITEM hoverItem
 
DWORD hoverStartTime
 
bool internalChange
 
- Protected Attributes inherited from MaterialView
MaterialDocManagermaterialDocManager
 

Detailed Description

A tree view of all the materials that have been defined.

Definition at line 46 of file MaterialTreeView.h.

Member Enumeration Documentation

anonymous enum
protected

List of tree item types.

Enumerator
TYPE_ROOT 
TYPE_FOLDER 
TYPE_FILE 
TYPE_MATERIAL_FOLDER 
TYPE_MATERIAL 

Definition at line 87 of file MaterialTreeView.h.

Constructor & Destructor Documentation

MaterialTreeView::~MaterialTreeView ( )
virtual

Destructor for MaterialTreeView.

Definition at line 93 of file MaterialTreeView.cpp.

MaterialTreeView::MaterialTreeView ( )
protected

Constructor for MaterialTreeView.

Definition at line 83 of file MaterialTreeView.cpp.

Member Function Documentation

HTREEITEM MaterialTreeView::AddFolder ( const char *  name,
HTREEITEM  parent 
)

Adds a new material folder.

Parameters
nameThe name of the folder.
parentThe parent item of the folder.

Definition at line 639 of file MaterialTreeView.cpp.

void MaterialTreeView::AddStrList ( const char *  root,
idStrList list,
bool  includeFile 
)
protected

Adds a string list of materials to the tree creating the proper hierarchy.

Parameters
rootThe name of the root item or NULL for no root item.
listThe list of materials.
includeFileIf true the materials will be sorted by file.

Definition at line 1529 of file MaterialTreeView.cpp.

void MaterialTreeView::BuildLookupTrees ( HTREEITEM  item)
protected

Build the lookup tree for a given item and all of its children.

Parameters
itemThe item to start from

Definition at line 1881 of file MaterialTreeView.cpp.

void MaterialTreeView::BuildMaterialList ( bool  includeFile = true,
const char *  filename = NULL 
)

Builds the tree of materials.

Parameters
includeFileShould the list include the filename
filenameThe file to load or NULL to load all files.

Definition at line 120 of file MaterialTreeView.cpp.

bool MaterialTreeView::CanCopy ( )

Returns true if the user can copy the selected item.

Definition at line 371 of file MaterialTreeView.cpp.

bool MaterialTreeView::CanCut ( )

Returns true if the user can cut the selected item.

Definition at line 395 of file MaterialTreeView.cpp.

bool MaterialTreeView::CanDelete ( )

Returns true if the user can delete the selected item.

Definition at line 412 of file MaterialTreeView.cpp.

bool MaterialTreeView::CanPaste ( )

Returns true if the user can paste an item in the copy buffer.

Definition at line 388 of file MaterialTreeView.cpp.

bool MaterialTreeView::CanRename ( )

Returns true if the user can rename the selected item.

Definition at line 429 of file MaterialTreeView.cpp.

bool MaterialTreeView::CanSaveFile ( )

Returns true if the currently selected file needs to be saved.

Definition at line 445 of file MaterialTreeView.cpp.

void MaterialTreeView::CleanLookupTrees ( HTREEITEM  item)
protected

Cleans the lookup tables for the provided item and all children.

Parameters
itemThe item to start from

Definition at line 1850 of file MaterialTreeView.cpp.

void MaterialTreeView::DeleteFolder ( HTREEITEM  item,
bool  addUndo = true 
)

Deletes a given folder.

Parameters
itemThe folder to delete.
addUndoTrue if this operation can be undone.

Definition at line 597 of file MaterialTreeView.cpp.

bool MaterialTreeView::FindNextMaterial ( MaterialSearchData_t searchData)

Searches for a material given the supplied search parameters.

Parameters
searchDataThe parameters to use for the search.

Definition at line 483 of file MaterialTreeView.cpp.

HTREEITEM MaterialTreeView::FindNextMaterial ( HTREEITEM  item,
MaterialSearchData_t searchData 
)

Searches for a material given the supplied search parameters.

Returns the tree item where the item was found or NULL if no material was found.

Parameters
itemThe tree item from where to start the search.
searchDataThe parameters to use for the search.

Definition at line 520 of file MaterialTreeView.cpp.

bool MaterialTreeView::GetFileName ( HTREEITEM  item,
idStr out 
)
protected

Returns the filename of the provided item.

Parameters
itemThe item for which to generate the filename
outThe location the filename will be placed.

Definition at line 1422 of file MaterialTreeView.cpp.

void MaterialTreeView::GetMaterialPaths ( HTREEITEM  item,
idList< MaterialTreeItem_t > *  list 
)
protected

Creates a list of material paths for all materials under the provided item.

Parameters
itemThe base item for which to generate the list
listThe list in which the paths will be stored.

Definition at line 1501 of file MaterialTreeView.cpp.

idStr MaterialTreeView::GetMediaPath ( HTREEITEM  item,
DWORD  type 
)
protected

Returns the Doom III name for the provided item.

Parameters
itemThe item for which to generate the name
typeThe type of the selected item

Definition at line 1455 of file MaterialTreeView.cpp.

HTREEITEM MaterialTreeView::GetNextSeachItem ( HTREEITEM  item,
bool  stayInFile 
)

Returns the next item to search or NULL if there is nothing else to search.

Parameters
itemThe last item searched.
stayInFileTrue if the search should stay in the current file.

Definition at line 559 of file MaterialTreeView.cpp.

idStr MaterialTreeView::GetQuicktreePath ( HTREEITEM  item)
protected

Returns the quicktree path for a given item.

Parameters
itemThe item for which to generate the quicktree path

Definition at line 1905 of file MaterialTreeView.cpp.

idStr MaterialTreeView::GetSaveFilename ( )

Returns the filename of currently selected file.

Definition at line 464 of file MaterialTreeView.cpp.

void MaterialTreeView::InitializeMaterialList ( bool  includeFile = true,
const char *  filename = NULL 
)

Clears the tree and rebuilds it.

Parameters
includeFileShould the list include the filename
filenameThe file to load or NULL to load all files.

Definition at line 101 of file MaterialTreeView.cpp.

void MaterialTreeView::MV_OnFileReload ( const char *  filename)
virtual

Called when a file has been reloaded.

Parameters
filenameThe file that was reloaded.

Reimplemented from MaterialView.

Definition at line 345 of file MaterialTreeView.cpp.

void MaterialTreeView::MV_OnMaterialAdd ( MaterialDoc pMaterial)
virtual

Called when a material is added.

Parameters
pMaterialThe material that was added.

Reimplemented from MaterialView.

Definition at line 244 of file MaterialTreeView.cpp.

void MaterialTreeView::MV_OnMaterialApply ( MaterialDoc pMaterial)
virtual

Called when the material changes have been applied.

Parameters
pMaterialThe selected material.

Reimplemented from MaterialView.

Definition at line 196 of file MaterialTreeView.cpp.

void MaterialTreeView::MV_OnMaterialChange ( MaterialDoc pMaterial)
virtual

Called when the material has changed but not applied.

Parameters
pMaterialThe selected material.

Reimplemented from MaterialView.

Definition at line 164 of file MaterialTreeView.cpp.

void MaterialTreeView::MV_OnMaterialDelete ( MaterialDoc pMaterial)
virtual

Called when a material is deleted.

Parameters
pMaterialThe material that was deleted.

Reimplemented from MaterialView.

Definition at line 278 of file MaterialTreeView.cpp.

void MaterialTreeView::MV_OnMaterialNameChanged ( MaterialDoc pMaterial,
const char *  oldName 
)
virtual

Called when the material name has changed.

Parameters
pMaterialThe material that was deleted.
oldNameThe old name of the material.

Reimplemented from MaterialView.

Definition at line 296 of file MaterialTreeView.cpp.

void MaterialTreeView::MV_OnMaterialSaved ( MaterialDoc pMaterial)
virtual

Called when the material changes have been saved.

Parameters
pMaterialThe saved material.

Reimplemented from MaterialView.

Definition at line 213 of file MaterialTreeView.cpp.

void MaterialTreeView::OnAddFolder ( )
protected

Adds a new folder.

Definition at line 1180 of file MaterialTreeView.cpp.

void MaterialTreeView::OnAddMaterial ( )
protected

Adds a new material.

Definition at line 1119 of file MaterialTreeView.cpp.

void MaterialTreeView::OnApplyAll ( )
protected

Applies all materials that need to be applied.

Definition at line 1076 of file MaterialTreeView.cpp.

void MaterialTreeView::OnApplyFile ( )
protected

Applies all materials in the currently selected file.

Definition at line 1065 of file MaterialTreeView.cpp.

void MaterialTreeView::OnApplyMaterial ( )
protected

Applies the current material.

Definition at line 1058 of file MaterialTreeView.cpp.

void MaterialTreeView::OnChar ( UINT  nChar,
UINT  nRepCnt,
UINT  nFlags 
)
protected

Handles keyboard shortcut for cut, copy and paste.

Definition at line 881 of file MaterialTreeView.cpp.

void MaterialTreeView::OnContextMenu ( CWnd *  pWnd,
CPoint  point 
)
protected

Displays the popup menu.

Definition at line 842 of file MaterialTreeView.cpp.

void MaterialTreeView::OnCopy ( )
protected

Performs a copy operation.

Definition at line 1288 of file MaterialTreeView.cpp.

int MaterialTreeView::OnCreate ( LPCREATESTRUCT  lpCreateStruct)
protected

Called by the MFC framework as the view is being created.

Definition at line 700 of file MaterialTreeView.cpp.

void MaterialTreeView::OnCut ( )
protected

Performs a cut operation.

Definition at line 1273 of file MaterialTreeView.cpp.

void MaterialTreeView::OnDeleteMaterial ( )
protected

Deletes a material or material folder.

Definition at line 1226 of file MaterialTreeView.cpp.

void MaterialTreeView::OnLButtonUp ( UINT  nFlags,
CPoint  point 
)
protected

Handles the end of a drag copy/move when the user releases the left mouse button.

Definition at line 992 of file MaterialTreeView.cpp.

void MaterialTreeView::OnMouseMove ( UINT  nFlags,
CPoint  point 
)
protected

Handles mouse movement as an item is being dragged.

Definition at line 943 of file MaterialTreeView.cpp.

void MaterialTreeView::OnNMRclick ( NMHDR *  pNMHDR,
LRESULT *  pResult 
)
protected

Displays the popup menu.

Definition at line 851 of file MaterialTreeView.cpp.

void MaterialTreeView::OnPaste ( )
protected

Performs a paste operation.

Definition at line 1304 of file MaterialTreeView.cpp.

void MaterialTreeView::OnReloadFile ( )
protected

Reloads the selected file.

Definition at line 1249 of file MaterialTreeView.cpp.

LRESULT MaterialTreeView::OnRenameFolderComplete ( WPARAM  wParam,
LPARAM  lParam 
)
protected

This message is sent after the label edit is complete to actually perform the rename operation.

Definition at line 1346 of file MaterialTreeView.cpp.

void MaterialTreeView::OnRenameMaterial ( )
protected

Begins a label edit to rename a material or material folder.

Definition at line 1108 of file MaterialTreeView.cpp.

LRESULT MaterialTreeView::OnRenameMaterialComplete ( WPARAM  wParam,
LPARAM  lParam 
)
protected

This message is sent after the label edit is complete to ensure that the sorting stays consistent.

Definition at line 1367 of file MaterialTreeView.cpp.

void MaterialTreeView::OnSaveAll ( )
protected

Save all materials that have been changed.

Definition at line 1101 of file MaterialTreeView.cpp.

void MaterialTreeView::OnSaveFile ( )
protected

Saves all materials in the selected file.

Definition at line 1090 of file MaterialTreeView.cpp.

void MaterialTreeView::OnSaveMaterial ( )
protected

Saves the selected material.

Definition at line 1083 of file MaterialTreeView.cpp.

void MaterialTreeView::OnTvnBegindrag ( NMHDR *  pNMHDR,
LRESULT *  pResult 
)
protected

Begins the process of a drag cut/copy.

Definition at line 901 of file MaterialTreeView.cpp.

void MaterialTreeView::OnTvnBeginlabeledit ( NMHDR *  pNMHDR,
LRESULT *  pResult 
)
protected

Determines if a tree item's label can be edited.

Definition at line 746 of file MaterialTreeView.cpp.

void MaterialTreeView::OnTvnEndlabeledit ( NMHDR *  pNMHDR,
LRESULT *  pResult 
)
protected

Makes sure that a rename operation can be performed after a label edit is complete and performs the folder or material rename.

Definition at line 765 of file MaterialTreeView.cpp.

void MaterialTreeView::OnTvnSelchanged ( NMHDR *  pNMHDR,
LRESULT *  pResult 
)
protected

Changes the selected material when the select tree item changes.

Definition at line 716 of file MaterialTreeView.cpp.

void MaterialTreeView::PopupMenu ( CPoint *  pt)
protected

Displays the popup menu with all of the appropriate menu items enabled.

Parameters
ptThe location where the menu should be displayed.

Definition at line 1690 of file MaterialTreeView.cpp.

BOOL MaterialTreeView::PreTranslateMessage ( MSG *  pMsg)
protectedvirtual

Handles the keyboard shortcut for delete.

Definition at line 684 of file MaterialTreeView.cpp.

void MaterialTreeView::RenameFolder ( HTREEITEM  item,
const char *  name 
)

Renames a material folder.

Parameters
itemThe folder tree item.
nameThe new name of the material folder.

Definition at line 663 of file MaterialTreeView.cpp.

void MaterialTreeView::RenameMaterial ( HTREEITEM  item,
const char *  originalName 
)
protected

Handles all of the little problems associated with renaming a folder.

Definition at line 1380 of file MaterialTreeView.cpp.

void MaterialTreeView::SetItemImage ( HTREEITEM  item,
bool  mod,
bool  apply,
bool  children 
)
protected

Sets the appropriate item image based on the state of the item.

Parameters
itemThe item to set.
modIs the item modified
applyDoes the item need an apply
childrenShould this method recurse through the items children and set their icons.

Definition at line 1806 of file MaterialTreeView.cpp.

Member Data Documentation

idList<MaterialTreeItem_t> MaterialTreeView::affectedMaterials
protected

Definition at line 161 of file MaterialTreeView.h.

bool MaterialTreeView::bDragging
protected

Definition at line 164 of file MaterialTreeView.h.

CImageList* MaterialTreeView::dragImage
protected

Definition at line 163 of file MaterialTreeView.h.

HTREEITEM MaterialTreeView::dragItem
protected

Definition at line 166 of file MaterialTreeView.h.

CPoint MaterialTreeView::dropPoint
protected

Definition at line 165 of file MaterialTreeView.h.

idHashTable<HTREEITEM> MaterialTreeView::fileToTree
protected

Definition at line 156 of file MaterialTreeView.h.

HTREEITEM MaterialTreeView::hoverItem
protected

Definition at line 169 of file MaterialTreeView.h.

DWORD MaterialTreeView::hoverStartTime
protected

Definition at line 170 of file MaterialTreeView.h.

bool MaterialTreeView::internalChange
protected

Definition at line 172 of file MaterialTreeView.h.

CImageList MaterialTreeView::m_image
protected

Definition at line 150 of file MaterialTreeView.h.

idHashTable<HTREEITEM> MaterialTreeView::materialToTree
protected

Definition at line 155 of file MaterialTreeView.h.

idHashTable<HTREEITEM> MaterialTreeView::quickTree
protected

Definition at line 154 of file MaterialTreeView.h.

HTREEITEM MaterialTreeView::renamedFolder
protected

Definition at line 160 of file MaterialTreeView.h.

bool MaterialTreeView::treeWithFile
protected

Definition at line 151 of file MaterialTreeView.h.


The documentation for this class was generated from the following files: