Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

Win_ent.cpp File Reference

#include "stdafx.h"
#include "qe3.h"
#include "entityw.h"
#include "TexWnd.h"
#include "WaveOpen.h"

Include dependency graph for Win_ent.cpp:

Include dependency graph

Go to the source code of this file.

Functions

void AddProp ()
void AssignModel ()
void AssignSound ()
void CreateEntity (void)
BOOL CreateEntityWindow (HINSTANCE hInstance)
void DelProp (void)
void EditProp (void)
BOOL CALLBACK EntityListWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL CALLBACK EntityWndProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL CALLBACK FieldWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
void FillClassList (void)
void GetEntityControls (HWND ghwndEntity)
BOOL GetSelectAllCriteria (CString &strKey, CString &strVal)
void GetSpawnFlags (void)
void GetTexMods (void)
 LRESULT (CALLBACK *OldFieldWindowProc)(HWND
void MOVE (HWND e, int x, int y, int w, int h, HWND hwndPlacement=HWND_TOP, int swp=SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOZORDER)
void SetInspectorMode (int iType)
void SetKeyValuePairs (bool bClearMD3)
void SetSpawnFlags (void)
void SizeEntityDlg (int iWidth, int iHeight)
BOOL UpdateEntitySel (eclass_t *pec)
BOOL UpdateSel (int iIndex, eclass_t *pec)
void WEnt_Create (HINSTANCE hInstance)

Variables

int col
HDWP defer
entity_tedit_entity
CTabCtrl g_wndTabs
HWND hwndEnt [EntLast]
int inspector_mode
 LPARAM
qboolean multiple_entities
int rgIds [EntLast]
 UINT
 WPARAM


Function Documentation

void AddProp  ) 
 

void AssignModel  ) 
 

Definition at line 1139 of file Win_ent.cpp.

References AddProp(), AddSlash(), entity_t::brushes, QEGlobals_t::d_project_entity, edit_entity, EntKeyField, EntValueField, g_pParentWnd, g_qeglobals, CMainFrame::GetXYWnd(), hwndEnt, LPARAM, n, NULL, QE_ConvertDOSToUnixName(), TRUE, and ValueForKey().

Referenced by EntityWndProc().

01140 {
01141   CString strBasePath = ValueForKey(g_qeglobals.d_project_entity, "basepath");
01142   AddSlash(strBasePath);
01143   CString strPath = strBasePath;
01144   strPath += "models\\mapobjects\\";
01145 
01146   CFileDialog dlgFile(TRUE, NULL, NULL, OFN_OVERWRITEPROMPT, "Model files (*.md3)|*.md3||", g_pParentWnd);
01147   dlgFile.m_ofn.lpstrInitialDir = strPath;
01148   if (dlgFile.DoModal() == IDOK)
01149   {
01150       SendMessage(hwndEnt[EntKeyField], WM_SETTEXT, 0, (LPARAM)"model");
01151     CString str = dlgFile.GetPathName().GetBuffer(0);
01152     str.MakeLower();
01153     strBasePath.MakeLower();
01154     QE_ConvertDOSToUnixName(str.GetBuffer(0), str.GetBuffer(0));
01155     QE_ConvertDOSToUnixName(strBasePath.GetBuffer(0), strBasePath.GetBuffer(0));
01156     int n = str.Find(strBasePath);
01157     if (n == 0)
01158     {
01159       str = str.Right(str.GetLength() - strBasePath.GetLength());
01160     }
01161 
01162       SendMessage(hwndEnt[EntValueField], WM_SETTEXT, 0, (LPARAM)str.GetBuffer(0)); 
01163     AddProp();
01164     edit_entity->md3Class = NULL;
01165     edit_entity->brushes.onext->bModelFailed = false;
01166     g_pParentWnd->GetXYWnd()->SetFocus();
01167   }
01168 }

Here is the call graph for this function:

void AssignSound  ) 
 

Definition at line 1110 of file Win_ent.cpp.

References AddProp(), AddSlash(), QEGlobals_t::d_project_entity, EntKeyField, EntValueField, g_pParentWnd, g_qeglobals, CMainFrame::GetXYWnd(), hwndEnt, LPARAM, n, NULL, QE_ConvertDOSToUnixName(), TRUE, and ValueForKey().

Referenced by EntityWndProc().

01111 {
01112   CString strBasePath = ValueForKey(g_qeglobals.d_project_entity, "basepath");
01113   AddSlash(strBasePath);
01114   CString strPath = strBasePath;
01115   strPath += "sound\\";
01116 
01117   CWaveOpen dlgFile(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "Sound files (*.wav)|*.wav||", g_pParentWnd);
01118   dlgFile.m_ofn.lpstrInitialDir = strPath;
01119   if (dlgFile.DoModal() == IDOK)
01120   {
01121       SendMessage(hwndEnt[EntKeyField], WM_SETTEXT, 0, (LPARAM)"noise");    
01122     CString str = dlgFile.GetPathName().GetBuffer(0);
01123     str.MakeLower();
01124     strBasePath.MakeLower();
01125     QE_ConvertDOSToUnixName(str.GetBuffer(0), str.GetBuffer(0));
01126     QE_ConvertDOSToUnixName(strBasePath.GetBuffer(0), strBasePath.GetBuffer(0));
01127     int n = str.Find(strBasePath);
01128     if (n == 0)
01129     {
01130       str = str.Right(str.GetLength() - strBasePath.GetLength());
01131     }
01132 
01133       SendMessage(hwndEnt[EntValueField], WM_SETTEXT, 0, (LPARAM)str.GetBuffer(0)); 
01134     AddProp();
01135     g_pParentWnd->GetXYWnd()->SetFocus();
01136   }
01137 }

