From 3352a2e76ccf21384dc7fce41414d21a41dab1b1 Mon Sep 17 00:00:00 2001 From: aj_genius Date: Wed, 17 Mar 2004 01:07:17 +0000 Subject: [PATCH] changed select behaviour - left-click replaces selection with individual device, right click always pulls up menu(as opposed to ctrl-right click), and shift works as modifier as well as ctrl for both drag and individual select --- GUI/Widgets/Fl_Canvas.C | 4 ++-- GUI/Widgets/Fl_Canvas.h | 30 +++++++++++++++++++----------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/GUI/Widgets/Fl_Canvas.C b/GUI/Widgets/Fl_Canvas.C index 1668499..e4b1e2e 100644 --- a/GUI/Widgets/Fl_Canvas.C +++ b/GUI/Widgets/Fl_Canvas.C @@ -603,7 +603,7 @@ int Fl_Canvas::handle(int event) m_HaveSelection = false; } - if ((Fl::event_state() & FL_CTRL) != 0) + if (((Fl::event_state() & FL_CTRL) != 0) || ((Fl::event_state() & FL_SHIFT) != 0)) { m_Selecting = true; m_StartSelectX=Fl::event_x(); @@ -700,7 +700,7 @@ int Fl_Canvas::handle(int event) } } - if ((Fl::event_button()==3) && (event==FL_PUSH) && ((Fl::event_state() & FL_CTRL) != 0)) + if ((Fl::event_button()==3) && (event==FL_PUSH)) { PopupEditMenu(this); } diff --git a/GUI/Widgets/Fl_Canvas.h b/GUI/Widgets/Fl_Canvas.h index 750eae4..522880a 100644 --- a/GUI/Widgets/Fl_Canvas.h +++ b/GUI/Widgets/Fl_Canvas.h @@ -204,27 +204,35 @@ private: PopupEditMenu(widget->parent()); } - if ((widget) && (button==1) && ((shift_state & FL_CTRL) != 0)) - { + if ((widget) && (button==1)) + { int ID = ((Fl_DeviceGUI*)(widget->parent()))->GetID(); std::vector::iterator device_iter = std::find(m_Selection.m_DeviceIds.begin(), m_Selection.m_DeviceIds.end(), ID); - if (m_HaveSelection) - { - if (device_iter != m_Selection.m_DeviceIds.end()) - m_Selection.m_DeviceIds.erase(device_iter); + if (((shift_state & FL_SHIFT) != 0) || ((shift_state & FL_CTRL) != 0)) + { + if (m_HaveSelection) + { + if (device_iter != m_Selection.m_DeviceIds.end()) + m_Selection.m_DeviceIds.erase(device_iter); + else + m_Selection.m_DeviceIds.push_back(ID); + } else - m_Selection.m_DeviceIds.push_back(ID); - } + { + m_Selection.Clear(); + m_HaveSelection = true; + m_Selection.m_DeviceIds.push_back(ID); + } + } else { m_Selection.Clear(); m_HaveSelection = true; m_Selection.m_DeviceIds.push_back(ID); } - - redraw(); - } + redraw(); + } } inline void cb_DeleteDeviceGroup_i();