root/trunk/src/gui/src/MainForm.h @ 2481

Revision 2481, 4.0 KB (checked in by wolke, 14 months ago)

add feature recorded midi nots are undo/redo able. add undo/redo midi_action. reformat hydrogen.cpp

RevLine 
[3]1/*
2 * Hydrogen
[73]3 * Copyright(c) 2002-2008 by Alex >Comix< Cominu [comix@users.sourceforge.net]
[3]4 *
5 * http://www.hydrogen-music.org
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY, without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20 *
21 */
22
23#ifndef MAINFORM_H
24#define MAINFORM_H
25
26#include <QtNetwork>
[377]27#include <QtGui>
[3]28
29#include <map>
[2441]30#include <unistd.h>
[3]31
32#include "EventListener.h"
33
[1680]34#include <hydrogen/config.h>
[2018]35#include <hydrogen/object.h>
[3]36
37class HydrogenApp;
[1513]38class QUndoView;///debug only
[3]39
40///
41/// Main window
42///
[2128]43class MainForm : public QMainWindow, public EventListener, public H2Core::Object
[3]44{
[1736]45    H2_OBJECT
[3]46        Q_OBJECT
47
48        public:
49                QApplication* m_pQApp;
50
[127]51                MainForm( QApplication *app, const QString& songFilename );
[3]52                ~MainForm();
53
54                void updateRecentUsedSongList();
55
56                virtual void errorEvent( int nErrorCode );
[2240]57                virtual void jacksessionEvent( int nValue);
[2348]58                virtual void playlistLoadSongEvent(int nIndex);
[2481]59                virtual void undoRedoActionEvent( int nEvent );
[1504]60                static void usr1SignalHandler(int unused);
[3]61
[1503]62
[2337]63public slots:
[3]64                void showPreferencesDialog();
65                void showUserManual();
66
67                void action_file_new();
68                void action_file_open();
69                void action_file_openDemo();
70                void action_file_save();
71                void action_file_save_as();
[115]72                void action_file_openPattern();
73                void action_file_export_pattern_as();
[3]74                bool action_file_exit();
75
76                void action_file_export();
77                void action_file_export_midi();
78                void action_file_songProperties();
79
80                void action_help_about();
81
82                void action_instruments_addInstrument();
83                void action_instruments_clearAll();
84                void action_instruments_saveLibrary();
85                void action_instruments_exportLibrary();
86                void action_instruments_importLibrary();
87
88
89                void action_window_showMixer();
[131]90                void action_window_showPlaylistDialog();
[1946]91                void action_window_show_DirectorWidget();
[3]92                void action_window_showSongEditor();
93                void action_window_showPatternEditor();
94                void action_window_showDrumkitManagerPanel();
95
96                void action_debug_printObjects();
97                void action_debug_showAudioEngineInfo();
98
99                void closeEvent( QCloseEvent* ev );
100
101                void onPlayStopAccelEvent();
102                void onRestartAccelEvent();
103                void onBPMPlusAccelEvent();
104                void onBPMMinusAccelEvent();
105                void onSaveAsAccelEvent();
106                void onSaveAccelEvent();
107                void onOpenAccelEvent();
108
109                void action_file_open_recent( QAction *pAction );
[1480]110                void showDevelWarning();
[177]111                void onLashPollTimer();
[3]112
[1528]113                void openUndoStack();
[1507]114                void action_undo();
115                void action_redo();
116
[1505]117                void handleSigUsr1();
118
[3]119        private slots:
120                void onAutoSaveTimer();
[255]121                void onPlaylistDisplayTimer();
[3]122
[632]123        protected:
124                // Returns true if handled, false if aborted.
125                bool handleUnsavedChanges();
126
[3]127        private:
128                HydrogenApp* h2app;
129
[1504]130                static int sigusr1Fd[2];
131                QSocketNotifier *snUsr1;
[1503]132
[2337]133                void functionDeleteInstrument(int instrument);
[1503]134
135
[3]136                QMenu *m_pRecentFilesMenu;
137                QAction *m_pRecentFileAction0;
138                QAction *m_pRecentFileAction1;
139                QAction *m_pRecentFileAction2;
140                QAction *m_pRecentFileAction3;
141                QAction *m_pRecentFileAction4;
142
143                QHttp m_http;
144
145                QTimer m_autosaveTimer;
146
147                /** Create the menubar */
148                void createMenuBar();
149
150                void closeAll();
[127]151                void openSongFile( const QString& sFilename );
[3]152
153                bool eventFilter( QObject *o, QEvent *e );
154
155                std::map<int,int>  keycodeInstrumentMap;
156                void initKeyInstMap();
157
[127]158                QString getAutoSaveFilename();
[1680]159        #ifdef H2CORE_HAVE_LASH
[177]160                QTimer *lashPollTimer;
161        #endif
[1513]162                QUndoView *undoView;///debug only
[3]163
[2345]164                bool handleSelectNextPrevSongOnPlaylist(int step);
165
[3]166};
167
168#endif
Note: See TracBrowser for help on using the browser.