Here is the call graph for this function:

void CreateEntity void   ) 
 

Definition at line 678 of file Win_ent.cpp.

References entity_t::brushes, QEGlobals_t::d_hwndMain, Eclass_ForName(), eclass_t, edit_entity, Entity_Create(), EntList, g_qeglobals, hwndEnt, i, LPARAM, brush_s::next, brush_s::owner, Select_Brush(), Select_Deselect(), selected_brushes, SetKeyValuePairs(), Sys_UpdateWindows(), and W_ALL.

Referenced by EntityWndProc().

00679 {
00680     eclass_t *pecNew;
00681     entity_t *petNew;
00682     int i;
00683     HWND hwnd;
00684     char sz[1024];
00685 
00686     // check to make sure we have a brush
00687 
00688     if (selected_brushes.next == &selected_brushes)
00689     {
00690         MessageBox(g_qeglobals.d_hwndMain, "You must have a selected brush to create an entity"
00691             , "info", 0);
00692         return;
00693     }
00694 
00695 
00696     // find out what type of entity we are trying to create
00697 
00698     hwnd = hwndEnt[EntList];
00699 
00700     i = SendMessage(hwndEnt[EntList], LB_GETCURSEL, 0, 0);
00701 
00702     if (i < 0)
00703     {
00704         MessageBox(g_qeglobals.d_hwndMain, "You must have a selected class to create an entity"
00705             , "info", 0);
00706         return;
00707     }
00708 
00709     SendMessage(hwnd, LB_GETTEXT, i, (LPARAM)sz);
00710 
00711     if (!stricmp(sz, "worldspawn"))
00712     {
00713         MessageBox(g_qeglobals.d_hwndMain, "Can't create an entity with worldspawn.", "info", 0);
00714         return;
00715     }
00716 
00717     pecNew = Eclass_ForName(sz, false);
00718 
00719     // create it
00720 
00721     petNew = Entity_Create(pecNew);
00722 
00723     if (petNew == NULL)
00724     {
00725         MessageBox(g_qeglobals.d_hwndMain, "Failed to create entity.", "info", 0);
00726         return;
00727     }
00728 
00729     if (selected_brushes.next == &selected_brushes)
00730         edit_entity = world_entity;
00731     else
00732         edit_entity = selected_brushes.next->owner;
00733 
00734     SetKeyValuePairs();
00735     Select_Deselect ();
00736     Select_Brush (edit_entity->brushes.onext);
00737   Sys_UpdateWindows(W_ALL);
00738 
00739 }

Here is the call graph for this function:

BOOL CreateEntityWindow HINSTANCE  hInstance  ) 
 

Definition at line 383 of file Win_ent.cpp.

References BOOL, QEGlobals_t::d_hwndEntity, QEGlobals_t::d_hwndMain, EntityListWndProc(), EntKeyField, EntList, EntValueField, Error(), FieldWndProc(), FillClassList(), g_qeglobals, GetEntityControls(), hwndEnt, IDD_ENTITY, inspector_mode, LoadWindowPlacement(), NULL, SetInspectorMode(), W_CONSOLE, and WEnt_Create().

Referenced by CMainFrame::OnCreateClient().

00384 {
00385     HWND hwndEntityPalette;
00386 
00387     inspector_mode = W_ENTITY;
00388 
00389     WEnt_Create (hInstance);
00390 
00391     hwndEntityPalette = CreateDialog(hInstance, (char *)IDD_ENTITY, g_qeglobals.d_hwndMain, (DLGPROC)NULL);
00392     if (!hwndEntityPalette)
00393         Error ("CreateDialog failed");
00394 
00395     GetEntityControls (hwndEntityPalette);
00396     DestroyWindow (hwndEntityPalette);
00397 
00398     OldFieldWindowProc = (WNDPROC)GetWindowLong (hwndEnt[EntKeyField], GWL_WNDPROC);
00399     SetWindowLong (hwndEnt[EntKeyField], GWL_WNDPROC, (long)FieldWndProc);
00400     SetWindowLong (hwndEnt[EntValueField], GWL_WNDPROC, (long)FieldWndProc);
00401 
00402     OldEntityListWindowProc = (WNDPROC)GetWindowLong (hwndEnt[EntList], GWL_WNDPROC);
00403     SetWindowLong (hwndEnt[EntList], GWL_WNDPROC, (long)EntityListWndProc);
00404 
00405     FillClassList ();
00406 
00407 
00408     LoadWindowPlacement(g_qeglobals.d_hwndEntity, "EntityWindowPlace");
00409     ShowWindow (g_qeglobals.d_hwndEntity, SW_HIDE);
00410     SetInspectorMode (W_CONSOLE);
00411 
00412     return TRUE;
00413 }

Here is the call graph for this function:

void DelProp void   ) 
 

Definition at line 806 of file Win_ent.cpp.

References b, brush_t, DeleteKey(), edit_entity, EntKeyField, hwndEnt, LPARAM, brush_s::next, brush_s::owner, selected_brushes, and SetKeyValuePairs().

Referenced by EntityWndProc().

