]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/xywindow.cpp
Merge commit '0d5ebb17b29d4263ec4f1634af24a27620ab47a4' into garux-merge
[xonotic/netradiant.git] / radiant / xywindow.cpp
index f1cb57fdbf8a47203516ebe0294d1bf850f1b915..1a176bfd242bf86bce78ab84abe83f48a77e79fd 100644 (file)
@@ -994,6 +994,18 @@ void XYWnd::Clipper_Crosshair_OnMouseMoved( int x, int y ){
        }
 }
 
+void XYWnd::SetCustomPivotOrigin( int pointx, int pointy ){
+       Vector3 point;
+       XY_ToPoint( pointx, pointy, point );
+       VIEWTYPE viewtype = static_cast<VIEWTYPE>( GetViewType() );
+       const int nDim = ( viewtype == YZ ) ? 0 : ( ( viewtype == XZ ) ? 1 : 2 );
+       //vector3_snap( point, GetSnapGridSize() );
+       point[nDim] = 999999;
+
+       GlobalSelectionSystem().setCustomPivotOrigin( point );
+       SceneChangeNotify();
+}
+
 unsigned int MoveCamera_buttons(){
        return RAD_CONTROL | ( g_glwindow_globals.m_nMouseType == ETwoButton ? RAD_RBUTTON : RAD_MBUTTON );
 }
@@ -1028,6 +1040,10 @@ void XYWnd_OrientCamera( XYWnd* xywnd, int x, int y, CamWnd& camwnd ){
        }
 }
 
+unsigned int SetCustomPivotOrigin_buttons(){
+       return RAD_MBUTTON | RAD_SHIFT;
+}
+
 /*
    ==============
    NewBrushDrag
@@ -1229,7 +1245,7 @@ void XYWnd::Move_Begin(){
 
 void XYWnd::Move_End(){
        m_move_started = false;
-       g_xywnd_freezePointer.unfreeze_pointer( m_parent ? m_parent : MainFrame_getWindow() );
+       g_xywnd_freezePointer.unfreeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), false );
        g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_move_focusOut );
 }
 
@@ -1274,7 +1290,7 @@ void XYWnd::Zoom_Begin(){
 
 void XYWnd::Zoom_End(){
        m_zoom_started = false;
-       g_xywnd_freezePointer.unfreeze_pointer( m_parent ? m_parent : MainFrame_getWindow() );
+       g_xywnd_freezePointer.unfreeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), false );
        g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_zoom_focusOut );
 }
 
@@ -1335,6 +1351,9 @@ void XYWnd::XY_MouseDown( int x, int y, unsigned int buttons ){
        else if ( buttons == OrientCamera_buttons() ) {
                XYWnd_OrientCamera( this, x, y, *g_pParentWnd->GetCamWnd() );
        }
+       else if ( buttons == SetCustomPivotOrigin_buttons() ) {
+               SetCustomPivotOrigin( x, y );
+       }
        else
        {
                m_window_observer->onMouseDown( WindowVector_forInteger( x, y ), button_for_flags( buttons ), modifiers_for_flags( buttons ) );
@@ -1392,6 +1411,10 @@ void XYWnd::XY_MouseMoved( int x, int y, unsigned int buttons ){
                XYWnd_OrientCamera( this, x, y, *g_pParentWnd->GetCamWnd() );
        }
 
+       else if ( buttons == SetCustomPivotOrigin_buttons() ) {
+               SetCustomPivotOrigin( x, y );
+       }
+
        else
        {
                m_window_observer->onMouseMotion( WindowVector_forInteger( x, y ), modifiers_for_flags( buttons ) );