1 /***************************************************************************
2 **                                                                        **
3 **  Polyphone, a soundfont editor                                         **
4 **  Copyright (C) 2013-2020 Davy Triponney                                **
5 **                                                                        **
6 **  This program is free software: you can redistribute it and/or modify  **
7 **  it under the terms of the GNU General Public License as published by  **
8 **  the Free Software Foundation, either version 3 of the License, or     **
9 **  (at your option) any later version.                                   **
10 **                                                                        **
11 **  This program is distributed in the hope that it will be useful,       **
12 **  but WITHOUT ANY WARRANTY; without even the implied warranty of        **
13 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the          **
14 **  GNU General Public License for more details.                          **
15 **                                                                        **
16 **  You should have received a copy of the GNU General Public License     **
17 **  along with this program. If not, see http://www.gnu.org/licenses/.    **
18 **                                                                        **
19 ****************************************************************************
20 **           Author: Davy Triponney                                       **
21 **  Website/Contact: https://www.polyphone-soundfonts.com                 **
22 **             Date: 01.01.2013                                           **
23 ***************************************************************************/
24 
25 #ifndef TREEVIEWMENU_H
26 #define TREEVIEWMENU_H
27 
28 #include <QMenu>
29 #include "basetypes.h"
30 class DialogList;
31 
32 class TreeViewMenu : public QMenu
33 {
34     Q_OBJECT
35 
36 public:
37     TreeViewMenu(QWidget * parent);
38     ~TreeViewMenu();
39 
40     /// Initialize the menu with the selected IDs
41     void initialize(IdList ids);
42 
43 signals:
44     void selectionChanged(IdList ids);
45 
46 public slots:
47     void associate();
48     void replace();
49     void itemSelectedFromList(EltID id, bool isAssociation);
50     void copy();
51     void paste();
52     void duplicate();
53     void remove();
54     void rename();
55 
56 private slots:
57     void bulkRename(int renameType, QString text1, QString text2, int val1, int val2);
58     void onRename(QString txt);
59 
60 private:
61     void associate(IdList ids, EltID idDest);
62     void replace(EltID idSrc, EltID idDest);
63 
64     IdList _currentIds;
65     QAction * _replaceAction;
66     QAction * _associateAction;
67     QAction * _copyAction;
68     QAction * _pasteAction;
69     QAction * _duplicateAction;
70     QAction * _removeAction;
71     QAction * _renameAction;
72     DialogList * _dialogList;
73 
74     // Same copy for all instances
75     static IdList s_copy;
76 };
77 
78 #endif // TREEVIEWMENU_H
79