28 #include "../../idlib/precompiled.h"
33 #define IMAGE_FOLDER 0
35 #define IMAGE_MATERIAL 2
36 #define IMAGE_MATERIAL_FOLDER 3
37 #define IMAGE_FILE_MOD 4
38 #define IMAGE_MATERIAL_MOD 5
39 #define IMAGE_MATERIAL_MOD_APPLY 6
41 #define HOVER_EXPAND_DELAY 500
43 #define MSG_RENAME_FOLDER_COMPLETE (WM_USER + 1000)
44 #define MSG_RENAME_MATERIAL_COMPLETE (WM_USER + 1001)
50 ON_NOTIFY_REFLECT(TVN_SELCHANGED, OnTvnSelchanged)
51 ON_NOTIFY_REFLECT(TVN_BEGINLABELEDIT, OnTvnBeginlabeledit)
52 ON_NOTIFY_REFLECT(TVN_ENDLABELEDIT, OnTvnEndlabeledit)
54 ON_NOTIFY_REFLECT(NM_RCLICK, OnNMRclick)
56 ON_NOTIFY_REFLECT(TVN_BEGINDRAG, OnTvnBegindrag)
83 MaterialTreeView::MaterialTreeView() {
87 internalChange =
false;
105 CTreeCtrl& tree = GetTreeCtrl();
107 tree.DeleteAllItems();
122 CTreeCtrl& tree = GetTreeCtrl();
139 if(!filename.
Icmp(
"<implicit file>")) {
143 if(filename.
Find(
"def") != -1) {
166 CTreeCtrl& tree = GetTreeCtrl();
169 HTREEITEM* materialItem =
NULL;
180 HTREEITEM* fileItem =
NULL;
197 CTreeCtrl& tree = GetTreeCtrl();
200 HTREEITEM* materialItem =
NULL;
214 CTreeCtrl& tree = GetTreeCtrl();
217 HTREEITEM* materialItem =
NULL;
230 HTREEITEM* fileItem =
NULL;
263 HTREEITEM* item =
NULL;
266 CTreeCtrl& tree = GetTreeCtrl();
267 HTREEITEM parent = tree.GetParentItem(*item);
268 tree.SortChildren(parent);
281 HTREEITEM* materialItem =
NULL;
284 CTreeCtrl& tree = GetTreeCtrl();
285 tree.DeleteItem(*materialItem);
298 CTreeCtrl& tree = GetTreeCtrl();
303 HTREEITEM* item =
NULL;
305 CTreeCtrl& tree = GetTreeCtrl();
306 HTREEITEM tempItem = *item;
308 tree.DeleteItem(tempItem);
331 CTreeCtrl& tree = GetTreeCtrl();
332 HTREEITEM parent = tree.GetParentItem(*item);
333 tree.SortChildren(parent);
347 HTREEITEM* fileItem =
NULL;
350 HTREEITEM item = *fileItem;
352 CTreeCtrl& tree = GetTreeCtrl();
354 tree.DeleteItem(item);
359 HTREEITEM* newItem =
NULL;
362 CTreeCtrl& tree = GetTreeCtrl();
363 HTREEITEM parent = tree.GetParentItem(*newItem);
364 tree.SortChildren(parent);
373 CTreeCtrl& tree = GetTreeCtrl();
375 HTREEITEM item = tree.GetSelectedItem();
376 DWORD itemType = tree.GetItemData(item);
397 CTreeCtrl& tree = GetTreeCtrl();
399 HTREEITEM item = tree.GetSelectedItem();
400 DWORD itemType = tree.GetItemData(item);
414 CTreeCtrl& tree = GetTreeCtrl();
416 HTREEITEM item = tree.GetSelectedItem();
417 DWORD itemType = tree.GetItemData(item);
431 CTreeCtrl& tree = GetTreeCtrl();
433 HTREEITEM item = tree.GetSelectedItem();
434 DWORD itemType = tree.GetItemData(item);
447 CTreeCtrl& tree = GetTreeCtrl();
448 HTREEITEM item = tree.GetSelectedItem();
466 CTreeCtrl& tree = GetTreeCtrl();
467 HTREEITEM item = tree.GetSelectedItem();
485 CTreeCtrl& tree = GetTreeCtrl();
487 HTREEITEM selected = tree.GetSelectedItem();
489 selected = tree.GetRootItem();
502 HTREEITEM search =selected;
507 tree.SelectItem(found);
522 CTreeCtrl& tree = GetTreeCtrl();
527 idStr itemName = tree.GetItemText(item);
543 idStr itemName = tree.GetItemText(item);
560 CTreeCtrl& tree = GetTreeCtrl();
562 HTREEITEM nextItem =
NULL;
565 if(tree.ItemHasChildren(item)) {
566 nextItem = tree.GetChildItem(item);
571 nextItem = tree.GetNextSiblingItem(item);
577 HTREEITEM parent = item;
578 while((parent = tree.GetParentItem(parent)) !=
NULL) {
579 DWORD parType = tree.GetItemData(parent);
583 HTREEITEM sib = tree.GetNextSiblingItem(parent);
599 CTreeCtrl& tree = GetTreeCtrl();
609 for(
int i = 0;
i < materialsToDelete.
Num();
i++) {
611 affectedMaterials.
Append(materialsToDelete[
i].materialName);
631 tree.DeleteItem(item);
641 CTreeCtrl& tree = GetTreeCtrl();
643 HTREEITEM newItem = tree.InsertItem(name, parent);
646 tree.Expand(newItem, TVE_EXPAND);
649 tree.SortChildren(parent);
665 CTreeCtrl& tree = GetTreeCtrl();
676 tree.SetItemText(item, name);
686 CTreeCtrl& tree = GetTreeCtrl();
687 if (pMsg->hwnd == tree.GetSafeHwnd()) {
689 if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_DELETE) {
702 lpCreateStruct->style |= TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT | TVS_EDITLABELS | TVS_SHOWSELALWAYS | TVS_INFOTIP;
703 if (CTreeView::OnCreate(lpCreateStruct) == -1)
706 CTreeCtrl& tree = GetTreeCtrl();
708 tree.SetImageList(&
m_image, TVSIL_NORMAL);
718 LPNMTREEVIEW pNMTreeView =
reinterpret_cast<LPNMTREEVIEW
>(pNMHDR);
720 if(pNMTreeView->itemNew.hItem) {
721 CTreeCtrl& tree = GetTreeCtrl();
723 DWORD type = tree.GetItemData(pNMTreeView->itemNew.hItem);
748 LPNMTVDISPINFO pTVDispInfo =
reinterpret_cast<LPNMTVDISPINFO
>(pNMHDR);
750 CTreeCtrl& tree = GetTreeCtrl();
751 DWORD type = tree.GetItemData(pTVDispInfo->item.hItem);
767 LPNMTVDISPINFO pTVDispInfo =
reinterpret_cast<LPNMTVDISPINFO
>(pNMHDR);
771 if(pTVDispInfo->item.pszText) {
774 idStr newLabel = pTVDispInfo->item.pszText;
776 strncpy( pTVDispInfo->item.pszText, newLabel.
c_str(), pTVDispInfo->item.cchTextMax);
778 CTreeCtrl& tree = GetTreeCtrl();
779 DWORD type = tree.GetItemData(pTVDispInfo->item.hItem);
790 HTREEITEM parent = tree.GetParentItem(pTVDispInfo->item.hItem);
791 DWORD parentType = tree.GetItemData(parent);
798 material += pTVDispInfo->item.pszText;
802 MessageBox(
"Unable to rename material because it conflicts with another material",
"Error");
844 ScreenToClient (&point);
853 CTreeCtrl& tree = GetTreeCtrl();
855 DWORD dwPos = GetMessagePos();
857 CPoint pt( LOWORD( dwPos ), HIWORD ( dwPos ) );
860 tree.ScreenToClient( &spt );
863 HTREEITEM item = tree.HitTest( spt, &test );
867 if ( test & TVHT_ONITEM )
870 tree.SelectItem(item);
883 if(nChar == 3 && GetKeyState(VK_CONTROL)) {
887 if(nChar == 22 && GetKeyState(VK_CONTROL)) {
891 if(nChar == 24 && GetKeyState(VK_CONTROL)) {
895 CTreeView::OnChar(nChar, nRepCnt, nFlags);
903 LPNMTREEVIEW pNMTreeView =
reinterpret_cast<LPNMTREEVIEW
>(pNMHDR);
905 CTreeCtrl& tree = GetTreeCtrl();
907 HTREEITEM selecteditem = tree.GetSelectedItem();
911 HTREEITEM item = tree.HitTest(pNMTreeView->ptDrag, &flags);
913 if(item && (TVHT_ONITEM & flags)) {
914 if(item != selecteditem) {
915 tree.SelectItem(item);
919 DWORD itemType = tree.GetItemData(item);
926 dragImage->DragEnter(GetDesktopWindow(), pNMTreeView->ptDrag);
945 CTreeCtrl& tree = GetTreeCtrl();
960 CTreeCtrl& tree = GetTreeCtrl();
963 GetCursorPos(&point);
964 ScreenToClient(&point);
967 HTREEITEM item = tree.HitTest(point, &flags);
968 if(item && (TVHT_ONITEM & flags)) {
973 DWORD currentTime = timeGetTime();
977 if(state != TVIS_EXPANDED && tree.ItemHasChildren(
hoverItem)) {
986 CTreeView::OnMouseMove(nFlags, point);
993 CTreeCtrl& tree = GetTreeCtrl();
1000 dragImage->DragLeave(GetDesktopWindow());
1008 HTREEITEM item = tree.HitTest(point, &flags);
1009 if(item && (TVHT_ONITEM & flags)) {
1011 DWORD itemType = tree.GetItemData(item);
1014 item = tree.GetParentItem(item);
1017 HTREEITEM dragItemParent = tree.GetParentItem(
dragItem);
1018 if(dragItemParent != item) {
1028 if(!dragFile.
Icmp(filename)) {
1039 idStr copyMaterialName;
1041 materialName +=
"/" + copyMaterialName;
1052 CTreeView::OnLButtonUp(nFlags, point);
1067 HTREEITEM item = GetTreeCtrl().GetSelectedItem();
1092 HTREEITEM item = GetTreeCtrl().GetSelectedItem();
1110 CTreeCtrl& tree = GetTreeCtrl();
1112 HTREEITEM item = tree.GetSelectedItem();
1113 tree.EditLabel(item);
1121 CTreeCtrl& tree = GetTreeCtrl();
1123 HTREEITEM item = tree.GetSelectedItem();
1124 DWORD itemType = tree.GetItemData(item);
1127 HTREEITEM parent =
NULL;
1130 parent = tree.GetParentItem(item);
1132 if(tree.GetItemData(parent) ==
TYPE_FILE)
1134 parent = tree.GetParentItem(parent);
1143 idStr materialFolder =
"";
1147 HTREEITEM parentFolderItem = tree.GetParentItem(item);
1163 if(materialFolder.
Length() > 0) {
1164 name =
va(
"%s/newmaterial%d", materialFolder.
c_str(),
num);
1166 name =
va(
"newmaterial%d", num);
1182 CTreeCtrl& tree = GetTreeCtrl();
1184 HTREEITEM item = tree.GetSelectedItem();
1185 DWORD itemType = tree.GetItemData(item);
1190 item = tree.GetParentItem(item);
1197 newFolder =
va(
"newfolder%d", num);
1198 if(tree.ItemHasChildren(item)) {
1199 HTREEITEM hChildItem = tree.GetChildItem(item);
1201 while (hChildItem !=
NULL)
1203 if(!newFolder.
Icmp(tree.GetItemText(hChildItem))) {
1207 hChildItem = tree.GetNextSiblingItem(hChildItem);
1217 HTREEITEM newItem =
AddFolder(newFolder, item);
1228 CTreeCtrl& tree = GetTreeCtrl();
1230 HTREEITEM item = tree.GetSelectedItem();
1231 DWORD itemType = tree.GetItemData(item);
1234 int result = MessageBox(
"Are you sure you want to delete this folder?",
"Delete?", MB_ICONQUESTION | MB_YESNO);
1235 if(result == IDYES) {
1239 int result = MessageBox(
"Are you sure you want to delete this material?",
"Delete?", MB_ICONQUESTION | MB_YESNO);
1240 if(result == IDYES) {
1251 CTreeCtrl& tree = GetTreeCtrl();
1253 HTREEITEM item = tree.GetSelectedItem();
1254 DWORD itemType = tree.GetItemData(item);
1261 int result = MessageBox(
"This file has been modified. Are you sure you want to reload this file?",
"Reload?", MB_ICONQUESTION | MB_YESNO);
1262 if(result != IDYES) {
1274 CTreeCtrl& tree = GetTreeCtrl();
1276 HTREEITEM item = tree.GetSelectedItem();
1277 DWORD itemType = tree.GetItemData(item);
1290 CTreeCtrl& tree = GetTreeCtrl();
1292 HTREEITEM item = tree.GetSelectedItem();
1293 DWORD itemType = tree.GetItemData(item);
1306 CTreeCtrl& tree = GetTreeCtrl();
1308 HTREEITEM item = tree.GetSelectedItem();
1309 DWORD itemType = tree.GetItemData(item);
1316 item = tree.GetParentItem(item);
1317 itemType = tree.GetItemData(item);
1320 idStr materialName =
"";
1326 idStr copyMaterialName;
1328 materialName += copyMaterialName;
1357 CTreeCtrl& tree = GetTreeCtrl();
1359 tree.SortChildren(parent);
1370 CTreeCtrl& tree = GetTreeCtrl();
1372 tree.SortChildren(parent);
1382 CTreeCtrl& tree = GetTreeCtrl();
1398 HTREEITEM parent = tree.GetParentItem(item);
1399 DWORD parentType = tree.GetItemData(parent);
1403 materialName +=
"/";
1405 materialName += tree.GetItemText(item);
1426 CTreeCtrl& tree = GetTreeCtrl();
1437 HTREEITEM parent = tree.GetParentItem( item );
1438 while ( parent !=
NULL ) {
1439 DWORD parentType = tree.GetItemData(parent);
1444 parent = tree.GetParentItem( parent );
1471 CTreeCtrl& tree = GetTreeCtrl();
1473 idStr mediaName = tree.GetItemText( item );
1476 HTREEITEM parent = tree.GetParentItem( item );
1477 while ( parent !=
NULL ) {
1480 DWORD parentType = tree.GetItemData(parent);
1481 if(parentType == stopType) {
1485 idStr strParent = tree.GetItemText( parent );
1487 strParent += mediaName;
1488 mediaName = strParent;
1489 parent = tree.GetParentItem( parent );
1503 CTreeCtrl& tree = GetTreeCtrl();
1504 if(tree.ItemHasChildren(item)) {
1506 HTREEITEM childItem = tree.GetChildItem(item);
1507 while(childItem !=
NULL) {
1509 DWORD childType = tree.GetItemData(childItem);
1518 childItem = tree.GetNextSiblingItem(childItem);
1531 CTreeCtrl& treeMedia = GetTreeCtrl();
1534 HTREEITEM base =
NULL;
1537 base = treeMedia.GetRootItem();
1539 out = treeMedia.GetItemText(base);
1546 base = treeMedia.InsertItem(root);
1551 HTREEITEM item = base;
1559 idStr *strItem = &(*list)[
i];
1565 bool afterFile =
true;
1571 name = name.
Left(index);
1582 index = name.
Last(
'/');
1584 name.
Left(index, last);
1589 add = treeMedia.InsertItem(out, item);
1610 while (index >= 0) {
1611 index = name.
Find(
'/');
1613 HTREEITEM newItem =
NULL;
1614 HTREEITEM *check =
NULL;
1615 name.
Left(index, out);
1624 bool thisisfile =
false;
1625 if(out == filename) {
1631 if (newItem ==
NULL) {
1632 newItem = treeMedia.InsertItem(out, item);
1639 if(!afterFile || thisisfile) {
1643 treeMedia.SetItemData(newItem,
TYPE_FILE);
1668 add = treeMedia.InsertItem(name, item);
1693 CTreeCtrl& tree = GetTreeCtrl();
1695 HTREEITEM item = tree.HitTest( *pt, &test );
1696 if ( item ==
NULL || !(test & TVHT_ONITEM) )
1699 ClientToScreen (pt);
1703 CMenu* pPopupMenu = FloatingMenu.GetSubMenu (0);
1705 DWORD itemType = tree.GetItemData(item);
1724 pPopupMenu->EnableMenuItem(
ID_POPUP_APPLYFILE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
1726 pPopupMenu->EnableMenuItem(
ID_POPUP_APPLYFILE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
1733 pPopupMenu->EnableMenuItem(
ID_POPUP_APPLYALL, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
1748 pPopupMenu->EnableMenuItem(
ID_POPUP_SAVEFILE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
1750 pPopupMenu->EnableMenuItem(
ID_POPUP_SAVEFILE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
1757 pPopupMenu->EnableMenuItem(
ID_POPUP_SAVEALL, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
1773 pPopupMenu->EnableMenuItem(
ID_POPUP_ADDFOLDER, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
1777 pPopupMenu->EnableMenuItem(
ID_POPUP_CUT, MF_BYCOMMAND | MF_ENABLED);
1778 pPopupMenu->EnableMenuItem(
ID_POPUP_COPY, MF_BYCOMMAND | MF_ENABLED);
1780 pPopupMenu->EnableMenuItem(
ID_POPUP_CUT, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
1781 pPopupMenu->EnableMenuItem(
ID_POPUP_COPY, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
1785 pPopupMenu->EnableMenuItem(
ID_POPUP_PASTE, MF_BYCOMMAND | MF_ENABLED);
1787 pPopupMenu->EnableMenuItem(
ID_POPUP_PASTE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
1796 pPopupMenu->TrackPopupMenu (TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt->x, pt->y, &GetTreeCtrl());
1808 CTreeCtrl& tree = GetTreeCtrl();
1812 DWORD itemType = tree.GetItemData(item);
1833 tree.SetItemImage(item, image, image);
1836 if(tree.ItemHasChildren(item)) {
1837 HTREEITEM hChildItem = tree.GetChildItem(item);
1838 while (hChildItem !=
NULL) {
1840 hChildItem = tree.GetNextSiblingItem(hChildItem);
1855 CTreeCtrl& tree = GetTreeCtrl();
1868 if(tree.ItemHasChildren(item)) {
1869 HTREEITEM childItem = tree.GetChildItem(item);
1870 while(childItem !=
NULL) {
1872 childItem = tree.GetNextSiblingItem(childItem);
1887 CTreeCtrl& tree = GetTreeCtrl();
1888 if(tree.ItemHasChildren(item)) {
1889 HTREEITEM childItem = tree.GetChildItem(item);
1890 while(childItem !=
NULL) {
1891 DWORD childType = tree.GetItemData(childItem);
1896 childItem = tree.GetNextSiblingItem(childItem);
1906 CTreeCtrl& tree = GetTreeCtrl();
1909 HTREEITEM pathItem = item;
1910 while(pathItem !=
NULL) {
1911 qt =
"/" +
idStr(tree.GetItemText(pathItem)) + qt;
1912 pathItem = tree.GetParentItem(pathItem);
#define HOVER_EXPAND_DELAY
#define IDR_ME_MATERIALTREE_POPUP
bool IsCopyMaterial()
Returns true if there is a material in the copy buffer.
Undo/Redo operation for adding material folders.
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct)
Called by the MFC framework as the view is being created.
virtual BOOL PreTranslateMessage(MSG *pMsg)
Handles the keyboard shortcut for delete.
const char * GetFileName(void) const
idStr GetUniqueMaterialName(idStr name)
Returns a unique material name given a base name.
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...
void DeleteMaterial(MaterialDoc *material, bool addUndo=true)
Deletes a material.
void ApplyAll()
Applies all materials that have been changed.
virtual void MV_OnFileReload(const char *filename)
Called when a file has been reloaded.
idMaterial * renderMaterial
idStr GetCopyMaterialName()
Returns the name of the material in the copy buffer.
void SaveAllMaterials()
Saves all materials that have been changed.
CONST PIXELFORMATDESCRIPTOR UINT
#define MSG_RENAME_MATERIAL_COMPLETE
virtual void MV_OnMaterialDelete(MaterialDoc *pMaterial)
Called when a material is deleted.
afx_msg void OnAddMaterial()
Adds a new material.
virtual void MV_OnMaterialSaved(MaterialDoc *pMaterial)
Called when the material changes have been saved.
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
Handles keyboard shortcut for cut, copy and paste.
void AddStrList(const char *root, idStrList *list, bool includeFile)
Adds a string list of materials to the tree creating the proper hierarchy.
#define ID_POPUP_ADDMATERIAL
#define ID_POPUP_RENAMEMATERIAL
#define ID_POPUP_SAVEMATERIAL
idHashTable< HTREEITEM > quickTree
afx_msg void OnNMRclick(NMHDR *pNMHDR, LRESULT *pResult)
Displays the popup menu.
#define IMAGE_MATERIAL_MOD
idHashTable< HTREEITEM > fileToTree
const char * GetName(void) const
#define ID_POPUP_ADDFOLDER
GLenum GLsizei GLenum GLenum const GLvoid * image
void InitializeMaterialList(bool includeFile=true, const char *filename=NULL)
Clears the tree and rebuilds it.
afx_msg void OnLButtonUp(UINT nFlags, CPoint point)
Handles the end of a drag copy/move when the user releases the left mouse button. ...
virtual ~MaterialTreeView()
Destructor for MaterialTreeView.
afx_msg void OnSaveAll()
Save all materials that have been changed.
const char * Left(int len, idStr &result) const
virtual void MV_OnMaterialChange(MaterialDoc *pMaterial)
Called when the material has changed but not applied.
void GetMaterialPaths(HTREEITEM item, idList< MaterialTreeItem_t > *list)
Creates a list of material paths for all materials under the provided item.
GLuint GLuint GLsizei GLenum type
virtual const idMaterial * FindMaterial(const char *name, bool makeDefault=true)=0
void BuildLookupTrees(HTREEITEM item)
Build the lookup tree for a given item and all of its children.
HTREEITEM AddFolder(const char *name, HTREEITEM parent)
Adds a new material folder.
int Icmp(const char *text) const
afx_msg void OnSaveFile()
Saves all materials in the selected file.
void BuildMaterialList(bool includeFile=true, const char *filename=NULL)
Builds the tree of materials.
idStr & BackSlashesToSlashes(void)
bool DoesFileNeedApply(const char *filename)
Returns true if the specified file needs to be applied and false otherwise.
#define ID_POPUP_APPLYMATERIAL
afx_msg void OnTvnBeginlabeledit(NMHDR *pNMHDR, LRESULT *pResult)
Determines if a tree item's label can be edited.
int Icmpn(const char *text, int n) const
void SetItemImage(HTREEITEM item, bool mod, bool apply, bool children)
Sets the appropriate item image based on the state of the item.
void Set(const char *key, Type &value)
void Sort(cmp_t *compare=(cmp_t *)&idListSortCompare< type >)
void ExtractFileName(idStr &dest) const
afx_msg LRESULT OnRenameFolderComplete(WPARAM wParam, LPARAM lParam)
This message is sent after the label edit is complete to actually perform the rename operation...
GLuint GLuint GLsizei count
Responsible for managing a single material that is being viewed and/or edited.
void DeleteFolder(HTREEITEM item, bool addUndo=true)
Deletes a given folder.
bool FindNextMaterial(MaterialSearchData_t *searchData)
Searches for a material given the supplied search parameters.
#define MSG_RENAME_FOLDER_COMPLETE
afx_msg void OnPaste()
Performs a paste operation.
void AddMaterialUndoModifier(MaterialModifier *mod, bool clearRedo=true)
Adds an undo operation to the undo buffer.
virtual void MV_OnMaterialNameChanged(MaterialDoc *pMaterial, const char *oldName)
Called when the material name has changed.
bool CanPaste()
Returns true if the user can paste an item in the copy buffer.
afx_msg void OnCut()
Performs a cut operation.
void PopupMenu(CPoint *pt)
Displays the popup menu with all of the appropriate menu items enabled.
#define IDB_ME_TREEBITMAP
afx_msg void OnTvnBegindrag(NMHDR *pNMHDR, LRESULT *pResult)
Begins the process of a drag cut/copy.
void SaveFile(const char *filename)
Saves all materials in the specified file.
void SetMaterialName(const char *materialName, bool addUndo=true)
Sets the material name.
bool CanSaveFile()
Returns true if the currently selected file needs to be saved.
afx_msg void OnAddFolder()
Adds a new folder.
MaterialDoc * CreateMaterialDoc(const char *materialName)
Creates a MaterialDoc object for the specified material name.
bool CanCut()
Returns true if the user can cut the selected item.
HTREEITEM GetNextSeachItem(HTREEITEM item, bool stayInFile)
Returns the next item to search or NULL if there is nothing else to search.
virtual void MV_OnMaterialApply(MaterialDoc *pMaterial)
Called when the material changes have been applied.
idList< MaterialTreeItem_t > affectedMaterials
const char * Right(int len, idStr &result) const
bool Remove(const char *key)
int Find(const char c, int start=0, int end=-1) const
void RenameMaterial(HTREEITEM item, const char *originalName)
Handles all of the little problems associated with renaming a folder.
afx_msg void OnApplyAll()
Applies all materials that need to be applied.
void SaveMaterial(MaterialDoc *material)
Saves a single material.
#define ID_POPUP_APPLYALL
idStr GetSaveFilename()
Returns the filename of currently selected file.
bool CanCopy()
Returns true if the user can copy the selected item.
void ApplyMaterial(MaterialDoc *materialDoc)
Applys changes to a material.
Structure used to store the user defined search parameters.
afx_msg void OnMouseMove(UINT nFlags, CPoint point)
Handles mouse movement as an item is being dragged.
#define ID_POPUP_SAVEFILE
void SetSelectedMaterial(idMaterial *material)
Tells the MaterialDocManager which material has been selected for editing.
idDeclManager * declManager
void PasteMaterial(const char *name, const char *filename)
Performs a material paste operation for a material in the copy buffer.
virtual int GetNumDecls(declType_t type)=0
bool Get(const char *key, Type **value=NULL) const
afx_msg void OnDeleteMaterial()
Deletes a material or material folder.
int Append(const type &obj)
A tree view of all the materials that have been defined.
#define ID_POPUP_DELETEMATERIAL
IMPLEMENT_DYNCREATE(CCamWnd, CWnd)
bool GetFileName(HTREEITEM item, idStr &out)
Returns the filename of the provided item.
bool IsFileModified(const char *filename)
Returns true if the specified file has been modified.
Structure used associate a material name with a tree item.
idHashTable< HTREEITEM > materialToTree
MaterialDocManager * materialDocManager
virtual const idMaterial * MaterialByIndex(int index, bool forceParse=true)=0
int Last(const char c) const
afx_msg void OnCopy()
Performs a copy operation.
afx_msg void OnTvnSelchanged(NMHDR *pNMHDR, LRESULT *pResult)
Changes the selected material when the select tree item changes.
bool DoesAnyNeedApply()
Returns true if any material needs to be applied.
const char * c_str(void) const
void ReloadFile(const char *filename)
Reloads a specified file.
#define ID_POPUP_RELOADFILE
#define IMAGE_MATERIAL_FOLDER
bool CanDelete()
Returns true if the user can delete the selected item.
Undo/Redo operation for renaming a material folder.
void ApplyFile(const char *filename)
Applies all materials in the specified filename.
void CleanLookupTrees(HTREEITEM item)
Cleans the lookup tables for the provided item and all children.
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 f...
#define ID_POPUP_APPLYFILE
void AddMaterial(const char *name, const char *filename, const char *sourceText=NULL, bool addUndo=true)
Adds a material.
idStr GetQuicktreePath(HTREEITEM item)
Returns the quicktree path for a given item.
Undo/Redo operation for deleting a material folder.
void CopyMaterial(MaterialDoc *materialDoc=NULL, bool cut=false)
Prepares a material for a copy/cut and paste operations.
afx_msg void OnContextMenu(CWnd *pWnd, CPoint point)
Displays the popup menu.
char * va(const char *fmt,...)
MaterialDoc * GetCurrentMaterialDoc()
afx_msg void OnReloadFile()
Reloads the selected file.
void RenameFolder(HTREEITEM item, const char *name)
Renames a material folder.
afx_msg void OnApplyFile()
Applies all materials in the currently selected file.
afx_msg void OnSaveMaterial()
Saves the selected material.
virtual void MV_OnMaterialAdd(MaterialDoc *pMaterial)
Called when a material is added.
bool IsAnyModified()
Returns true if any material has been modified.
afx_msg void OnRenameMaterial()
Begins a label edit to rename a material or material folder.
afx_msg void OnApplyMaterial()
Applies the current material.
#define IMAGE_MATERIAL_MOD_APPLY
bool CanRename()
Returns true if the user can rename the selected item.
bool FindMaterial(const char *name, MaterialSearchData_t *searchData, bool checkName)
Searches for a material that matches the specified search data.
idStr GetMediaPath(HTREEITEM item, DWORD type)
Returns the Doom III name for the provided item.