00807 {
00808     char    sz[4096];
00809 
00810     if (edit_entity == NULL)
00811         return;
00812 
00813     // Get current selection text
00814 
00815     SendMessage(hwndEnt[EntKeyField], WM_GETTEXT, sizeof(sz)-1, (LPARAM)sz);    
00816 
00817     if (multiple_entities)
00818     {
00819         brush_t *b;
00820 
00821         for (b=selected_brushes.next ; b != &selected_brushes ; b=b->next)
00822             DeleteKey(b->owner, sz);
00823     }
00824     else
00825         DeleteKey(edit_entity, sz);
00826 
00827     // refresh the prop listbox
00828 
00829     SetKeyValuePairs(); 
00830 }

Here is the call graph for this function:

void EditProp void   ) 
 

Definition at line 852 of file Win_ent.cpp.

References edit_entity, EntKeyField, EntValueField, hwndEnt, i, and LPARAM.

Referenced by EntityWndProc().

00853 {
00854     int i;
00855     HWND hwnd;
00856     char    sz[4096];
00857     char    *val;
00858 
00859     if (edit_entity == NULL)
00860         return;
00861 
00862     hwnd = hwndEnt[EntProps];
00863 
00864     // Get current selection text
00865 
00866     i = SendMessage(hwnd, LB_GETCURSEL, 0, 0);  
00867 
00868     if (i < 0)
00869         return;
00870 
00871     SendMessage(hwnd, LB_GETTEXT, i, (LPARAM)sz);   
00872 
00873     // strip it down to the key name
00874 
00875     for(i=0;sz[i] != '\t';i++)
00876     ;
00877 
00878     sz[i] = '\0';
00879 
00880     val = sz + i + 1;
00881     if (*val == '\t')
00882         val++;
00883 
00884     SendMessage(hwndEnt[EntKeyField], WM_SETTEXT, 0, (LPARAM)sz);   
00885     SendMessage(hwndEnt[EntValueField], WM_SETTEXT, 0, (LPARAM)val);    
00886 }

BOOL CALLBACK EntityListWndProc HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam
 

Definition at line 160 of file Win_ent.cpp.

References BOOL, QEGlobals_t::d_hwndEntity, g_qeglobals, IDC_E_LIST, uMsg, and wParam.

Referenced by CreateEntityWindow().

00165 {
00166     switch (uMsg)
00167     {
00168     case WM_KEYDOWN:
00169         if (LOWORD(wParam) == VK_RETURN)
00170         {
00171             SendMessage ( g_qeglobals.d_hwndEntity, 
00172                           WM_COMMAND, 
00173                           (LBN_DBLCLK<<16) + IDC_E_LIST, 
00174                           0 );
00175             return 0;
00176         }
00177         break;
00178     }
00179     return CallWindowProc (OldEntityListWindowProc, hwnd, uMsg, wParam, lParam);
00180 }

BOOL CALLBACK EntityWndProc HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam
 

Definition at line 1176 of file Win_ent.cpp.

References AssignModel(), AssignSound(), BOOL, c, CreateEntity(), CMainFrame::CurrentStyle(), QEGlobals_t::d_hwndCamera, QEGlobals_t::d_hwndEntity, QEGlobals_t::d_hwndMain, DelProp(), eclass_t, edit_entity, EditProp(), EntList, g_pParentWnd, g_qeglobals, g_wndTabs, GetSpawnFlags(), hwndEnt, ID_VIEW_CONSOLE, ID_VIEW_ENTITY, ID_VIEW_GROUPS, ID_VIEW_TEXTURE, IDC_BTN_ASSIGNMODEL, IDC_BTN_ASSIGNSOUND, IDC_BTN_HIDE, IDC_CHECK1, IDC_CHECK10, IDC_CHECK11, IDC_CHECK12, IDC_CHECK2, IDC_CHECK3, IDC_CHECK4, IDC_CHECK5, IDC_CHECK6, IDC_CHECK7, IDC_CHECK8, IDC_CHECK9, IDC_E_0, IDC_E_135, IDC_E_180, IDC_E_225, IDC_E_270, IDC_E_315, IDC_E_45, IDC_E_90, IDC_E_DELPROP, IDC_E_DOWN, IDC_E_LIST, IDC_E_PROPS, IDC_E_UP, n, SaveWindowPlacement(), SetInspectorMode(), SetKeyValue(), SetKeyValuePairs(), SizeEntityDlg(), toupper(), uMsg, UpdateSel(), W_CONSOLE, W_ENTITY, W_GROUP, W_TEXTURE, and wParam.

