X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=radiant%2Fxywindow.cpp;h=e5128ae7db609b38335d9229f684897437c64a64;hb=2f3014d79f98abd19b003327ed7852e8246e0a1e;hp=35d491701aa9a318ee3cfa822aa852a02b302f81;hpb=80bb5fdd23e124b4c4da8509634d95d1459e6a3b;p=xonotic%2Fnetradiant.git diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index 35d49170..e5128ae7 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -113,6 +113,7 @@ void Draw( const char *label, float scale ); VIEWTYPE g_clip_viewtype; bool g_bSwitch = true; bool g_clip_useCaulk = false; +bool g_quick_clipper = false; ClipPoint g_Clip1; ClipPoint g_Clip2; ClipPoint g_Clip3; @@ -261,6 +262,10 @@ void Clip(){ g_Clip3.Reset(); Clip_Update(); ClipperChangeNotify(); + if( g_quick_clipper ){ + g_quick_clipper = false; + ClipperMode(); + } } } @@ -275,6 +280,10 @@ void SplitClip(){ g_Clip3.Reset(); Clip_Update(); ClipperChangeNotify(); + if( g_quick_clipper ){ + g_quick_clipper = false; + ClipperMode(); + } } } @@ -349,11 +358,13 @@ struct xywindow_globals_private_t bool m_bChaseMouse; bool m_bSizePaint; + bool g_bCrossHairs; + xywindow_globals_private_t() : d_showgrid( true ), show_names( false ), - show_coordinates( true ), + show_coordinates( false ), show_angles( true ), show_outline( false ), show_axis( true ), @@ -364,7 +375,9 @@ struct xywindow_globals_private_t m_bCamXYUpdate( true ), m_bChaseMouse( true ), - m_bSizePaint( true ){ + m_bSizePaint( true ), + + g_bCrossHairs( false ){ } }; @@ -497,17 +510,17 @@ void XYWnd::SetScale( float f ){ XYWnd_Update( *this ); } -void XYWnd_ZoomIn( XYWnd* xy ){ +void XYWnd::ZoomIn(){ float max_scale = 64; - float scale = xy->Scale() * 5.0f / 4.0f; + float scale = Scale() * 5.0f / 4.0f; if ( scale > max_scale ) { - if ( xy->Scale() != max_scale ) { - xy->SetScale( max_scale ); + if ( Scale() != max_scale ) { + SetScale( max_scale ); } } else { - xy->SetScale( scale ); + SetScale( scale ); } } @@ -515,17 +528,31 @@ void XYWnd_ZoomIn( XYWnd* xy ){ // NOTE: the zoom out factor is 4/5, we could think about customizing it // we don't go below a zoom factor corresponding to 10% of the max world size // (this has to be computed against the window size) -void XYWnd_ZoomOut( XYWnd* xy ){ - float min_scale = MIN( xy->Width(),xy->Height() ) / ( 1.1f * ( g_MaxWorldCoord - g_MinWorldCoord ) ); - float scale = xy->Scale() * 4.0f / 5.0f; +void XYWnd::ZoomOut(){ + float min_scale = MIN( Width(), Height() ) / ( 1.1f * ( g_MaxWorldCoord - g_MinWorldCoord ) ); + float scale = Scale() * 4.0f / 5.0f; if ( scale < min_scale ) { - if ( xy->Scale() != min_scale ) { - xy->SetScale( min_scale ); + if ( Scale() != min_scale ) { + SetScale( min_scale ); } } else { - xy->SetScale( scale ); + SetScale( scale ); + } +} + +void XYWnd::ZoomInWithMouse( int pointx, int pointy ){ + float old_scale = Scale(); + ZoomIn(); + if ( g_xywindow_globals.m_bImprovedWheelZoom ) { + float scale_diff = 1.0 / old_scale - 1.0 / Scale(); + int nDim1 = ( m_viewType == YZ ) ? 1 : 0; + int nDim2 = ( m_viewType == XY ) ? 1 : 2; + Vector3 origin = GetOrigin(); + origin[nDim1] += scale_diff * (pointx - 0.5 * Width()); + origin[nDim2] -= scale_diff * (pointy - 0.5 * Height()); + SetOrigin( origin ); } } @@ -551,8 +578,6 @@ VIEWTYPE GlobalXYWnd_getCurrentViewType(){ // ============================================================================= // variables -bool g_bCrossHairs = false; - ui::Menu XYWnd::m_mnuDrop(ui::null); // this is disabled, and broken @@ -723,13 +748,24 @@ Shader* XYWnd::m_state_selected = 0; void xy_update_xor_rectangle( XYWnd& self, rect_t area ){ if ( self.GetWidget().visible() ) { - self.m_XORRectangle.set( rectangle_from_area( area.min, area.max, self.Width(), self.Height() ) ); + 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]; + 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 ); + if( !xywnd->Active() ){ + g_pParentWnd->SetActiveXY( xywnd ); + } xywnd->ButtonState_onMouseDown( buttons_for_event_button( event ) ); @@ -750,7 +786,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; @@ -764,11 +802,14 @@ void xywnd_motion( gdouble x, gdouble y, guint state, void* data ){ } gboolean xywnd_wheel_scroll( ui::Widget widget, GdkEventScroll* event, XYWnd* xywnd ){ + if( !xywnd->Active() ){ + g_pParentWnd->SetActiveXY( xywnd ); + } if ( event->direction == GDK_SCROLL_UP ) { - XYWnd_ZoomIn( xywnd ); + xywnd->ZoomInWithMouse( (int)event->x, (int)event->y ); } else if ( event->direction == GDK_SCROLL_DOWN ) { - XYWnd_ZoomOut( xywnd ); + xywnd->ZoomOut(); } return FALSE; } @@ -799,7 +840,7 @@ XYWnd::XYWnd() : m_parent( ui::null ), m_window_observer( NewWindowObserver() ), m_XORRectangle( m_gl_widget ), - m_chasemouse_handler( 0 ) { + m_chasemouse_handler( 0 ){ m_bActive = false; m_buttonstate = 0; @@ -844,7 +885,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 ); @@ -911,6 +952,10 @@ unsigned int Clipper_buttons(){ return RAD_LBUTTON; } +unsigned int Clipper_quick_buttons(){ + return RAD_LBUTTON | RAD_CONTROL; +} + void XYWnd::DropClipPoint( int pointx, int pointy ){ Vector3 point; @@ -961,6 +1006,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( 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 ); } @@ -995,6 +1052,10 @@ void XYWnd_OrientCamera( XYWnd* xywnd, int x, int y, CamWnd& camwnd ){ } } +unsigned int SetCustomPivotOrigin_buttons(){ + return RAD_MBUTTON | RAD_SHIFT; +} + /* ============== NewBrushDrag @@ -1074,8 +1135,8 @@ void entitycreate_activated( ui::Widget item ){ g_pParentWnd->ActiveXY()->OnEntityCreate( entity_name ); } else { - GlobalRadiant().m_pfnMessageBox( MainFrame_getWindow(), "There's already a worldspawn in your map!" - "", + GlobalRadiant().m_pfnMessageBox( MainFrame_getWindow(), + "There's already a worldspawn in your map!", "Info", eMB_OK, eMB_ICONDEFAULT ); @@ -1190,18 +1251,22 @@ void XYWnd::Move_Begin(){ Move_End(); } m_move_started = true; + /* NetRadiantCustom did this instead: + g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), m_gl_widget, XYWnd_moveDelta, this ); */ g_xywnd_freezePointer.freeze_pointer( m_gl_widget, XYWnd_moveDelta, this ); m_move_focusOut = m_gl_widget.connect( "focus_out_event", G_CALLBACK( XYWnd_Move_focusOut ), this ); } 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 ); } unsigned int Zoom_buttons(){ - return RAD_RBUTTON | RAD_SHIFT; + return RAD_RBUTTON | RAD_ALT; } int g_dragZoom = 0; @@ -1209,16 +1274,15 @@ int g_dragZoom = 0; void XYWnd_zoomDelta( int x, int y, unsigned int state, void* data ){ if ( y != 0 ) { g_dragZoom += y; - while ( abs( g_dragZoom ) > 8 ) { if ( g_dragZoom > 0 ) { - XYWnd_ZoomOut( reinterpret_cast( data ) ); + reinterpret_cast( data )->ZoomOut(); g_dragZoom -= 8; } else { - XYWnd_ZoomIn( reinterpret_cast( data ) ); + reinterpret_cast( data )->ZoomIn(); g_dragZoom += 8; } } @@ -1236,13 +1300,15 @@ void XYWnd::Zoom_Begin(){ } m_zoom_started = true; g_dragZoom = 0; + /* 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 ); m_zoom_focusOut = m_gl_widget.connect( "focus_out_event", G_CALLBACK( XYWnd_Zoom_focusOut ), this ); } 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 ); } @@ -1284,7 +1350,12 @@ void XYWnd::XY_MouseDown( int x, int y, unsigned int buttons ){ else if ( buttons == Zoom_buttons() ) { Zoom_Begin(); } - else if ( ClipMode() && buttons == Clipper_buttons() ) { + else if ( ClipMode() && ( buttons == Clipper_buttons() || buttons == Clipper_quick_buttons() ) ) { + Clipper_OnLButtonDown( x, y ); + } + else if ( !ClipMode() && buttons == Clipper_quick_buttons() ) { + ClipperMode(); + g_quick_clipper = true; Clipper_OnLButtonDown( x, y ); } else if ( buttons == NewBrushDrag_buttons() && GlobalSelectionSystem().countSelected() == 0 ) { @@ -1298,6 +1369,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 ) ); @@ -1312,12 +1386,16 @@ void XYWnd::XY_MouseUp( int x, int y, unsigned int buttons ){ else if ( m_zoom_started ) { Zoom_End(); } - else if ( ClipMode() && buttons == Clipper_buttons() ) { + else if ( ClipMode() && ( buttons == Clipper_buttons() || buttons == Clipper_quick_buttons() ) ) { Clipper_OnLButtonUp( x, y ); } else if ( m_bNewBrushDrag ) { m_bNewBrushDrag = false; NewBrushDrag_End( x, y ); + if ( m_NewBrushDrag == 0 ) { + //L button w/o created brush = tunnel selection + m_window_observer->onMouseUp( WindowVector_forInteger( x, y ), button_for_flags( buttons ), modifiers_for_flags( buttons ) ); + } } else { @@ -1351,6 +1429,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 ) ); @@ -1365,7 +1447,7 @@ void XYWnd::XY_MouseMoved( int x, int y, unsigned int buttons ){ << " z:: " << FloatFormat( m_mousePosition[2], 6, 1 ); g_pParentWnd->SetStatusText( g_pParentWnd->m_position_status, status.c_str() ); - if ( g_bCrossHairs ) { + if ( g_xywindow_globals_private.g_bCrossHairs ) { XYWnd_Update( *this ); } @@ -1539,8 +1621,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 @@ -1572,6 +1660,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 ); @@ -1739,16 +1926,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(); @@ -2138,8 +2328,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. @@ -2200,7 +2390,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 ); } } @@ -2311,7 +2501,7 @@ void XYWnd::XY_Draw(){ PaintSizeInfo( nDim1, nDim2, min, max ); } - if ( g_bCrossHairs ) { + if ( g_xywindow_globals_private.g_bCrossHairs ) { glColor4f( 0.2f, 0.9f, 0.2f, 0.8f ); glBegin( GL_LINES ); if ( m_viewType == XY ) { @@ -2528,20 +2718,20 @@ void XY_Zoom100(){ } void XY_ZoomIn(){ - XYWnd_ZoomIn( g_pParentWnd->ActiveXY() ); + g_pParentWnd->ActiveXY()->ZoomIn(); } // NOTE: the zoom out factor is 4/5, we could think about customizing it // we don't go below a zoom factor corresponding to 10% of the max world size // (this has to be computed against the window size) void XY_ZoomOut(){ - XYWnd_ZoomOut( g_pParentWnd->ActiveXY() ); + g_pParentWnd->ActiveXY()->ZoomOut(); } void ToggleShowCrosshair(){ - g_bCrossHairs ^= 1; + g_xywindow_globals_private.g_bCrossHairs ^= 1; XY_UpdateAllWindows(); } @@ -2598,77 +2788,145 @@ 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; +// 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 ); @@ -2697,7 +2955,24 @@ 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( "ShowBlocks", ShowBlocksToggleCaller(), ToggleItem::AddCallbackCaller( g_show_blocks ) ); @@ -2715,8 +2990,8 @@ 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 ); } @@ -2756,9 +3031,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 ) ); @@ -2775,8 +3050,10 @@ void XYWindow_Construct(){ 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( "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 ) ); GlobalPreferenceSystem().registerPreference( "NoStipple", make_property_string( g_xywindow_globals.m_bNoStipple ) ); 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 ) ); @@ -2793,7 +3070,11 @@ 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 ) );