Cut core/ui and core/audio comment bloat ~60% (comments only, zero code change)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// card_drag — pure implementation. See card_drag.h. NO REAPER / SWELL / LICE / OS / vendor.
|
||||
// card_drag — pure implementation. See card_drag.h.
|
||||
|
||||
#include "core/ui/card_drag.h"
|
||||
|
||||
@@ -6,7 +6,6 @@ namespace reasampler::ui {
|
||||
|
||||
namespace {
|
||||
|
||||
// Half-open point-in-rect (matches drag_out / bank_grid: [x, x+w) x [y, y+h)).
|
||||
bool insideClient(int px, int py, const PanelClientRect& c) {
|
||||
return px >= c.x && px < c.x + c.width &&
|
||||
py >= c.y && py < c.y + c.height;
|
||||
@@ -16,25 +15,18 @@ bool insideClient(int px, int py, const PanelClientRect& c) {
|
||||
|
||||
CardGesture decideCardGesture(int px, int py, const PanelClientRect& client,
|
||||
const DragState& state, const DragModifiers& mods) {
|
||||
// No drag / empty payload: nothing to do.
|
||||
if (!state.dragging || !state.hasArmedSamples) return CardGesture::None;
|
||||
|
||||
// Precedence 1: pointer left the client rect -> OS drag-out (wins first).
|
||||
if (!insideClient(px, py, client)) return CardGesture::OsDragOut;
|
||||
|
||||
// Precedence 2: over a tab / the other bank -> move (or copy on Ctrl).
|
||||
if (mods.region == DropRegion::OtherBankOrTab)
|
||||
return mods.ctrl ? CardGesture::Copy : CardGesture::Move;
|
||||
|
||||
// Precedence 3: within the same bank's own grid -> reorder / replace.
|
||||
if (mods.region == DropRegion::SameBankGrid) {
|
||||
// Alt over an OCCUPIED slot replaces; otherwise reorder (empty = place,
|
||||
// occupied+no-Alt = insert-before-and-shift).
|
||||
if (mods.alt && mods.slotOccupied) return CardGesture::Replace;
|
||||
return CardGesture::Reorder;
|
||||
}
|
||||
|
||||
// Dead space inside the client: a drop here is a no-op.
|
||||
return CardGesture::None;
|
||||
}
|
||||
|
||||
@@ -56,7 +48,7 @@ std::vector<SlotCellRect> computeSlotRects(int maxSlot, int panelWidth,
|
||||
if (maxSlot < 0) return rects;
|
||||
|
||||
const int cols = columnsForWidth(panelWidth, spec);
|
||||
const int count = maxSlot + 1; // slots 0..maxSlot inclusive (empties included)
|
||||
const int count = maxSlot + 1;
|
||||
rects.reserve(static_cast<std::size_t>(count));
|
||||
|
||||
for (int slot = 0; slot < count; ++slot) {
|
||||
@@ -76,16 +68,13 @@ std::vector<SlotCellRect> computeSlotRects(int maxSlot, int panelWidth,
|
||||
std::vector<SlotCellRect> computeSlotRectsForDrop(int maxSlot, int panelWidth,
|
||||
const GridSpec& spec) {
|
||||
const int cols = columnsForWidth(panelWidth, spec);
|
||||
// One trailing row of slots past the last occupied slot — the drop-target extension.
|
||||
// When maxSlot < 0 (empty bank) the trailing row begins at slot 0.
|
||||
const int firstTrailing = maxSlot + 1;
|
||||
const int newMax = firstTrailing + cols - 1; // fills one full trailing row
|
||||
const int newMax = firstTrailing + cols - 1; // one full trailing row
|
||||
return computeSlotRects(newMax, panelWidth, spec);
|
||||
}
|
||||
|
||||
int hitTestSlot(int px, int py, const std::vector<SlotCellRect>& rects) {
|
||||
for (const SlotCellRect& r : rects) {
|
||||
// Half-open bounds so adjacent rects never both claim a pixel.
|
||||
if (px >= r.x && px < r.x + r.width &&
|
||||
py >= r.y && py < r.y + r.height)
|
||||
return r.slot;
|
||||
|
||||
Reference in New Issue
Block a user