29 #include "../../idlib/precompiled.h"
43 static char THIS_FILE[] = __FILE__;
53 ON_COMMAND(ID_HELP, OnHelp)
56 ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
57 ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
59 ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
108 if ( g_qeglobals.rw ==
NULL ) {
112 if ( g_qeglobals.sw ==
NULL ) {
126 CWinApp* pApp = AfxGetApp();
127 CWinThread *pThread = AfxGetThread();
132 pApp->InitApplication();
135 pThread->InitInstance();
168 static bool exceptionErr =
false;
172 if (!exceptionErr && !show) {
182 ::MessageBox(
NULL, ex.
error,
"Exception error", MB_OK);
213 char RadiantPath[_MAX_PATH];
214 GetModuleFileName(
NULL, RadiantPath, _MAX_PATH );
218 Finder.FindFile( RadiantPath );
219 Finder.FindNextFile();
221 CString Root = Finder.GetRoot();
223 CString IniPath = Root +
"\\REGISTRY.INI";
225 Finder.FindNextFile();
226 if (Finder.FindFile( IniPath ))
228 Finder.FindNextFile();
230 free((
void*)m_pszProfileName);
231 m_pszProfileName=_tcsdup(_T(Finder.GetFilePath()));
242 key =
"Software\\Q3Radiant\\IniPrefs" + CString(iBuf);
244 if ( RegOpenKeyEx( HKEY_CURRENT_USER, key, 0, KEY_ALL_ACCESS, &hkResult ) != ERROR_SUCCESS )
247 strcpy( g_qeglobals.use_ini_registry, key.GetBuffer(0) );
248 RegCreateKeyEx( HKEY_CURRENT_USER, key, 0,
NULL,
249 REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS,
NULL, &hkResult, &dwDisp );
250 RegSetValueEx( hkResult,
"RadiantName", 0, REG_SZ, reinterpret_cast<CONST BYTE *>(RadiantPath), strlen( RadiantPath )+1 );
251 RegCloseKey( hkResult );
256 char RadiantAux[ _MAX_PATH ];
257 unsigned long size = _MAX_PATH;
259 RegQueryValueEx( hkResult,
"RadiantName", 0, &type, reinterpret_cast<BYTE *>(RadiantAux), &size );
260 RegCloseKey( hkResult );
261 if ( !
strcmp( RadiantAux, RadiantPath ) )
264 strcpy( g_qeglobals.use_ini_registry, key.GetBuffer(0) );
270 g_qeglobals.use_ini =
true;
276 g_qeglobals.use_ini =
false;
279 LoadStdProfileSettings();
299 CString strTemp = m_lpCmdLine;
301 if (strTemp.Find(
"builddefs") >= 0) {
310 if (pMainFrame->m_hAccelTable) {
311 ::DestroyAcceleratorTable(pMainFrame->m_hAccelTable);
316 m_pMainWnd = pMainFrame;
319 pMainFrame->ShowWindow(m_nCmdShow);
320 pMainFrame->UpdateWindow();
332 int ret = CWinApp::ExitInstance();
348 ShellExecute(m_pMainWnd->GetSafeHwnd(),
"open",
"http://www.idDevNet.com",
NULL,
NULL, SW_SHOW);
358 MSG *msg = AfxGetCurrentMessage();
360 MSG *msg = &m_msgCur;
364 while (bIdle && !::PeekMessage(msg,
NULL,
NULL,
NULL, PM_NOREMOVE)) {
366 if (!
OnIdle(lIdleCount++)) {
374 if (!PumpMessage()) {
379 if (IsIdleMessage(msg)) {
384 }
while (::PeekMessage(msg,
NULL,
NULL,
NULL, PM_NOREMOVE));
413 GetWindowRect(hWnd, &rc);
427 LONG lSize =
sizeof(rc);
435 if (rc.right < rc.left + 16)
436 rc.right = rc.left + 16;
437 if (rc.bottom < rc.top + 16)
438 rc.bottom = rc.top + 16;
440 MoveWindow(hWnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top,
FALSE);
457 extern int g_numbrushes, g_numentities;
459 char numbrushbuffer[100] =
"";
461 sprintf( numbrushbuffer,
"Brushes: %d Entities: %d", g_numbrushes, g_numentities );
CMainFrame * g_pParentWnd
virtual bool IsOpenGLRunning(void) const =0
void SetStatusText(int nPane, const char *pText)
void WINAPI Sys_UpdateWindows(int nBits)
#define qglEnableClientState
virtual idSoundWorld * AllocSoundWorld(idRenderWorld *rw)=0
void SetView(const idVec3 &origin, const idAngles &angles)
idRenderSystem * renderSystem
idFileSystem * fileSystem
void Sys_Status(const char *psz, int part)
void RadiantPrint(const char *text)
void SetCvarBinary(const char *name, void *pv, int size)
GLuint GLuint GLsizei GLenum type
bool LoadRegistryInfo(const char *pszName, void *pvBuf, long *plSize)
virtual int ExitInstance()
virtual BOOL InitInstance()
#define EDITOR_REGISTRY_KEY
virtual idRenderWorld * AllocRenderWorld(void)=0
void Map_VerifyCurrentMap(const char *map)
void RadiantShutdown(void)
virtual bool InitFromMap(const char *mapName)=0
bool SaveRegistryInfo(const char *pszName, void *pvBuf, long lSize)
virtual void Printf(const char *fmt,...) id_attribute((format(printf
CInspectorDialog * g_Inspectors
virtual const char * RelativePathToOSPath(const char *relativePath, const char *basePath="fs_devpath")=0
virtual BOOL OnIdle(LONG lCount)
void Sys_UpdateStatusBar(void)
bool GetCvarBinary(const char *name, void *pv, int size)
char error[MAX_STRING_CHARS]
bool SaveWindowState(HWND hWnd, const char *pszName)
MFnDagNode * GetParent(MFnDagNode *joint)
idSoundSystem * soundSystem
virtual void WriteFlaggedCVarsToFile(const char *filename, int flags, const char *setCmd)=0
idCVar radiant_entityMode("radiant_entityMode","0", CVAR_TOOL|CVAR_ARCHIVE,"")
void RadiantSync(const char *mapName, const idVec3 &viewOrg, const idAngles &viewAngles)
bool LoadWindowState(HWND hWnd, const char *pszName)
int sprintf(idStr &string, const char *fmt,...)
virtual void Shutdown(void)=0
void AddText(const char *msg)
void Sys_GrabMouseCursor(bool)