29 #include "../../idlib/precompiled.h"
32 #include "../../sys/win32/rc/guied_resource.h"
33 #include "../../renderer/tr_local.h"
34 #include "../../sys/win32/win_local.h"
35 #include "../../ui/DeviceContext.h"
36 #include "../../ui/EditWindow.h"
37 #include "../../ui/ListWindow.h"
38 #include "../../ui/BindWindow.h"
39 #include "../../ui/RenderWindow.h"
40 #include "../../ui/ChoiceWindow.h"
58 static const int ID_GUIED_SELECT_FIRST = 9800;
59 static const int ID_GUIED_SELECT_LAST = 9900;
125 return g_ZoomScales [
mZoom ];
147 SetWindowLong (
mWnd, GWL_USERDATA, (
LONG)
this );
165 SetWindowLong (
mWnd, GWL_USERDATA, 0 );
181 int pixelFormat = ChoosePixelFormat(hDC, &
win32.
pfd);
184 if (SetPixelFormat(hDC, pixelFormat, &
win32.
pfd) ==
NULL)
194 ReleaseDC (
mWnd, hDC );
271 scale = g_ZoomScales[
mZoom];
277 common->
Printf(
"Please restart Q3Radiant if the Map view is not working\n");
289 qglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
308 memset ( &viewDef, 0,
sizeof(viewDef) );
351 qwglSwapBuffers(hdc);
386 scale = g_ZoomScales[
mZoom];
389 GetClientRect (
mWnd, &rcClient );
429 si.cbSize =
sizeof (si);
433 GetScrollInfo (
mWnd, scrollbar, &si);
435 si.nPos += (1000 *
offset);
436 if ( si.nPos < si.nMin ) si.nPos = si.nMin;
437 if ( si.nPos > si.nMax ) si.nPos = si.nMax;
440 SetScrollInfo (
mWnd, scrollbar, &si,
TRUE);
441 GetScrollInfo (
mWnd, scrollbar, &si);
451 si.cbSize =
sizeof (si);
455 GetScrollInfo (
mWnd, scrollbar, &si);
457 switch (LOWORD (wParam))
481 si.nPos = si.nTrackPos;
491 SetScrollInfo (
mWnd, scrollbar, &si,
TRUE);
492 GetScrollInfo (
mWnd, scrollbar, &si);
515 info.cbSize =
sizeof(info);
516 info.fMask = SIF_RANGE|SIF_PAGE;
518 info.nMin = -info.nMax;
520 info.nMax += info.nPage;
531 SetScrollInfo (
mWnd, SB_VERT, &info,
TRUE );
537 SetScrollPos (
mWnd, SB_VERT, 0,
FALSE );
543 info.nMin = -info.nMax;
545 info.nMax += info.nPage;
557 SetScrollInfo (
mWnd, SB_HORZ, &info,
TRUE );
563 SetScrollPos (
mWnd, SB_HORZ, 0,
FALSE );
583 SetCursor ( LoadCursor (
NULL, MAKEINTRESOURCE(IDC_ARROW) ) );
587 SetCursor ( LoadCursor (
NULL, MAKEINTRESOURCE(IDC_SIZEALL) ) );
592 SetCursor ( LoadCursor (
NULL, MAKEINTRESOURCE(IDC_SIZEWE ) ) );
597 SetCursor ( LoadCursor (
NULL, MAKEINTRESOURCE(IDC_SIZENS ) ) );
602 SetCursor ( LoadCursor (
NULL, MAKEINTRESOURCE(IDC_SIZENESW ) ) );
607 SetCursor ( LoadCursor (
NULL, MAKEINTRESOURCE(IDC_SIZENWSE ) ) );
630 SetCursor ( LoadCursor (
NULL, MAKEINTRESOURCE(IDC_ARROW ) ) );
641 GetCursorPos ( &point );
642 cursor.
Set ( point.
x, point.
y );
669 if ( IDYES ==
gApp.
MessageBox (
va(
"Save changes to the document \"%s\" before closing?",
GetFilename() ), MB_YESNO|MB_ICONQUESTION ) )
682 case WM_CAPTURECHANGED:
683 if ( (HWND)lParam !=
mWnd )
694 GetCursorPos ( &point );
695 cursor.
Set ( point.
x, point.
y );
709 if ( (
short)HIWORD(wParam) > 0 )
713 else if ( (
short)HIWORD(wParam) < 0 )
739 case WM_LBUTTONDBLCLK:
743 case WM_INITMENUPOPUP:
783 if ( LOWORD(wParam) >= ID_GUIED_SELECT_FIRST && LOWORD(wParam) <= ID_GUIED_SELECT_LAST )
789 if ( GetAsyncKeyState ( VK_SHIFT ) & 0x8000 )
860 POINT point = { LOWORD(lParam), HIWORD(lParam) };
881 HMENU popup = CreatePopupMenu ( );
887 AppendMenu ( popup, MF_STRING|MF_ENABLED|(wrapper->
IsSelected()?MF_CHECKED:0), ID_GUIED_SELECT_FIRST + i,
mSelectMenu[i]->GetName() );
890 InsertMenu ( menu, 1, MF_POPUP|MF_BYPOSITION, (
LONG) popup,
"Select" );
893 ClientToScreen (
mWnd, &point );
894 TrackPopupMenu ( menu, TPM_RIGHTBUTTON|TPM_LEFTALIGN, point.
x, point.
y, 0,
mWnd,
NULL );
896 DestroyMenu ( popup );
897 DestroyMenu ( menu );
916 idVec2 point ( LOWORD(lParam), HIWORD(lParam) );
952 if ( GetAsyncKeyState ( VK_SHIFT ) & 0x8000 )
1039 cursor.
Set ( (
short)LOWORD(lParam), (
short)HIWORD(lParam) );
1149 bool shift = (GetAsyncKeyState ( VK_SHIFT ) & 0x8000) ?
true :
false;
1363 va_start(args,type) ;
1387 va_start(args,type);
1397 va_start(args,type) ;
1512 baseName = state ? state->
GetString(
"name",
"unnamed") :
"unnamed";
1528 if ( wrapper && wrapper->IsDeleted ( ) )
1547 winTemplate = winName +
" { }";
1556 wrapper->SetState ( *state );
1559 wrapper->SetStateKey (
"name", winName );
1560 wrapper->Finish ( );
1573 state.
Set (
"rect",
"0,0,100,100" );
1574 state.
Set (
"visible",
"1" );
1672 width = rectTo.
w - rectFrom.
w;
1677 height = rectTo.
h - rectFrom.
h;
1700 static const char* alignNames[]={
"Lefts",
"Centers",
"Rights",
"Tops",
"Middles",
"Bottoms" };
1707 modName =
"Align " +
idStr(alignNames[align]);
1727 x = rectTo[0] - rectFrom[0];
1732 x = (rectTo[0]+rectTo[2]) - (rectFrom[0]+rectFrom[2]);
1737 x = (rectTo[0]+rectTo[2]/2) - (rectFrom[0]+rectFrom[2]/2);
1742 y = rectTo[1] - rectFrom[1];
1748 y = (rectTo[1]+rectTo[3]) - (rectFrom[1]+rectFrom[3]);
1753 y = (rectTo[1]+rectTo[3]/2) - (rectFrom[1]+rectFrom[3]/2);
1786 newRect = scaleRect;
1835 newRect = scaleRect;
1838 newRect.
w += (r -
l);
1839 newRect.
h += (b -
t);
1842 if ( newRect.
w <= 1 )
1844 newRect.
x = newRect.
x - (l ? (1 - newRect.
w) : 0);
1855 if ( newRect.
h <= 1 )
1857 newRect.
y = newRect.
y - (t ? (1 - newRect.
h) : 0);
1877 l = (newRect.
x + ((sizeRect.
x - scaleRect.
x) / scaleRect.
w) * newRect.
w) - sizeRect.
x;
1878 t = (newRect.
y + ((sizeRect.
y - scaleRect.
y) / scaleRect.
h) * newRect.
h) - sizeRect.
y;
1879 r = (sizeRect.
w / scaleRect.
w * newRect.
w) - sizeRect.
w + l;
1880 b = (sizeRect.
h / scaleRect.
h * newRect.
h) - sizeRect.
h +
t;
1899 offset = ((newRect.
x + ((sizeRect.
x - scaleRect.
x) / scaleRect.
w) * newRect.
w) - sizeRect.
x);
1904 offset = ((newRect.
y + ((sizeRect.
y - scaleRect.
y) / scaleRect.
h) * newRect.
h) - sizeRect.
y);
1933 gApp.
MessageBox (
"Cannot add children to an htmlDef item", MB_OK|MB_ICONERROR );
2005 state.
Delete (
"windowType" );
bool IsSelected(idWindow *window)
int HandleCommand(WPARAM wParam, LPARAM lParam)
virtual void EndFrame(int *frontEndMsec, int *backEndMsec)=0
assert(prefInfo.fullscreenBtn)
void Scroll(int scrollbar, int offset)
void Add(idWindow *window, bool expand=true)
rvGESelectionMgr::EHitTest mDragType
void UpdateScrollbars(void)
void Delete(const char *key)
bool GEItemScriptsDlg_DoModal(HWND parent, idWindow *window)
bool EditSelectedScripts(void)
void AddModifierShowAll(void)
static bool CleanupEnumProc(rvGEWindowWrapper *wrapper, void *data)
idWindow * WindowFromPoint(float x, float y, bool visibleOnly=true)
CONST PIXELFORMATDESCRIPTOR UINT
int HandleLButtonDblClk(WPARAM wParam, LPARAM lParam)
idStr & StripQuotes(void)
void HandleMessage(UINT msg, WPARAM wParam, LPARAM lParam)
GLenum GLenum GLenum GLenum GLenum scale
void SetWorkspace(rvGEWorkspace *workspace)
void SnapRectToGrid(idRectangle &rect, bool snapLeft=true, bool snapTop=true, bool snapWidth=true, bool snapHeight=true)
drawWin_t * FindChildByName(const char *name)
virtual void Redraw(int time)
EWindowType GetWindowType(void)
idRenderSystem * renderSystem
int Sys_Milliseconds(void)
int HandleLButtonDown(WPARAM wParam, LPARAM lParam)
void SendSelectedToBack(void)
#define ID_GUIED_FILE_SAVE
void AddModifierSizeNudge(float w, float h, bool snap)
rvGEWorkspace(rvGEApp *app)
void SetModified(bool mod)
void AddModifiers(EModifierType type,...)
void SendSelectedBackward(void)
static bool ShowAllEnumProc(rvGEWindowWrapper *wrapper, void *data)
rvGEProperties & GetProperties(void)
const char * GetFilename(void)
GLuint GLuint GLsizei GLenum type
static const char * WindowTypeToString(EWindowType type)
rvGEWorkspace * GetActiveWorkspace(HWND *retwnd=NULL)
static EWindowType StringToWindowType(const char *string)
EHitTest HitTest(float x, float y)
void Set(const char *key, const char *value)
virtual void BeginFrame(int windowWidth, int windowHeight)=0
HINSTANCE GetInstance(void)
void SetTriangles(int tris)
void Copy(const idDict &other)
idDict & GetStateDict(void)
int HandleScroll(int scrollbar, WPARAM wParam, LPARAM lParam)
rvGETransformer & GetTransformer(void)
void BringSelectedForward(void)
void SetWorkspace(rvGEWorkspace *workspace)
rvGEModifier * CreateModifier(EModifierType type, idWindow *window, va_list args)
rvGEModifierStack mModifiers
idVec4 & GetWorkspaceColor(void)
GLuint GLuint GLsizei count
ESourceControlState mSourceControlState
bool GEItemPropsDlg_DoModal(HWND parent, idWindow *window, idDict &dict)
rvGEOptions & GetOptions(void)
const char * GetString(const char *key, const char *defaultString="") const
idDict & GetScriptDict(void)
idRectangle & GetClientRect(void)
bool Append(rvGEModifier *mod)
rvGEApp * GetApplication(void)
int HandleMouseMove(WPARAM wParam, LPARAM lParam)
idDeviceContext * GetDC(void)
GLsizei GLsizei GLenum GLenum const GLvoid * data
idRectangle & GetScreenRect(void)
idDict & GetVariableDict(void)
void DeleteSelected(void)
virtual bool Parse(idParser *src, bool rebuild=true)
bool GetGridVisible(void)
void HideWindow(idWindow *window)
int MessageBox(const char *text, int flags)
void UpdateRectangle(bool useScroll=true)
void glLoadIdentity(void)
bool GetIgnoreDesktopSelect(void)
typedef HDC(WINAPI *PFNWGLGETCURRENTREADDCARBPROC)(void)
idList< idWindow * > mSelectMenu
idWindow * GetDesktop() const
virtual void Printf(const char *fmt,...) id_attribute((format(printf
void SetWorkspace(rvGEWorkspace *workspace)
idWindow * NewWindow(idDict *state, rvGEWindowWrapper::EWindowType type)
#define IDR_GUIED_ITEM_POPUP
GLenum GLsizei GLsizei height
idRectangle & GetRect(void)
bool SetupPixelFormat(void)
void UnhideWindow(idWindow *window)
void MakeSelectedAChild(void)
void BringSelectedToFront(void)
idVec4 & GetGridColor(void)
int Append(const type &obj)
GLdouble GLdouble GLdouble r
rvGENavigator & GetNavigator(void)
static rvGEWindowWrapper * GetWrapper(idWindow *window)
idWindow * GetWindow(void)
bool Append(rvGEModifier *modifier)
rvGESelectionMgr mSelections
void AddModifierSize(const char *modName, float l, float t, float r, float b, bool snap)
idVec2 & WorkspaceToWindow(idVec2 &point)
void AddModifierMoveNudge(float x, float y, bool snap)
void AlignSelected(EItemAlign align)
idVec2 & WindowToWorkspace(idVec2 &point)
void UnhideSelected(void)
MFnDagNode * GetParent(MFnDagNode *joint)
bool Contains(float xt, float yt)
PIXELFORMATDESCRIPTOR pfd
int HandleMButtonUp(WPARAM wParam, LPARAM lParam)
rvGEStatusBar & GetStatusBar(void)
void MakeSelectedSameSize(bool width, bool height)
const char * c_str(void) const
void AddModifierMove(const char *modName, float x, float y, bool snap)
void BlockNextMerge(void)
#define GL_TEXTURE_CUBE_MAP_EXT
void GL_State(int stateBits)
static bool BuildSelectMenuEnumProc(rvGEWindowWrapper *wrapper, void *data)
void Set(const float x, const float y)
static idList< rvGEClipboardItem * > mClipboard
char * va(const char *fmt,...)
void glMatrixMode(GLenum mode)
bool EditSelectedProperties(void)
int HandleMButtonDown(WPARAM wParam, LPARAM lParam)
int HandleLButtonUp(WPARAM wParam, LPARAM lParam)
bool EnumChildren(PFNENUMCHILDRENPROC proc, void *data)
int HandleRButtonDown(WPARAM wParam, LPARAM lParam)
idWindow * AddWindow(rvGEWindowWrapper::EWindowType type)
idUserInterfaceLocal * mInterface
int HandleKeyDown(WPARAM wParam, LPARAM lParam)