-
Notifications
You must be signed in to change notification settings - Fork 26
/
CreateListDialog.h
64 lines (50 loc) · 1.96 KB
/
CreateListDialog.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
Copyright (c) 2021 Christof Ruch. All rights reserved.
Dual licensed: Distributed under Affero GPL license by default, an MIT license is available for purchase
*/
#pragma once
#include "JuceHeader.h"
#include "PatchList.h"
#include "SynthBank.h"
#include "PropertyEditor.h"
class CreateListDialog : public Component, private TextButton::Listener {
public:
enum TListFillMode {
None,
Top,
Random
};
struct TFillParameters {
TListFillMode fillMode;
size_t number;
};
typedef std::function<void(std::shared_ptr<midikraft::PatchList> result)> TCallback;
typedef std::function<void(std::shared_ptr<midikraft::PatchList> result, TFillParameters fillParameters)> TCallbackWithFill;
CreateListDialog(std::shared_ptr<midikraft::Synth> synth, TCallbackWithFill& callback, TCallback& deleteCallback);
CreateListDialog(TCallbackWithFill& callback, TCallback& deleteCallback);
void setList(std::shared_ptr<midikraft::PatchList> list);
virtual void resized() override;
static void showCreateListDialog(std::shared_ptr<midikraft::SynthBank> list, std::shared_ptr<midikraft::Synth> synth, Component* centeredAround, TCallbackWithFill callback, TCallback deleteCallback);
static void showCreateListDialog(std::shared_ptr<midikraft::PatchList> list, Component* centeredAround, TCallbackWithFill callback, TCallback deleteCallback);
static void release();
void notifyResult();
private:
void buttonClicked(Button* button) override;
static std::unique_ptr<CreateListDialog> sCreateListDialog_;
static DialogWindow* sWindow_;
std::shared_ptr<midikraft::Synth> synth_;
MidiBankNumber bank_ = MidiBankNumber::invalid();
bool isBank_;
std::shared_ptr<midikraft::PatchList> list_;
Value nameValue_;
Value bankValue_;
Value fillMode_;
Value patchNumber_;
PropertyEditor propertyEditor_;
TextButton ok_;
TextButton cancel_;
TextButton delete_;
TCallbackWithFill callback_;
TCallback deleteCallback_;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CreateListDialog)
};