📄 rosegardenguiapp.cpp
字号:
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: *//* Rosegarden A MIDI and audio sequencer and musical notation editor. This program is Copyright 2000-2007 Guillaume Laurent <glaurent@telegraph-road.org>, Chris Cannam <cannam@all-day-breakfast.com>, Richard Bown <richard.bown@ferventsoftware.com> The moral rights of Guillaume Laurent, Chris Cannam, and Richard Bown to claim authorship of this work have been asserted. Other copyrights also apply to some parts of this work. Please see the AUTHORS file and individual file headers for details. 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; either version 2 of the License, or (at your option) any later version. See the file COPYING included with this distribution for more information.*/#include "RosegardenGUIApp.h"#include <kapplication.h>#include "gui/editors/segment/TrackEditor.h"#include "gui/editors/segment/TrackButtons.h"#include "misc/Debug.h"#include "misc/Strings.h"#include "gui/application/RosegardenDCOP.h"#include "base/AnalysisTypes.h"#include "base/AudioPluginInstance.h"#include "base/Clipboard.h"#include "base/Composition.h"#include "base/CompositionTimeSliceAdapter.h"#include "base/Configuration.h"#include "base/Device.h"#include "base/Exception.h"#include "base/Instrument.h"#include "base/MidiDevice.h"#include "base/MidiProgram.h"#include "base/NotationTypes.h"#include "base/Profiler.h"#include "base/RealTime.h"#include "base/Segment.h"#include "base/SegmentNotationHelper.h"#include "base/Selection.h"#include "base/Studio.h"#include "base/Track.h"#include "commands/edit/CopyCommand.h"#include "commands/edit/CutCommand.h"#include "commands/edit/EventQuantizeCommand.h"#include "commands/edit/PasteSegmentsCommand.h"#include "commands/edit/TransposeCommand.h"#include "commands/edit/AddMarkerCommand.h"#include "commands/edit/ModifyMarkerCommand.h"#include "commands/edit/RemoveMarkerCommand.h"#include "commands/notation/KeyInsertionCommand.h"#include "commands/segment/AddTempoChangeCommand.h"#include "commands/segment/AddTimeSignatureAndNormalizeCommand.h"#include "commands/segment/AddTimeSignatureCommand.h"#include "commands/segment/AudioSegmentAutoSplitCommand.h"#include "commands/segment/AudioSegmentRescaleCommand.h"#include "commands/segment/AudioSegmentSplitCommand.h"#include "commands/segment/ChangeCompositionLengthCommand.h"#include "commands/segment/CreateTempoMapFromSegmentCommand.h"#include "commands/segment/CutRangeCommand.h"#include "commands/segment/DeleteRangeCommand.h"#include "commands/segment/InsertRangeCommand.h"#include "commands/segment/ModifyDefaultTempoCommand.h"#include "commands/segment/MoveTracksCommand.h"#include "commands/segment/PasteRangeCommand.h"#include "commands/segment/RemoveTempoChangeCommand.h"#include "commands/segment/SegmentAutoSplitCommand.h"#include "commands/segment/SegmentChangeTransposeCommand.h"#include "commands/segment/SegmentJoinCommand.h"#include "commands/segment/SegmentLabelCommand.h"#include "commands/segment/SegmentReconfigureCommand.h"#include "commands/segment/SegmentRescaleCommand.h"#include "commands/segment/SegmentSplitByPitchCommand.h"#include "commands/segment/SegmentSplitByRecordingSrcCommand.h"#include "commands/segment/SegmentSplitCommand.h"#include "commands/segment/SegmentTransposeCommand.h"#include "commands/studio/CreateOrDeleteDeviceCommand.h"#include "commands/studio/ModifyDeviceCommand.h"#include "document/io/CsoundExporter.h"#include "document/io/HydrogenLoader.h"#include "document/io/LilypondExporter.h"#include "document/MultiViewCommandHistory.h"#include "document/io/RG21Loader.h"#include "document/io/MupExporter.h"#include "document/io/MusicXmlExporter.h"#include "document/RosegardenGUIDoc.h"#include "document/ConfigGroups.h"#include "gui/application/RosegardenApplication.h"#include "gui/dialogs/AddTracksDialog.h"#include "gui/dialogs/AudioManagerDialog.h"#include "gui/dialogs/AudioPluginDialog.h"#include "gui/dialogs/AudioSplitDialog.h"#include "gui/dialogs/BeatsBarsDialog.h"#include "gui/dialogs/CompositionLengthDialog.h"#include "gui/dialogs/ConfigureDialog.h"#include "gui/dialogs/CountdownDialog.h"#include "gui/dialogs/DocumentConfigureDialog.h"#include "gui/dialogs/FileMergeDialog.h"#include "gui/dialogs/IdentifyTextCodecDialog.h"#include "gui/dialogs/IntervalDialog.h"#include "gui/dialogs/LilypondOptionsDialog.h"#include "gui/dialogs/ManageMetronomeDialog.h"#include "gui/dialogs/QuantizeDialog.h"#include "gui/dialogs/RescaleDialog.h"#include "gui/dialogs/SplitByPitchDialog.h"#include "gui/dialogs/SplitByRecordingSrcDialog.h"#include "gui/dialogs/TempoDialog.h"#include "gui/dialogs/TimeDialog.h"#include "gui/dialogs/TimeSignatureDialog.h"#include "gui/dialogs/TransportDialog.h"#include "gui/editors/parameters/InstrumentParameterBox.h"#include "gui/editors/parameters/RosegardenParameterArea.h"#include "gui/editors/parameters/SegmentParameterBox.h"#include "gui/editors/parameters/TrackParameterBox.h"#include "gui/editors/segment/segmentcanvas/CompositionView.h"#include "gui/editors/segment/ControlEditorDialog.h"#include "gui/editors/segment/MarkerEditor.h"#include "gui/editors/segment/PlayListDialog.h"#include "gui/editors/segment/PlayList.h"#include "gui/editors/segment/segmentcanvas/SegmentEraser.h"#include "gui/editors/segment/segmentcanvas/SegmentJoiner.h"#include "gui/editors/segment/segmentcanvas/SegmentMover.h"#include "gui/editors/segment/segmentcanvas/SegmentPencil.h"#include "gui/editors/segment/segmentcanvas/SegmentResizer.h"#include "gui/editors/segment/segmentcanvas/SegmentSelector.h"#include "gui/editors/segment/segmentcanvas/SegmentSplitter.h"#include "gui/editors/segment/segmentcanvas/SegmentToolBox.h"#include "gui/editors/segment/TrackLabel.h"#include "gui/editors/segment/TriggerSegmentManager.h"#include "gui/editors/tempo/TempoView.h"#include "gui/general/EditViewBase.h"#include "gui/kdeext/KStartupLogo.h"#include "gui/kdeext/KTmpStatusMsg.h"#include "gui/seqmanager/MidiFilterDialog.h"#include "gui/seqmanager/SequenceManager.h"#include "gui/seqmanager/SequencerMapper.h"#include "gui/studio/AudioMixerWindow.h"#include "gui/studio/AudioPlugin.h"#include "gui/studio/AudioPluginManager.h"#include "gui/studio/AudioPluginOSCGUIManager.h"#include "gui/studio/BankEditorDialog.h"#include "gui/studio/DeviceManagerDialog.h"#include "gui/studio/MidiMixerWindow.h"#include "gui/studio/RemapInstrumentDialog.h"#include "gui/studio/StudioControl.h"#include "gui/studio/SynthPluginManagerDialog.h"#include "gui/widgets/CurrentProgressDialog.h"#include "gui/widgets/ProgressBar.h"#include "gui/widgets/ProgressDialog.h"#include "LircClient.h"#include "LircCommander.h"#include "RosegardenGUIView.h"#include "RosegardenIface.h"#include "SetWaitCursor.h"#include "sound/AudioFile.h"#include "sound/AudioFileManager.h"#include "sound/MappedCommon.h"#include "sound/MappedComposition.h"#include "sound/MappedEvent.h"#include "sound/MappedStudio.h"#include "sound/MidiFile.h"#include "sound/PluginIdentifier.h"#include "sound/SoundDriver.h"#include "StartupTester.h"#include <dcopclient.h>#include <dcopobject.h>#include <dcopref.h>#include <kaction.h>#include <kconfig.h>#include <kdcopactionproxy.h>#include <kdockwidget.h>#include <kedittoolbar.h>#include <kfiledialog.h>#include <kglobal.h>#include <kinputdialog.h>#include <kio/netaccess.h>#include <kkeydialog.h>#include <klocale.h>#include <kmainwindow.h>#include <kmessagebox.h>#include <kmimetype.h>#include <kprocess.h>#include <kstatusbar.h>#include <kstdaccel.h>#include <kstdaction.h>#include <kstddirs.h>#include <ktempfile.h>#include <ktip.h>#include <ktoolbar.h>#include <kurl.h>#include <kxmlguiclient.h>#include <qaccel.h>#include <qcanvas.h>#include <qcstring.h>#include <qcursor.h>#include <qdatastream.h>#include <qdialog.h>#include <qdir.h>#include <qfile.h>#include <qfileinfo.h>#include <qiconset.h>#include <qinputdialog.h>#include <qlabel.h>#include <qobject.h>#include <qobjectlist.h>#include <qpixmap.h>#include <qpopupmenu.h>#include <qpushbutton.h>#include <qregexp.h>#include <qslider.h>#include <qstring.h>#include <qstringlist.h>#include <qtextcodec.h>#include <qtimer.h>#include <qvaluevector.h>#include <qwidget.h>#ifdef HAVE_LIBJACK#include <jack/jack.h>#endifnamespace Rosegarden{RosegardenGUIApp::RosegardenGUIApp(bool useSequencer, bool useExistingSequencer, QObject *startupStatusMessageReceiver) : DCOPObject("RosegardenIface"), RosegardenIface(this), KDockMainWindow(0), m_actionsSetup(false), m_fileRecent(0), m_view(0), m_swapView(0), m_mainDockWidget(0), m_dockLeft(0), m_doc(0), m_sequencerProcess(0), m_sequencerCheckedIn(false),#ifdef HAVE_LIBJACK m_jackProcess(0),#endif m_zoomSlider(0), m_seqManager(0), m_transport(0), m_audioManagerDialog(0), m_originatingJump(false), m_storedLoopStart(0), m_storedLoopEnd(0), m_useSequencer(useSequencer), m_dockVisible(true), m_autoSaveTimer(new QTimer(this)), m_clipboard(new Clipboard), m_playList(0), m_deviceManager(0), m_synthManager(0), m_audioMixer(0), m_midiMixer(0), m_bankEditor(0), m_markerEditor(0), m_tempoView(0), m_triggerSegmentManager(0),#ifdef HAVE_LIBLO m_pluginGUIManager(new AudioPluginOSCGUIManager(this)),#endif m_playTimer(new QTimer(this)), m_stopTimer(new QTimer(this)), m_startupTester(0),#ifdef HAVE_LIRC m_lircClient(0), m_lircCommander(0),#endif m_haveAudioImporter(false), m_parameterArea(0){ m_myself = this; if (startupStatusMessageReceiver) { QObject::connect(this, SIGNAL(startupStatusMessage(QString)), startupStatusMessageReceiver, SLOT(slotShowStatusMessage(QString))); } // Try to start the sequencer // if (m_useSequencer) {#ifdef HAVE_LIBJACK#define OFFER_JACK_START_OPTION 1#ifdef OFFER_JACK_START_OPTION // First we check if jackd is running allready std::string jackClientName = "rosegarden"; // attempt connection to JACK server // jack_client_t* testJackClient; testJackClient = jack_client_new(jackClientName.c_str()); if (testJackClient == 0 ) { // If no connection to JACK // try to launch JACK - if the configuration wants us to. if (!launchJack()) { KStartupLogo::hideIfStillThere(); KMessageBox::error(this, i18n("Attempted to launch JACK audio daemon failed. Audio will be disabled.\nPlease check configuration (Settings -> Configure Rosegarden -> Audio -> Startup)\n and restart.")); } } else { //this client was just for testing jack_client_close(testJackClient); }#endif // OFFER_JACK_START_OPTION#endif // HAVE_LIBJACK emit startupStatusMessage(i18n("Starting sequencer...")); launchSequencer(useExistingSequencer); } else RG_DEBUG << "RosegardenGUIApp : don't use sequencer\n"; // Plugin manager // emit startupStatusMessage(i18n("Initializing plugin manager...")); m_pluginManager = new AudioPluginManager(); // call inits to invoke all other construction parts // emit startupStatusMessage(i18n("Initializing view...")); initStatusBar(); setupActions(); iFaceDelayedInit(this); initZoomToolbar(); QPixmap dummyPixmap; // any icon will do m_mainDockWidget = createDockWidget("Rosegarden MainDockWidget", dummyPixmap, 0L, "main_dock_widget"); // allow others to dock to the left and right sides only m_mainDockWidget->setDockSite(KDockWidget::DockLeft | KDockWidget::DockRight); // forbit docking abilities of m_mainDockWidget itself m_mainDockWidget->setEnableDocking(KDockWidget::DockNone); setView(m_mainDockWidget); // central widget in a KDE mainwindow setMainDockWidget(m_mainDockWidget); // master dockwidget m_dockLeft = createDockWidget("params dock", dummyPixmap, 0L, i18n("Special Parameters")); m_dockLeft->manualDock(m_mainDockWidget, // dock target KDockWidget::DockLeft, // dock site 20); // relation target/this (in percent) connect(m_dockLeft, SIGNAL(iMBeingClosed()), this, SLOT(slotParametersClosed()));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -