From: Garux <garux@mail.ru>
Date: Wed, 2 Aug 2017 06:15:07 +0000 (+0300)
Subject: Radiant:
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=89c4e25e26ba634d5911fd596597387876f2e636;p=xonotic%2Fnetradiant.git

Radiant:

misc...
	* fix: update projections on prev/nextleakspot
	* use active projection for prev/nextleakspot tracking
	* fix of: no redo available after ( nothing selected + M1 click ) in 2D
	* fix: nudge left, right, up, down commands work in scale, rotate, clipper manipulator modes
	* deprecated 'Disable system menu on popup windows' preference, was doing nothing
	* preference: Nudge selected after duplication (def = no)
	* preference: Left mouse click tunnel selector (def = yes)
---

diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp
index 2f3db714..68fb2b61 100644
--- a/radiant/mainframe.cpp
+++ b/radiant/mainframe.cpp
@@ -1232,6 +1232,12 @@ Vector3 AxisBase_axisForDirection( const AxisBase& axes, ENudgeDirection directi
 	return Vector3( 0, 0, 0 );
 }
 
+bool g_bNudgeAfterClone = false;
+
+void Nudge_constructPreferences( PreferencesPage& page ){
+	page.appendCheckBox( "", "Nudge selected after duplication", g_bNudgeAfterClone );
+}
+
 void NudgeSelection( ENudgeDirection direction, float fAmount, VIEWTYPE viewtype ){
 	AxisBase axes( AxisBase_forViewType( viewtype ) );
 	Vector3 view_direction( vector3_negated( axes.z ) );
@@ -1245,8 +1251,10 @@ void Selection_Clone(){
 
 		Scene_Clone_Selected( GlobalSceneGraph(), false );
 
-		//NudgeSelection(eNudgeRight, GetGridSize(), GlobalXYWnd_getCurrentViewType());
-		//NudgeSelection(eNudgeDown, GetGridSize(), GlobalXYWnd_getCurrentViewType());
+		if( g_bNudgeAfterClone ){
+			NudgeSelection(eNudgeRight, GetGridSize(), GlobalXYWnd_getCurrentViewType());
+			NudgeSelection(eNudgeDown, GetGridSize(), GlobalXYWnd_getCurrentViewType());
+		}
 	}
 }
 
@@ -1256,8 +1264,10 @@ void Selection_Clone_MakeUnique(){
 
 		Scene_Clone_Selected( GlobalSceneGraph(), true );
 
-		//NudgeSelection(eNudgeRight, GetGridSize(), GlobalXYWnd_getCurrentViewType());
-		//NudgeSelection(eNudgeDown, GetGridSize(), GlobalXYWnd_getCurrentViewType());
+		if( g_bNudgeAfterClone ){
+			NudgeSelection(eNudgeRight, GetGridSize(), GlobalXYWnd_getCurrentViewType());
+			NudgeSelection(eNudgeDown, GetGridSize(), GlobalXYWnd_getCurrentViewType());
+		}
 	}
 }
 
