diff --git a/src/bank_panel.cpp b/src/bank_panel.cpp index 4f3d5b5..69864c3 100644 --- a/src/bank_panel.cpp +++ b/src/bank_panel.cpp @@ -198,7 +198,10 @@ struct CachedThumbnail { enum class Region { Pool, Banks }; // What a drag is dropping onto, resolved live under the pointer during a drag. -enum class DropKind { None, PoolRegion, Tab }; +// BanksRegion fires when the pointer is anywhere in the named-banks grid that is NOT +// on a specific tab (tab takes precedence — more specific wins). The resolved bank is +// always shownBankId. +enum class DropKind { None, PoolRegion, Tab, BanksRegion }; struct PanelState { ReaSamplerSession* session = nullptr; @@ -869,6 +872,15 @@ void paintPanel(HWND hwnd, HDC hdc) { ? "Select or create a named bank." : "This bank is empty. Move samples here from the pool.", g_panel.focusedRegion == Region::Banks, projectDir); + // Drop-target highlight for the banks region during a drag. BanksRegion fires + // when the pointer is in the grid but not on a specific tab; Tab draws its own + // highlight on the individual tab (drawTabStrip above handles that case). + if (g_panel.dragging && g_panel.dropKind == DropKind::BanksRegion) { + const RECT grid = regionGridRect(region, true); + LICE_DrawRect(&bmp, grid.left + 1, grid.top + 1, + grid.right - grid.left - 2, grid.bottom - grid.top - 2, + kColDropTarget, 1.0f, 0); + } } drawModeSwitch(&bmp, w); @@ -1803,6 +1815,16 @@ void updateDropTarget(int x, int y) { g_panel.dropBankId = tabs[static_cast(hit.index)]->id; return; } + // Tab takes precedence over the region; if the point is in the banks region but + // not on a specific tab, treat the whole grid as a drop zone for the shown bank. + // No valid target when there are no named banks or no shown bank. + if (!g_panel.shownBankId.empty() && book() && book()->bank(g_panel.shownBankId)) { + if (x >= br.left && x < br.right && y >= br.top && y < br.bottom) { + g_panel.dropKind = DropKind::BanksRegion; + g_panel.dropBankId = g_panel.shownBankId; + return; + } + } } if (poolShown()) { const RECT pr = poolRegionRect(w, h); @@ -1838,8 +1860,10 @@ void onLBtnUp(int x, int y) { if (g_panel.dragging) { updateDropTarget(x, y); std::string destId; - if (g_panel.dropKind == DropKind::PoolRegion) destId = std::string(kPoolBankId); - else if (g_panel.dropKind == DropKind::Tab) destId = g_panel.dropBankId; + if (g_panel.dropKind == DropKind::PoolRegion) destId = std::string(kPoolBankId); + else if (g_panel.dropKind == DropKind::Tab || + g_panel.dropKind == DropKind::BanksRegion) + destId = g_panel.dropBankId; if (!destId.empty() && destId != g_panel.dragSourceBankId && !g_panel.dragSampleIds.empty()) {