From: Thomas Debesse Date: Tue, 23 Feb 2021 02:16:31 +0000 (+0100) Subject: Merge commit 'c92c662abbbbc7ed93f628ad0e0f25e996ab686c' into garux-merge X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e36a9e0f374477a0a4c778d06454a979cd53fc47;p=xonotic%2Fnetradiant.git Merge commit 'c92c662abbbbc7ed93f628ad0e0f25e996ab686c' into garux-merge --- e36a9e0f374477a0a4c778d06454a979cd53fc47 diff --cc libs/gtkutil/accelerator.cpp index a17931de,596c1878..b5aa9531 --- a/libs/gtkutil/accelerator.cpp +++ b/libs/gtkutil/accelerator.cpp @@@ -496,18 -517,18 +496,18 @@@ static gboolean override_global_acceler return b; } -void global_accel_connect_window( GtkWindow* window ){ +void global_accel_connect_window( ui::Window window ){ #if 1 - unsigned int override_handler = g_signal_connect( G_OBJECT( window ), "key_press_event", G_CALLBACK( override_global_accelerators ), 0 ); + unsigned int override_handler = window.connect( "key_press_event", G_CALLBACK( override_global_accelerators ), 0 ); g_object_set_data( G_OBJECT( window ), "override_handler", gint_to_pointer( override_handler ) ); + GlobalPressedKeys_connect( window ); + - unsigned int special_key_press_handler = g_signal_connect( G_OBJECT( window ), "key_press_event", G_CALLBACK( accelerator_key_event ), &g_special_accelerators ); + unsigned int special_key_press_handler = window.connect( "key_press_event", G_CALLBACK( accelerator_key_event ), &g_special_accelerators ); g_object_set_data( G_OBJECT( window ), "special_key_press_handler", gint_to_pointer( special_key_press_handler ) ); - - GlobalPressedKeys_connect( window ); #else - unsigned int key_press_handler = g_signal_connect( G_OBJECT( window ), "key_press_event", G_CALLBACK( accelerator_key_event ), &g_keydown_accelerators ); - unsigned int key_release_handler = g_signal_connect( G_OBJECT( window ), "key_release_event", G_CALLBACK( accelerator_key_event ), &g_keyup_accelerators ); + unsigned int key_press_handler = window.connect( "key_press_event", G_CALLBACK( accelerator_key_event ), &g_keydown_accelerators ); + unsigned int key_release_handler = window.connect( "key_release_event", G_CALLBACK( accelerator_key_event ), &g_keyup_accelerators ); g_object_set_data( G_OBJECT( window ), "key_press_handler", gint_to_pointer( key_press_handler ) ); g_object_set_data( G_OBJECT( window ), "key_release_handler", gint_to_pointer( key_release_handler ) ); #endif diff --cc radiant/camwindow.cpp index 41024bbe,a5ac5885..a6134f5f --- a/radiant/camwindow.cpp +++ b/radiant/camwindow.cpp @@@ -513,26 -525,34 +519,34 @@@ void Camera_PitchDown_KeyUp( camera_t& Camera_clearMovementFlags( camera, MOVE_PITCHDOWN ); } + void Camera_Focus_KeyDown( camera_t& camera ){ + Camera_setMovementFlags( camera, MOVE_FOCUS ); + } + void Camera_Focus_KeyUp( camera_t& camera ){ + Camera_clearMovementFlags( camera, MOVE_FOCUS ); + } -typedef ReferenceCaller FreeMoveCameraMoveForwardKeyDownCaller; -typedef ReferenceCaller FreeMoveCameraMoveForwardKeyUpCaller; -typedef ReferenceCaller FreeMoveCameraMoveBackKeyDownCaller; -typedef ReferenceCaller FreeMoveCameraMoveBackKeyUpCaller; -typedef ReferenceCaller FreeMoveCameraMoveLeftKeyDownCaller; -typedef ReferenceCaller FreeMoveCameraMoveLeftKeyUpCaller; -typedef ReferenceCaller FreeMoveCameraMoveRightKeyDownCaller; -typedef ReferenceCaller FreeMoveCameraMoveRightKeyUpCaller; -typedef ReferenceCaller FreeMoveCameraMoveUpKeyDownCaller; -typedef ReferenceCaller FreeMoveCameraMoveUpKeyUpCaller; -typedef ReferenceCaller FreeMoveCameraMoveDownKeyDownCaller; -typedef ReferenceCaller FreeMoveCameraMoveDownKeyUpCaller; - -typedef ReferenceCaller FreeMoveCameraFocusKeyDownCaller; -typedef ReferenceCaller FreeMoveCameraFocusKeyUpCaller; - -#define SPEED_MOVE 32 -#define SPEED_TURN 22.5 -#define MIN_CAM_SPEED 10 -#define MAX_CAM_SPEED 610 -#define CAM_SPEED_STEP 50 +typedef ReferenceCaller FreeMoveCameraMoveForwardKeyDownCaller; +typedef ReferenceCaller FreeMoveCameraMoveForwardKeyUpCaller; +typedef ReferenceCaller FreeMoveCameraMoveBackKeyDownCaller; +typedef ReferenceCaller FreeMoveCameraMoveBackKeyUpCaller; +typedef ReferenceCaller FreeMoveCameraMoveLeftKeyDownCaller; +typedef ReferenceCaller FreeMoveCameraMoveLeftKeyUpCaller; +typedef ReferenceCaller FreeMoveCameraMoveRightKeyDownCaller; +typedef ReferenceCaller FreeMoveCameraMoveRightKeyUpCaller; +typedef ReferenceCaller FreeMoveCameraMoveUpKeyDownCaller; +typedef ReferenceCaller FreeMoveCameraMoveUpKeyUpCaller; +typedef ReferenceCaller FreeMoveCameraMoveDownKeyDownCaller; +typedef ReferenceCaller FreeMoveCameraMoveDownKeyUpCaller; + ++typedef ReferenceCaller FreeMoveCameraFocusKeyDownCaller; ++typedef ReferenceCaller FreeMoveCameraFocusKeyUpCaller; + +const float SPEED_MOVE = 32; +const float SPEED_TURN = 22.5; +const float MIN_CAM_SPEED = 10; +const float MAX_CAM_SPEED = 610; +const float CAM_SPEED_STEP = 50; void Camera_MoveForward_Discrete( camera_t& camera ){ Camera_Move_updateAxes( camera ); @@@ -1036,17 -1054,22 +1050,22 @@@ void CamWnd_registerCommands( CamWnd& c FreeMoveCameraMoveDownKeyUpCaller( camwnd.getCamera() ) ); + GlobalKeyEvents_insert( "CameraFreeFocus", accelerator_null(), + FreeMoveCameraFocusKeyDownCaller( camwnd.getCamera() ), + FreeMoveCameraFocusKeyUpCaller( camwnd.getCamera() ) + ); + - GlobalCommands_insert( "CameraForward", ReferenceCaller( camwnd.getCamera() ) ); - GlobalCommands_insert( "CameraBack", ReferenceCaller( camwnd.getCamera() ) ); - GlobalCommands_insert( "CameraLeft", ReferenceCaller( camwnd.getCamera() ) ); - GlobalCommands_insert( "CameraRight", ReferenceCaller( camwnd.getCamera() ) ); - GlobalCommands_insert( "CameraStrafeRight", ReferenceCaller( camwnd.getCamera() ) ); - GlobalCommands_insert( "CameraStrafeLeft", ReferenceCaller( camwnd.getCamera() ) ); + GlobalCommands_insert( "CameraForward", ReferenceCaller( camwnd.getCamera() ) ); + GlobalCommands_insert( "CameraBack", ReferenceCaller( camwnd.getCamera() ) ); + GlobalCommands_insert( "CameraLeft", ReferenceCaller( camwnd.getCamera() ) ); + GlobalCommands_insert( "CameraRight", ReferenceCaller( camwnd.getCamera() ) ); + GlobalCommands_insert( "CameraStrafeRight", ReferenceCaller( camwnd.getCamera() ) ); + GlobalCommands_insert( "CameraStrafeLeft", ReferenceCaller( camwnd.getCamera() ) ); - GlobalCommands_insert( "CameraUp", ReferenceCaller( camwnd.getCamera() ) ); - GlobalCommands_insert( "CameraDown", ReferenceCaller( camwnd.getCamera() ) ); - GlobalCommands_insert( "CameraAngleUp", ReferenceCaller( camwnd.getCamera() ) ); - GlobalCommands_insert( "CameraAngleDown", ReferenceCaller( camwnd.getCamera() ) ); + GlobalCommands_insert( "CameraUp", ReferenceCaller( camwnd.getCamera() ) ); + GlobalCommands_insert( "CameraDown", ReferenceCaller( camwnd.getCamera() ) ); + GlobalCommands_insert( "CameraAngleUp", ReferenceCaller( camwnd.getCamera() ) ); + GlobalCommands_insert( "CameraAngleDown", ReferenceCaller( camwnd.getCamera() ) ); } void CamWnd_Move_Enable( CamWnd& camwnd ){ @@@ -2055,21 -2072,23 +2074,23 @@@ void CamWnd_Construct() GlobalShortcuts_insert( "CameraFreeMoveUp", accelerator_null() ); GlobalShortcuts_insert( "CameraFreeMoveDown", accelerator_null() ); + GlobalShortcuts_insert( "CameraFreeFocus", Accelerator( GDK_Tab ) ); + - GlobalToggles_insert( "ShowStats", FreeCaller(), ToggleItem::AddCallbackCaller( g_show_stats ) ); - - GlobalPreferenceSystem().registerPreference( "ShowStats", BoolImportStringCaller( g_camwindow_globals_private.m_showStats ), BoolExportStringCaller( g_camwindow_globals_private.m_showStats ) ); - GlobalPreferenceSystem().registerPreference( "MoveSpeed", IntImportStringCaller( g_camwindow_globals_private.m_nMoveSpeed ), IntExportStringCaller( g_camwindow_globals_private.m_nMoveSpeed ) ); - GlobalPreferenceSystem().registerPreference( "CamLinkSpeed", BoolImportStringCaller( g_camwindow_globals_private.m_bCamLinkSpeed ), BoolExportStringCaller( g_camwindow_globals_private.m_bCamLinkSpeed ) ); - GlobalPreferenceSystem().registerPreference( "AngleSpeed", IntImportStringCaller( g_camwindow_globals_private.m_nAngleSpeed ), IntExportStringCaller( g_camwindow_globals_private.m_nAngleSpeed ) ); - GlobalPreferenceSystem().registerPreference( "CamInverseMouse", BoolImportStringCaller( g_camwindow_globals_private.m_bCamInverseMouse ), BoolExportStringCaller( g_camwindow_globals_private.m_bCamInverseMouse ) ); - GlobalPreferenceSystem().registerPreference( "CamDiscrete", makeBoolStringImportCallback( CamWndMoveDiscreteImportCaller() ), BoolExportStringCaller( g_camwindow_globals_private.m_bCamDiscrete ) ); - GlobalPreferenceSystem().registerPreference( "CubicClipping", BoolImportStringCaller( g_camwindow_globals_private.m_bCubicClipping ), BoolExportStringCaller( g_camwindow_globals_private.m_bCubicClipping ) ); - GlobalPreferenceSystem().registerPreference( "CubicScale", IntImportStringCaller( g_camwindow_globals.m_nCubicScale ), IntExportStringCaller( g_camwindow_globals.m_nCubicScale ) ); - GlobalPreferenceSystem().registerPreference( "SI_Colors4", Vector3ImportStringCaller( g_camwindow_globals.color_cameraback ), Vector3ExportStringCaller( g_camwindow_globals.color_cameraback ) ); - GlobalPreferenceSystem().registerPreference( "SI_Colors12", Vector3ImportStringCaller( g_camwindow_globals.color_selbrushes3d ), Vector3ExportStringCaller( g_camwindow_globals.color_selbrushes3d ) ); - GlobalPreferenceSystem().registerPreference( "CameraRenderMode", makeIntStringImportCallback( RenderModeImportCaller() ), makeIntStringExportCallback( RenderModeExportCaller() ) ); - GlobalPreferenceSystem().registerPreference( "StrafeMode", IntImportStringCaller( g_camwindow_globals_private.m_nStrafeMode ), IntExportStringCaller( g_camwindow_globals_private.m_nStrafeMode ) ); - GlobalPreferenceSystem().registerPreference( "3DZoomInToPointer", BoolImportStringCaller( g_camwindow_globals.m_bZoomInToPointer ), BoolExportStringCaller( g_camwindow_globals.m_bZoomInToPointer ) ); + GlobalToggles_insert( "ShowStats", makeCallbackF(ShowStatsToggle), ToggleItem::AddCallbackCaller( g_show_stats ) ); + + GlobalPreferenceSystem().registerPreference( "ShowStats", make_property_string( g_camwindow_globals_private.m_showStats ) ); + GlobalPreferenceSystem().registerPreference( "MoveSpeed", make_property_string( g_camwindow_globals_private.m_nMoveSpeed ) ); + GlobalPreferenceSystem().registerPreference( "CamLinkSpeed", make_property_string( g_camwindow_globals_private.m_bCamLinkSpeed ) ); + GlobalPreferenceSystem().registerPreference( "AngleSpeed", make_property_string( g_camwindow_globals_private.m_nAngleSpeed ) ); + GlobalPreferenceSystem().registerPreference( "CamInverseMouse", make_property_string( g_camwindow_globals_private.m_bCamInverseMouse ) ); + GlobalPreferenceSystem().registerPreference( "CamDiscrete", make_property_string()); + GlobalPreferenceSystem().registerPreference( "CubicClipping", make_property_string( g_camwindow_globals_private.m_bCubicClipping ) ); + GlobalPreferenceSystem().registerPreference( "CubicScale", make_property_string( g_camwindow_globals.m_nCubicScale ) ); + GlobalPreferenceSystem().registerPreference( "SI_Colors4", make_property_string( g_camwindow_globals.color_cameraback ) ); + GlobalPreferenceSystem().registerPreference( "SI_Colors12", make_property_string( g_camwindow_globals.color_selbrushes3d ) ); + GlobalPreferenceSystem().registerPreference( "CameraRenderMode", make_property_string() ); + GlobalPreferenceSystem().registerPreference( "StrafeMode", make_property_string( g_camwindow_globals_private.m_nStrafeMode ) ); + GlobalPreferenceSystem().registerPreference( "3DZoomInToPointer", make_property_string( g_camwindow_globals.m_bZoomInToPointer ) ); CamWnd_constructStatic();