doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StageView.h
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 #pragma once
29 
30 #include <afxcview.h>
31 #include <afxole.h>
32 
33 #include "MaterialEditor.h"
34 #include "ToggleListView.h"
35 #include "MaterialView.h"
36 #include "MaterialPropTreeView.h"
37 
41 class StageView : public ToggleListView, public MaterialView
42 {
43 
44 public:
45  virtual ~StageView();
46 
50  enum {
54  };
55 
56  //Associates a property view with this stage view
57  void SetMaterialPropertyView(MaterialPropTreeView* propView) { m_propView = propView; };
58 
59  //MaterialView Interface
60  virtual void MV_OnMaterialSelectionChange(MaterialDoc* pMaterial);
61  virtual void MV_OnMaterialStageAdd(MaterialDoc* pMaterial, int stageNum);
62  virtual void MV_OnMaterialStageDelete(MaterialDoc* pMaterial, int stageNum);
63  virtual void MV_OnMaterialStageMove(MaterialDoc* pMaterial, int from, int to);
64  virtual void MV_OnMaterialAttributeChanged(MaterialDoc* pMaterial, int stage, const char* attribName);
65  virtual void MV_OnMaterialSaved(MaterialDoc* pMaterial);
66 
67  //Edit Operation Tests
68  bool CanCopy();
69  bool CanPaste();
70  bool CanCut();
71  bool CanDelete();
72  bool CanRename();
73 
74  //Refresh the stage list
75  void RefreshStageList();
76 
77 protected:
78  StageView();
79  DECLARE_DYNCREATE(StageView)
80 
81  afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
82  afx_msg void OnLvnItemchanged(NMHDR *pNMHDR, LRESULT *pResult);
83  afx_msg void OnLvnDeleteallitems(NMHDR *pNMHDR, LRESULT *pResult);
84  afx_msg void OnLvnBegindrag(NMHDR *pNMHDR, LRESULT *pResult);
85  afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
86  afx_msg void OnMouseMove(UINT nFlags, CPoint point);
87  afx_msg void OnNMRclick(NMHDR *pNMHDR, LRESULT *pResult);
88 
89  afx_msg void OnRenameStage();
90  afx_msg void OnDeleteStage();
91  afx_msg void OnDeleteAllStages();
92  afx_msg void OnAddStage();
93  afx_msg void OnAddBumpmapStage();
94  afx_msg void OnAddDiffuseStage();
95  afx_msg void OnAddSpecualarStage();
96 
97  afx_msg void OnCopy();
98  afx_msg void OnPaste();
99 
100  afx_msg void OnLvnBeginlabeledit(NMHDR *pNMHDR, LRESULT *pResult);
101  afx_msg void OnLvnEndlabeledit(NMHDR *pNMHDR, LRESULT *pResult);
102  afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
103  DECLARE_MESSAGE_MAP()
104 
105  //Overrides
106  virtual BOOL PreTranslateMessage(MSG* pMsg);
107  virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
108 
109  //Toggle List View Interface
110  virtual void OnStateChanged(int index, int toggleState);
111 
112  void PopupMenu(CPoint* pt);
113 
114  void DropItemOnList();
115 
116 protected:
117 
120 
121  //Manual handing of the row dragging
122  CImageList* dragImage;
123  bool bDragging;
126  CWnd* dropWnd;
127  CPoint dropPoint;
128 
130 };
131 
132 
virtual void MV_OnMaterialAttributeChanged(MaterialDoc *pMaterial, int stage, const char *attribName)
Called when an attribute is changed.
Definition: StageView.cpp:183
virtual void MV_OnMaterialSelectionChange(MaterialDoc *pMaterial)
Called when the selected material has changed.
Definition: StageView.cpp:79
View that displays material and stage properties and allows the user to edit the properties.
afx_msg void OnPaste()
Performs a paste operation when the user selects the menu option.
Definition: StageView.cpp:583
CONST PIXELFORMATDESCRIPTOR UINT
Definition: win_qgl.cpp:47
CPoint dropPoint
Definition: StageView.h:127
int dropIndex
Definition: StageView.h:125
virtual void MV_OnMaterialStageDelete(MaterialDoc *pMaterial, int stageNum)
Called when a stage is deleted.
Definition: StageView.cpp:122
afx_msg void OnAddDiffuseStage()
Adds a new diffusemap stage when the user selects the menu option.
Definition: StageView.cpp:548
void PopupMenu(CPoint *pt)
Dispalys the popup menu with the appropriate menu items enabled.
Definition: StageView.cpp:711
CWnd * dropWnd
Definition: StageView.h:126
afx_msg void OnLvnItemchanged(NMHDR *pNMHDR, LRESULT *pResult)
Called when the user changes the selection in the list box.
Definition: StageView.cpp:323
bool CanDelete()
Returns true if the current state of the stage view will allow a delete operation.
Definition: StageView.cpp:228
void DropItemOnList()
Performs the stage move when the user has dragged and dropped a stage.
Definition: StageView.cpp:765
afx_msg void OnLvnDeleteallitems(NMHDR *pNMHDR, LRESULT *pResult)
Notifies the property view that all stages have been removed.
Definition: StageView.cpp:367
afx_msg void OnAddStage()
Adds a new stage when the user selects the menu option.
Definition: StageView.cpp:530
int dragIndex
Definition: StageView.h:124
#define BOOL
Definition: mprintf.c:71
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct)
Called by the MFC framework when the view is being created.
Definition: StageView.cpp:310
afx_msg void OnCopy()
Performs a copy operation when the user selects the menu option.
Definition: StageView.cpp:564
MaterialPropTreeView * m_propView
Definition: StageView.h:118
virtual ~StageView()
Destructor for StageView.
Definition: StageView.cpp:72
Responsible for managing a single material that is being viewed and/or edited.
Definition: MaterialDoc.h:67
afx_msg void OnAddBumpmapStage()
Adds a new bumpmap stage when the user selects the menu option.
Definition: StageView.cpp:540
GLuint index
Definition: glext.h:3476
afx_msg void OnNMRclick(NMHDR *pNMHDR, LRESULT *pResult)
Displays the popup menu when the user performs a right mouse click.
Definition: StageView.cpp:465
MaterialView Interface.
Definition: MaterialView.h:38
virtual void MV_OnMaterialSaved(MaterialDoc *pMaterial)
Called when the material changes have been saved.
Definition: StageView.cpp:90
View that handles managing the material stages.
Definition: StageView.h:41
afx_msg void OnLvnBeginlabeledit(NMHDR *pNMHDR, LRESULT *pResult)
Determines is a label edit can be performed on the selected stage.
Definition: StageView.cpp:609
afx_msg void OnLButtonUp(UINT nFlags, CPoint point)
Finishes a stage drag operation of the user was dragging a stage.
Definition: StageView.cpp:419
bool bDragging
Definition: StageView.h:123
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
Handles keyboard shortcuts for copy and paste operations.
Definition: StageView.cpp:655
afx_msg void OnLvnEndlabeledit(NMHDR *pNMHDR, LRESULT *pResult)
Performs the stage name change after the label edit is done.
Definition: StageView.cpp:638
CImageList * dragImage
Definition: StageView.h:122
bool internalChange
Definition: StageView.h:129
afx_msg void OnLvnBegindrag(NMHDR *pNMHDR, LRESULT *pResult)
Starts the stage drag operation.
Definition: StageView.cpp:379
virtual void MV_OnMaterialStageMove(MaterialDoc *pMaterial, int from, int to)
Called when a stage is moved.
Definition: StageView.cpp:133
afx_msg void OnMouseMove(UINT nFlags, CPoint point)
Handles drawing the drag image when a user is draging a stage.
Definition: StageView.cpp:445
void RefreshStageList()
Rebuilds the list of stages based on the currently selected material.
Definition: StageView.cpp:267
StageView()
Constructor for StageView.
Definition: StageView.cpp:63
afx_msg void OnDeleteStage()
Deletes the selected stage when the user selects the delete menu option.
Definition: StageView.cpp:498
virtual void MV_OnMaterialStageAdd(MaterialDoc *pMaterial, int stageNum)
Called when a stage is added.
Definition: StageView.cpp:107
virtual void OnStateChanged(int index, int toggleState)
Called by the ToggleListView when the toggle state has changed.
Definition: StageView.cpp:697
afx_msg void OnRenameStage()
Begins a label edit when the user selects the rename menu option.
Definition: StageView.cpp:484
afx_msg void OnAddSpecualarStage()
Adds a new specularmap stage when the user selects the menu option.
Definition: StageView.cpp:556
void SetMaterialPropertyView(MaterialPropTreeView *propView)
Definition: StageView.h:57
virtual BOOL PreTranslateMessage(MSG *pMsg)
Handles keyboard shortcut for the delete operations.
Definition: StageView.cpp:671
#define protected
Definition: TypeInfo.cpp:31
afx_msg void OnDeleteAllStages()
Conforms the user wants to delete all stages and then performs the operation.
Definition: StageView.cpp:519
A simple list view that supports a toggle button.
bool CanRename()
Returns true if the current state of the stage view will allow a rename operation.
Definition: StageView.cpp:245
MaterialDoc * currentMaterial
Definition: StageView.h:119
virtual BOOL PreCreateWindow(CREATESTRUCT &cs)
Sets window styles before the window is created.
Definition: StageView.cpp:687
bool CanCopy()
Returns true if the current state of the stage view will allow a copy operation.
Definition: StageView.cpp:195
bool CanCut()
Cut is not supported for stages.
Definition: StageView.cpp:220
bool CanPaste()
Returns true if the current state of the stage view will allow a paste operation. ...
Definition: StageView.cpp:213