From f93b3f61846b91a5679daca40a5f23e355ac787b Mon Sep 17 00:00:00 2001 From: Garux Date: Wed, 2 Aug 2017 09:00:52 +0300 Subject: [PATCH] m1 selector --- radiant/selection.cpp | 22 ++++++++++++++++++++++ radiant/xywindow.cpp | 4 ++++ 2 files changed, 26 insertions(+) diff --git a/radiant/selection.cpp b/radiant/selection.cpp index 5013af7b..1ac80e79 100644 --- a/radiant/selection.cpp +++ b/radiant/selection.cpp @@ -2537,7 +2537,9 @@ EManipulatorMode m_manipulator_mode; Manipulator* m_manipulator; // state +public: bool m_undo_begun; +private: EMode m_mode; EComponentMode m_componentmode; @@ -3445,6 +3447,7 @@ Single 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; @@ -3526,6 +3529,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; } @@ -3673,6 +3690,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 ); diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index 4d4d7517..ba0bae5b 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -1332,6 +1332,10 @@ void XYWnd::XY_MouseUp( int x, int y, unsigned int buttons ){ 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 { -- 2.39.2