X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=radiant%2Fxywindow.cpp;h=c06994c4fa90df0765d4ef1fae205952bd124c4a;hb=b72e20ae7037d4c0a14885678cf6335bde71af0f;hp=7d7f984ce072e005fb25385f803a92e9c6debc41;hpb=578b01e8cb2bf425c24cbeee3bbb6a5f7c59b1cb;p=xonotic%2Fnetradiant.git diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index 7d7f984c..c06994c4 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -139,7 +139,9 @@ void ClipPoint::Draw( const char *label, float scale ){ // draw label glRasterPos3f( m_ptClip[0] + offset, m_ptClip[1] + offset, m_ptClip[2] + offset ); - glCallLists( GLsizei( strlen( label ) ), GL_UNSIGNED_BYTE, label ); + //glCallLists( GLsizei( strlen( label ) ), GL_UNSIGNED_BYTE, label ); //fails with GCC + //glCallLists( GLsizei( strlen( label ) ), GL_UNSIGNED_BYTE, reinterpret_cast( label ) ); //worx + GlobalOpenGL().drawString( label ); } float fDiff( float f1, float f2 ){ @@ -354,7 +356,7 @@ struct xywindow_globals_private_t bool show_blocks; int blockSize; - bool m_bCamXYUpdate; +// bool m_bCamXYUpdate; bool m_bChaseMouse; bool m_bSizePaint; @@ -364,16 +366,16 @@ struct xywindow_globals_private_t d_showgrid( true ), show_names( false ), - show_coordinates( true ), + show_coordinates( false ), show_angles( true ), - show_outline( false ), + show_outline( true ), show_axis( true ), d_show_work( false ), show_blocks( false ), - m_bCamXYUpdate( true ), +// m_bCamXYUpdate( true ), m_bChaseMouse( true ), m_bSizePaint( true ), @@ -545,7 +547,7 @@ void XYWnd::ZoomOut(){ void XYWnd::ZoomInWithMouse( int pointx, int pointy ){ float old_scale = Scale(); ZoomIn(); - if ( g_xywindow_globals.m_bImprovedWheelZoom ) { + if ( g_xywindow_globals.m_bZoomInToPointer ) { float scale_diff = 1.0 / old_scale - 1.0 / Scale(); int nDim1 = ( m_viewType == YZ ) ? 1 : 0; int nDim2 = ( m_viewType == XY ) ? 1 : 2; @@ -569,6 +571,20 @@ void XYWnd::Redraw() { } } +void XYWnd::FocusOnBounds( AABB& bounds ){ + SetOrigin( bounds.origin ); + int nDim1 = ( m_viewType == YZ ) ? 1 : 0; + int nDim2 = ( m_viewType == XY ) ? 1 : 2; + if( bounds.extents[ nDim1 ] < 128.f ) + bounds.extents[ nDim1 ] = 128.f; + if( bounds.extents[ nDim2 ] < 128.f ) + bounds.extents[ nDim2 ] = 128.f; + float scale1 = Width() / ( 3.f * bounds.extents[ nDim1 ] ); + float scale2 = Height() / ( 3.f * bounds.extents[ nDim2 ] ); + SetScale( MIN( scale1, scale2 ) ); + +} + VIEWTYPE GlobalXYWnd_getCurrentViewType(){ ASSERT_NOTNULL( g_pParentWnd ); ASSERT_NOTNULL( g_pParentWnd->ActiveXY() ); @@ -749,21 +765,25 @@ Shader* XYWnd::m_state_selected = 0; void xy_update_xor_rectangle( XYWnd& self, rect_t area ){ if ( self.GetWidget().visible() ) { rectangle_t rect = rectangle_from_area( area.min, area.max, self.Width(), self.Height() ); - int nDim1 = ( self.GetViewType() == YZ ) ? 1 : 0; - int nDim2 = ( self.GetViewType() == XY ) ? 1 : 2; - rect.x /= self.Scale(); - rect.y /= self.Scale(); - rect.w /= self.Scale(); - rect.h /= self.Scale(); - rect.x += self.GetOrigin()[nDim1]; - rect.y += self.GetOrigin()[nDim2]; +// int nDim1 = ( self.GetViewType() == YZ ) ? 1 : 0; +// int nDim2 = ( self.GetViewType() == XY ) ? 1 : 2; +// rect.x /= self.Scale(); +// rect.y /= self.Scale(); +// rect.w /= self.Scale(); +// rect.h /= self.Scale(); +// rect.x += self.GetOrigin()[nDim1]; +// rect.y += self.GetOrigin()[nDim2]; self.m_XORRectangle.set( rect ); } } gboolean xywnd_button_press( ui::Widget widget, GdkEventButton* event, XYWnd* xywnd ){ if ( event->type == GDK_BUTTON_PRESS ) { - g_pParentWnd->SetActiveXY( xywnd ); + gtk_widget_grab_focus( xywnd->GetWidget() ); + + if( !xywnd->Active() ){ + g_pParentWnd->SetActiveXY( xywnd ); + } xywnd->ButtonState_onMouseDown( buttons_for_event_button( event ) ); @@ -784,7 +804,9 @@ gboolean xywnd_button_release( ui::Widget widget, GdkEventButton* event, XYWnd* gboolean xywnd_focus_in( ui::Widget widget, GdkEventFocus* event, XYWnd* xywnd ){ if ( event->type == GDK_FOCUS_CHANGE ) { if ( event->in ) { - g_pParentWnd->SetActiveXY( xywnd ); + if( !xywnd->Active() ){ + g_pParentWnd->SetActiveXY( xywnd ); + } } } return FALSE; @@ -798,6 +820,14 @@ void xywnd_motion( gdouble x, gdouble y, guint state, void* data ){ } gboolean xywnd_wheel_scroll( ui::Widget widget, GdkEventScroll* event, XYWnd* xywnd ){ + gtk_widget_grab_focus( xywnd->GetWidget() ); + ui::Window window = xywnd->m_parent ? xywnd->m_parent : MainFrame_getWindow(); + if( !gtk_window_is_active( window ) ) + gtk_window_present( window ); + + if( !xywnd->Active() ){ + g_pParentWnd->SetActiveXY( xywnd ); + } if ( event->direction == GDK_SCROLL_UP ) { xywnd->ZoomInWithMouse( (int)event->x, (int)event->y ); } @@ -821,9 +851,10 @@ gboolean xywnd_expose( ui::Widget widget, GdkEventExpose* event, XYWnd* xywnd ){ } void XYWnd_CameraMoved( XYWnd& xywnd ){ - if ( g_xywindow_globals_private.m_bCamXYUpdate ) { - XYWnd_Update( xywnd ); - } +// if ( g_xywindow_globals_private.m_bCamXYUpdate ) { + //XYWnd_Update( xywnd ); + xywnd.UpdateCameraIcon(); +// } } XYWnd::XYWnd() : @@ -878,7 +909,7 @@ XYWnd::XYWnd() : m_gl_widget.connect( "button_press_event", G_CALLBACK( xywnd_button_press ), this ); m_gl_widget.connect( "button_release_event", G_CALLBACK( xywnd_button_release ), this ); - m_gl_widget.connect( "focus_in_event", G_CALLBACK( xywnd_focus_in ), this ); + m_gl_widget.connect( "focus_in_event", G_CALLBACK( xywnd_focus_in ), this ); //works only in floating views layout m_gl_widget.connect( "motion_notify_event", G_CALLBACK( DeferredMotion::gtk_motion ), &m_deferred_motion ); m_gl_widget.connect( "scroll_event", G_CALLBACK( xywnd_wheel_scroll ), this ); @@ -946,7 +977,7 @@ unsigned int Clipper_buttons(){ } unsigned int Clipper_quick_buttons(){ - return RAD_RBUTTON | RAD_CONTROL; + return RAD_LBUTTON | RAD_CONTROL; } void XYWnd::DropClipPoint( int pointx, int pointy ){ @@ -987,20 +1018,58 @@ void XYWnd::Clipper_OnMouseMoved( int x, int y ){ } } +//#include "gtkutil/image.h" + +/* is called on every mouse move fraction; ain't good! */ void XYWnd::Clipper_Crosshair_OnMouseMoved( int x, int y ){ Vector3 mousePosition; XY_ToPoint( x, y, mousePosition ); +#if 0 // NetRadiantCustom + if ( ClipMode() ) { + if( GlobalClipPoints_Find( mousePosition, (VIEWTYPE)m_viewType, m_fScale ) != 0 ){ + GdkCursor *cursor; + cursor = gdk_cursor_new( GDK_CROSSHAIR ); + //cursor = gdk_cursor_new( GDK_FLEUR ); + gdk_window_set_cursor( gtk_widget_get_window(m_gl_widget), cursor ); + gdk_cursor_unref( cursor ); + } + else{ + GdkCursor *cursor; + cursor = gdk_cursor_new( GDK_HAND2 ); +// GdkPixbuf* pixbuf = pixbuf_new_from_file_with_mask( "bitmaps/icon.png" ); +// cursor = gdk_cursor_new_from_pixbuf( gdk_display_get_default(), pixbuf, 0, 0 ); +// g_object_unref( pixbuf ); + gdk_window_set_cursor( gtk_widget_get_window(m_gl_widget), cursor ); + gdk_cursor_unref( cursor ); + + } + } +#else if ( ClipMode() && GlobalClipPoints_Find( mousePosition, (VIEWTYPE)m_viewType, m_fScale ) != 0 ) { set_cursor ( m_gl_widget, GDK_CROSSHAIR ); } +#endif else { default_cursor( m_gl_widget ); } } +void XYWnd::SetCustomPivotOrigin( int pointx, int pointy ){ + Vector3 point; + XY_ToPoint( pointx, pointy, point ); + VIEWTYPE viewtype = static_cast( 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 ); +// return RAD_CONTROL | ( g_glwindow_globals.m_nMouseType == ETwoButton ? RAD_RBUTTON : RAD_MBUTTON ); + return RAD_CONTROL | RAD_MBUTTON; } void XYWnd_PositionCamera( XYWnd* xywnd, int x, int y, CamWnd& camwnd ){ @@ -1011,16 +1080,17 @@ void XYWnd_PositionCamera( XYWnd* xywnd, int x, int y, CamWnd& camwnd ){ } unsigned int OrientCamera_buttons(){ - if ( g_glwindow_globals.m_nMouseType == ETwoButton ) { - return RAD_RBUTTON | RAD_SHIFT | RAD_CONTROL; - } +// if ( g_glwindow_globals.m_nMouseType == ETwoButton ) { +// return RAD_RBUTTON | RAD_SHIFT | RAD_CONTROL; +// } return RAD_MBUTTON; } void XYWnd_OrientCamera( XYWnd* xywnd, int x, int y, CamWnd& camwnd ){ + //globalOutputStream() << Camera_getAngles( camwnd ) << " b4\n"; Vector3 point = g_vector3_identity; xywnd->XY_ToPoint( x, y, point ); - xywnd->XY_SnapToGrid( point ); + //xywnd->XY_SnapToGrid( point ); vector3_subtract( point, Camera_getOrigin( camwnd ) ); int n1 = ( xywnd->GetViewType() == XY ) ? 1 : 2; @@ -1029,8 +1099,38 @@ void XYWnd_OrientCamera( XYWnd* xywnd, int x, int y, CamWnd& camwnd ){ if ( point[n1] || point[n2] ) { Vector3 angles( Camera_getAngles( camwnd ) ); angles[nAngle] = static_cast( radians_to_degrees( atan2( point[n1], point[n2] ) ) ); + if( angles[CAMERA_YAW] < 0 ) + angles[CAMERA_YAW] = angles[CAMERA_YAW] + 360; + if ( nAngle == CAMERA_PITCH ){ + if( fabs( angles[CAMERA_PITCH] ) > 90 ){ + angles[CAMERA_PITCH] = ( angles[CAMERA_PITCH] > 0 ) ? ( -angles[CAMERA_PITCH] + 180 ) : ( -angles[CAMERA_PITCH] - 180 ); + if( xywnd->GetViewType() == YZ ){ + if( angles[CAMERA_YAW] < 180 ){ + angles[CAMERA_YAW] = 360 - angles[CAMERA_YAW]; + } + } + else if( angles[CAMERA_YAW] < 90 || angles[CAMERA_YAW] > 270 ){ + angles[CAMERA_YAW] = 180 - angles[CAMERA_YAW]; + } + } + else{ + if( xywnd->GetViewType() == YZ ){ + if( angles[CAMERA_YAW] > 180 ){ + angles[CAMERA_YAW] = 360 - angles[CAMERA_YAW]; + } + } + else if( angles[CAMERA_YAW] > 90 && angles[CAMERA_YAW] < 270 ){ + angles[CAMERA_YAW] = 180 - angles[CAMERA_YAW]; + } + } + } Camera_setAngles( camwnd, angles ); } + //globalOutputStream() << Camera_getAngles( camwnd ) << "\n"; +} + +unsigned int SetCustomPivotOrigin_buttons(){ + return RAD_MBUTTON | RAD_SHIFT; } /* @@ -1048,7 +1148,6 @@ void XYWnd::NewBrushDrag_Begin( int x, int y ){ m_nNewBrushPressy = y; m_bNewBrushDrag = true; - GlobalUndoSystem().start(); } void XYWnd::NewBrushDrag_End( int x, int y ){ @@ -1086,6 +1185,7 @@ void XYWnd::NewBrushDrag( int x, int y ){ } if ( m_NewBrushDrag == 0 ) { + GlobalUndoSystem().start(); NodeSmartReference node( GlobalBrushCreator().createBrush() ); Node_getTraversable( Map_FindOrInsertWorldspawn( g_map ) )->insert( node ); @@ -1193,9 +1293,9 @@ void addItem( const char* name, const char* next ){ }; void XYWnd::OnContextMenu(){ - if ( g_xywindow_globals.m_bRightClick == false ) { - return; - } +// if ( g_xywindow_globals.m_bRightClick == false ) { +// return; +// } if ( !m_mnuDrop ) { // first time, load it up auto menu = m_mnuDrop = ui::Menu(ui::New); @@ -1236,7 +1336,9 @@ void XYWnd::Move_Begin(){ void XYWnd::Move_End(){ m_move_started = false; - g_xywnd_freezePointer.unfreeze_pointer( m_gl_widget ); + /* NetRadiant did this instead: + g_xywnd_freezePointer.unfreeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), false ); */ + g_xywnd_freezePointer.unfreeze_pointer( m_gl_widget, false ); g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_move_focusOut ); } @@ -1245,6 +1347,8 @@ unsigned int Zoom_buttons(){ } int g_dragZoom = 0; +int g_zoom2x = 0; +int g_zoom2y = 0; void XYWnd_zoomDelta( int x, int y, unsigned int state, void* data ){ if ( y != 0 ) { @@ -1257,7 +1361,12 @@ void XYWnd_zoomDelta( int x, int y, unsigned int state, void* data ){ } else { - reinterpret_cast( data )->ZoomIn(); + if ( g_xywindow_globals.m_bZoomInToPointer ) { + reinterpret_cast( data )->ZoomInWithMouse( g_zoom2x, g_zoom2y ); + } + else{ + reinterpret_cast( data )->ZoomIn(); + } g_dragZoom += 8; } } @@ -1269,12 +1378,14 @@ gboolean XYWnd_Zoom_focusOut( ui::Widget widget, GdkEventFocus* event, XYWnd* xy return FALSE; } -void XYWnd::Zoom_Begin(){ +void XYWnd::Zoom_Begin( int x, int y ){ if ( m_zoom_started ) { Zoom_End(); } m_zoom_started = true; g_dragZoom = 0; + g_zoom2x = x; + g_zoom2y = y; /* NetRadiantCustom did this instead: g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), m_gl_widget, XYWnd_zoomDelta, this ); */ g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), XYWnd_zoomDelta, this ); @@ -1283,7 +1394,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 ); } @@ -1323,7 +1434,7 @@ void XYWnd::XY_MouseDown( int x, int y, unsigned int buttons ){ EntityCreate_MouseDown( x, y ); } else if ( buttons == Zoom_buttons() ) { - Zoom_Begin(); + Zoom_Begin( x, y ); } else if ( ClipMode() && ( buttons == Clipper_buttons() || buttons == Clipper_quick_buttons() ) ) { Clipper_OnLButtonDown( x, y ); @@ -1344,6 +1455,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,15 +1506,19 @@ void XYWnd::XY_MouseMoved( int x, int y, unsigned int buttons ){ } // control mbutton = move camera - else if ( getButtonState() == MoveCamera_buttons() ) { + else if ( buttons == MoveCamera_buttons() ) { XYWnd_PositionCamera( this, x, y, *g_pParentWnd->GetCamWnd() ); } // mbutton = angle camera - else if ( getButtonState() == OrientCamera_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->onMouseMotion( WindowVector_forInteger( x, y ), modifiers_for_flags( buttons ) ); @@ -1589,8 +1707,14 @@ void XYWnd::XY_DrawAxis( void ){ const int w = ( m_nWidth / 2 / m_fScale ); const int h = ( m_nHeight / 2 / m_fScale ); - const Vector3& colourX = ( m_viewType == YZ ) ? g_xywindow_globals.AxisColorY : g_xywindow_globals.AxisColorX; - const Vector3& colourY = ( m_viewType == XY ) ? g_xywindow_globals.AxisColorY : g_xywindow_globals.AxisColorZ; + Vector3 colourX = ( m_viewType == YZ ) ? g_xywindow_globals.AxisColorY : g_xywindow_globals.AxisColorX; + Vector3 colourY = ( m_viewType == XY ) ? g_xywindow_globals.AxisColorY : g_xywindow_globals.AxisColorZ; + if( !Active() ){ + float grayX = vector3_dot( colourX, Vector3( 0.2989, 0.5870, 0.1140 ) ); + float grayY = vector3_dot( colourY, Vector3( 0.2989, 0.5870, 0.1140 ) ); + colourX[0] = colourX[1] = colourX[2] = grayX; + colourY[0] = colourY[1] = colourY[2] = grayY; + } // draw two lines with corresponding axis colors to highlight current view // horizontal line: nDim1 color @@ -1622,6 +1746,105 @@ void XYWnd::XY_DrawAxis( void ){ } } +void XYWnd::RenderActive( void ){ + if ( glwidget_make_current( m_gl_widget ) != FALSE ) { + if ( Map_Valid( g_map ) && ScreenUpdates_Enabled() ) { + GlobalOpenGL_debugAssertNoErrors(); + glDrawBuffer( GL_FRONT ); + + if ( g_xywindow_globals_private.show_outline ) { + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glOrtho( 0, m_nWidth, 0, m_nHeight, 0, 1 ); + + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + + if( !Active() ){ //sorta erase + glColor3fv( vector3_to_array( g_xywindow_globals.color_gridmajor ) ); + } + // four view mode doesn't colorize + else if ( g_pParentWnd->CurrentStyle() == MainFrame::eSplit ) { + glColor3fv( vector3_to_array( g_xywindow_globals.color_viewname ) ); + } + else + { + switch ( m_viewType ) + { + case YZ: + glColor3fv( vector3_to_array( g_xywindow_globals.AxisColorX ) ); + break; + case XZ: + glColor3fv( vector3_to_array( g_xywindow_globals.AxisColorY ) ); + break; + case XY: + glColor3fv( vector3_to_array( g_xywindow_globals.AxisColorZ ) ); + break; + } + } + glBegin( GL_LINE_LOOP ); + glVertex2f( 0.5, 0.5 ); + glVertex2f( m_nWidth - 0.5, 1 ); + glVertex2f( m_nWidth - 0.5, m_nHeight - 0.5 ); + glVertex2f( 0.5, m_nHeight - 0.5 ); + glEnd(); + } + // we do this part (the old way) only if show_axis is disabled + if ( !g_xywindow_globals_private.show_axis ) { + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glOrtho( 0, m_nWidth, 0, m_nHeight, 0, 1 ); + + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + + if ( Active() ) { + glColor3fv( vector3_to_array( g_xywindow_globals.color_viewname ) ); + } + else{ + glColor4fv( vector4_to_array( Vector4( g_xywindow_globals.color_gridtext, 1.0f ) ) ); + } + + glDisable( GL_BLEND ); + glRasterPos2f( 35, m_nHeight - 20 ); + + GlobalOpenGL().drawString( ViewType_getTitle( m_viewType ) ); + } + else{ + // clear + glViewport( 0, 0, m_nWidth, m_nHeight ); + // set up viewpoint + glMatrixMode( GL_PROJECTION ); + glLoadMatrixf( reinterpret_cast( &m_projection ) ); + + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + glScalef( m_fScale, m_fScale, 1 ); + int nDim1 = ( m_viewType == YZ ) ? 1 : 0; + int nDim2 = ( m_viewType == XY ) ? 1 : 2; + glTranslatef( -m_vOrigin[nDim1], -m_vOrigin[nDim2], 0 ); + + glDisable( GL_LINE_STIPPLE ); + glDisableClientState( GL_TEXTURE_COORD_ARRAY ); + glDisableClientState( GL_NORMAL_ARRAY ); + glDisableClientState( GL_COLOR_ARRAY ); + glDisable( GL_TEXTURE_2D ); + glDisable( GL_LIGHTING ); + glDisable( GL_COLOR_MATERIAL ); + glDisable( GL_DEPTH_TEST ); + glDisable( GL_TEXTURE_1D ); + glDisable( GL_BLEND ); + + XYWnd::XY_DrawAxis(); + } + + glDrawBuffer( GL_BACK ); + GlobalOpenGL_debugAssertNoErrors(); + glwidget_make_current( m_gl_widget ); + } + } +} + void XYWnd::XY_DrawBackground( void ){ glPushAttrib( GL_ALL_ATTRIB_BITS ); @@ -1789,16 +2012,19 @@ void XYWnd::XY_DrawGrid( void ) { GlobalOpenGL().drawString( text ); } + } + // we do this part (the old way) only if show_axis is disabled + if ( !g_xywindow_globals_private.show_axis ) { if ( Active() ) { glColor3fv( vector3_to_array( g_xywindow_globals.color_viewname ) ); } + else{ + glColor4fv( vector4_to_array( Vector4( g_xywindow_globals.color_gridtext, 1.0f ) ) ); + } - // we do this part (the old way) only if show_axis is disabled - if ( !g_xywindow_globals_private.show_axis ) { - glRasterPos2f( m_vOrigin[nDim1] - w + 35 / m_fScale, m_vOrigin[nDim2] + h - 20 / m_fScale ); + glRasterPos2f( m_vOrigin[nDim1] - w + 35 / m_fScale, m_vOrigin[nDim2] + h - 20 / m_fScale ); - GlobalOpenGL().drawString( ViewType_getTitle( m_viewType ) ); - } + GlobalOpenGL().drawString( ViewType_getTitle( m_viewType ) ); } XYWnd::XY_DrawAxis(); @@ -1918,47 +2144,108 @@ void XYWnd::XY_DrawBlockGrid(){ } void XYWnd::DrawCameraIcon( const Vector3& origin, const Vector3& angles ){ - float x, y, fov, box; - double a; - - fov = 48 / m_fScale; - box = 16 / m_fScale; + Cam.fov = 48 / m_fScale; + Cam.box = 16 / m_fScale; +// globalOutputStream() << "pitch " << angles[CAMERA_PITCH] << " yaw " << angles[CAMERA_YAW] << "\n"; if ( m_viewType == XY ) { - x = origin[0]; - y = origin[1]; - a = degrees_to_radians( angles[CAMERA_YAW] ); + Cam.x = origin[0]; + Cam.y = origin[1]; + Cam.a = degrees_to_radians( angles[CAMERA_YAW] ); } else if ( m_viewType == YZ ) { - x = origin[1]; - y = origin[2]; - a = degrees_to_radians( angles[CAMERA_PITCH] ); + Cam.x = origin[1]; + Cam.y = origin[2]; + Cam.a = degrees_to_radians( ( angles[CAMERA_YAW] > 180 ) ? ( 180.0f - angles[CAMERA_PITCH] ) : angles[CAMERA_PITCH] ); } else { - x = origin[0]; - y = origin[2]; - a = degrees_to_radians( angles[CAMERA_PITCH] ); + Cam.x = origin[0]; + Cam.y = origin[2]; + Cam.a = degrees_to_radians( ( angles[CAMERA_YAW] < 270 && angles[CAMERA_YAW] > 90 ) ? ( 180.0f - angles[CAMERA_PITCH] ) : angles[CAMERA_PITCH] ); } - glColor3f( 0.0, 0.0, 1.0 ); + //glColor3f( 0.0, 0.0, 1.0 ); + glColor3f( 1.0, 1.0, 1.0 ); glBegin( GL_LINE_STRIP ); - glVertex3f( x - box,y,0 ); - glVertex3f( x,y + ( box / 2 ),0 ); - glVertex3f( x + box,y,0 ); - glVertex3f( x,y - ( box / 2 ),0 ); - glVertex3f( x - box,y,0 ); - glVertex3f( x + box,y,0 ); + glVertex3f( Cam.x - Cam.box,Cam.y,0 ); + glVertex3f( Cam.x,Cam.y + ( Cam.box / 2 ),0 ); + glVertex3f( Cam.x + Cam.box,Cam.y,0 ); + glVertex3f( Cam.x,Cam.y - ( Cam.box / 2 ),0 ); + glVertex3f( Cam.x - Cam.box,Cam.y,0 ); + glVertex3f( Cam.x + Cam.box,Cam.y,0 ); glEnd(); glBegin( GL_LINE_STRIP ); - glVertex3f( x + static_cast( fov * cos( a + c_pi / 4 ) ), y + static_cast( fov * sin( a + c_pi / 4 ) ), 0 ); - glVertex3f( x, y, 0 ); - glVertex3f( x + static_cast( fov * cos( a - c_pi / 4 ) ), y + static_cast( fov * sin( a - c_pi / 4 ) ), 0 ); + glVertex3f( Cam.x + static_cast( Cam.fov * cos( Cam.a + c_pi / 4 ) ), Cam.y + static_cast( Cam.fov * sin( Cam.a + c_pi / 4 ) ), 0 ); + glVertex3f( Cam.x, Cam.y, 0 ); + glVertex3f( Cam.x + static_cast( Cam.fov * cos( Cam.a - c_pi / 4 ) ), Cam.y + static_cast( Cam.fov * sin( Cam.a - c_pi / 4 ) ), 0 ); glEnd(); } +void XYWnd::UpdateCameraIcon( void ){ + if ( glwidget_make_current( m_gl_widget ) != FALSE ) { + if ( Map_Valid( g_map ) && ScreenUpdates_Enabled() ) { + GlobalOpenGL_debugAssertNoErrors(); + glDrawBuffer( GL_FRONT ); + { + // clear + glViewport( 0, 0, m_nWidth, m_nHeight ); + // set up viewpoint + glMatrixMode( GL_PROJECTION ); + glLoadMatrixf( reinterpret_cast( &m_projection ) ); + + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + glScalef( m_fScale, m_fScale, 1 ); + int nDim1 = ( m_viewType == YZ ) ? 1 : 0; + int nDim2 = ( m_viewType == XY ) ? 1 : 2; + glTranslatef( -m_vOrigin[nDim1], -m_vOrigin[nDim2], 0 ); + + glDisable( GL_LINE_STIPPLE ); + glDisableClientState( GL_TEXTURE_COORD_ARRAY ); + glDisableClientState( GL_NORMAL_ARRAY ); + glDisableClientState( GL_COLOR_ARRAY ); + glDisable( GL_TEXTURE_2D ); + glDisable( GL_LIGHTING ); + glDisable( GL_COLOR_MATERIAL ); + glDisable( GL_DEPTH_TEST ); + glDisable( GL_TEXTURE_1D ); + + glEnable( GL_BLEND ); + glBlendFunc( GL_ONE_MINUS_DST_COLOR, GL_ZERO ); + + //glColor3f( 0.0, 0.0, 1.0 ); + glColor3f( 1.0, 1.0, 1.0 ); + glBegin( GL_LINE_STRIP ); + glVertex3f( Cam.x - Cam.box,Cam.y,0 ); + glVertex3f( Cam.x,Cam.y + ( Cam.box / 2 ),0 ); + glVertex3f( Cam.x + Cam.box,Cam.y,0 ); + glVertex3f( Cam.x,Cam.y - ( Cam.box / 2 ),0 ); + glVertex3f( Cam.x - Cam.box,Cam.y,0 ); + glVertex3f( Cam.x + Cam.box,Cam.y,0 ); + glEnd(); + + glBegin( GL_LINE_STRIP ); + glVertex3f( Cam.x + static_cast( Cam.fov * cos( Cam.a + c_pi / 4 ) ), Cam.y + static_cast( Cam.fov * sin( Cam.a + c_pi / 4 ) ), 0 ); + glVertex3f( Cam.x, Cam.y, 0 ); + glVertex3f( Cam.x + static_cast( Cam.fov * cos( Cam.a - c_pi / 4 ) ), Cam.y + static_cast( Cam.fov * sin( Cam.a - c_pi / 4 ) ), 0 ); + glEnd(); + + XYWnd::DrawCameraIcon( Camera_getOrigin( *g_pParentWnd->GetCamWnd() ), Camera_getAngles( *g_pParentWnd->GetCamWnd() ) ); + + glDisable( GL_BLEND ); + glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); + } + + glDrawBuffer( GL_BACK ); + GlobalOpenGL_debugAssertNoErrors(); + glwidget_make_current( m_gl_widget ); + } + } +} + float Betwixt( float f1, float f2 ){ if ( f1 > f2 ) { @@ -2188,8 +2475,8 @@ void XYWnd::updateProjection( bool reconstruct ){ m_projection[15] = 1.0f; if (reconstruct) { - m_view.Construct( m_projection, m_modelview, m_nWidth, m_nHeight ); - } + m_view.Construct( m_projection, m_modelview, m_nWidth, m_nHeight ); +} } // note: modelview matrix must have a uniform scale, otherwise strange things happen when rendering the rotation manipulator. @@ -2250,7 +2537,7 @@ void XYWnd::updateModelview( bool reconstruct ){ m_modelview[15] = 1; if (reconstruct) { - m_view.Construct( m_projection, m_modelview, m_nWidth, m_nHeight ); + m_view.Construct( m_projection, m_modelview, m_nWidth, m_nHeight ); } } @@ -2397,7 +2684,11 @@ void XYWnd::XY_Draw(){ glScalef( m_fScale, m_fScale, 1 ); glTranslatef( -m_vOrigin[nDim1], -m_vOrigin[nDim2], 0 ); + glEnable( GL_BLEND ); + glBlendFunc( GL_ONE_MINUS_DST_COLOR, GL_ZERO ); DrawCameraIcon( Camera_getOrigin( *g_pParentWnd->GetCamWnd() ), Camera_getAngles( *g_pParentWnd->GetCamWnd() ) ); + glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); + glDisable( GL_BLEND ); Feedback_draw2D( m_viewType ); @@ -2463,7 +2754,7 @@ void XYWnd::OnEntityCreate( const char* item ){ -void GetFocusPosition( Vector3& position ){ +void GetCenterPosition( Vector3& position ){ if ( GlobalSelectionSystem().countSelected() != 0 ) { Select_GetMid( position ); } @@ -2473,15 +2764,15 @@ void GetFocusPosition( Vector3& position ){ } } -void XYWnd_Focus( XYWnd* xywnd ){ +void XYWnd_Centralize( XYWnd* xywnd ){ Vector3 position; - GetFocusPosition( position ); + GetCenterPosition( position ); xywnd->PositionView( position ); } -void XY_Split_Focus(){ +void XY_Split_Centralize(){ Vector3 position; - GetFocusPosition( position ); + GetCenterPosition( position ); if ( g_pParentWnd->GetXYWnd() ) { g_pParentWnd->GetXYWnd()->PositionView( position ); } @@ -2493,66 +2784,87 @@ void XY_Split_Focus(){ } } -void XY_Focus(){ - if ( g_pParentWnd->CurrentStyle() == MainFrame::eSplit ) { - // cannot do this in a split window - // do something else that the user may want here - XY_Split_Focus(); +void XY_Centralize(){ + if ( g_pParentWnd->CurrentStyle() == MainFrame::eSplit || g_pParentWnd->CurrentStyle() == MainFrame::eFloating ) { + // centralize all + XY_Split_Centralize(); return; } XYWnd* xywnd = g_pParentWnd->GetXYWnd(); - XYWnd_Focus( xywnd ); + XYWnd_Centralize( xywnd ); } -void XY_Top(){ - if ( g_pParentWnd->CurrentStyle() == MainFrame::eSplit || g_pParentWnd->CurrentStyle() == MainFrame::eFloating ) { - // cannot do this in a split window - // do something else that the user may want here - XY_Split_Focus(); - return; + + +void GetSelectionBbox( AABB& bounds ){ + if ( GlobalSelectionSystem().countSelected() != 0 ) { + Scene_BoundsSelected( GlobalSceneGraph(), bounds ); + } + else + { + bounds = AABB( Camera_getOrigin( *g_pParentWnd->GetCamWnd() ), Vector3( 128.f, 128.f, 128.f ) ); } +} - XYWnd* xywnd = g_pParentWnd->GetXYWnd(); - xywnd->SetViewType( XY ); - XYWnd_Focus( xywnd ); +void XYWnd_Focus( XYWnd* xywnd ){ + AABB bounds; + GetSelectionBbox( bounds ); + xywnd->FocusOnBounds( bounds ); } -void XY_Side(){ - if ( g_pParentWnd->CurrentStyle() == MainFrame::eSplit || g_pParentWnd->CurrentStyle() == MainFrame::eFloating ) { - // cannot do this in a split window - // do something else that the user may want here - XY_Split_Focus(); - return; +void XY_Split_Focus(){ + AABB bounds; + GetSelectionBbox( bounds ); + if ( g_pParentWnd->GetXYWnd() ) { + g_pParentWnd->GetXYWnd()->FocusOnBounds( bounds ); + } + if ( g_pParentWnd->GetXZWnd() ) { + g_pParentWnd->GetXZWnd()->FocusOnBounds( bounds ); + } + if ( g_pParentWnd->GetYZWnd() ) { + g_pParentWnd->GetYZWnd()->FocusOnBounds( bounds ); } - - XYWnd* xywnd = g_pParentWnd->GetXYWnd(); - xywnd->SetViewType( XZ ); - XYWnd_Focus( xywnd ); } -void XY_Front(){ +void XY_Focus(){ if ( g_pParentWnd->CurrentStyle() == MainFrame::eSplit || g_pParentWnd->CurrentStyle() == MainFrame::eFloating ) { - // cannot do this in a split window - // do something else that the user may want here + // focus all XY_Split_Focus(); return; } XYWnd* xywnd = g_pParentWnd->GetXYWnd(); - xywnd->SetViewType( YZ ); XYWnd_Focus( xywnd ); } -void XY_Next(){ - if ( g_pParentWnd->CurrentStyle() == MainFrame::eSplit || g_pParentWnd->CurrentStyle() == MainFrame::eFloating ) { + + +void XY_TopFrontSide( VIEWTYPE viewtype ){ + if ( g_pParentWnd->CurrentStyle() == MainFrame::eSplit ) { // cannot do this in a split window // do something else that the user may want here - XY_Split_Focus(); + XY_Split_Centralize(); return; } + XYWnd* xywnd = g_pParentWnd->CurrentStyle() == MainFrame::eFloating ? g_pParentWnd->ActiveXY() : g_pParentWnd->GetXYWnd(); + xywnd->SetViewType( viewtype ); + XYWnd_Centralize( xywnd ); +} - XYWnd* xywnd = g_pParentWnd->GetXYWnd(); +void XY_Top(){ + XY_TopFrontSide( XY ); +} + +void XY_Side(){ + XY_TopFrontSide( XZ ); +} + +void XY_Front(){ + XY_TopFrontSide( YZ ); +} + +void XY_NextView( XYWnd* xywnd ){ if ( xywnd->GetViewType() == XY ) { xywnd->SetViewType( XZ ); } @@ -2562,7 +2874,18 @@ void XY_Next(){ else{ xywnd->SetViewType( XY ); } - XYWnd_Focus( xywnd ); + XYWnd_Centralize( xywnd ); +} + +void XY_Next(){ + if ( g_pParentWnd->CurrentStyle() == MainFrame::eSplit ) { + // cannot do this in a split window + // do something else that the user may want here + XY_Split_Centralize(); + return; + } + XYWnd* xywnd = g_pParentWnd->CurrentStyle() == MainFrame::eFloating ? g_pParentWnd->ActiveXY() : g_pParentWnd->GetXYWnd(); + XY_NextView( xywnd ); } void XY_Zoom100(){ @@ -2647,82 +2970,167 @@ void unrealise(){ EntityClassMenu g_EntityClassMenu; - - +// Names void ShowNamesToggle(){ GlobalEntityCreator().setShowNames( !GlobalEntityCreator().getShowNames() ); XY_UpdateAllWindows(); } + typedef FreeCaller ShowNamesToggleCaller; + void ShowNamesExport( const Callback & importer ){ importer( GlobalEntityCreator().getShowNames() ); } + typedef FreeCaller &), ShowNamesExport> ShowNamesExportCaller; +// TargetNames +void ShowTargetNamesToggle(){ + GlobalEntityCreator().setShowTargetNames( !GlobalEntityCreator().getShowTargetNames() ); + XY_UpdateAllWindows(); +} + +typedef FreeCaller ShowTargetNamesToggleCaller; + +void ShowTargetNamesExport( const Callback & importer ){ + importer( GlobalEntityCreator().getShowTargetNames() ); +} + +typedef FreeCaller &), ShowTargetNamesExport> ShowTargetNamesExportCaller; + +// Angles void ShowAnglesToggle(){ GlobalEntityCreator().setShowAngles( !GlobalEntityCreator().getShowAngles() ); XY_UpdateAllWindows(); } + typedef FreeCaller ShowAnglesToggleCaller; + void ShowAnglesExport( const Callback & importer ){ importer( GlobalEntityCreator().getShowAngles() ); } typedef FreeCaller &), ShowAnglesExport> ShowAnglesExportCaller; +// Blocks void ShowBlocksToggle(){ g_xywindow_globals_private.show_blocks ^= 1; XY_UpdateAllWindows(); } + typedef FreeCaller ShowBlocksToggleCaller; + void ShowBlocksExport( const Callback & importer ){ importer( g_xywindow_globals_private.show_blocks ); } + typedef FreeCaller &), ShowBlocksExport> ShowBlocksExportCaller; +// Coordinates void ShowCoordinatesToggle(){ g_xywindow_globals_private.show_coordinates ^= 1; XY_UpdateAllWindows(); } + typedef FreeCaller ShowCoordinatesToggleCaller; + void ShowCoordinatesExport( const Callback & importer ){ importer( g_xywindow_globals_private.show_coordinates ); } + typedef FreeCaller &), ShowCoordinatesExport> ShowCoordinatesExportCaller; +// Outlines void ShowOutlineToggle(){ g_xywindow_globals_private.show_outline ^= 1; XY_UpdateAllWindows(); } + typedef FreeCaller ShowOutlineToggleCaller; + void ShowOutlineExport( const Callback & importer ){ importer( g_xywindow_globals_private.show_outline ); } + typedef FreeCaller &), ShowOutlineExport> ShowOutlineExportCaller; +// Axes void ShowAxesToggle(){ g_xywindow_globals_private.show_axis ^= 1; XY_UpdateAllWindows(); } typedef FreeCaller ShowAxesToggleCaller; + void ShowAxesExport( const Callback & importer ){ importer( g_xywindow_globals_private.show_axis ); } + typedef FreeCaller &), ShowAxesExport> ShowAxesExportCaller; +// Workzone void ShowWorkzoneToggle(){ g_xywindow_globals_private.d_show_work ^= 1; XY_UpdateAllWindows(); } typedef FreeCaller ShowWorkzoneToggleCaller; + void ShowWorkzoneExport( const Callback & importer ){ importer( g_xywindow_globals_private.d_show_work ); } + typedef FreeCaller &), ShowWorkzoneExport> ShowWorkzoneExportCaller; +/* +BoolExportCaller g_texdef_movelock_caller( g_brush_texturelock_enabled ); +ToggleItem g_texdef_movelock_item( g_texdef_movelock_caller ); + +void Texdef_ToggleMoveLock(){ + g_brush_texturelock_enabled = !g_brush_texturelock_enabled; + g_texdef_movelock_item.update(); +} +*/ + +// Size +void ShowSizeToggle(){ + g_xywindow_globals_private.m_bSizePaint = !g_xywindow_globals_private.m_bSizePaint; + XY_UpdateAllWindows(); +} +typedef FreeCaller ShowSizeToggleCaller; +void ShowSizeExport( const Callback & importer ){ + importer( g_xywindow_globals_private.m_bSizePaint ); +} +typedef FreeCaller &), ShowSizeExport> ShowSizeExportCaller; + +// Crosshair +void ShowCrosshairToggle(){ + g_xywindow_globals_private.g_bCrossHairs ^= 1; + XY_UpdateAllWindows(); +} +typedef FreeCaller ShowCrosshairToggleCaller; +void ShowCrosshairExport( const Callback & importer ){ + importer( g_xywindow_globals_private.g_bCrossHairs ); +} +typedef FreeCaller &), ShowCrosshairExport> ShowCrosshairExportCaller; + +// Grid +void ShowGridToggle(){ + g_xywindow_globals_private.d_showgrid = !g_xywindow_globals_private.d_showgrid; + XY_UpdateAllWindows(); +} +typedef FreeCaller ShowGridToggleCaller; +void ShowGridTExport( const Callback & importer ){ + importer( g_xywindow_globals_private.d_showgrid ); +} +typedef FreeCaller &), ShowSizeExport> ShowGridExportCaller; + + ShowNamesExportCaller g_show_names_caller; Callback &)> g_show_names_callback( g_show_names_caller ); ToggleItem g_show_names( g_show_names_callback ); +ShowTargetNamesExportCaller g_show_targetnames_caller; +Callback &)> g_show_targetnames_callback( g_show_targetnames_caller ); +ToggleItem g_show_targetnames( g_show_targetnames_callback ); + ShowAnglesExportCaller g_show_angles_caller; Callback &)> g_show_angles_callback( g_show_angles_caller ); ToggleItem g_show_angles( g_show_angles_callback ); @@ -2747,9 +3155,27 @@ ShowWorkzoneExportCaller g_show_workzone_caller; Callback &)> g_show_workzone_callback( g_show_workzone_caller ); ToggleItem g_show_workzone( g_show_workzone_callback ); +ShowSizeExportCaller g_show_size_caller; +Callback &)> g_show_size_callback( g_show_size_caller ); +ToggleItem g_show_size( g_show_size_callback ); + +ShowCrosshairExportCaller g_show_crosshair_caller; +Callback &)> g_show_crosshair_callback( g_show_crosshair_caller ); +ToggleItem g_show_crosshair( g_show_crosshair_callback ); + +ShowGridExportCaller g_show_grid_caller; +Callback &)> g_show_grid_callback( g_show_grid_caller ); +ToggleItem g_show_grid( g_show_grid_callback ); + + void XYShow_registerCommands(){ + GlobalToggles_insert( "ToggleSizePaint", ShowSizeToggleCaller(), ToggleItem::AddCallbackCaller( g_show_size ), Accelerator( 'J' ) ); + GlobalToggles_insert( "ToggleCrosshairs", ShowCrosshairToggleCaller(), ToggleItem::AddCallbackCaller( g_show_crosshair ), Accelerator( 'X', (GdkModifierType)GDK_SHIFT_MASK ) ); + GlobalToggles_insert( "ToggleGrid", ShowGridToggleCaller(), ToggleItem::AddCallbackCaller( g_show_grid ), Accelerator( '0' ) ); + GlobalToggles_insert( "ShowAngles", ShowAnglesToggleCaller(), ToggleItem::AddCallbackCaller( g_show_angles ) ); GlobalToggles_insert( "ShowNames", ShowNamesToggleCaller(), ToggleItem::AddCallbackCaller( g_show_names ) ); + GlobalToggles_insert( "ShowTargetNames", ShowTargetNamesToggleCaller(), ToggleItem::AddCallbackCaller( g_show_targetnames ) ); GlobalToggles_insert( "ShowBlocks", ShowBlocksToggleCaller(), ToggleItem::AddCallbackCaller( g_show_blocks ) ); GlobalToggles_insert( "ShowCoordinates", ShowCoordinatesToggleCaller(), ToggleItem::AddCallbackCaller( g_show_coordinates ) ); GlobalToggles_insert( "ShowWindowOutline", ShowOutlineToggleCaller(), ToggleItem::AddCallbackCaller( g_show_outline ) ); @@ -2765,10 +3191,11 @@ void XYWnd_registerShortcuts(){ void Orthographic_constructPreferences( PreferencesPage& page ){ - page.appendCheckBox( "", "Solid selection boxes", g_xywindow_globals.m_bNoStipple ); - page.appendCheckBox( "", "Display size info", g_xywindow_globals_private.m_bSizePaint ); + page.appendCheckBox( "", "Solid selection boxes ( no stipple )", g_xywindow_globals.m_bNoStipple ); + //page.appendCheckBox( "", "Display size info", g_xywindow_globals_private.m_bSizePaint ); page.appendCheckBox( "", "Chase mouse during drags", g_xywindow_globals_private.m_bChaseMouse ); - page.appendCheckBox( "", "Update views on camera move", g_xywindow_globals_private.m_bCamXYUpdate ); +// page.appendCheckBox( "", "Update views on camera move", g_xywindow_globals_private.m_bCamXYUpdate ); + page.appendCheckBox( "", "Zoom In to Mouse pointer", g_xywindow_globals.m_bZoomInToPointer ); } void Orthographic_constructPage( PreferenceGroup& group ){ PreferencesPage page( group.createPage( "Orthographic", "Orthographic View Preferences" ) ); @@ -2806,9 +3233,9 @@ struct ToggleShown_Bool { void XYWindow_Construct(){ - GlobalCommands_insert( "ToggleCrosshairs", makeCallbackF(ToggleShowCrosshair), Accelerator( 'X', (GdkModifierType)GDK_SHIFT_MASK ) ); - GlobalCommands_insert( "ToggleSizePaint", makeCallbackF(ToggleShowSizeInfo), Accelerator( 'J' ) ); - GlobalCommands_insert( "ToggleGrid", makeCallbackF(ToggleShowGrid), Accelerator( '0' ) ); +// GlobalCommands_insert( "ToggleCrosshairs", makeCallbackF(ToggleShowCrosshair), Accelerator( 'X', (GdkModifierType)GDK_SHIFT_MASK ) ); +// GlobalCommands_insert( "ToggleSizePaint", makeCallbackF(ToggleShowSizeInfo), Accelerator( 'J' ) ); +// GlobalCommands_insert( "ToggleGrid", makeCallbackF(ToggleShowGrid), Accelerator( '0' ) ); GlobalToggles_insert( "ToggleView", ToggleShown::ToggleCaller( g_xy_top_shown ), ToggleItem::AddCallbackCaller( g_xy_top_shown.m_item ), Accelerator( 'V', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); GlobalToggles_insert( "ToggleSideView", ToggleShown::ToggleCaller( g_yz_side_shown ), ToggleItem::AddCallbackCaller( g_yz_side_shown.m_item ) ); @@ -2820,12 +3247,13 @@ void XYWindow_Construct(){ GlobalCommands_insert( "ViewSide", makeCallbackF(XY_Side), Accelerator( GDK_KEY_KP_Page_Down ) ); GlobalCommands_insert( "ViewFront", makeCallbackF(XY_Front), Accelerator( GDK_KEY_KP_End ) ); GlobalCommands_insert( "Zoom100", makeCallbackF(XY_Zoom100) ); - GlobalCommands_insert( "CenterXYView", makeCallbackF(XY_Focus), Accelerator( GDK_KEY_Tab, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); + GlobalCommands_insert( "CenterXYView", makeCallbackF(XY_Centralize), Accelerator( GDK_KEY_Tab, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); + GlobalCommands_insert( "XYFocusOnSelected", makeCallbackF(XY_Focus), Accelerator( GDK_KEY_grave ) ); GlobalPreferenceSystem().registerPreference( "ClipCaulk", make_property_string( g_clip_useCaulk ) ); - GlobalPreferenceSystem().registerPreference( "NewRightClick", make_property_string( g_xywindow_globals.m_bRightClick ) ); - GlobalPreferenceSystem().registerPreference( "ImprovedWheelZoom", make_property_string( g_xywindow_globals.m_bImprovedWheelZoom ) ); +// GlobalPreferenceSystem().registerPreference( "NewRightClick", make_property_string( g_xywindow_globals.m_bRightClick ) ); + GlobalPreferenceSystem().registerPreference( "2DZoomInToPointer", make_property_string( g_xywindow_globals.m_bZoomInToPointer ) ); GlobalPreferenceSystem().registerPreference( "ChaseMouse", make_property_string( g_xywindow_globals_private.m_bChaseMouse ) ); GlobalPreferenceSystem().registerPreference( "SizePainting", make_property_string( g_xywindow_globals_private.m_bSizePaint ) ); GlobalPreferenceSystem().registerPreference( "ShowCrosshair", make_property_string( g_xywindow_globals_private.g_bCrossHairs ) ); @@ -2833,7 +3261,7 @@ void XYWindow_Construct(){ GlobalPreferenceSystem().registerPreference( "SI_ShowCoords", make_property_string( g_xywindow_globals_private.show_coordinates ) ); GlobalPreferenceSystem().registerPreference( "SI_ShowOutlines", make_property_string( g_xywindow_globals_private.show_outline ) ); GlobalPreferenceSystem().registerPreference( "SI_ShowAxis", make_property_string( g_xywindow_globals_private.show_axis ) ); - GlobalPreferenceSystem().registerPreference( "CamXYUpdate", make_property_string( g_xywindow_globals_private.m_bCamXYUpdate ) ); +// GlobalPreferenceSystem().registerPreference( "CamXYUpdate", make_property_string( g_xywindow_globals_private.m_bCamXYUpdate ) ); GlobalPreferenceSystem().registerPreference( "ShowWorkzone", make_property_string( g_xywindow_globals_private.d_show_work ) ); GlobalPreferenceSystem().registerPreference( "SI_AxisColors0", make_property_string( g_xywindow_globals.AxisColorX ) ); @@ -2845,7 +3273,9 @@ void XYWindow_Construct(){ GlobalPreferenceSystem().registerPreference( "SI_Colors6", make_property_string( g_xywindow_globals.color_gridblock ) ); GlobalPreferenceSystem().registerPreference( "SI_Colors7", make_property_string( g_xywindow_globals.color_gridtext ) ); GlobalPreferenceSystem().registerPreference( "SI_Colors8", make_property_string( g_xywindow_globals.color_brushes ) ); - GlobalPreferenceSystem().registerPreference( "SI_Colors14", make_property_string( g_xywindow_globals.color_gridmajor_alt ) ); + GlobalPreferenceSystem().registerPreference( "SI_Colors9", make_property_string( g_xywindow_globals.color_viewname ) ); + GlobalPreferenceSystem().registerPreference( "SI_Colors10", make_property_string( g_xywindow_globals.color_clipper ) ); + GlobalPreferenceSystem().registerPreference( "SI_Colors11", make_property_string( g_xywindow_globals.color_selbrushes ) ); GlobalPreferenceSystem().registerPreference( "XZVIS", make_property_string( g_xz_front_shown ) );