Skip to content

Commit

Permalink
[meta data] Persist the meta data openness state, and do something se…
Browse files Browse the repository at this point in the history
…nsible while switching patches.
  • Loading branch information
christofmuc committed Apr 8, 2022
1 parent 221bae4 commit 27cf21c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
17 changes: 17 additions & 0 deletions The-Orm/CurrentPatchDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#include "LayeredPatchCapability.h"

#include "Settings.h"

#include <boost/format.hpp>

MetaDataArea::MetaDataArea(std::vector<CategoryButtons::Category> categories, std::function<void(CategoryButtons::Category)> categoryUpdateHandler) :
Expand Down Expand Up @@ -66,6 +68,7 @@ CurrentPatchDisplay::CurrentPatchDisplay(midikraft::PatchDatabase &database, std
onCurrentPatchClicked(currentPatch_);
}
})
, propertyEditor_(true)
, favorite_("Fav!")
, hide_("Hide")
, metaData_(categories, [this](CategoryButtons::Category categoryClicked) {
Expand All @@ -89,17 +92,25 @@ CurrentPatchDisplay::CurrentPatchDisplay(midikraft::PatchDatabase &database, std
addAndMakeVisible(metaDataScroller_);
addAndMakeVisible(patchAsText_);

if (Settings::instance().keyIsSet("MetaDataLayout")) {
lastOpenState_ = Settings::instance().get("MetaDataLayout");
}

// We need to recolor in case the categories are changed
UIModel::instance()->categoriesChanged.addChangeListener(this);
}

CurrentPatchDisplay::~CurrentPatchDisplay()
{
UIModel::instance()->categoriesChanged.removeChangeListener(this);
Settings::instance().set("MetaDataLayout", propertyEditor_.getLayout().toStdString());
}

void CurrentPatchDisplay::setCurrentPatch(std::shared_ptr<midikraft::PatchHolder> patch)
{
if (lastOpenState_.isEmpty()) {
lastOpenState_ = propertyEditor_.getLayout();
}
currentPatch_ = patch;
if (patch && patch->patch()) {
name_.setButtonData(patch->name(), patch->createDragInfoString());
Expand All @@ -123,6 +134,12 @@ void CurrentPatchDisplay::setCurrentPatch(std::shared_ptr<midikraft::PatchHolder
currentPatch_ = patch; // Keep the patch anyway, even if it was empty
jassertfalse;
}

if (lastOpenState_.isNotEmpty()) {
propertyEditor_.fromLayout(lastOpenState_);
lastOpenState_.clear();
resized();
}
}

String getTypeName(std::shared_ptr<midikraft::PatchHolder> patch)
Expand Down
1 change: 1 addition & 0 deletions The-Orm/CurrentPatchDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class CurrentPatchDisplay : public Component,
midikraft::PatchDatabase &database_;
PatchButton name_;
PropertyEditor propertyEditor_;
String lastOpenState_;
TextButton favorite_;
TextButton hide_;
Viewport metaDataScroller_;
Expand Down
8 changes: 1 addition & 7 deletions The-Orm/ideas.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,14 @@

Bug: When you open the export to sysex dialog in an adaptation and then cancel again, KnobKraft will crash on exit.

bugs:
meta data editor needs to persist layout
meta data editor needs to grow and shrink better (section headers don't sent data?)



1.14.0:
Mac Python warning needs to be bigger, i.e. a dialog box

1.15.0 (Meta data)
Selector for display on patch button (combo box upper right)
better attribute entry for patch name
* Better patch name display - the Rev2 patch names are too long. Make it two rows anyway (with two layers?). Switchable, Choice of storage place
* Would expect to choose sort order of patches in grid

Could do better layer switch

Surf! Auto-Surf! Dive!
Expand Down
2 changes: 1 addition & 1 deletion juce-widgets

0 comments on commit 27cf21c

Please sign in to comment.