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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
//=========================================================
// MusE
// Linux Music Editor
// $Id: helper.h,v 1.1.1.1 2003/10/27 18:52:11 wschweer Exp $
// (C) Copyright 2003 Werner Schweer (ws@seh.de)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2 of
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
//=========================================================
#ifndef __HELPER_H__
#define __HELPER_H__
#include <set>
#include <QSet>
#include <QStringList>
#include "drummap.h"
class QActionGroup;
class QString;
class QMenu;
class QWidget;
class QLine;
class QRect;
namespace MusECore {
class Part;
class Track;
class PartList;
QString pitch2string(int v);
Part* partFromSerialNumber(int serial);
bool any_event_selected(const std::set<const Part*>&, bool in_range=false);
bool drummaps_almost_equal(const DrumMap* one, const DrumMap* two, int drummap_size=128);
// drummap_hidden may be NULL.
void write_new_style_drummap(int level, Xml& xml, const char* tagname,
DrumMap* drummap, bool* drummap_hidden=NULL, bool full=false);
void read_new_style_drummap(Xml& xml, const char* tagname,
DrumMap* drummap, bool* drummap_hidden=NULL, bool compatibility=false);
QSet<Part*> parts_at_tick(unsigned tick);
QSet<Part*> parts_at_tick(unsigned tick, const Track* track);
QSet<Part*> parts_at_tick(unsigned tick, const QSet<Track*>& tracks);
bool parse_range(const QString& str, int* from, int* to); // returns true if successful, false on error
void record_controller_change_and_maybe_send(unsigned tick, int ctrl_num, int val, MidiTrack* mt);
}
namespace MusEGui {
class PopupMenu;
QMenu* populateAddSynth(QWidget* parent);
QActionGroup* populateAddTrack(QMenu* addTrack, bool populateAll=false, bool evenIgnoreDrumPreference=false);
QStringList localizedStringListFromCharArray(const char** array, const char* context);
QString getFilterExtension(const QString &filter);
QString browseProjectFolder(QWidget* parent = 0);
QString projectTitleFromFilename(QString filename);
QString projectPathFromFilename(QString filename);
QString projectExtensionFromFilename(QString filename);
QString getUniqueUntitledName();
void populateMidiPorts();
int populateMidiCtrlMenu(PopupMenu* menu, MusECore::PartList* part_list, MusECore::Part* cur_part, int curDrumPitch);
QLine clipQLine(int x1, int y1, int x2, int y2, const QRect& rect);
}
#endif
|