01181 {
01182   LPNMHDR lpnmh = NULL;
01183     RECT    rc;
01184 
01185     GetClientRect(hwndDlg, &rc);
01186 
01187     switch (uMsg)
01188     {
01189 
01190       case WM_CHAR :
01191       {
01192         char c = toupper(LOWORD(wParam));
01193         // escape: hide the window
01194             if (c == 27)
01195                 ShowWindow(hwndDlg, SW_HIDE);
01196         if (c == 'N')
01197           g_pParentWnd->PostMessage(WM_COMMAND, ID_VIEW_ENTITY, 0);
01198         else
01199         if (c == 'O')
01200           g_pParentWnd->PostMessage(WM_COMMAND, ID_VIEW_CONSOLE, 0);
01201         else
01202         if (c == 'T')
01203           g_pParentWnd->PostMessage(WM_COMMAND, ID_VIEW_TEXTURE, 0);
01204         else
01205         if (c == 'G')
01206           g_pParentWnd->PostMessage(WM_COMMAND, ID_VIEW_GROUPS, 0);
01207         else
01208                 DefWindowProc (hwndDlg, uMsg, wParam, lParam);
01209         break;
01210       }
01211 
01212       case WM_NOTIFY:
01213         lpnmh = reinterpret_cast<LPNMHDR>(lParam);
01214         if (lpnmh->hwndFrom == g_wndTabs.GetSafeHwnd()) {
01215           if ( lpnmh->code == TCN_SELCHANGE)
01216           {
01217             int n = g_wndTabs.GetCurSel();
01218             if (g_pParentWnd->CurrentStyle() == 2 || g_pParentWnd->CurrentStyle() == 1)
01219             {
01220               if (n == 0) {
01221                 SetInspectorMode(W_ENTITY);
01222               } else if (n == 1) {
01223                 SetInspectorMode(W_TEXTURE);
01224               } else if (n == 2) {
01225                 SetInspectorMode(W_CONSOLE);
01226               } else {
01227                 SetInspectorMode(W_GROUP);
01228               }
01229             }
01230             else
01231             {
01232               if (n == 0) {
01233                 SetInspectorMode(W_ENTITY);
01234               } else if (n == 1) {
01235                 SetInspectorMode(W_GROUP);
01236               }
01237             }
01238           }
01239         }
01240         break;
01241         
01242     case WM_SIZE:
01243 
01244             DefWindowProc (hwndDlg, uMsg, wParam, lParam);
01245       break;
01246 
01247   case WM_DESTROY:
01248       SaveWindowPlacement(g_qeglobals.d_hwndEntity, "EntityWindowPlace");
01249       DefWindowProc(hwndDlg, uMsg, wParam, lParam);
01250       break;
01251 
01252     case WM_GETMINMAXINFO:
01253         {
01254             LPMINMAXINFO    lpmmi;
01255 
01256             lpmmi = (LPMINMAXINFO) lParam;
01257             lpmmi->ptMinTrackSize.x = 320;
01258             lpmmi->ptMinTrackSize.y = 500;
01259         }
01260         return 0;
01261 
01262     case WM_WINDOWPOSCHANGING:
01263         {
01264             LPWINDOWPOS lpwp;
01265             lpwp = (LPWINDOWPOS) lParam;
01266 
01267             DefWindowProc (hwndDlg, uMsg, wParam, lParam);
01268 
01269             lpwp->flags |= SWP_NOCOPYBITS;
01270             SizeEntityDlg(lpwp->cx-8, lpwp->cy-32);
01271             return 0;
01272 
01273         }
01274         return 0;
01275 
01276 
01277     case WM_COMMAND: 
01278         switch (LOWORD(wParam)) { 
01279 
01280     case IDC_BTN_ASSIGNSOUND:
01281       AssignSound();
01282       break;
01283 
01284     case IDC_BTN_ASSIGNMODEL:
01285       AssignModel();
01286       break;
01287 
01288         case IDC_E_DELPROP:
01289             DelProp();
01290             SetFocus (g_qeglobals.d_hwndCamera);
01291             break;
01292 
01293         case IDC_E_0:
01294             SetKeyValue (edit_entity, "angle", "360");
01295             SetFocus (g_qeglobals.d_hwndCamera);
01296             SetKeyValuePairs ();
01297             break;
01298         case IDC_E_45:
01299             SetKeyValue (edit_entity, "angle", "45");
01300             SetFocus (g_qeglobals.d_hwndCamera);
01301             SetKeyValuePairs ();
01302             break;
01303         case IDC_E_90:
01304             SetKeyValue (edit_entity, "angle", "90");
01305             SetFocus (g_qeglobals.d_hwndCamera);
01306             SetKeyValuePairs ();
01307             break;
01308         case IDC_E_135:
01309             SetKeyValue (edit_entity, "angle", "135");
01310             SetFocus (g_qeglobals.d_hwndCamera);
01311             SetKeyValuePairs ();
01312             break;
01313         case IDC_E_180:
01314             SetKeyValue (edit_entity, "angle", "180");
01315             SetFocus (g_qeglobals.d_hwndCamera);
01316             SetKeyValuePairs ();
01317             break;
01318         case IDC_E_225:
01319             SetKeyValue (edit_entity, "angle", "225");
01320             SetFocus (g_qeglobals.d_hwndCamera);
01321             SetKeyValuePairs ();
01322             break;
01323         case IDC_E_270:
01324             SetKeyValue (edit_entity, "angle", "270");
01325             SetFocus (g_qeglobals.d_hwndCamera);
01326             SetKeyValuePairs ();
01327             break;
01328         case IDC_E_315:
01329             SetKeyValue (edit_entity, "angle", "315");
01330             SetFocus (g_qeglobals.d_hwndCamera);
01331             SetKeyValuePairs ();
01332             break;
01333         case IDC_E_UP:
01334             SetKeyValue (edit_entity, "angle", "-1");
01335             SetFocus (g_qeglobals.d_hwndCamera);
01336             SetKeyValuePairs ();
01337             break;
01338         case IDC_E_DOWN:
01339             SetKeyValue (edit_entity, "angle", "-2");
01340             SetFocus (g_qeglobals.d_hwndCamera);
01341             SetKeyValuePairs ();
01342             break;
01343 
01344     case IDC_BTN_HIDE:
01345       ::PostMessage(g_qeglobals.d_hwndMain, WM_COMMAND, ID_VIEW_CAMERATOGGLE, 0);
01346       break;
01347 
01348         case IDC_CHECK1:
01349         case IDC_CHECK2:
01350         case IDC_CHECK3:
01351         case IDC_CHECK4:
01352         case IDC_CHECK5:
01353         case IDC_CHECK6:
01354         case IDC_CHECK7:
01355         case IDC_CHECK8:
01356         case IDC_CHECK9:
01357         case IDC_CHECK10:
01358         case IDC_CHECK11:
01359         case IDC_CHECK12:
01360             GetSpawnFlags();
01361             SetFocus (g_qeglobals.d_hwndCamera);
01362             break;
01363 
01364 
01365         case IDC_E_PROPS: 
01366             switch (HIWORD(wParam))
01367             { 
01368             case LBN_SELCHANGE:
01369 
01370                 EditProp();
01371                 return TRUE; 
01372             }
01373             break;
01374 
01375         case IDC_E_LIST: 
01376        
01377             switch (HIWORD(wParam)) { 
01378             
01379             case LBN_SELCHANGE: 
01380             {
01381                 int iIndex;
01382                 eclass_t *pec;
01383                 
01384                 iIndex = SendMessage(hwndEnt[EntList], LB_GETCURSEL, 0, 0); 
01385                 pec = (eclass_t *)SendMessage(hwndEnt[EntList], LB_GETITEMDATA, 
01386                         iIndex, 0); 
01387             
01388                 UpdateSel(iIndex, pec);
01389 
01390                 return TRUE; 
01391                 break; 
01392             }
01393 
01394             case LBN_DBLCLK: 
01395                 CreateEntity ();
01396                 SetFocus (g_qeglobals.d_hwndCamera);
01397                 break; 
01398             } 
01399             break; 
01400 
01401 
01402             default: 
01403               return DefWindowProc( hwndDlg, uMsg, wParam, lParam ); 
01404         } 
01405 
01406         return 0;
01407     }
01408 
01409     return DefWindowProc (hwndDlg, uMsg, wParam, lParam);
01410 }

