Browse Source

Clear filters in Module Browser when backspace is pressed while the search field is empty.

tags/v1.1.0
Andrew Belt 5 years ago
parent
commit
81d3fb7afc
2 changed files with 26 additions and 14 deletions
  1. +3
    -1
      CHANGELOG.md
  2. +23
    -13
      src/app/ModuleBrowser.cpp

+ 3
- 1
CHANGELOG.md View File

@@ -1,8 +1,10 @@
### 1.0.1 (in development) ### 1.0.1 (in development)
- Request microphone access on Mac to prevent Mac 10.14+ from blocking audio input. - Request microphone access on Mac to prevent Mac 10.14+ from blocking audio input.
- Clear filters in Module Browser when backspace is pressed while the search field is empty.
- Fix MIDI receiving in Bridge MIDI driver. - Fix MIDI receiving in Bridge MIDI driver.
- Fix opening/saving UTF-8 filenames on Windows. - Fix opening/saving UTF-8 filenames on Windows.
- API
- Fix bug where cable ID's were not being set in .vcv patches.
- Plugin API
- Add `string::absolutePath()`. - Add `string::absolutePath()`.
- Use namespace for Core plugin to avoid name clashes. - Use namespace for Core plugin to avoid name clashes.




+ 23
- 13
src/app/ModuleBrowser.cpp View File

@@ -296,19 +296,7 @@ struct BrowserSearchField : ui::TextField {
TextField::step(); TextField::step();
} }


void onSelectKey(const event::SelectKey &e) override {
if (e.action == GLFW_PRESS) {
if (e.key == GLFW_KEY_ESCAPE) {
BrowserOverlay *overlay = getAncestorOfType<BrowserOverlay>();
overlay->hide();
e.consume(this);
}
}

if (!e.getTarget())
ui::TextField::onSelectKey(e);
}

void onSelectKey(const event::SelectKey &e) override;
void onChange(const event::Change &e) override; void onChange(const event::Change &e) override;
void onAction(const event::Action &e) override; void onAction(const event::Action &e) override;


@@ -625,6 +613,28 @@ inline void TagItem::step() {
active = (browser->tag == text); active = (browser->tag == text);
} }


inline void BrowserSearchField::onSelectKey(const event::SelectKey &e) {
if (e.action == GLFW_PRESS) {
switch (e.key) {
case GLFW_KEY_ESCAPE: {
BrowserOverlay *overlay = getAncestorOfType<BrowserOverlay>();
overlay->hide();
e.consume(this);
} break;
case GLFW_KEY_BACKSPACE: {
if (text == "") {
ModuleBrowser *browser = getAncestorOfType<ModuleBrowser>();
browser->clear();
e.consume(this);
}
} break;
}
}

if (!e.getTarget())
ui::TextField::onSelectKey(e);
}

inline void BrowserSearchField::onChange(const event::Change &e) { inline void BrowserSearchField::onChange(const event::Change &e) {
ModuleBrowser *browser = getAncestorOfType<ModuleBrowser>(); ModuleBrowser *browser = getAncestorOfType<ModuleBrowser>();
browser->search = string::trim(text); browser->search = string::trim(text);


Loading…
Cancel
Save