Parcourir la source

Spreadsheet: Rename variables to better describe their function

Rename some variables relating to the drag-and-cut operations as
well as the select operation so that they are more clear.
martinfalisse il y a 3 ans
Parent
commit
8a7d2c3336

+ 8 - 8
Userland/Applications/Spreadsheet/SpreadsheetView.cpp

@@ -79,7 +79,7 @@ void InfinitelyScrollableTableView::mousemove_event(GUI::MouseEvent& event)
 
         m_is_hovering_cut_zone = false;
         m_is_hovering_extend_zone = false;
-        if (selection().size() > 0 && !m_should_intercept_drag) {
+        if (selection().size() > 0 && !m_is_dragging_for_select) {
             // Get top-left and bottom-right most cells of selection
             auto bottom_right_most_index = selection().first();
             auto top_left_most_index = selection().first();
@@ -134,20 +134,20 @@ void InfinitelyScrollableTableView::mousemove_event(GUI::MouseEvent& event)
 
         auto holding_left_button = !!(event.buttons() & GUI::MouseButton::Primary);
         if (m_is_dragging_for_copy) {
-            m_should_intercept_drag = false;
+            m_is_dragging_for_select = false;
             if (holding_left_button) {
-                m_has_committed_to_dragging = true;
+                m_has_committed_to_cutting = true;
             }
-        } else if (!m_should_intercept_drag) {
+        } else if (!m_is_dragging_for_select) {
             if (!holding_left_button) {
                 m_starting_selection_index = index;
             } else {
-                m_should_intercept_drag = true;
+                m_is_dragging_for_select = true;
                 m_might_drag = false;
             }
         }
 
-        if (holding_left_button && m_should_intercept_drag && !m_has_committed_to_dragging) {
+        if (holding_left_button && m_is_dragging_for_select && !m_has_committed_to_cutting) {
             if (!m_starting_selection_index.is_valid())
                 m_starting_selection_index = index;
 
@@ -189,9 +189,9 @@ void InfinitelyScrollableTableView::mousedown_event(GUI::MouseEvent& event)
 
 void InfinitelyScrollableTableView::mouseup_event(GUI::MouseEvent& event)
 {
-    m_should_intercept_drag = false;
-    m_has_committed_to_dragging = false;
+    m_is_dragging_for_select = false;
     m_is_dragging_for_copy = false;
+    m_has_committed_to_cutting = false;
     if (m_is_hovering_cut_zone) {
         auto rect = content_rect(m_target_cell);
         GUI::MouseEvent adjusted_event = { (GUI::Event::Type)event.type(), rect.center(), event.buttons(), event.button(), event.modifiers(), event.wheel_delta_x(), event.wheel_delta_y() };

+ 2 - 2
Userland/Applications/Spreadsheet/SpreadsheetView.h

@@ -78,9 +78,9 @@ private:
     virtual void mouseup_event(GUI::MouseEvent&) override;
     virtual void drop_event(GUI::DropEvent&) override;
 
-    bool m_should_intercept_drag { false };
-    bool m_has_committed_to_dragging { false };
+    bool m_is_dragging_for_select { false };
     bool m_is_dragging_for_copy { false };
+    bool m_has_committed_to_cutting { false };
     bool m_is_hovering_extend_zone { false };
     bool m_is_hovering_cut_zone { false };
     GUI::ModelIndex m_starting_selection_index;