Here is the call graph for this function:

BOOL CALLBACK FieldWndProc HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam
 

Definition at line 99 of file Win_ent.cpp.

References AddProp(), BOOL, QEGlobals_t::d_hwndCamera, EntKeyField, EntValueField, g_qeglobals, hwndEnt, uMsg, and wParam.

Referenced by CreateEntityWindow().

00104 {
00105     switch (uMsg)
00106     {
00107     case WM_CHAR:
00108         if (LOWORD(wParam) == VK_TAB)
00109             return FALSE;
00110         if (LOWORD(wParam) == VK_RETURN)
00111             return FALSE;
00112         if (LOWORD(wParam) == VK_ESCAPE)
00113         {
00114             SetFocus (g_qeglobals.d_hwndCamera);
00115             return FALSE;
00116         }
00117         break;
00118 
00119     case WM_KEYDOWN:
00120         if (LOWORD(wParam) == VK_TAB)
00121         {
00122             if (hwnd == hwndEnt[EntKeyField])
00123             {
00124                 SendMessage (hwndEnt[EntValueField], WM_SETTEXT, 0, (long)"");
00125                 SetFocus (hwndEnt[EntValueField]);
00126             }
00127             else
00128                 SetFocus (hwndEnt[EntKeyField]);
00129         }
00130         if (LOWORD(wParam) == VK_RETURN)
00131         {
00132             if (hwnd == hwndEnt[EntKeyField])
00133             {
00134                 SendMessage (hwndEnt[EntValueField], WM_SETTEXT, 0, (long)"");
00135                 SetFocus (hwndEnt[EntValueField]);
00136             }
00137             else
00138             {
00139                 AddProp ();
00140                 SetFocus (g_qeglobals.d_hwndCamera);
00141             }
00142         }
00143         break;
00144 //  case WM_NCHITTEST:
00145     case WM_LBUTTONDOWN:
00146         SetFocus (hwnd);
00147         break;
00148     }
00149     return CallWindowProc (OldFieldWindowProc, hwnd, uMsg, wParam, lParam);
00150 }

Here is the call graph for this function:

void FillClassList void   ) 
 

Definition at line 319 of file Win_ent.cpp.

References eclass_t, EntList, hwndEnt, LPARAM, eclass_s::name, and eclass_s::next.

Referenced by CreateEntityWindow(), and QE_LoadProject().

00320 {
00321     eclass_t    *pec;
00322     int         iIndex;
00323 
00324     SendMessage(hwndEnt[EntList], LB_RESETCONTENT, 0 , 0);
00325 
00326     for (pec = eclass ; pec ; pec = pec->next)
00327     {
00328         iIndex = SendMessage(hwndEnt[EntList], LB_ADDSTRING, 0 , (LPARAM)pec->name);
00329         SendMessage(hwndEnt[EntList], LB_SETITEMDATA, iIndex, (LPARAM)pec);
00330     }   
00331 
00332 }

void GetEntityControls HWND  ghwndEntity  ) 
 

Definition at line 191 of file Win_ent.cpp.

References CMainFrame::CurrentStyle(), QEGlobals_t::d_hInstance, QEGlobals_t::d_hwndEdit, QEGlobals_t::d_hwndEntity, EntCheck1, EntComment, EntKeyField, EntList, EntProps, EntTab, EntValueField, Error(), g_pParentWnd, g_qeglobals, g_wndTabs, hwndEnt, i, IDC_E_COMMENT, IDC_E_KEY_FIELD, IDC_E_LIST, IDC_E_PROPS, IDC_E_STATUS, IDC_E_VALUE_FIELD, IDC_TAB_MODE, LPARAM, NULL, rgIds, TRUE, and WPARAM.

Referenced by CreateEntityWindow().

