2 ===========================================================================
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
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.
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.
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/>.
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.
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.
26 ===========================================================================
28 #include "../../idlib/precompiled.h"
31 #include "StageView.h"
33 IMPLEMENT_DYNCREATE(StageView, ToggleListView)
35 BEGIN_MESSAGE_MAP(StageView, ToggleListView)
37 ON_NOTIFY_REFLECT(LVN_ITEMCHANGED, OnLvnItemchanged)
38 ON_NOTIFY_REFLECT(LVN_DELETEALLITEMS, OnLvnDeleteallitems)
39 ON_NOTIFY_REFLECT(LVN_BEGINDRAG, OnLvnBegindrag)
42 ON_NOTIFY_REFLECT(NM_RCLICK, OnNMRclick)
44 ON_COMMAND(ID_STAGEPOPUP_RENAMESTAGE, OnRenameStage)
45 ON_COMMAND(ID_STAGEPOPUP_DELETESTAGE, OnDeleteStage)
46 ON_COMMAND(ID_STAGEPOPUP_DELETEALLSTAGES, OnDeleteAllStages)
47 ON_COMMAND(ID_STAGEPOPUP_ADDSTAGE, OnAddStage)
48 ON_COMMAND(ID_STAGEPOPUP_ADDBUMPMAP, OnAddBumpmapStage)
49 ON_COMMAND(ID_STAGEPOPUP_ADDDIFFUSEMAP, OnAddDiffuseStage)
50 ON_COMMAND(ID_STAGEPOPUP_ADDSPECULAR, OnAddSpecualarStage)
52 ON_COMMAND(ID_STAGEPOPUP_COPY, OnCopy)
53 ON_COMMAND(ID_STAGEPOPUP_PASTE, OnPaste)
55 ON_NOTIFY_REFLECT(LVN_BEGINLABELEDIT, OnLvnBeginlabeledit)
56 ON_NOTIFY_REFLECT(LVN_ENDLABELEDIT, OnLvnEndlabeledit)
61 * Constructor for StageView.
63 StageView::StageView() {
64 currentMaterial = NULL;
66 internalChange = false;
70 * Destructor for StageView.
72 StageView::~StageView() {
76 * Called when the selected material has changed.
77 * @param pMaterial The newly selected material.
79 void StageView::MV_OnMaterialSelectionChange(MaterialDoc* pMaterial) {
81 currentMaterial = pMaterial;
87 * Called when the material changes have been saved.
88 * @param pMaterial The saved material.
90 void StageView::MV_OnMaterialSaved(MaterialDoc* pMaterial) {
92 CListCtrl& list = GetListCtrl();
94 //Saving a material reenables all of the stages
95 if(pMaterial == currentMaterial) {
96 for(int i = 1; i < list.GetItemCount(); i++) {
97 SetToggleState(i, ToggleListView::TOGGLE_STATE_ON);
103 * Called when a stage is added
104 * @param pMaterial The material that was affected.
105 * @param stageNum The index of the stage that was added
107 void StageView::MV_OnMaterialStageAdd(MaterialDoc* pMaterial, int stageNum) {
109 CListCtrl& list = GetListCtrl();
111 idStr name = pMaterial->GetAttribute(stageNum, "name");
113 int index = list.InsertItem(stageNum+1, name.c_str());
114 SetToggleState(index, ToggleListView::TOGGLE_STATE_ON);
118 * Called when a stage is deleted
119 * @param pMaterial The material that was affected.
120 * @param stageNum The index of the stage that was deleted
122 void StageView::MV_OnMaterialStageDelete(MaterialDoc* pMaterial, int stageNum) {
123 CListCtrl& list = GetListCtrl();
124 list.DeleteItem(stageNum+1);
128 * Called when a stage is moved
129 * @param pMaterial The material that was deleted.
130 * @param from The from index
131 * @param to The to index
133 void StageView::MV_OnMaterialStageMove(MaterialDoc* pMaterial, int from, int to) {
135 if(!internalChange) {
139 CListCtrl& list = GetListCtrl();
143 ZeroMemory(&lvi, sizeof(LV_ITEM));
144 lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE | LVIF_PARAM;
145 lvi.stateMask = LVIS_DROPHILITED | LVIS_FOCUSED | LVIS_SELECTED;
146 lvi.pszText = szLabel;
148 lvi.cchTextMax = 255;
151 //Delete the original item
152 list.DeleteItem(from);
156 list.InsertItem(&lvi);
160 int stageType = currentMaterial->GetAttributeInt(to-1, "stagetype");
162 case MaterialDoc::STAGE_TYPE_NORMAL:
163 type = MaterialDefManager::MATERIAL_DEF_STAGE;
165 case MaterialDoc::STAGE_TYPE_SPECIALMAP:
166 type = MaterialDefManager::MATERIAL_DEF_SPECIAL_STAGE;
170 m_propView->SetPropertyListType(type, to-1);
178 * Called when an attribute is changed
179 * @param pMaterial The material that was deleted.
180 * @param stage The stage that contains the change.
181 * @param attribName The attribute that has changed.
183 void StageView::MV_OnMaterialAttributeChanged(MaterialDoc* pMaterial, int stage, const char* attribName) {
185 //Refresh this stage list if a material name has changed
186 if(!internalChange && currentMaterial == pMaterial && stage >= 0 && attribName && !strcmp(attribName, "name") ) {
187 CListCtrl& list = GetListCtrl();
188 list.SetItemText(stage+1, 0, currentMaterial->GetAttribute(stage, attribName));
193 * Returns true if the current state of the stage view will allow a copy operation
195 bool StageView::CanCopy() {
197 CListCtrl& list = GetListCtrl();
198 POSITION pos = list.GetFirstSelectedItemPosition();
201 nItem = list.GetNextSelectedItem(pos);
211 * Returns true if the current state of the stage view will allow a paste operation
213 bool StageView::CanPaste() {
214 return materialDocManager->IsCopyStage();
218 * Cut is not supported for stages.
220 bool StageView::CanCut() {
226 * Returns true if the current state of the stage view will allow a delete operation
228 bool StageView::CanDelete() {
229 CListCtrl& list = GetListCtrl();
230 POSITION pos = list.GetFirstSelectedItemPosition();
233 nItem = list.GetNextSelectedItem(pos);
243 * Returns true if the current state of the stage view will allow a rename operation
245 bool StageView::CanRename() {
246 CListCtrl& list = GetListCtrl();
248 POSITION pos = list.GetFirstSelectedItemPosition();
251 nItem = list.GetNextSelectedItem(pos);
255 MaterialDoc* material = materialDocManager->GetCurrentMaterialDoc();
256 if(nItem > 0 && material->GetAttributeInt(nItem-1, "stagetype") == MaterialDoc::STAGE_TYPE_NORMAL) {
265 * Rebuilds the list of stages based on the currently selected material
267 void StageView::RefreshStageList() {
269 CListCtrl& list = GetListCtrl();
271 POSITION pos = list.GetFirstSelectedItemPosition();
272 int selectedItem = -1;
274 selectedItem = list.GetNextSelectedItem(pos);
276 list.DeleteAllItems();
278 if(currentMaterial) {
280 //Always add the material item for the main material properties
281 list.InsertItem(0, "Material");
282 SetToggleState(0, ToggleListView::TOGGLE_STATE_DISABLED);
285 int stageCount = currentMaterial->GetStageCount();
286 for(int i = 0; i < stageCount; i++) {
287 const char* name = currentMaterial->GetAttribute(i, "name");
289 int itemNum = list.InsertItem(list.GetItemCount(), name);
291 if(currentMaterial->IsStageEnabled(i)) {
292 SetToggleState(itemNum, ToggleListView::TOGGLE_STATE_ON);
294 SetToggleState(itemNum, ToggleListView::TOGGLE_STATE_OFF);
298 if(selectedItem < 0) {
299 //Select the material
300 list.SetItemState(0, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
302 list.SetItemState(selectedItem, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
308 * Called by the MFC framework when the view is being created.
310 int StageView::OnCreate(LPCREATESTRUCT lpCreateStruct) {
311 if (ToggleListView::OnCreate(lpCreateStruct) == -1)
314 SetToggleIcons(MAKEINTRESOURCE(IDI_ME_DISABLED_ICON), MAKEINTRESOURCE(IDI_ME_ON_ICON), MAKEINTRESOURCE(IDI_ME_OFF_ICON));
320 * Called when the user changes the selection in the list box. This method will notify the
321 * property view of the change so that it can display the appropriate properties.
323 void StageView::OnLvnItemchanged(NMHDR *pNMHDR, LRESULT *pResult) {
324 LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
328 //The state has changed and changed to selected
329 if(pNMLV->uChanged && LVIF_STATE && pNMLV->uNewState & LVIS_SELECTED) {
333 if(pNMLV->iItem >= 0) {
334 if(pNMLV->iItem == 0)
335 type = MaterialDefManager::MATERIAL_DEF_MATERIAL;
337 int stageType = currentMaterial->GetAttributeInt(pNMLV->iItem-1, "stagetype");
339 case MaterialDoc::STAGE_TYPE_NORMAL:
340 type = MaterialDefManager::MATERIAL_DEF_STAGE;
342 case MaterialDoc::STAGE_TYPE_SPECIALMAP:
343 type = MaterialDefManager::MATERIAL_DEF_SPECIAL_STAGE;
349 m_propView->SetPropertyListType(type, pNMLV->iItem-1);
352 if(pNMLV->uChanged && LVIF_STATE && pNMLV->uOldState & LVIS_SELECTED && !(pNMLV->uNewState & LVIS_SELECTED)) {
353 //This item was deselected.
354 //If there is no item selected then clear the prop list
355 CListCtrl& list = GetListCtrl();
356 POSITION pos = list.GetFirstSelectedItemPosition();
358 m_propView->SetPropertyListType(-1);
365 * Notifies the property view that all stages have been removed.
367 void StageView::OnLvnDeleteallitems(NMHDR *pNMHDR, LRESULT *pResult) {
368 LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
370 //The list has been cleared so clear the prop view
371 m_propView->SetPropertyListType(-1);
377 * Starts the stage drag operation.
379 void StageView::OnLvnBegindrag(NMHDR *pNMHDR, LRESULT *pResult) {
380 LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
382 CListCtrl& list = GetListCtrl();
384 //Start a drag if the item isn't the material
385 if(pNMLV->iItem > 0) {
388 dragIndex = pNMLV->iItem;
390 //Trun off ownerdrawn to create the drag image correctly
391 list.ModifyStyle(LVS_OWNERDRAWFIXED, 0);
393 //Create the drag image
397 dragImage = list.CreateDragImage(dragIndex, &pt);
398 dragImage->BeginDrag(0, CPoint (8, 8));
399 dragImage->DragEnter(GetDesktopWindow(), pNMLV->ptAction);
401 //Turn the owner draw back on
402 list.ModifyStyle(0, LVS_OWNERDRAWFIXED);
404 //Drag is in progress
409 //Capture the messages
417 * Finishes a stage drag operation of the user was dragging a stage.
419 void StageView::OnLButtonUp(UINT nFlags, CPoint point) {
421 //Release mouse capture
424 //Delete the drag image
425 dragImage->DragLeave(GetDesktopWindow());
426 dragImage->EndDrag();
431 dropWnd = WindowFromPoint(pt);
433 if( dropWnd->IsKindOf(RUNTIME_CLASS(StageView)) )
439 ToggleListView::OnLButtonUp(nFlags, point);
443 * Handles drawing the drag image when a user is draging a stage.
445 void StageView::OnMouseMove(UINT nFlags, CPoint point) {
448 ClientToScreen(&dropPoint);
450 //Move the drag image
451 dragImage->DragMove(dropPoint);
452 dragImage->DragShowNolock(FALSE);
454 dropWnd = WindowFromPoint(dropPoint);
455 dropWnd->ScreenToClient(&dropPoint);
457 dragImage->DragShowNolock(TRUE);
459 ToggleListView::OnMouseMove(nFlags, point);
463 * Displays the popup menu when the user performs a right mouse click.
465 void StageView::OnNMRclick(NMHDR *pNMHDR, LRESULT *pResult) {
466 if(materialDocManager->GetCurrentMaterialDoc()) {
467 CListCtrl& list = GetListCtrl();
469 DWORD dwPos = GetMessagePos();
471 CPoint pt( LOWORD( dwPos ), HIWORD ( dwPos ) );
474 list.ScreenToClient( &spt );
482 * Begins a label edit when the user selects the rename menu option.
484 void StageView::OnRenameStage() {
486 CListCtrl& list = GetListCtrl();
487 POSITION pos = list.GetFirstSelectedItemPosition();
490 nItem = list.GetNextSelectedItem(pos);
491 list.EditLabel(nItem);
496 * Deletes the selected stage when the user selects the delete menu option.
498 void StageView::OnDeleteStage() {
500 CListCtrl& list = GetListCtrl();
501 POSITION pos = list.GetFirstSelectedItemPosition();
504 nItem = list.GetNextSelectedItem(pos);
506 int result = MessageBox("Are you sure you want to delete this stage?", "Delete?", MB_ICONQUESTION | MB_YESNO);
507 if(result == IDYES) {
509 MaterialDoc* material = materialDocManager->GetCurrentMaterialDoc();
510 material->RemoveStage(nItem-1);
517 * Conforms the user wants to delete all stages and then performs the operation.
519 void StageView::OnDeleteAllStages() {
520 int result = MessageBox("Are you sure you want to delete all stages?", "Delete?", MB_ICONQUESTION | MB_YESNO);
521 if(result == IDYES) {
522 MaterialDoc* material = materialDocManager->GetCurrentMaterialDoc();
523 material->ClearStages();
528 * Adds a new stage when the user selects the menu option.
530 void StageView::OnAddStage() {
531 MaterialDoc* material = materialDocManager->GetCurrentMaterialDoc();
533 idStr name = va("Stage %d", material->GetStageCount()+1);
534 material->AddStage(MaterialDoc::STAGE_TYPE_NORMAL, name.c_str());
538 * Adds a new bumpmap stage when the user selects the menu option.
540 void StageView::OnAddBumpmapStage() {
541 MaterialDoc* material = materialDocManager->GetCurrentMaterialDoc();
542 material->AddStage(MaterialDoc::STAGE_TYPE_SPECIALMAP, "bumpmap");
546 * Adds a new diffusemap stage when the user selects the menu option.
548 void StageView::OnAddDiffuseStage() {
549 MaterialDoc* material = materialDocManager->GetCurrentMaterialDoc();
550 material->AddStage(MaterialDoc::STAGE_TYPE_SPECIALMAP, "diffusemap");
554 * Adds a new specularmap stage when the user selects the menu option.
556 void StageView::OnAddSpecualarStage() {
557 MaterialDoc* material = materialDocManager->GetCurrentMaterialDoc();
558 material->AddStage(MaterialDoc::STAGE_TYPE_SPECIALMAP, "specularmap");
562 * Performs a copy operation when the user selects the menu option.
564 void StageView::OnCopy() {
566 MaterialDoc* material = materialDocManager->GetCurrentMaterialDoc();
568 CListCtrl& list = GetListCtrl();
570 POSITION pos = list.GetFirstSelectedItemPosition();
573 nItem = list.GetNextSelectedItem(pos);
576 materialDocManager->CopyStage(material, nItem-1);
581 * Performs a paste operation when the user selects the menu option.
583 void StageView::OnPaste() {
584 if(materialDocManager->IsCopyStage()) {
586 MaterialDoc* material = materialDocManager->GetCurrentMaterialDoc();
591 materialDocManager->GetCopyStageInfo(type, name);
593 int existingIndex = material->FindStage(type, name);
595 if(type != MaterialDoc::STAGE_TYPE_SPECIALMAP || existingIndex == -1) {
596 materialDocManager->PasteStage(material);
598 if(MessageBox(va("Do you want to replace '%s' stage?", name.c_str()), "Replace?", MB_ICONQUESTION | MB_YESNO) == IDYES) {
599 material->RemoveStage(existingIndex);
600 materialDocManager->PasteStage(material);
607 * Determines is a label edit can be performed on the selected stage.
609 void StageView::OnLvnBeginlabeledit(NMHDR *pNMHDR, LRESULT *pResult) {
610 NMLVDISPINFO *pDispInfo = reinterpret_cast<NMLVDISPINFO*>(pNMHDR);
612 //if this is a special stage then don't allow edit
613 int index = pDispInfo->item.iItem;
615 MaterialDoc* material = materialDocManager->GetCurrentMaterialDoc();
616 if(index <= 0 || material->GetAttributeInt(index-1, "stagetype") != MaterialDoc::STAGE_TYPE_NORMAL)
622 //ToDo: Can we move the edit box
623 /*HWND edit = ListView_GetEditControl(m_hWnd);
624 CWnd* editWnd = CWnd::FromHandle(edit);
626 editWnd->GetWindowRect(rect);
629 editWnd->MoveWindow(rect);*/
636 * Performs the stage name change after the label edit is done.
638 void StageView::OnLvnEndlabeledit(NMHDR *pNMHDR, LRESULT *pResult) {
639 NMLVDISPINFO *pDispInfo = reinterpret_cast<NMLVDISPINFO*>(pNMHDR);
641 if(pDispInfo->item.pszText) {
642 MaterialDoc* material = materialDocManager->GetCurrentMaterialDoc();
643 internalChange = true;
644 material->SetAttribute(pDispInfo->item.iItem-1, "name", pDispInfo->item.pszText);
645 internalChange = false;
653 * Handles keyboard shortcuts for copy and paste operations.
655 void StageView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) {
656 if(nChar == 3 && GetKeyState(VK_CONTROL)) {
660 if(nChar == 22 && GetKeyState(VK_CONTROL)) {
665 ToggleListView::OnChar(nChar, nRepCnt, nFlags);
669 * Handles keyboard shortcut for the delete operations.
671 BOOL StageView::PreTranslateMessage(MSG* pMsg) {
673 CListCtrl& list = GetListCtrl();
674 if (pMsg->hwnd == list.GetSafeHwnd()) {
676 if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_DELETE) {
685 * Sets window styles before the window is created.
687 BOOL StageView::PreCreateWindow(CREATESTRUCT& cs) {
688 cs.style &= ~LVS_TYPEMASK;
689 cs.style |= LVS_SINGLESEL | LVS_EDITLABELS;
691 return ToggleListView::PreCreateWindow(cs);
695 * Called by the ToggleListView when the toggle state has changed.
697 void StageView::OnStateChanged(int index, int toggleState) {
698 MaterialDoc* material = materialDocManager->GetCurrentMaterialDoc();
699 if(material && index > 0) {
700 if (toggleState == ToggleListView::TOGGLE_STATE_ON) {
701 material->EnableStage(index-1, true);
702 } else if (toggleState == ToggleListView::TOGGLE_STATE_OFF) {
703 material->EnableStage(index-1, false);
709 * Dispalys the popup menu with the appropriate menu items enabled.
711 void StageView::PopupMenu(CPoint* pt) {
713 //Determine the type of object clicked on
714 CListCtrl& list = GetListCtrl();
720 VERIFY(FloatingMenu.LoadMenu(IDR_ME_STAGELIST_POPUP));
721 CMenu* pPopupMenu = FloatingMenu.GetSubMenu (0);
722 ASSERT(pPopupMenu != NULL);
724 POSITION pos = list.GetFirstSelectedItemPosition();
727 nItem = list.GetNextSelectedItem(pos);
730 pPopupMenu->EnableMenuItem(ID_STAGEPOPUP_RENAMESTAGE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
731 pPopupMenu->EnableMenuItem(ID_STAGEPOPUP_DELETESTAGE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
733 pPopupMenu->EnableMenuItem(ID_STAGEPOPUP_CUT, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
734 pPopupMenu->EnableMenuItem(ID_STAGEPOPUP_COPY, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
736 MaterialDoc* material = materialDocManager->GetCurrentMaterialDoc();
737 if(material->GetAttributeInt(nItem-1, "stagetype") != MaterialDoc::STAGE_TYPE_NORMAL) {
738 pPopupMenu->EnableMenuItem(ID_STAGEPOPUP_RENAMESTAGE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
742 MaterialDoc* material = materialDocManager->GetCurrentMaterialDoc();
743 if(material->FindStage(MaterialDoc::STAGE_TYPE_SPECIALMAP, "bumpmap") >= 0) {
744 pPopupMenu->EnableMenuItem(ID_STAGEPOPUP_ADDBUMPMAP, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
746 if(material->FindStage(MaterialDoc::STAGE_TYPE_SPECIALMAP, "diffusemap") >= 0) {
747 pPopupMenu->EnableMenuItem(ID_STAGEPOPUP_ADDDIFFUSEMAP, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
749 if(material->FindStage(MaterialDoc::STAGE_TYPE_SPECIALMAP, "specularmap") >= 0) {
750 pPopupMenu->EnableMenuItem(ID_STAGEPOPUP_ADDSPECULAR, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
753 if(materialDocManager->IsCopyStage()) {
754 pPopupMenu->EnableMenuItem(ID_STAGEPOPUP_PASTE, MF_BYCOMMAND | MF_ENABLED);
756 pPopupMenu->EnableMenuItem(ID_STAGEPOPUP_PASTE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
759 pPopupMenu->TrackPopupMenu (TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt->x, pt->y, &list);
763 * Performs the stage move when the user has dragged and dropped a stage.
765 void StageView::DropItemOnList() {
766 CListCtrl& list = GetListCtrl();
770 //Get and adjust the drop index based on the direction of the move
771 dropIndex = list.HitTest(dropPoint);
772 if(dropIndex < 0) dropIndex = list.GetItemCount()-1;
774 //Ignore the drop if the index is the same or they are droping on the material
775 if(dropIndex == dragIndex || dropIndex == 0)
778 //Move the stage data
779 MaterialDoc* material = materialDocManager->GetCurrentMaterialDoc();
781 internalChange = true;
782 toStage = dropIndex-1;
783 material->MoveStage(dragIndex-1, dropIndex-1);
784 internalChange = false;
786 if(dragIndex < dropIndex) {
793 ZeroMemory(&lvi, sizeof(LV_ITEM));
794 lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE | LVIF_PARAM;
795 lvi.stateMask = LVIS_DROPHILITED | LVIS_FOCUSED | LVIS_SELECTED;
796 lvi.pszText = szLabel;
797 lvi.iItem = dragIndex;
798 lvi.cchTextMax = 255;
802 lvi.iItem = dropIndex;
803 list.InsertItem(&lvi);
805 //Adjust the drag index if the move was up in the list
806 if(dragIndex > dropIndex) {
810 //Delete the original item
811 list.DeleteItem(dragIndex);
814 int stageType = currentMaterial->GetAttributeInt(toStage, "stagetype");
816 case MaterialDoc::STAGE_TYPE_NORMAL:
817 type = MaterialDefManager::MATERIAL_DEF_STAGE;
819 case MaterialDoc::STAGE_TYPE_SPECIALMAP:
820 type = MaterialDefManager::MATERIAL_DEF_SPECIAL_STAGE;
823 m_propView->SetPropertyListType(type, toStage);