Skip to content

Commit

Permalink
Fix drag and drop for cartmanager
Browse files Browse the repository at this point in the history
  • Loading branch information
asb2m10 committed Sep 29, 2024
1 parent b4c7053 commit 05a62d5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
1 change: 1 addition & 0 deletions Documentation/Keybindings.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
| CTRL+P | Open parameter dialog |
| CTRL+C | Copy current context on clipboard as hexa |
| CTRL+V | Paste context from clipboard content |
| SHIFT+UP or SHIFT+DOWN | On sliders, it steps 10 % |
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ Dexed Forks
Changelog
---------
#### Version 0.9.8 (in development)
* Accessibility implementation
* Cartridge Manager UI refactoring (e.g. display .syx cartridge name)
* UI Refresh
* Accessibility implementation (including keyboard shortcuts)
* Mono/Poly parameter is now a plugin parameter
* Fix Logic startup issue
* Fix Apple Logic startup issue

#### Version 0.9.7
* [MTS-ESP](https://oddsound.com/index.php) microtuning support
Expand Down
2 changes: 1 addition & 1 deletion Source/CartManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ void CartManager::programDragged(ProgramListBox *destListBox, int dest, char *pa

Cartridge cart;
cart.load(file);
memcpy(cart.getRawVoice()+(dest*128), packedPgm, 128);
cart.replaceProgram(dest, packedPgm);;
cart.saveVoice(file);
browserCart->setCartridge(cart);
}
Expand Down
6 changes: 5 additions & 1 deletion Source/PluginData.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,11 @@ class Cartridge {
memcpy(perfData, other.perfData, SYSEX_SIZE);
return *this;
}


void replaceProgram(int idx, char *src) {
memcpy(getRawVoice() + (idx * 128), src, 128);
}

void unpackProgram(uint8_t *unpackPgm, int idx);
void packProgram(uint8_t *src, int idx, String name, char *opSwitch);
};
Expand Down
9 changes: 3 additions & 6 deletions Source/ProgramListBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ class ProgramLabel : public Component, public DragAndDropTarget {

void paint(Graphics &g) override {
if ( inDrag ) {
g.setColour(Colours::black);
g.fillRect(0,0,getWidth(), getHeight());
g.fillAll(DXLookNFeel::background);
return;
}

Expand Down Expand Up @@ -146,9 +145,7 @@ class ProgramLabel : public Component, public DragAndDropTarget {
return;

if (DragAndDropContainer* const dragContainer = DragAndDropContainer::findParentDragContainerFor(this)) {
Image snapshot (Image::ARGB, getWidth(), getHeight(), true);
Graphics g(snapshot);
paint(g);
ScaledImage snapshot;
void *src = pgmListBox->cartContent.getRawVoice() + (idx*128);
var description = var(src, 128);
dragContainer->startDragging(description, this, snapshot, false);
Expand Down Expand Up @@ -193,7 +190,7 @@ class ProgramLabel : public Component, public DragAndDropTarget {

MemoryBlock* block = dragSourceDetails.description.getBinaryData();
if ( pgmListBox->listener != nullptr )
pgmListBox->listener->programDragged(pgmListBox, dest->idx, (char *)block->getData());
pgmListBox->listener->programDragged(pgmListBox, idx, (char *)block->getData());

repaint();
}
Expand Down

0 comments on commit 05a62d5

Please sign in to comment.