29 #include "../../idlib/precompiled.h"
42 static char THIS_FILE[] = __FILE__;
45 HTREEITEM
FindTreeItem(CTreeCtrl *tree, HTREEITEM root,
const char *text, HTREEITEM forceParent);
82 CDialog::DoDataExchange(pDX);
97 ON_NOTIFY(TVN_SELCHANGED, IDC_TREE_TEXTURES, OnSelchangedTreeTextures)
98 ON_NOTIFY(NM_DBLCLK, IDC_TREE_TEXTURES, OnDblclkTreeTextures)
107 ON_NOTIFY(NM_RCLICK, IDC_TREE_TEXTURES, OnNMRclickTreeTextures)
123 CDialog::OnInitDialog();
142 if ( item ==
NULL ) {
152 while ( childItem !=
NULL ) {
155 childName = name +
"/" + (
const char *)
m_treeTextures.GetItemText( childItem );
158 if ( !
loadTree( childItem, childName, dlg ) ) {
165 childName =
"textures/" + childName;
175 childItem = nextItem;
183 if (*foundItem || item ==
NULL) {
189 while (childItem !=
NULL && *foundItem ==
NULL) {
190 nextItem = childItem;
192 findItem(name, nextItem, foundItem);
198 *foundItem = nextItem;
203 if (
stricmp(name, matName) == 0) {
204 *foundItem = nextItem;
207 }
else if (dw ==
SOUNDS) {
209 *foundItem = nextItem;
230 childItem = nextItem;
238 HTREEITEM matItem =
NULL;
239 HTREEITEM *matPtr = &matItem;
252 HTREEITEM *check =
NULL;
264 if (matItem ==
NULL) {
265 matItem =
findItem(name, root, matPtr);
272 }
else if (
id ==
SOUNDS) {
289 dlg.SetWindowText(
"Loading textures..." );
313 if (parent ==
NULL) {
334 for (i = 0; i <
count; i++) {
344 count = textures.
Num();
345 for (i = 0; i <
count; i++) {
358 for (i = 0; i <
count; i++) {
368 count = textures.
Num();
369 for (i = 0; i <
count; i++) {
399 HTREEITEM
FindTreeItem(CTreeCtrl *tree, HTREEITEM root,
const char *text, HTREEITEM forceParent) {
400 HTREEITEM theItem =
NULL;
402 if ((theItem = tree->GetNextSiblingItem(root)) !=
NULL) {
406 if (tree->GetParentItem(theItem) == forceParent) {
416 if ((theItem = tree->GetChildItem(root)) !=
NULL) {
420 if (tree->GetParentItem(theItem) == forceParent) {
429 if (text &&
idStr::Icmp(tree->GetItemText(root), text) == 0 ) {
433 if (theItem && forceParent) {
434 if (tree->GetParentItem(theItem) != forceParent) {
488 g_qeglobals.sw->PlayShaderDirectly(actionName);
494 g_qeglobals.sw->StopAllSounds();
504 NM_TREEVIEW *pNMTreeView = (NM_TREEVIEW *) pNMHDR;
527 strParent += matName;
530 if (parent ==
NULL) {
535 matName =
"textures/" + matName;
545 Select_SetDefaultTexture(mat,
false,
setTexture);
547 }
else if (dw ==
MODELS) {
558 strParent += modelName;
559 modelName = strParent;
561 if (parent ==
NULL) {
565 strParent =
"models/";
566 strParent += modelName;
573 }
else if (dw ==
SOUNDS) {
585 strParent += modelName;
586 modelName = strParent;
588 if (parent ==
NULL) {
592 strParent = modelName;
599 }
else if (dw ==
GUIS) {
610 strParent += modelName;
611 modelName = strParent;
613 if (parent ==
NULL) {
618 strParent += modelName;
703 for (i = 0; i < list.
Num(); i++) {
715 for (j = 0; j < list2.
Num(); j++) {
740 HTREEITEM item = base;
756 index = name.
Last(
'/');
758 name.
Left(index, last);
780 index = name.
Find(
'/');
782 HTREEITEM newItem =
NULL;
783 HTREEITEM *check =
NULL;
784 name.
Left( index, out );
793 if (newItem ==
NULL) {
924 if (CDialog::OnCreate(lpCreateStruct) == -1)
934 CDialog::OnSize(nType, cx, cy);
940 CRect rect, rect2, rect3;
944 m_btnLoad.SetWindowPos(
NULL, rect.left + 4, rect.top + 4, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
945 m_btnRefresh.SetWindowPos(
NULL, rect.left + rect2.Width() + 4, rect.top + 4, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
948 int right = rect.right - 4 - rect3.Width() - 4;
951 right = rect3.right - 4 - rect3.Width() - 4;
954 m_chkHideRoot.SetWindowPos(
NULL, right - rect3.Width() * 2, rect.top + 4, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
957 int verticalSpace = (rect.Height() - rect2.Height() - 12) / 2;
959 m_treeTextures.SetWindowPos(
NULL, rect.left + 4, rect.top + 8 + rect2.Height(), (rect.Width() - 8), verticalSpace, SWP_SHOWWINDOW);
960 m_wndPreview.SetWindowPos(
NULL, rect.left + 4, rect.top + 12 + rect2.Height() + verticalSpace, (rect.Width() - 8), verticalSpace, SWP_SHOWWINDOW);
967 return CDialog::PreCreateWindow(cs);
976 if (g_qeglobals.d_savedinfo.editorExpanded) {
987 if (pMsg->message == WM_KEYDOWN && (pMsg->wParam == VK_ESCAPE || pMsg->wParam == VK_RETURN)) {
988 if (pMsg->wParam == VK_ESCAPE) {
995 return CDialog::PreTranslateMessage(pMsg);
1000 CDialog::OnSetFocus(pOldWnd);
CMainFrame * g_pParentWnd
int GetLineNum(void) const
afx_msg void OnMaterialEdit()
void UpdateEntitySel(eclass_t *ent)
assert(prefInfo.fullscreenBtn)
virtual void setMedia(const char *name)
virtual void setMedia(const char *name)
void SelectCurrentItem(bool collapse, const char *name, int id)
const char * GetFileName(void) const
CONST PIXELFORMATDESCRIPTOR UINT
int GetNumFiles(void) const
const idStrList & GetList(void) const
#define IDC_TREE_TEXTURES
const char * buildItemName(HTREEITEM item, const char *rootName)
void addScripts(bool rootItems)
void AllowCancel(bool enable)
virtual void DoDataExchange(CDataExchange *pDX)
idFileSystem * fileSystem
void SetGranularity(int newgranularity)
#define IDC_CHECK_HIDEROOT
const char * GetName(void) const
void HandlePopup(CWnd *pWindow, unsigned int uId)
afx_msg void OnClickTreeTextures(NMHDR *pNMHDR, LRESULT *pResult)
const char * Left(int len, idStr &result) const
afx_msg void OnSetFocus(CWnd *pOldWnd)
void UpdateKeyVal(const char *key, const char *val)
virtual const idMaterial * FindMaterial(const char *name, bool makeDefault=true)=0
double Milliseconds(void) const
void Select_SetKeyVal(const char *key, const char *val)
#define IDB_BITMAP_MATERIAL
HTREEITEM findItem(const char *name, HTREEITEM item, HTREEITEM *foundItem)
int Cmpn(const char *text, int n) const
int Icmp(const char *text) const
idStr & BackSlashesToSlashes(void)
idGLDrawableMaterial m_drawMaterial
int Icmpn(const char *text, int n) const
void Set(const char *key, Type &value)
GLuint GLuint GLsizei count
afx_msg void OnMaterialInfo()
void SetMaterialFlag(const int flag) const
const idMaterial * Texture_ForName(const char *name)
void addParticles(bool rootItems)
void addModels(bool rootItems)
#define IDR_POPUP_MATERIAL
void SetGuiInfo(const char *name)
afx_msg void OnSelchangedTreeTextures(NMHDR *pNMHDR, LRESULT *pResult)
static const char * TypeNames[NUMIDS]
idGLDrawableModel m_drawModel
void SetText(const char *msg, bool append=false)
afx_msg void OnNMRclickTreeTextures(NMHDR *pNMHDR, LRESULT *pResult)
virtual void Reload(bool force)=0
const char * Right(int len, idStr &result) const
int Find(const char c, int start=0, int end=-1) const
virtual void FreeFileList(idFileList *fileList)=0
virtual const idSoundShader * SoundByIndex(int index, bool forceParse=true)=0
virtual void Printf(const char *fmt,...) id_attribute((format(printf
CInspectorDialog * g_Inspectors
idHashTable< HTREEITEM > quickTree
idGLDrawable m_testDrawable
idDeclManager * declManager
ID_INLINE void idStrListSortPaths(idStrList &list)
virtual int GetNumDecls(declType_t type)=0
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct)
bool Get(const char *key, Type **value=NULL) const
afx_msg void OnCheckHideroot()
bool loadTree(HTREEITEM item, const idStr &name, CWaitDlg *dlg)
virtual void SetMute(bool mute)=0
int Append(const type &obj)
int AddUnique(const type &obj)
virtual const idDecl * DeclByIndex(declType_t type, int index, bool forceParse=true)=0
const idMaterial * editMaterial
virtual idFileList * ListFilesTree(const char *relativePath, const char *extension, bool sort=false, const char *gamedir=NULL)=0
virtual const idMaterial * MaterialByIndex(int index, bool forceParse=true)=0
int Last(const char c) const
idSoundSystem * soundSystem
CDialogTextures(CWnd *pParent=NULL)
void CollapseChildren(HTREEITEM parent)
void addStrList(const char *root, const idStrList &list, int id)
virtual BOOL PreCreateWindow(CREATESTRUCT &cs)
afx_msg void OnSize(UINT nType, int cx, int cy)
virtual BOOL OnInitDialog()
void SetGui(const char *_gui) const
const char * c_str(void) const
bool TestMaterialFlag(const int flag) const
void addSounds(bool rootItems)
void addGuis(bool rootItems)
HTREEITEM FindTreeItem(CTreeCtrl *tree, HTREEITEM root, const char *text, HTREEITEM forceParent)
virtual BOOL PreTranslateMessage(MSG *pMsg)
void SetMaterialInfo(const char *name, const char *file, int line)
afx_msg void OnDblclkTreeTextures(NMHDR *pNMHDR, LRESULT *pResult)
void addMaterials(bool rootItems)