00192 {
00193     int i;
00194 
00195     for (i = 0; i < EntLast; i++)
00196     {
00197         if (i == EntList || i == EntProps || i == EntComment)
00198             continue;
00199         if (i == EntKeyField || i == EntValueField)
00200             continue;
00201         hwndEnt[i] = GetDlgItem(ghwndEntity, rgIds[i]);     
00202         if (hwndEnt[i])
00203     {
00204             SetParent (hwndEnt[i], g_qeglobals.d_hwndEntity );
00205             SendMessage(hwndEnt[i], WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), (LPARAM)TRUE);
00206     }
00207     }
00208 
00209 
00210     // SetParent apears to not modify some internal state
00211     // on listboxes, so create it from scratch...
00212 
00213     hwndEnt[EntList] = CreateWindow ("listbox", NULL, 
00214         LBS_STANDARD | LBS_NOINTEGRALHEIGHT | LBS_WANTKEYBOARDINPUT 
00215         | WS_VSCROLL | WS_CHILD | WS_VISIBLE,
00216         5, 5, 180, 99,
00217         g_qeglobals.d_hwndEntity,
00218         (HMENU)IDC_E_LIST,
00219         g_qeglobals.d_hInstance,
00220         NULL);
00221     if (!hwndEnt[EntList])
00222         Error ("CreateWindow failed");
00223 
00224     hwndEnt[EntProps] = CreateWindow ("listbox", NULL, 
00225         LBS_STANDARD | LBS_NOINTEGRALHEIGHT | LBS_USETABSTOPS
00226         | WS_VSCROLL | WS_CHILD | WS_VISIBLE,
00227         5, 100, 180, 99,
00228         g_qeglobals.d_hwndEntity,
00229         (HMENU)IDC_E_PROPS,
00230         g_qeglobals.d_hInstance,
00231         NULL);
00232     if (!hwndEnt[EntProps])
00233         Error ("CreateWindow failed");
00234 
00235     hwndEnt[EntComment] = CreateWindow ("edit", NULL, 
00236         ES_MULTILINE | ES_READONLY | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER,
00237         5, 100, 180, 99,
00238         g_qeglobals.d_hwndEntity,
00239         (HMENU)IDC_E_COMMENT,
00240         g_qeglobals.d_hInstance,
00241         NULL);
00242     if (!hwndEnt[EntComment])
00243         Error ("CreateWindow failed");
00244 
00245     hwndEnt[EntKeyField] = CreateWindow ("edit", NULL, 
00246         WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL,
00247         5, 100, 180, 99,
00248         g_qeglobals.d_hwndEntity,
00249         (HMENU)IDC_E_KEY_FIELD,
00250         g_qeglobals.d_hInstance,
00251         NULL);
00252     if (!hwndEnt[EntKeyField])
00253         Error ("CreateWindow failed");
00254 
00255     hwndEnt[EntValueField] = CreateWindow ("edit", NULL, 
00256         WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL,
00257         5, 100, 180, 99,
00258         g_qeglobals.d_hwndEntity,
00259         (HMENU)IDC_E_VALUE_FIELD,
00260         g_qeglobals.d_hInstance,
00261         NULL);
00262     if (!hwndEnt[EntValueField])
00263         Error ("CreateWindow failed");
00264 
00265   g_wndTabs.SubclassDlgItem(IDC_TAB_MODE, CWnd::FromHandle(ghwndEntity));
00266   hwndEnt[EntTab] = g_wndTabs.GetSafeHwnd();
00267   g_wndTabs.InsertItem(0, "Groups");
00268   ::SetParent(g_wndTabs.GetSafeHwnd(), g_qeglobals.d_hwndEntity);
00269 
00270   if (g_pParentWnd->CurrentStyle() > 0 && g_pParentWnd->CurrentStyle() < 3)
00271   {
00272       g_qeglobals.d_hwndEdit = CreateWindow ("edit", NULL, ES_MULTILINE | ES_READONLY | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER,
00273                                                5, 100, 180, 99, g_qeglobals.d_hwndEntity, (HMENU)IDC_E_STATUS,
00274                                                g_qeglobals.d_hInstance, NULL);
00275       if (!g_qeglobals.d_hwndEdit)
00276           Error ("CreateWindow failed");
00277     g_wndTabs.InsertItem(0, "Console");
00278     g_wndTabs.InsertItem(0, "Textures");
00279   }
00280   g_wndTabs.InsertItem(0, "Entities");
00281   g_wndTabs.ShowWindow(SW_SHOW);
00282 
00283 #if 0
00284     for (i=0 ; i<12 ; i++)
00285     {
00286         hwndEnt[EntCheck1 + i] = CreateWindow ("button", NULL, 
00287         BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE,
00288         5, 100, 180, 99,
00289         entwindow,
00290         (HMENU)IDC_E_STATUS,
00291         main_instance,
00292         NULL);
00293         if (!hwndEnt[EntCheck1 + i])
00294             Error ("CreateWindow failed");
00295     }
00296 #endif
00297     SendMessage(hwndEnt[EntList], WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), (LPARAM)TRUE);
00298     SendMessage(hwndEnt[EntProps], WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), (LPARAM)TRUE);
00299     SendMessage(hwndEnt[EntComment], WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), (LPARAM)TRUE);
00300     SendMessage(hwndEnt[EntKeyField], WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), (LPARAM)TRUE);
00301     SendMessage(hwndEnt[EntValueField], WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), (LPARAM)TRUE);
00302     SendMessage(hwndEnt[EntTab], WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), (LPARAM)TRUE);
00303 
00304     if (g_pParentWnd->CurrentStyle() > 0 && g_pParentWnd->CurrentStyle() < 3)
00305         SendMessage(g_qeglobals.d_hwndEdit, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), (LPARAM)TRUE);
00306 }

