mirror of
https://github.com/dhewm/dhewm3.git
synced 2025-04-19 08:58:56 +00:00
MaterialEditor: improvements to StageView.
This commit is contained in:
parent
319ef9988e
commit
69d035a1b0
4 changed files with 519 additions and 414 deletions
|
@ -54,6 +54,7 @@ MaterialEditView::MaterialEditView() {
|
|||
sourceChanged = false;
|
||||
propsTabSelected = true;
|
||||
textTabSelected = false;
|
||||
tabSel = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -254,6 +255,9 @@ bool MaterialEditView::Draw( const ImVec2 &size ) {
|
|||
* the appropriate windows.
|
||||
*/
|
||||
void MaterialEditView::OnTcnSelChange(int sel) {
|
||||
if ( tabSel == sel ) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch(sel) {
|
||||
case 0:
|
||||
|
@ -271,7 +275,10 @@ void MaterialEditView::OnTcnSelChange(int sel) {
|
|||
|
||||
GetMaterialSource();
|
||||
m_textView.SetReadOnly( false );
|
||||
|
||||
break;
|
||||
}
|
||||
tabSel = sel;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -90,6 +90,7 @@ protected:
|
|||
idStr currentMaterialName;
|
||||
bool propsTabSelected;
|
||||
bool textTabSelected;
|
||||
int tabSel;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -36,6 +36,33 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
namespace ImGuiTools {
|
||||
|
||||
class StageViewItem {
|
||||
public:
|
||||
StageViewItem() : label(), data(0) {
|
||||
}
|
||||
virtual ~StageViewItem() {
|
||||
label.Clear();
|
||||
}
|
||||
|
||||
ID_INLINE void SetLabel(const char *_label) {
|
||||
label = _label;
|
||||
}
|
||||
ID_INLINE idStr &GetLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
ID_INLINE int GetData() const {
|
||||
return data;
|
||||
}
|
||||
ID_INLINE void SetData(int _data) {
|
||||
data = _data;
|
||||
}
|
||||
|
||||
private:
|
||||
idStr label;
|
||||
int data;
|
||||
};
|
||||
|
||||
/**
|
||||
* View that handles managing the material stages.
|
||||
*/
|
||||
|
@ -55,6 +82,15 @@ public:
|
|||
STAGE_TYPE_SPECIAL_MAP_STAGE
|
||||
};
|
||||
|
||||
/**
|
||||
* Enumeration that defines the possible states of the toggle button.
|
||||
*/
|
||||
enum {
|
||||
TOGGLE_STATE_DISABLED = 0,
|
||||
TOGGLE_STATE_ON,
|
||||
TOGGLE_STATE_OFF
|
||||
};
|
||||
|
||||
//Associates a property view with this stage view
|
||||
void SetMaterialPropertyView(MaterialPropTreeView* propView) { m_propView = propView; };
|
||||
|
||||
|
@ -80,57 +116,76 @@ public:
|
|||
int OnCreate();
|
||||
bool Draw( const ImVec2 &size );
|
||||
|
||||
private:
|
||||
void DeleteAllItems();
|
||||
void SetItemState(int index);
|
||||
int GetItemCount() const;
|
||||
void DeleteItem( int index );
|
||||
int InsertItem( int index, const char *label );
|
||||
void GetItem( int index, idStr &label );
|
||||
int GetSelectedItemIndex();
|
||||
void SetItemText( int index, const char *label );
|
||||
void SetItemData( int index, int data );
|
||||
int GetItemData( int index );
|
||||
|
||||
//void SetToggleIcons(LPCSTR disabled = NULL, LPCSTR on = NULL, LPCSTR off = NULL);
|
||||
void SetToggleState(int index, int toggleState, bool notify = false);
|
||||
int GetToggleState(int index);
|
||||
|
||||
protected:
|
||||
/*
|
||||
afx_msg void OnLvnItemchanged(NMHDR *pNMHDR, LRESULT *pResult);
|
||||
afx_msg void OnLvnDeleteallitems(NMHDR *pNMHDR, LRESULT *pResult);
|
||||
afx_msg void OnLvnBegindrag(NMHDR *pNMHDR, LRESULT *pResult);
|
||||
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
||||
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||
afx_msg void OnNMRclick(NMHDR *pNMHDR, LRESULT *pResult);
|
||||
void OnLvnItemchanged();
|
||||
void OnLvnDeleteallitems();
|
||||
|
||||
void OnLvnBegindrag( int index );
|
||||
void OnLvnEnddrag( int index );
|
||||
void OnNMRclick();
|
||||
void OnNMClick( int index );
|
||||
|
||||
afx_msg void OnRenameStage();
|
||||
afx_msg void OnDeleteStage();
|
||||
afx_msg void OnDeleteAllStages();
|
||||
afx_msg void OnAddStage();
|
||||
afx_msg void OnAddBumpmapStage();
|
||||
afx_msg void OnAddDiffuseStage();
|
||||
afx_msg void OnAddSpecualarStage();
|
||||
void OnRenameStage();
|
||||
void OnDeleteStage();
|
||||
void OnDeleteAllStages();
|
||||
void OnAddStage();
|
||||
void OnAddBumpmapStage();
|
||||
void OnAddDiffuseStage();
|
||||
void OnAddSpecualarStage();
|
||||
|
||||
afx_msg void OnCopy();
|
||||
afx_msg void OnPaste();
|
||||
|
||||
afx_msg void OnLvnBeginlabeledit(NMHDR *pNMHDR, LRESULT *pResult);
|
||||
afx_msg void OnLvnEndlabeledit(NMHDR *pNMHDR, LRESULT *pResult);
|
||||
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
//Overrides
|
||||
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
||||
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
|
||||
void OnCopy();
|
||||
void OnPaste();
|
||||
|
||||
bool OnLvnBeginlabeledit( int index );
|
||||
void OnLvnEndlabeledit( int index, const char *newLabel );
|
||||
|
||||
void OnChar( int index );
|
||||
|
||||
//Toggle List View Interface
|
||||
virtual void OnStateChanged(int index, int toggleState);
|
||||
|
||||
void PopupMenu(CPoint* pt);
|
||||
|
||||
void DropItemOnList();
|
||||
*/
|
||||
void OnStateChanged(int index, int toggleState);
|
||||
|
||||
void PopupMenu();
|
||||
|
||||
void DropItemOnList( int dropIndex );
|
||||
|
||||
protected:
|
||||
|
||||
MaterialPropTreeView* m_propView;
|
||||
MaterialDoc* currentMaterial;
|
||||
|
||||
idStr labelEdit;
|
||||
int labelIndex;
|
||||
|
||||
idList<StageViewItem> items;
|
||||
int itemCurSel;
|
||||
|
||||
int lastKeyDownTime;
|
||||
|
||||
//Manual handing of the row dragging
|
||||
/*
|
||||
CImageList* dragImage;
|
||||
*/
|
||||
bool bDragging;
|
||||
|
||||
int dragIndex;
|
||||
int dropIndex;
|
||||
CWnd* dropWnd;
|
||||
CPoint dropPoint;
|
||||
*/
|
||||
|
||||
bool internalChange;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue