]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/selection.cpp
Merge commit 'f93b3f61846b91a5679daca40a5f23e355ac787b' into garux-merge
[xonotic/netradiant.git] / radiant / selection.cpp
index df18daa9c5ef23a908cc40e83b84b62eb09617c9..2fe57fdfa11d285b041e2ead2978df58a56600e1 100644 (file)
@@ -2541,7 +2541,9 @@ EManipulatorMode m_manipulator_mode;
 Manipulator* m_manipulator;
 
 // state
+public:
 bool m_undo_begun;
+private:
 EMode m_mode;
 EComponentMode m_componentmode;
 
@@ -3449,6 +3451,7 @@ Single<MouseEventCallback> g_mouseUpCallback;
 
 #if 1
 const ButtonIdentifier c_button_select = c_buttonLeft;
+const ButtonIdentifier c_button_select2 = c_buttonRight;
 const ModifierFlags c_modifier_manipulator = c_modifierNone;
 const ModifierFlags c_modifier_toggle = c_modifierShift;
 const ModifierFlags c_modifier_replace = c_modifierShift | c_modifierAlt;
@@ -3530,6 +3533,20 @@ void testSelect( DeviceVector position ){
        draw_area();
 }
 
+void testSelect_simpleM1( DeviceVector position ){
+       RadiantSelectionSystem::EModifier modifier = RadiantSelectionSystem::eReplace;
+       if ( m_unmoved_replaces++ > 0 ) {
+               if( GlobalSelectionSystem().countSelected() != 0 ){
+                       modifier = RadiantSelectionSystem::eCycle;
+               }
+               else{
+                       m_unmoved_replaces = 0;
+               }
+       }
+       getSelectionSystem().SelectPoint( *m_view, &position[0], &m_epsilon[0], modifier, false );
+}
+
+
 bool selecting() const {
        return m_state != c_modifier_manipulator;
 }
@@ -3677,6 +3694,11 @@ void onMouseUp( const WindowVector& position, ButtonIdentifier button, ModifierF
 
                g_mouseUpCallback.get() ( window_to_normalised_device( position, m_width, m_height ) );
        }
+       //L button w/o scene changed = tunnel selection
+       if( !getSelectionSystem().m_undo_begun && modifiers == c_modifierNone && button == c_button_select && GlobalSelectionSystem().Mode() != SelectionSystem::eComponent ){
+               m_selector.testSelect_simpleM1( window_to_normalised_device( position, m_width, m_height ) );
+       }
+       getSelectionSystem().m_undo_begun = false;
 }
 void onModifierDown( ModifierFlags type ){
        m_selector.modifierEnable( type );