Here is the call graph for this function:

BOOL GetSelectAllCriteria CString &  strKey,
CString &  strVal
 

Definition at line 832 of file Win_ent.cpp.

References BOOL, EntKeyField, EntValueField, hwndEnt, i, inspector_mode, and LPARAM.

Referenced by Select_AllOfType().

00832                                                             {
00833     char    sz[4096];
00834     HWND hwnd = hwndEnt[EntProps];
00835     int i = SendMessage(hwnd, LB_GETCURSEL, 0, 0);  
00836   if (i >= 0 && inspector_mode == W_ENTITY) {
00837       SendMessage(hwndEnt[EntKeyField], WM_GETTEXT, sizeof(sz), (LPARAM)sz);    
00838     strKey = sz;
00839       SendMessage(hwndEnt[EntValueField], WM_GETTEXT, sizeof(sz), (LPARAM)sz);  
00840     strVal = sz;
00841     return TRUE;
00842   }
00843   return FALSE;
00844 }

void GetSpawnFlags void   ) 
 

Definition at line 578 of file Win_ent.cpp.

References b, brush_t, edit_entity, EntCheck1, f, hwndEnt, i, brush_s::next, brush_s::owner, selected_brushes, SetKeyValue(), SetKeyValuePairs(), sprintf(), and v.

Referenced by EntityWndProc().

00579 {
00580     int     f;
00581     int     i, v;
00582     char    sz[32];
00583 
00584     f = 0;
00585     for (i=0 ; i<12 ; i++)
00586     {
00587         v = SendMessage(hwndEnt[EntCheck1+i], BM_GETCHECK, 0, 0);
00588         f |= v<<i;
00589     }
00590 
00591     sprintf (sz, "%i", f);
00592 
00593     if (multiple_entities)
00594     {
00595         brush_t *b;
00596 
00597         for (b=selected_brushes.next ; b != &selected_brushes ; b=b->next)
00598             SetKeyValue(b->owner, "spawnflags", sz);
00599     }
00600     else
00601         SetKeyValue (edit_entity, "spawnflags", sz);
00602     SetKeyValuePairs ();
00603 }

Here is the call graph for this function:

void GetTexMods void   ) 
 

LRESULT CALLBACK *  OldEntityListWindowProc  ) 
 

Referenced by CMainFrame::DefWindowProc(), CMainFrame::OnBSPDone(), CMainFrame::OnBSPStatus(), Sys_Printf(), and CMainFrame::WindowProc().

void MOVE HWND  e,
int  x,
int  y,
int  w,
int  h,
HWND  hwndPlacement = HWND_TOP,
int  swp = SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_NOZORDER
 

Definition at line 891 of file Win_ent.cpp.

References col, e, h(), w, x, and y.

Referenced by SizeEntityDlg().

00892 {
00893 //  defer=DeferWindowPos(defer,e,HWND_TOP,col+(x),y,w,h,SWP_SHOWWINDOW);
00894 //  MoveWindow (e, col+x, y, w, h, FALSE);
00895     SetWindowPos (e, hwndPlacement, col+x, y, w, h, swp);
00896 }

Here is the call graph for this function:

void SetInspectorMode int  iType  ) 
 

Definition at line 420 of file Win_ent.cpp.

References CMainFrame::CurrentStyle(), QEGlobals_t::d_hwndEntity, QEGlobals_t::d_hwndMain, CTexWnd::FocusEdit(), g_pParentWnd, g_qeglobals, g_wndTabs, CMainFrame::GetTexWnd(), ID_MISC_SELECTENTITYCOLOR, inspector_mode, NULL, QR_SPLIT, SizeEntityDlg(), W_CONSOLE, W_ENTITY, W_GROUP, and W_TEXTURE.

Referenced by CreateEntityFromName(), CreateEntityWindow(), EntityWndProc(), CMainFrame::OnViewConsole(), CMainFrame::OnViewEntity(), CMainFrame::OnViewGroups(), CMainFrame::OnViewTexture(), and RunBsp().

