X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=radiant%2Fxywindow.h;h=310654be2de445074c98a314cdab6ded8451427f;hb=refs%2Fheads%2FTimePath%2Fdevelop;hp=cbf37b430f1a0bdfb496f79faa279f8582e928a4;hpb=7fc621fc78d0e040dc2c12f38dc53dd9048215dc;p=xonotic%2Fnetradiant.git diff --git a/radiant/xywindow.h b/radiant/xywindow.h index cbf37b43..310654be 100644 --- a/radiant/xywindow.h +++ b/radiant/xywindow.h @@ -35,244 +35,311 @@ #include "qerplugin.h" class Shader; + class SelectionSystemWindowObserver; -namespace scene -{ -class Node; +namespace scene { + class Node; } -typedef struct _GtkWindow GtkWindow; -typedef struct _GtkMenu GtkMenu; void FlipClip(); + void SplitClip(); + void Clip(); -void OnClipMode( bool enabled ); + +void OnClipMode(bool enabled); + bool ClipMode(); -inline const char* ViewType_getTitle( VIEWTYPE viewtype ){ - if ( viewtype == XY ) { - return "XY Top"; - } - if ( viewtype == XZ ) { - return "XZ Front"; - } - if ( viewtype == YZ ) { - return "YZ Side"; - } - return ""; +inline const char *ViewType_getTitle(VIEWTYPE viewtype) +{ + if (viewtype == XY) { + return "XY Top"; + } + if (viewtype == XZ) { + return "XZ Front"; + } + if (viewtype == YZ) { + return "YZ Side"; + } + return ""; } -class XYWnd -{ -GtkWidget* m_gl_widget; -guint m_sizeHandler; -guint m_exposeHandler; +struct OpenGLBinding; -DeferredDraw m_deferredDraw; -DeferredMotion m_deferred_motion; +class XYWnd { public: -GtkWindow* m_parent; -XYWnd(); -~XYWnd(); + OpenGLBinding ≷ +private: + ui::GLArea m_gl_widget; + guint m_sizeHandler; + guint m_exposeHandler; -void queueDraw(){ - m_deferredDraw.draw(); -} -GtkWidget* GetWidget(){ - return m_gl_widget; -} + DeferredDraw m_deferredDraw; + DeferredMotion m_deferred_motion; +public: + ui::Window m_parent; + + XYWnd(OpenGLBinding &GL); + + ~XYWnd(); + + void queueDraw() + { + m_deferredDraw.draw(); + } + + ui::GLArea GetWidget() + { + return m_gl_widget; + } public: -SelectionSystemWindowObserver* m_window_observer; -XORRectangle m_XORRectangle; -WindowPositionTracker m_positionTracker; - -static void captureStates(); -static void releaseStates(); - -void PositionView( const Vector3& position ); -const Vector3& GetOrigin(); -void SetOrigin( const Vector3& origin ); -void Scroll( int x, int y ); - -void XY_Draw(); -void DrawCameraIcon( const Vector3& origin, const Vector3& angles ); -void XY_DrawBlockGrid(); -void XY_DrawAxis(); -void XY_DrawGrid(); -void XY_DrawBackground(); -void XY_LoadBackgroundImage( const char *name ); -void XY_DisableBackground(); - -void XY_MouseUp( int x, int y, unsigned int buttons ); -void XY_MouseDown( int x, int y, unsigned int buttons ); -void XY_MouseMoved( int x, int y, unsigned int buttons ); - -void NewBrushDrag_Begin( int x, int y ); -void NewBrushDrag( int x, int y ); -void NewBrushDrag_End( int x, int y ); - -void XY_ToPoint( int x, int y, Vector3& point ); -void XY_SnapToGrid( Vector3& point ); - -void Move_Begin(); -void Move_End(); -bool m_move_started; -guint m_move_focusOut; - -void Zoom_Begin(); -void Zoom_End(); -bool m_zoom_started; -guint m_zoom_focusOut; - -void SetActive( bool b ){ - m_bActive = b; -}; -bool Active(){ - return m_bActive; -}; + SelectionSystemWindowObserver *m_window_observer; + XORRectangle m_XORRectangle; + WindowPositionTracker m_positionTracker; + + static void captureStates(); + + static void releaseStates(); + + void PositionView(const Vector3 &position); + + const Vector3 &GetOrigin(); + + void SetOrigin(const Vector3 &origin); + + void Scroll(int x, int y); + + void XY_Draw(); + + void DrawCameraIcon(const Vector3 &origin, const Vector3 &angles); + + void XY_DrawBlockGrid(); + + void XY_DrawAxis(); + + void XY_DrawGrid(); + + void XY_DrawBackground(); + + void XY_LoadBackgroundImage(const char *name); + + void XY_DisableBackground(); + + void XY_MouseUp(int x, int y, unsigned int buttons); + + void XY_MouseDown(int x, int y, unsigned int buttons); + + void XY_MouseMoved(int x, int y, unsigned int buttons); + + void NewBrushDrag_Begin(int x, int y); + + void NewBrushDrag(int x, int y); + + void NewBrushDrag_End(int x, int y); + + void XY_ToPoint(int x, int y, Vector3 &point); + + void XY_SnapToGrid(Vector3 &point); + + void Move_Begin(); + + void Move_End(); + + bool m_move_started; + guint m_move_focusOut; -void Clipper_OnLButtonDown( int x, int y ); -void Clipper_OnLButtonUp( int x, int y ); -void Clipper_OnMouseMoved( int x, int y ); -void Clipper_Crosshair_OnMouseMoved( int x, int y ); -void DropClipPoint( int pointx, int pointy ); + void Zoom_Begin(); -void SetViewType( VIEWTYPE n ); -bool m_bActive; + void Zoom_End(); -static GtkMenu* m_mnuDrop; + bool m_zoom_started; + guint m_zoom_focusOut; -int m_chasemouse_current_x, m_chasemouse_current_y; -int m_chasemouse_delta_x, m_chasemouse_delta_y; + void SetActive(bool b) + { + m_bActive = b; + }; + bool Active() + { + return m_bActive; + }; -guint m_chasemouse_handler; -void ChaseMouse(); -bool chaseMouseMotion( int pointx, int pointy ); + void Clipper_OnLButtonDown(int x, int y); -void updateModelview(); -void updateProjection(); -Matrix4 m_projection; -Matrix4 m_modelview; + void Clipper_OnLButtonUp(int x, int y); -int m_nWidth; -int m_nHeight; + void Clipper_OnMouseMoved(int x, int y); + + void Clipper_Crosshair_OnMouseMoved(int x, int y); + + void DropClipPoint(int pointx, int pointy); + + void SetViewType(VIEWTYPE n); + + bool m_bActive; + + static ui::Menu m_mnuDrop; + + int m_chasemouse_current_x, m_chasemouse_current_y; + int m_chasemouse_delta_x, m_chasemouse_delta_y; + + + guint m_chasemouse_handler; + + void ChaseMouse(); + + bool chaseMouseMotion(int pointx, int pointy); + + void updateModelview(); + + void updateProjection(); + + Matrix4 m_projection; + Matrix4 m_modelview; + + int m_nWidth; + int m_nHeight; // background image stuff -qtexture_t *m_tex; -bool m_backgroundActivated; -float m_alpha; // vertex alpha -float m_xmin, m_ymin, m_xmax, m_ymax; + qtexture_t *m_tex; + bool m_backgroundActivated; + float m_alpha; // vertex alpha + float m_xmin, m_ymin, m_xmax, m_ymax; private: -float m_fScale; -Vector3 m_vOrigin; + float m_fScale; + Vector3 m_vOrigin; + + + View m_view; + static Shader *m_state_selected; + int m_ptCursorX, m_ptCursorY; -View m_view; -static Shader* m_state_selected; + unsigned int m_buttonstate; -int m_ptCursorX, m_ptCursorY; + int m_nNewBrushPressx; + int m_nNewBrushPressy; + scene::Node *m_NewBrushDrag; + bool m_bNewBrushDrag; -unsigned int m_buttonstate; + Vector3 m_mousePosition; -int m_nNewBrushPressx; -int m_nNewBrushPressy; -scene::Node* m_NewBrushDrag; -bool m_bNewBrushDrag; + VIEWTYPE m_viewType; -Vector3 m_mousePosition; + void OriginalButtonUp(guint32 nFlags, int point, int pointy); -VIEWTYPE m_viewType; + void OriginalButtonDown(guint32 nFlags, int point, int pointy); -void OriginalButtonUp( guint32 nFlags, int point, int pointy ); -void OriginalButtonDown( guint32 nFlags, int point, int pointy ); + void OnContextMenu(); -void OnContextMenu(); -void PaintSizeInfo( int nDim1, int nDim2, Vector3& vMinBounds, Vector3& vMaxBounds ); + void PaintSizeInfo(int nDim1, int nDim2, Vector3 &vMinBounds, Vector3 &vMaxBounds); -int m_entityCreate_x, m_entityCreate_y; -bool m_entityCreate; + int m_entityCreate_x, m_entityCreate_y; + bool m_entityCreate; public: -void ButtonState_onMouseDown( unsigned int buttons ){ - m_buttonstate |= buttons; -} -void ButtonState_onMouseUp( unsigned int buttons ){ - m_buttonstate &= ~buttons; -} -unsigned int getButtonState() const { - return m_buttonstate; -} -void EntityCreate_MouseDown( int x, int y ); -void EntityCreate_MouseMove( int x, int y ); -void EntityCreate_MouseUp( int x, int y ); + void ButtonState_onMouseDown(unsigned int buttons) + { + m_buttonstate |= buttons; + } -void OnEntityCreate( const char* item ); -VIEWTYPE GetViewType(){ - return m_viewType; -} -void SetScale( float f ); -float Scale(){ - return m_fScale; -} -int Width(){ - return m_nWidth; -} -int Height(){ - return m_nHeight; -} + void ButtonState_onMouseUp(unsigned int buttons) + { + m_buttonstate &= ~buttons; + } + + unsigned int getButtonState() const + { + return m_buttonstate; + } + + void EntityCreate_MouseDown(int x, int y); + + void EntityCreate_MouseMove(int x, int y); + + void EntityCreate_MouseUp(int x, int y); + + void OnEntityCreate(const char *item); + + VIEWTYPE GetViewType() + { + return m_viewType; + } + + void SetScale(float f); + + float Scale() + { + return m_fScale; + } + + int Width() + { + return m_nWidth; + } -Signal0 onDestroyed; -Signal3 onMouseDown; -void mouseDown( const WindowVector& position, ButtonIdentifier button, ModifierFlags modifiers ); -typedef Member3 MouseDownCaller; + int Height() + { + return m_nHeight; + } + + Signal0 onDestroyed; + Signal3 onMouseDown; + + void mouseDown(const WindowVector &position, ButtonIdentifier button, ModifierFlags modifiers); + + typedef Member MouseDownCaller; }; -inline void XYWnd_Update( XYWnd& xywnd ){ - xywnd.queueDraw(); +inline void XYWnd_Update(XYWnd &xywnd) +{ + xywnd.queueDraw(); } -struct xywindow_globals_t -{ - Vector3 color_gridback; - Vector3 color_gridminor; - Vector3 color_gridmajor; - Vector3 color_gridblock; - Vector3 color_gridtext; - Vector3 color_brushes; - Vector3 color_selbrushes; - Vector3 color_clipper; - Vector3 color_viewname; - Vector3 color_gridminor_alt; - Vector3 color_gridmajor_alt; - Vector3 AxisColorX; - Vector3 AxisColorY; - Vector3 AxisColorZ; - - bool m_bRightClick; - bool m_bNoStipple; - - xywindow_globals_t() : - color_gridback( 1.f, 1.f, 1.f ), - color_gridminor( 0.75f, 0.75f, 0.75f ), - color_gridmajor( 0.5f, 0.5f, 0.5f ), - color_gridblock( 0.f, 0.f, 1.f ), - color_gridtext( 0.f, 0.f, 0.f ), - color_brushes( 0.f, 0.f, 0.f ), - color_selbrushes( 1.f, 0.f, 0.f ), - color_clipper( 0.f, 0.f, 1.f ), - color_viewname( 0.5f, 0.f, 0.75f ), - color_gridminor_alt( 0.f, 0.f, 0.f ), - color_gridmajor_alt( 0.f, 0.f, 0.f ), - - AxisColorX( 1.f, 0.f, 0.f ), - AxisColorY( 0.f, 1.f, 0.f ), - AxisColorZ( 0.f, 0.f, 1.f ), - m_bRightClick( true ), - m_bNoStipple( false ){ - } +struct xywindow_globals_t { + Vector3 color_gridback; + Vector3 color_gridminor; + Vector3 color_gridmajor; + Vector3 color_gridblock; + Vector3 color_gridtext; + Vector3 color_brushes; + Vector3 color_selbrushes; + Vector3 color_clipper; + Vector3 color_viewname; + Vector3 color_gridminor_alt; + Vector3 color_gridmajor_alt; + Vector3 AxisColorX; + Vector3 AxisColorY; + Vector3 AxisColorZ; + + bool m_bRightClick; + bool m_bNoStipple; + + xywindow_globals_t() : + color_gridback(1.f, 1.f, 1.f), + color_gridminor(0.75f, 0.75f, 0.75f), + color_gridmajor(0.5f, 0.5f, 0.5f), + color_gridblock(0.f, 0.f, 1.f), + color_gridtext(0.f, 0.f, 0.f), + color_brushes(0.f, 0.f, 0.f), + color_selbrushes(1.f, 0.f, 0.f), + color_clipper(0.f, 0.f, 1.f), + color_viewname(0.5f, 0.f, 0.75f), + color_gridminor_alt(0.f, 0.f, 0.f), + color_gridmajor_alt(0.f, 0.f, 0.f), + + AxisColorX(1.f, 0.f, 0.f), + AxisColorY(0.f, 1.f, 0.f), + AxisColorZ(0.f, 0.f, 1.f), + m_bRightClick(true), + m_bNoStipple(false) + { + } }; @@ -281,18 +348,22 @@ extern xywindow_globals_t g_xywindow_globals; VIEWTYPE GlobalXYWnd_getCurrentViewType(); -typedef struct _GtkWindow GtkWindow; -void XY_Top_Shown_Construct( GtkWindow* parent ); -void YZ_Side_Shown_Construct( GtkWindow* parent ); -void XZ_Front_Shown_Construct( GtkWindow* parent ); +void XY_Top_Shown_Construct(ui::Window parent); + +void YZ_Side_Shown_Construct(ui::Window parent); + +void XZ_Front_Shown_Construct(ui::Window parent); void XYWindow_Construct(); + void XYWindow_Destroy(); void WXY_Print(); + void WXY_BackgroundSelect(); void XYShow_registerCommands(); + void XYWnd_registerShortcuts(); #endif