@@ -1848,7 +1858,7 @@ GtkMenuItem* create_file_menu(){
 //	menu_separator( menu );
 	create_menu_item_with_mnemonic( menu, "Pro_ject settings...", "ProjectSettings" );
 	//menu_separator( menu );
-	create_menu_item_with_mnemonic( menu, "_Pointfile...", "TogglePointfile" );
+	create_menu_item_with_mnemonic( menu, "_Pointfile", "TogglePointfile" );
 	menu_separator( menu );
 	MRU_constructMenu( menu );
 	menu_separator( menu );
@@ -3513,6 +3523,8 @@ void MainFrame_Construct(){
 	GlobalPreferenceSystem().registerPreference( "XZWnd", WindowPositionTrackerImportStringCaller( g_posXZWnd ), WindowPositionTrackerExportStringCaller( g_posXZWnd ) );
 
 	GlobalPreferenceSystem().registerPreference( "EnginePath", CopiedStringImportStringCaller( g_strEnginePath ), CopiedStringExportStringCaller( g_strEnginePath ) );
+
+	GlobalPreferenceSystem().registerPreference( "NudgeAfterClone", BoolImportStringCaller( g_bNudgeAfterClone ), BoolExportStringCaller( g_bNudgeAfterClone ) );
 	if ( g_strEnginePath.empty() )
 	{
 		g_strEnginePath_was_empty_1st_start = true;
@@ -3544,6 +3556,7 @@ void MainFrame_Construct(){
 
 	Layout_registerPreferencesPage();
 	Paths_registerPreferencesPage();
+	PreferencesDialog_addSettingsPreferences( FreeCaller1<PreferencesPage&, Nudge_constructPreferences>() );
 
 	g_brushCount.setCountChangedCallback( FreeCaller<QE_brushCountChanged>() );
 	g_entityCount.setCountChangedCallback( FreeCaller<QE_entityCountChanged>() );
diff --git a/radiant/multimon.cpp b/radiant/multimon.cpp
index 04407591..33ae89f1 100644
--- a/radiant/multimon.cpp
+++ b/radiant/multimon.cpp
@@ -29,16 +29,16 @@
 
 multimon_globals_t g_multimon_globals;
 
-LatchedBool g_Multimon_enableSysMenuPopups( false, "Floating windows sysmenu icons" );
+//LatchedBool g_Multimon_enableSysMenuPopups( false, "Floating windows sysmenu icons" );
 
 void MultiMonitor_constructPreferences( PreferencesPage& page ){
 	GtkWidget* primary_monitor = page.appendCheckBox( "Multi Monitor", "Start on Primary Monitor", g_multimon_globals.m_bStartOnPrimMon );
-	GtkWidget* popup = page.appendCheckBox(
-		"", "Disable system menu on popup windows",
-		LatchedBoolImportCaller( g_Multimon_enableSysMenuPopups ),
-		BoolExportCaller( g_Multimon_enableSysMenuPopups.m_latched )
-		);
-	Widget_connectToggleDependency( popup, primary_monitor );
+//	GtkWidget* popup = page.appendCheckBox(
+//		"", "Disable system menu on popup windows",
+//		LatchedBoolImportCaller( g_Multimon_enableSysMenuPopups ),
+//		BoolExportCaller( g_Multimon_enableSysMenuPopups.m_latched )
+//		);
+//	Widget_connectToggleDependency( popup, primary_monitor );
 }
 
 #include "preferencesystem.h"
@@ -88,9 +88,9 @@ void MultiMon_Construct(){
 	}
 
 	GlobalPreferenceSystem().registerPreference( "StartOnPrimMon", BoolImportStringCaller( g_multimon_globals.m_bStartOnPrimMon ), BoolExportStringCaller( g_multimon_globals.m_bStartOnPrimMon ) );
-	GlobalPreferenceSystem().registerPreference( "NoSysMenuPopups", BoolImportStringCaller( g_Multimon_enableSysMenuPopups.m_latched ), BoolExportStringCaller( g_Multimon_enableSysMenuPopups.m_latched ) );
+//	GlobalPreferenceSystem().registerPreference( "NoSysMenuPopups", BoolImportStringCaller( g_Multimon_enableSysMenuPopups.m_latched ), BoolExportStringCaller( g_Multimon_enableSysMenuPopups.m_latched ) );
 
-	g_Multimon_enableSysMenuPopups.useLatched();
+//	g_Multimon_enableSysMenuPopups.useLatched();
 
 	PreferencesDialog_addInterfacePreferences( FreeCaller1<PreferencesPage&, MultiMonitor_constructPreferences>() );
 }
diff --git a/radiant/points.cpp b/radiant/points.cpp
index 342c5be0..0a0c3c0f 100644
--- a/radiant/points.cpp
+++ b/radiant/points.cpp
@@ -193,7 +193,8 @@ void Pointfile_Next( void ){
 
 	CamWnd& camwnd = *g_pParentWnd->GetCamWnd();
 	Camera_setOrigin( camwnd, *i );
-	g_pParentWnd->GetXYWnd()->SetOrigin( *i );
+	g_pParentWnd->ActiveXY()->SetOrigin( *i );
+	g_pParentWnd->ActiveXY()->queueDraw();
 	{
 		Vector3 dir( vector3_normalised( vector3_subtracted( *( ++i ), Camera_getOrigin( camwnd ) ) ) );
 		Vector3 angles( Camera_getAngles( camwnd ) );
@@ -218,7 +219,8 @@ void Pointfile_Prev( void ){
 
 	CamWnd& camwnd = *g_pParentWnd->GetCamWnd();
 	Camera_setOrigin( camwnd, *i );
-	g_pParentWnd->GetXYWnd()->SetOrigin( *i );
+	g_pParentWnd->ActiveXY()->SetOrigin( *i );
+	g_pParentWnd->ActiveXY()->queueDraw();
 	{
 		Vector3 dir( vector3_normalised( vector3_subtracted( *( ++i ), Camera_getOrigin( camwnd ) ) ) );
 		Vector3 angles( Camera_getAngles( camwnd ) );
diff --git a/radiant/selection.cpp b/radiant/selection.cpp
index 96cde65b..805b6ed7 100644
--- a/radiant/selection.cpp
+++ b/radiant/selection.cpp
@@ -3466,9 +3466,9 @@ void MoveSelected( const View& view, const float device_point[2], bool snap, boo
 
 /// \todo Support view-dependent nudge.
 void NudgeManipulator( const Vector3& nudge, const Vector3& view ){
-	if ( ManipulatorMode() == eTranslate || ManipulatorMode() == eDrag ) {
+//	if ( ManipulatorMode() == eTranslate || ManipulatorMode() == eDrag ) {
 		translateSelected( nudge );
-	}
+//	}
 }
 
 void endMove();
@@ -3959,8 +3959,11 @@ void RadiantSelectionSystem::renderSolid( Renderer& renderer, const VolumeTest&
 #include "preferencesystem.h"
 #include "preferences.h"
 
+bool g_bLeftMouseClickSelector = true;
+
 void SelectionSystem_constructPreferences( PreferencesPage& page ){
 	page.appendCheckBox( "", "Prefer point entities in 2D", getSelectionSystem().m_bPreferPointEntsIn2D );
+	page.appendCheckBox( "", "Left mouse click tunnel selector", g_bLeftMouseClickSelector );
 }
 void SelectionSystem_constructPage( PreferenceGroup& group ){
 	PreferencesPage page( group.createPage( "Selection", "Selection System Settings" ) );
@@ -3988,6 +3991,7 @@ void SelectionSystem_Construct(){
 	GlobalShaderCache().attachRenderable( getSelectionSystem() );
 
 	GlobalPreferenceSystem().registerPreference( "PreferPointEntsIn2D", BoolImportStringCaller( getSelectionSystem().m_bPreferPointEntsIn2D ), BoolExportStringCaller( getSelectionSystem().m_bPreferPointEntsIn2D ) );
+	GlobalPreferenceSystem().registerPreference( "LeftMouseClickSelector", BoolImportStringCaller( g_bLeftMouseClickSelector ), BoolExportStringCaller( g_bLeftMouseClickSelector ) );
 	SelectionSystem_registerPreferencesPage();
 }
 
@@ -4131,7 +4135,9 @@ void testSelect_simpleM1( DeviceVector position ){
 		modifier = RadiantSelectionSystem::eCycle;
 	}
 	getSelectionSystem().SelectPoint( *m_view, &position[0], &m_epsilon[0], modifier, false );*/
-	getSelectionSystem().SelectPoint( *m_view, &position[0], &m_epsilon[0], m_mouseMoved ? RadiantSelectionSystem::eReplace : RadiantSelectionSystem::eCycle, false );
+	if( g_bLeftMouseClickSelector ){
+		getSelectionSystem().SelectPoint( *m_view, &position[0], &m_epsilon[0], m_mouseMoved ? RadiantSelectionSystem::eReplace : RadiantSelectionSystem::eCycle, false );
+	}
 	m_start = m_current = device_constrained( position );
 }
 
@@ -4287,12 +4293,7 @@ void onMouseDown( const WindowVector& position, ButtonIdentifier button, Modifie
 		}
 		else
 		{
-			if ( button == c_button_select ) {
-				m_selector.m_mouse2 = false;
-			}
-			else{
-				m_selector.m_mouse2 = true;
-			}
+			m_selector.m_mouse2 = ( button == c_button_select ) ? false : true;
 			m_selector.mouseDown( devicePosition );
 			g_mouseMovedCallback.insert( MouseEventCallback( Selector_::MouseMovedCaller( m_selector ) ) );
 			g_mouseUpCallback.insert( MouseEventCallback( Selector_::MouseUpCaller( m_selector ) ) );
diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp
index bab35a07..f82ab0d2 100644
--- a/radiant/xywindow.cpp
+++ b/radiant/xywindow.cpp
@@ -1090,7 +1090,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 ){
@@ -1128,6 +1127,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 );