00421 {
00422     RECT rc;
00423     HMENU hMenu = GetMenu( g_qeglobals.d_hwndMain );
00424 
00425   if ((g_pParentWnd->CurrentStyle() == QR_SPLIT || g_pParentWnd->CurrentStyle() == QR_SPLITZ) && (iType == W_TEXTURE || iType == W_CONSOLE))
00426     return;
00427 
00428 
00429     // Is the caller asking us to cycle to the next window?
00430 
00431     if (iType == -1)
00432     {
00433         if (inspector_mode == W_ENTITY)
00434             iType = W_TEXTURE;
00435         else if (inspector_mode == W_TEXTURE)
00436             iType = W_CONSOLE;
00437         else if (inspector_mode == W_CONSOLE)
00438       iType = W_GROUP;
00439     else
00440             iType = W_ENTITY;
00441     }       
00442 
00443     inspector_mode = iType;
00444     switch(iType)
00445     {
00446         
00447     case W_ENTITY:
00448         SetWindowText(g_qeglobals.d_hwndEntity, "Entity");
00449         EnableMenuItem( hMenu, ID_MISC_SELECTENTITYCOLOR, MF_ENABLED | MF_BYCOMMAND );
00450     // entity is always first in the inspector
00451     g_wndTabs.SetCurSel(0);
00452         break;
00453 
00454     case W_TEXTURE:
00455     SetWindowText(g_qeglobals.d_hwndEntity, "Textures");
00456     g_pParentWnd->GetTexWnd()->FocusEdit();
00457         EnableMenuItem( hMenu, ID_MISC_SELECTENTITYCOLOR, MF_GRAYED | MF_DISABLED | MF_BYCOMMAND );
00458     if (g_pParentWnd->CurrentStyle() > 0 && g_pParentWnd->CurrentStyle() < 3)
00459       g_wndTabs.SetCurSel(1);
00460         break;
00461 
00462     case W_CONSOLE:
00463         SetWindowText(g_qeglobals.d_hwndEntity, "Console");     
00464         EnableMenuItem( hMenu, ID_MISC_SELECTENTITYCOLOR, MF_GRAYED | MF_DISABLED | MF_BYCOMMAND );
00465     if (g_pParentWnd->CurrentStyle() > 0 && g_pParentWnd->CurrentStyle() < 3)
00466       g_wndTabs.SetCurSel(2);
00467         break;
00468 
00469   case W_GROUP:
00470         SetWindowText(g_qeglobals.d_hwndEntity, "Groups");      
00471         EnableMenuItem( hMenu, ID_MISC_SELECTENTITYCOLOR, MF_GRAYED | MF_DISABLED | MF_BYCOMMAND );
00472     if (g_pParentWnd->CurrentStyle() > 0 && g_pParentWnd->CurrentStyle() < 3)
00473       g_wndTabs.SetCurSel(3);
00474     else
00475       g_wndTabs.SetCurSel(1);
00476         break;
00477 
00478 
00479     default:
00480         break;
00481     }
00482 
00483     GetWindowRect (g_qeglobals.d_hwndEntity, &rc);
00484     SizeEntityDlg( rc.right - rc.left - 8, rc.bottom - rc.top - 20);
00485 
00486 
00487 //  InvalidateRect(entwindow, NULL, true);
00488 //  ShowWindow (entwindow, SW_SHOW);
00489 //  UpdateWindow (entwindow);
00490 
00491   HWND hFlag = (g_pParentWnd->CurrentStyle() == QR_QE4) ? HWND_TOP : HWND_TOPMOST;
00492     SetWindowPos( g_qeglobals.d_hwndEntity, hFlag, rc.left, rc.top,  rc.right - rc.left, rc.bottom - rc.top, SWP_NOSIZE | SWP_NOMOVE );
00493     RedrawWindow (g_qeglobals.d_hwndEntity, NULL, NULL, RDW_ERASE | RDW_INVALIDATE| RDW_ERASENOW | RDW_UPDATENOW | RDW_ALLCHILDREN);
00494 }

Here is the call graph for this function:

void SetKeyValuePairs bool  bClearMD3  ) 
 

Definition at line 506 of file Win_ent.cpp.

References edit_entity, EntProps, epair_t, entity_t::epairs, hwndEnt, epair_s::key, LPARAM, epair_s::next, sprintf(), strlen(), Sys_UpdateWindows(), epair_s::value, W_CAMERA, and W_XY.

Referenced by AddProp(), CreateEntity(), DelProp(), EntityWndProc(), GetSpawnFlags(), and UpdateSel().

00507 {
00508     epair_t *pep;
00509     RECT    rc;
00510     char    sz[4096];
00511     
00512     if (edit_entity == NULL)
00513         return;
00514     
00515     // set key/value pair list
00516     
00517     GetWindowRect(hwndEnt[EntProps], &rc);
00518     SendMessage(hwndEnt[EntProps], LB_SETCOLUMNWIDTH, (rc.right - rc.left)/2, 0);
00519     SendMessage(hwndEnt[EntProps], LB_RESETCONTENT, 0, 0);
00520     
00521     // Walk through list and add pairs
00522     
00523     for (pep = edit_entity->epairs ; pep ; pep = pep->next)
00524     {
00525         // if the key is less than 8 chars, add a tab for alignment
00526         if (strlen(pep->key) > 8)
00527             sprintf (sz, "%s\t%s", pep->key, pep->value);
00528         else
00529             sprintf (sz, "%s\t\t%s", pep->key, pep->value);
00530         SendMessage(hwndEnt[EntProps], LB_ADDSTRING, 0, (LPARAM)sz);
00531     }
00532     
00533     if (edit_entity->eclass->nShowFlags & ECLASS_MISCMODEL)
00534     {
00535         // if this is a misc_model
00536         // cache the md3 for display later
00537         if (bClearMD3)
00538         {
00539             edit_entity->md3Class = NULL;
00540         }
00541         //char *pModel = ValueForKey(edit_entity, "model");
00542         
00543         /*
00544         if (pModel != NULL)
00545         {
00546         GetCachedModel(pModel, vMin, vMax);
00547         }
00548         */
00549     }
00550         
00551     Sys_UpdateWindows(W_CAMERA | W_XY);
00552     
00553 }

Here is the call graph for this function:

void SetSpawnFlags void   ) 
 

Definition at line 559 of file Win_ent.cpp.

References atoi, edit_entity, EntCheck1, f, hwndEnt, i, v, and ValueForKey().

Referenced by UpdateSel().

00560 {
00561     int     f;
00562     int     i;
00563     int     v;
00564 
00565     f = atoi(ValueForKey (edit_entity, "spawnflags"));
00566     for (i=0 ;