Merge pull request #1426 from LMMS/ed_refac

Editor Refactoring
This commit is contained in:
Lukas W
2015-01-11 13:28:32 +01:00
72 changed files with 2522 additions and 2583 deletions

View File

@@ -378,9 +378,17 @@ QWidget#mainToolbar {
QToolBar {
background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #98a2a7, stop:1 #5b646f);
border: none;
padding: 1px;
spacing: 0;
}
QToolButton, ToolButton {
QToolBar::separator {
border: none;
width: 5px;
}
QToolButton {
padding: 1px 1px 1px 1px;
border-radius: 2px;
border: 1px solid rgba(0,0,0,32);
@@ -391,12 +399,12 @@ QToolButton, ToolButton {
/* separate corner rounding for play and stop buttons! */
ToolButton#playButton {
QToolButton#playButton {
border-top-left-radius: 5px 15px;
border-bottom-left-radius: 5px 15px;
}
ToolButton#stopButton {
QToolButton#stopButton {
border-top-right-radius: 5px 15px;
border-bottom-right-radius: 5px 15px;
}
@@ -405,20 +413,20 @@ ToolButton#stopButton {
/* all tool buttons */
QToolButton:hover, ToolButton:hover {
QToolButton:hover {
background: qradialgradient(cx:0.3, cy:0.3, radius:0.8, fx:0.3, fy:0.3, stop:0 #e0e0e0, stop:0.5 #c9c9c9, stop:1 #969696 );
border: 1px solid rgba(0,0,0,128);
color: white;
}
QToolButton:pressed, ToolButton:pressed {
QToolButton:pressed {
background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #969696, stop:0.5 #c9c9c9, stop:1 #969696 );
padding: 2px 1px 0px 1px;
border: 1px solid rgba(0,0,0,128);
color: white;
}
QToolButton:checked, ToolButton:checked {
QToolButton:checked {
background: qradialgradient(cx:0.3, cy:0.3, radius:0.8, fx:0.3, fy:0.3, stop:0 #e0e0e0, stop:0.8 #c9c9c9, stop:1 #c0c0c0 );
border-radius: 3px;
padding: 2px 1px 0px 1px;

View File

@@ -34,7 +34,7 @@
class AboutDialog : public QDialog, public Ui::AboutDialog
{
public:
AboutDialog( void );
AboutDialog(QWidget* parent=0);
} ;

57
include/ActionGroup.h Normal file
View File

@@ -0,0 +1,57 @@
/*
* Editor.h - declaration of Editor class
*
* Copyright (c) 2014 Lukas W <lukaswhl/at/gmail.com>
*
* This file is part of LMMS - http://lmms.io
*
* 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.
*
* 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 (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef ACTION_GROUP_H
#define ACTION_GROUP_H
#include <QActionGroup>
/// \brief Convenience subclass of QActionGroup
///
/// This class provides the same functionality as QActionGroup, but in addition
/// has the actionTriggered(int) signal.
/// It also sets every added action's checkable property to true.
class ActionGroup : public QActionGroup
{
Q_OBJECT
public:
ActionGroup(QObject* parent);
QAction* addAction(QAction *a);
QAction* addAction(const QString &text);
QAction* addAction(const QIcon &icon, const QString &text);
signals:
/// This signal is emitted when the action at the given index is triggered.
void triggered(int index);
private slots:
void actionTriggered_(QAction* action);
private:
QList<QAction*> m_actions;
};
#endif

View File

@@ -29,6 +29,8 @@
#include <QtCore/QMutex>
#include <QWidget>
#include "Editor.h"
#include "lmms_basics.h"
#include "JournallingObject.h"
#include "MidiTime.h"
@@ -36,58 +38,60 @@
#include "ComboBoxModel.h"
#include "Knob.h"
class QPainter;
class QPixmap;
class QScrollBar;
class ComboBox;
class NotePlayHandle;
class Timeline;
class ToolButton;
class TimeLineWidget;
class AutomationEditor : public QWidget, public JournallingObject
{
Q_OBJECT
Q_PROPERTY( QColor gridColor READ gridColor WRITE setGridColor )
Q_PROPERTY( QColor vertexColor READ vertexColor WRITE setVertexColor )
Q_PROPERTY( QBrush scaleColor READ scaleColor WRITE setScaleColor )
Q_PROPERTY( QBrush graphColor READ graphColor WRITE setGraphColor )
Q_PROPERTY(QColor gridColor READ gridColor WRITE setGridColor)
Q_PROPERTY(QColor vertexColor READ vertexColor WRITE setVertexColor)
Q_PROPERTY(QBrush scaleColor READ scaleColor WRITE setScaleColor)
Q_PROPERTY(QBrush graphColor READ graphColor WRITE setGraphColor)
public:
void setCurrentPattern( AutomationPattern * _new_pattern );
void setCurrentPattern(AutomationPattern * new_pattern);
inline const AutomationPattern * currentPattern() const
{
return( m_pattern );
return m_pattern;
}
inline bool validPattern() const
{
return( m_pattern != NULL );
return m_pattern != nullptr;
}
int quantization() const;
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );
inline virtual QString nodeName() const
virtual void saveSettings(QDomDocument & doc, QDomElement & parent);
virtual void loadSettings(const QDomElement & parent);
QString nodeName() const
{
return( "automationeditor" );
return "automationeditor";
}
void setPauseIcon( bool pause );
// qproperty access methods
QColor gridColor() const;
QBrush graphColor() const;
QColor vertexColor() const;
QBrush scaleColor() const;
void setGridColor( const QColor & c );
void setGraphColor( const QBrush & c );
void setVertexColor( const QColor & c );
void setScaleColor( const QBrush & c );
void setGridColor(const QColor& c);
void setGraphColor(const QBrush& c);
void setVertexColor(const QColor& c);
void setScaleColor(const QBrush& c);
enum EditModes
{
DRAW,
ERASE,
SELECT,
MOVE
};
public slots:
void update();
@@ -97,69 +101,56 @@ public slots:
protected:
typedef AutomationPattern::timeMap timeMap;
virtual void closeEvent( QCloseEvent * _ce );
virtual void keyPressEvent( QKeyEvent * _ke );
virtual void leaveEvent( QEvent * _e );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void mouseReleaseEvent( QMouseEvent * _me );
virtual void mouseMoveEvent( QMouseEvent * _me );
virtual void paintEvent( QPaintEvent * _pe );
virtual void resizeEvent( QResizeEvent * _re );
virtual void wheelEvent( QWheelEvent * _we );
virtual void keyPressEvent(QKeyEvent * ke);
virtual void leaveEvent(QEvent * e);
virtual void mousePressEvent(QMouseEvent * mouseEvent);
virtual void mouseReleaseEvent(QMouseEvent * mouseEvent);
virtual void mouseMoveEvent(QMouseEvent * mouseEvent);
virtual void paintEvent(QPaintEvent * pe);
virtual void resizeEvent(QResizeEvent * re);
virtual void wheelEvent(QWheelEvent * we);
float getLevel( int _y );
int xCoordOfTick( int _tick );
int yCoordOfLevel( float _level );
inline void drawLevelTick( QPainter & _p, int _tick,
float _value, bool _is_selected );
float getLevel( int y );
int xCoordOfTick( int tick );
int yCoordOfLevel( float level );
inline void drawLevelTick( QPainter & p, int tick,
float value, bool is_selected );
void removeSelection();
void selectAll();
void getSelectedValues( timeMap & _selected_values );
void getSelectedValues(timeMap & selected_values );
void drawLine( int x0, float y0, int x1, float y1 );
void disableTensionKnob();
protected slots:
void play();
void stop();
void horScrolled( int _new_pos );
void verScrolled( int _new_pos );
void horScrolled( int new_pos );
void verScrolled( int new_pos );
void drawButtonToggled();
void eraseButtonToggled();
void selectButtonToggled();
void moveButtonToggled();
void flipYButtonPressed();
void flipXButtonPressed();
void setEditMode(AutomationEditor::EditModes mode);
void setEditMode(int mode);
void discreteButtonToggled();
void linearButtonToggled();
void cubicHermiteButtonToggled();
void tensionChanged();
void setProgressionType(AutomationPattern::ProgressionTypes type);
void setProgressionType(int type);
void setTension();
void copySelectedValues();
void cutSelectedValues();
void pasteValues();
void deleteSelectedValues();
void updatePosition( const MidiTime & _t );
void updatePosition( const MidiTime & t );
void zoomingXChanged();
void zoomingYChanged();
/// Updates the pattern's quantization using the current user selected value.
void setQuantization();
private:
enum editModes
{
DRAW,
ERASE,
SELECT,
MOVE
} ;
enum actions
enum Actions
{
NONE,
MOVE_VALUE,
@@ -168,11 +159,8 @@ private:
} ;
// some constants...
static const int INITIAL_WIDTH = 860;
static const int INITIAL_HEIGHT = 480;
static const int SCROLLBAR_SIZE = 16;
static const int TOP_MARGIN = 48;
static const int TOP_MARGIN = 16;
static const int DEFAULT_Y_DELTA = 6;
static const int DEFAULT_STEPS_PER_TACT = 16;
@@ -184,7 +172,6 @@ private:
AutomationEditor( const AutomationEditor & );
virtual ~AutomationEditor();
static QPixmap * s_toolDraw;
static QPixmap * s_toolErase;
static QPixmap * s_toolSelect;
@@ -192,37 +179,12 @@ private:
static QPixmap * s_toolYFlip;
static QPixmap * s_toolXFlip;
QWidget * m_toolBar;
ToolButton * m_playButton;
ToolButton * m_stopButton;
ToolButton * m_drawButton;
ToolButton * m_eraseButton;
ToolButton * m_selectButton;
ToolButton * m_moveButton;
ToolButton * m_flipYButton;
ToolButton * m_flipXButton;
ToolButton * m_discreteButton;
ToolButton * m_linearButton;
ToolButton * m_cubicHermiteButton;
Knob * m_tensionKnob;
FloatModel * m_tensionModel;
ToolButton * m_cutButton;
ToolButton * m_copyButton;
ToolButton * m_pasteButton;
ComboBox * m_zoomingXComboBox;
ComboBox * m_zoomingYComboBox;
ComboBox * m_quantizeComboBox;
ComboBoxModel m_zoomingXModel;
ComboBoxModel m_zoomingYModel;
ComboBoxModel m_quantizeModel;
FloatModel * m_tensionModel;
QMutex m_patternMutex;
AutomationPattern * m_pattern;
float m_minLevel;
@@ -239,7 +201,7 @@ private:
MidiTime m_currentPosition;
actions m_action;
Actions m_action;
tick_t m_selectStartTick;
tick_t m_selectedTick;
@@ -261,13 +223,13 @@ private:
timeMap m_selValuesForMove;
editModes m_editMode;
EditModes m_editMode;
Timeline * m_timeLine;
TimeLineWidget * m_timeLine;
bool m_scrollBack;
void drawCross( QPainter & _p );
void drawCross(QPainter & p );
void drawAutomationPoint( QPainter & p, timeMap::iterator it );
bool inBBEditor();
@@ -276,14 +238,62 @@ private:
QColor m_vertexColor;
QBrush m_scaleColor;
friend class Engine;
//friend class Engine;
friend class AutomationEditorWindow;
signals:
void currentPatternChanged();
void positionChanged( const MidiTime & );
} ;
class AutomationEditorWindow : public Editor
{
Q_OBJECT
static const int INITIAL_WIDTH = 860;
static const int INITIAL_HEIGHT = 480;
public:
AutomationEditorWindow();
~AutomationEditorWindow();
void setCurrentPattern(AutomationPattern* pattern);
const AutomationPattern* currentPattern();
void open(AutomationPattern* pattern);
AutomationEditor* m_editor;
QSize sizeHint() const;
public slots:
void clearCurrentPattern();
signals:
void currentPatternChanged();
protected slots:
void play();
void stop();
private:
QAction* m_discreteAction;
QAction* m_linearAction;
QAction* m_cubicHermiteAction;
QAction* m_flipYAction;
QAction* m_flipXAction;
Knob * m_tensionKnob;
ComboBox * m_zoomingXComboBox;
ComboBox * m_zoomingYComboBox;
ComboBox * m_quantizeComboBox;
friend class Engine;
};
#endif

View File

@@ -136,15 +136,8 @@ public:
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );
static inline const QString classNodeName()
{
return "automationpattern";
}
inline virtual QString nodeName() const
{
return classNodeName();
}
static const QString classNodeName() { return "automationpattern"; }
QString nodeName() const { return classNodeName(); }
void processMidiTime( const MidiTime & _time );
@@ -156,21 +149,17 @@ public:
static AutomationPattern * globalAutomationPattern( AutomatableModel * _m );
static void resolveAllIDs();
bool isRecording() const
{
return m_isRecording;
}
void setRecording( const bool b )
{
m_isRecording = b;
}
bool isRecording() const { return m_isRecording; }
void setRecording( const bool b ) { m_isRecording = b; }
static int quantization() { return s_quantization; }
static void setQuantization(int q) { s_quantization = q; }
public slots:
void clear();
void openInAutomationEditor();
void objectDestroyed( jo_id_t );
void flipY( int min, int max );
void flipY();
void flipX( int length = -1 );
private:
@@ -194,6 +183,8 @@ private:
bool m_isRecording;
float m_lastRecordedValue;
static int s_quantization;
static const float DEFAULT_MIN_VALUE;
static const float DEFAULT_MAX_VALUE;

View File

@@ -26,56 +26,72 @@
#ifndef BB_EDITOR_H
#define BB_EDITOR_H
#include "Editor.h"
#include "TrackContainerView.h"
class BBTrackContainer;
class ComboBox;
class ToolButton;
class BBTrackContainerView;
class BBEditor : public TrackContainerView
class BBEditor : public Editor
{
Q_OBJECT
public:
BBEditor( BBTrackContainer * _tc );
virtual ~BBEditor();
~BBEditor();
virtual inline bool fixedTCOs() const
{
return( true );
QSize sizeHint() const;
const BBTrackContainerView* trackContainerView() const {
return m_trackContainerView;
}
BBTrackContainerView* trackContainerView() {
return m_trackContainerView;
}
virtual void dropEvent( QDropEvent * _de );
void removeBBView( int _bb );
void setPauseIcon( bool pause );
void removeBBView( int bb );
public slots:
void play();
void stop();
void updatePosition();
void addAutomationTrack();
void addSteps();
void removeSteps();
protected:
virtual void closeEvent( QCloseEvent * _ce );
private:
virtual void keyPressEvent( QKeyEvent * _ke );
BBTrackContainer * m_bbtc;
QWidget * m_toolBar;
ToolButton * m_playButton;
ToolButton * m_stopButton;
BBTrackContainerView* m_trackContainerView;
ComboBox * m_bbComboBox;
} ;
class BBTrackContainerView : public TrackContainerView
{
Q_OBJECT
public:
BBTrackContainerView(BBTrackContainer* tc);
bool fixedTCOs() const
{
return true;
}
void removeBBView(int bb);
public slots:
void addSteps();
void removeSteps();
void addAutomationTrack();
protected slots:
virtual void dropEvent(QDropEvent * de );
void updatePosition();
private:
BBTrackContainer * m_bbtc;
};
#endif

View File

@@ -53,6 +53,10 @@ public:
virtual QSize sizeHint() const;
public slots:
void selectNext();
void selectPrevious();
protected:
virtual void contextMenuEvent( QContextMenuEvent* event );

75
include/Editor.h Normal file
View File

@@ -0,0 +1,75 @@
/*
* Editor.h - declaration of Editor class
*
* Copyright (c) 2014 Lukas W <lukaswhl/at/gmail.com>
*
* This file is part of LMMS - http://lmms.io
*
* 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.
*
* 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 (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef EDITOR_COMMON_H
#define EDITOR_COMMON_H
#include <QAction>
#include <QMainWindow>
#include <QToolBar>
#include "TimeLineWidget.h"
#include "ToolButton.h"
/// \brief Superclass for editors with a toolbar.
///
/// Those editors include the Song Editor, the Automation Editor, B&B Editor,
/// and the Piano Roll.
class Editor : public QMainWindow
{
Q_OBJECT
public:
void setPauseIcon(bool displayPauseIcon=true);
protected slots:
virtual void play() {}
virtual void record() {}
virtual void recordAccompany() {}
virtual void stop() {}
private slots:
/// Called by pressing the space key. Plays or stops.
void togglePlayStop();
signals:
protected:
/// \brief Constructor.
///
/// \param record If set true, the editor's toolbar will contain record
/// buttons in addition to the play and stop buttons.
Editor(bool record = false);
virtual ~Editor();
QToolBar* m_toolBar;
QAction* m_playAction;
QAction* m_recordAction;
QAction* m_recordAccompanyAction;
QAction* m_stopAction;
};
#endif

View File

@@ -33,7 +33,7 @@
#include "export.h"
class AutomationEditor;
class AutomationEditorWindow;
class BBEditor;
class BBTrackContainer;
class DummyTrackContainer;
@@ -42,10 +42,10 @@ class FxMixerView;
class ProjectJournal;
class MainWindow;
class Mixer;
class PianoRoll;
class PianoRollWindow;
class ProjectNotes;
class Song;
class SongEditor;
class SongEditorWindow;
class Ladspa2LMMS;
class ControllerRackView;
@@ -53,13 +53,10 @@ class ControllerRackView;
class EXPORT Engine
{
public:
static void init( const bool _has_gui = true );
static void init();
static void destroy();
static bool hasGUI()
{
return s_hasGUI;
}
static bool hasGUI();
static void setSuppressMessages( bool _on )
{
@@ -68,7 +65,7 @@ public:
static bool suppressMessages()
{
return !s_hasGUI || s_suppressMessages;
return !hasGUI() || s_suppressMessages;
}
// core
@@ -97,42 +94,6 @@ public:
return s_projectJournal;
}
// GUI
static MainWindow * mainWindow()
{
return s_mainWindow;
}
static FxMixerView * fxMixerView()
{
return s_fxMixerView;
}
static SongEditor* songEditor()
{
return s_songEditor;
}
static BBEditor * getBBEditor()
{
return s_bbEditor;
}
static PianoRoll* pianoRoll()
{
return s_pianoRoll;
}
static ProjectNotes * getProjectNotes()
{
return s_projectNotes;
}
static AutomationEditor * automationEditor()
{
return s_automationEditor;
}
static Ladspa2LMMS * getLADSPAManager()
{
return s_ladspaManager;
@@ -143,11 +104,6 @@ public:
return s_dummyTC;
}
static ControllerRackView * getControllerRackView()
{
return s_controllerRackView;
}
static float framesPerTick()
{
return s_framesPerTick;
@@ -171,7 +127,6 @@ private:
delete tmp;
}
static bool s_hasGUI;
static bool s_suppressMessages;
static float s_framesPerTick;
@@ -182,23 +137,15 @@ private:
static BBTrackContainer * s_bbTrackContainer;
static ProjectJournal * s_projectJournal;
static DummyTrackContainer * s_dummyTC;
static ControllerRackView * s_controllerRackView;
// GUI
static MainWindow * s_mainWindow;
static FxMixerView * s_fxMixerView;
static SongEditor* s_songEditor;
static AutomationEditor * s_automationEditor;
static BBEditor * s_bbEditor;
static PianoRoll* s_pianoRoll;
static ProjectNotes * s_projectNotes;
static Ladspa2LMMS * s_ladspaManager;
static QMap<QString, QString> s_pluginFileHandling;
static void initPluginFileHandling();
} ;
friend class GuiApplication;
};

71
include/GuiApplication.h Normal file
View File

@@ -0,0 +1,71 @@
/*
* GuiApplication.h
*
* Copyright (c) 2014 Lukas W <lukaswhl/at/gmail.com>
*
* This file is part of LMMS - http://lmms.io
*
* 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.
*
* 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 (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef GUIAPPLICATION_H
#define GUIAPPLICATION_H
#include "export.h"
class AutomationEditorWindow;
class BBEditor;
class ControllerRackView;
class FxMixerView;
class MainWindow;
class PianoRollWindow;
class ProjectNotes;
class SongEditorWindow;
class EXPORT GuiApplication
{
public:
explicit GuiApplication();
~GuiApplication();
static GuiApplication* instance();
MainWindow* mainWindow() { return m_mainWindow; }
FxMixerView* fxMixerView() { return m_fxMixerView; }
SongEditorWindow* songEditor() { return m_songEditor; }
BBEditor* getBBEditor() { return m_bbEditor; }
PianoRollWindow* pianoRoll() { return m_pianoRoll; }
ProjectNotes* getProjectNotes() { return m_projectNotes; }
AutomationEditorWindow* automationEditor() { return m_automationEditor; }
ControllerRackView* getControllerRackView() { return m_controllerRackView; }
private:
static GuiApplication* s_instance;
MainWindow* m_mainWindow;
FxMixerView* m_fxMixerView;
SongEditorWindow* m_songEditor;
AutomationEditorWindow* m_automationEditor;
BBEditor* m_bbEditor;
PianoRollWindow* m_pianoRoll;
ProjectNotes* m_projectNotes;
ControllerRackView* m_controllerRackView;
};
#define gui GuiApplication::instance()
#endif // GUIAPPLICATION_H

View File

@@ -180,7 +180,7 @@ private:
QList<QString>* m_errors;
friend class Engine;
friend class GuiApplication;
private slots:

View File

@@ -202,11 +202,10 @@ public:
{
return m_detuning;
}
void editDetuningPattern();
bool hasDetuningInfo() const;
void createDetuning();
protected:
virtual void saveSettings( QDomDocument & _doc,
@@ -228,10 +227,7 @@ private:
MidiTime m_length;
MidiTime m_pos;
DetuningHelper * m_detuning;
void createDetuning();
} ;
};
typedef QVector<Note *> NoteVector;

View File

@@ -138,7 +138,7 @@ private:
int m_steps;
friend class PatternView;
friend class BBEditor;
friend class BBTrackContainerView;
signals:

View File

@@ -30,6 +30,7 @@
#include <QWidget>
#include <QInputDialog>
#include "Editor.h"
#include "ComboBoxModel.h"
#include "SerializingObject.h"
#include "Note.h"
@@ -47,10 +48,9 @@ class QSignalMapper;
class ComboBox;
class NotePlayHandle;
class Pattern;
class Timeline;
class ToolButton;
class TimeLineWidget;
class PianoRoll : public QWidget, public SerializingObject
class PianoRoll : public QWidget
{
Q_OBJECT
Q_PROPERTY( QColor gridColor READ gridColor WRITE setGridColor )
@@ -58,6 +58,14 @@ class PianoRoll : public QWidget, public SerializingObject
Q_PROPERTY( QColor noteColor READ noteColor WRITE setNoteColor )
Q_PROPERTY( QColor barColor READ barColor WRITE setBarColor )
public:
enum EditModes
{
ModeDraw,
ModeErase,
ModeSelect,
ModeEditDetuning,
};
/*! \brief Resets settings to default when e.g. creating a new project */
void reset();
@@ -86,47 +94,36 @@ public:
Song::PlayModes desiredPlayModeForAccompany() const;
int quantization() const;
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );
inline virtual QString nodeName() const
{
return "pianoroll";
}
void setPauseIcon( bool pause );
// qproperty acces functions
QColor gridColor() const;
void setGridColor( const QColor & _c );
void setGridColor( const QColor & c );
QColor noteModeColor() const;
void setNoteModeColor( const QColor & _c );
void setNoteModeColor( const QColor & c );
QColor noteColor() const;
void setNoteColor( const QColor & _c );
void setNoteColor( const QColor & c );
QColor barColor() const;
void setBarColor( const QColor & _c );
void setBarColor( const QColor & c );
protected:
virtual void closeEvent( QCloseEvent * _ce );
virtual void keyPressEvent( QKeyEvent * _ke );
virtual void keyReleaseEvent( QKeyEvent * _ke );
virtual void leaveEvent( QEvent * _e );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void mouseDoubleClickEvent( QMouseEvent * _me );
virtual void mouseReleaseEvent( QMouseEvent * _me );
virtual void mouseMoveEvent( QMouseEvent * _me );
virtual void paintEvent( QPaintEvent * _pe );
virtual void resizeEvent( QResizeEvent * _re );
virtual void wheelEvent( QWheelEvent * _we );
virtual void keyPressEvent( QKeyEvent * ke );
virtual void keyReleaseEvent( QKeyEvent * ke );
virtual void leaveEvent( QEvent * e );
virtual void mousePressEvent( QMouseEvent * me );
virtual void mouseDoubleClickEvent( QMouseEvent * me );
virtual void mouseReleaseEvent( QMouseEvent * me );
virtual void mouseMoveEvent( QMouseEvent * me );
virtual void paintEvent( QPaintEvent * pe );
virtual void resizeEvent( QResizeEvent * re );
virtual void wheelEvent( QWheelEvent * we );
int getKey( int _y ) const;
static inline void drawNoteRect( QPainter & _p, int _x, int _y,
int _width, Note * _n, const QColor & noteCol );
int getKey( int y ) const;
static inline void drawNoteRect( QPainter & p, int x, int y,
int width, Note * n, const QColor & noteCol );
void removeSelection();
void selectAll();
void getSelectedNotes( NoteVector & _selected_notes );
void getSelectedNotes( NoteVector & selected_notes );
// for entering values with dblclick in the vol/pan bars
void enterValue( NoteVector* nv );
@@ -137,24 +134,21 @@ protected slots:
void recordAccompany();
void stop();
void startRecordNote( const Note & _n );
void finishRecordNote( const Note & _n );
void startRecordNote( const Note & n );
void finishRecordNote( const Note & n );
void horScrolled( int _new_pos );
void verScrolled( int _new_pos );
void horScrolled( int new_pos );
void verScrolled( int new_pos );
void drawButtonToggled();
void eraseButtonToggled();
void selectButtonToggled();
void detuneButtonToggled();
void setEditMode(int mode);
void copySelectedNotes();
void cutSelectedNotes();
void pasteNotes();
void deleteSelectedNotes();
void updatePosition( const MidiTime & _t );
void updatePositionAccompany( const MidiTime & _t );
void updatePosition(const MidiTime & t );
void updatePositionAccompany(const MidiTime & t );
void zoomingChanged();
void quantizeChanged();
@@ -174,15 +168,7 @@ signals:
private:
enum editModes
{
ModeDraw,
ModeErase,
ModeSelect,
ModeEditDetuning,
};
enum actions
enum Actions
{
ActionNone,
ActionMoveNote,
@@ -192,14 +178,14 @@ private:
ActionResizeNoteEditArea
};
enum noteEditMode
enum NoteEditMode
{
NoteEditVolume,
NoteEditPanning,
NoteEditCount // make sure this one is always last
};
enum semiToneMarkerAction
enum SemiToneMarkerAction
{
stmaUnmarkAll,
stmaMarkCurrentSemiTone,
@@ -224,7 +210,7 @@ private:
PianoRoll( const PianoRoll & );
virtual ~PianoRoll();
void autoScroll( const MidiTime & _t );
void autoScroll(const MidiTime & t );
MidiTime newNoteLen() const;
@@ -234,7 +220,7 @@ private:
int selectionCount() const;
void testPlayNote( Note * n );
void testPlayKey( int _key, int _vol, int _pan );
void pauseTestNotes( bool _pause = true );
void pauseTestNotes(bool pause = true );
inline int noteEditTop() const;
inline int keyAreaBottom() const;
@@ -264,28 +250,6 @@ private:
static TextFloat * s_textFloat;
QWidget * m_toolBar;
ToolButton * m_playButton;
ToolButton * m_recordButton;
ToolButton * m_recordAccompanyButton;
ToolButton * m_stopButton;
ToolButton * m_drawButton;
ToolButton * m_eraseButton;
ToolButton * m_selectButton;
ToolButton * m_detuneButton;
ToolButton * m_cutButton;
ToolButton * m_copyButton;
ToolButton * m_pasteButton;
ComboBox * m_zoomingComboBox;
ComboBox * m_quantizeComboBox;
ComboBox * m_noteLenComboBox;
ComboBox * m_scaleComboBox;
ComboBox * m_chordComboBox;
ComboBoxModel m_zoomingModel;
ComboBoxModel m_quantizeModel;
ComboBoxModel m_noteLenModel;
@@ -293,7 +257,6 @@ private:
ComboBoxModel m_chordModel;
Pattern* m_pattern;
QScrollBar * m_leftRightScroll;
QScrollBar * m_topBottomScroll;
@@ -303,8 +266,8 @@ private:
QList<Note> m_recordingNotes;
Note * m_currentNote;
actions m_action;
noteEditMode m_noteEditMode;
Actions m_action;
NoteEditMode m_noteEditMode;
int m_selectStartTick;
int m_selectedTick;
@@ -344,16 +307,16 @@ private:
int m_startKey; // first key when drawing
int m_lastKey;
editModes m_editMode;
editModes m_ctrlMode; // mode they were in before they hit ctrl
EditModes m_editMode;
EditModes m_ctrlMode; // mode they were in before they hit ctrl
bool m_mouseDownLeft; //true if left click is being held down
bool m_mouseDownRight; //true if right click is being held down
Timeline * m_timeLine;
TimeLineWidget * m_timeLine;
bool m_scrollBack;
void copy_to_clipboard( const NoteVector & _notes ) const;
void copy_to_clipboard(const NoteVector & notes ) const;
void drawDetuningInfo( QPainter & _p, Note * _n, int _x, int _y );
bool mouseOverNote();
@@ -367,6 +330,7 @@ private:
bool m_startedWithShift;
friend class Engine;
friend class PianoRollWindow;
// qproperty fields
QColor m_gridColor;
@@ -380,5 +344,54 @@ signals:
} ;
class PianoRollWindow : public Editor, SerializingObject
{
Q_OBJECT
public:
PianoRollWindow();
const Pattern* currentPattern() const;
void setCurrentPattern(Pattern* pattern);
int quantization() const;
void play();
void stop();
void record();
void recordAccompany();
void stopRecording();
bool isRecording() const;
/*! \brief Resets settings to default when e.g. creating a new project */
void reset();
using SerializingObject::saveState;
using SerializingObject::restoreState;
virtual void saveSettings(QDomDocument & doc, QDomElement & de );
virtual void loadSettings( const QDomElement & de );
inline virtual QString nodeName() const
{
return "pianoroll";
}
QSize sizeHint() const;
signals:
void currentPatternChanged();
private:
PianoRoll* m_editor;
ComboBox * m_zoomingComboBox;
ComboBox * m_quantizeComboBox;
ComboBox * m_noteLenComboBox;
ComboBox * m_scaleComboBox;
ComboBox * m_chordComboBox;
};
#endif

View File

@@ -37,7 +37,7 @@
class AutomationTrack;
class Pattern;
class Timeline;
class TimeLineWidget;
const bpm_t MinTempo = 10;
@@ -84,7 +84,7 @@ public:
{
return m_currentFrame;
}
Timeline * m_timeLine;
TimeLineWidget * m_timeLine;
bool m_timeLineUpdate;
private:

View File

@@ -27,6 +27,7 @@
#ifndef SONG_EDITOR_H
#define SONG_EDITOR_H
#include "Editor.h"
#include "TrackContainerView.h"
class QLabel;
@@ -34,12 +35,12 @@ class QScrollBar;
class AutomatableSlider;
class ComboBox;
class ComboBoxModel;
class LcdSpinBox;
class MeterDialog;
class Song;
class TextFloat;
class Timeline;
class ToolButton;
class TimeLineWidget;
class positionLine : public QWidget
{
@@ -56,34 +57,37 @@ class SongEditor : public TrackContainerView
{
Q_OBJECT
public:
enum EditMode
{
DrawMode,
SelectMode
};
SongEditor( Song * _song );
virtual ~SongEditor();
void setPauseIcon( bool pause );
~SongEditor();
public slots:
void scrolled( int _new_pos );
void setEditMode(EditMode mode);
void setEditModeDraw();
void setEditModeSelect();
protected:
virtual void closeEvent( QCloseEvent * _ce );
private slots:
void setHighQuality( bool );
void play();
void record();
void recordAccompany();
void stop();
void setMasterVolume( int _new_val );
void showMasterVolumeFloat();
void updateMasterVolumeFloat( int _new_val );
void hideMasterVolumeFloat();
void masterVolumeChanged( int _new_val );
void masterVolumePressed();
void masterVolumeMoved( int _new_val );
void masterVolumeReleased();
void masterPitchChanged( int _new_val );
void masterPitchPressed();
void masterPitchMoved( int _new_val );
void masterPitchReleased();
void setMasterPitch( int _new_val );
void showMasterPitchFloat();
void updateMasterPitchFloat( int _new_val );
void hideMasterPitchFloat();
void updateScrollBar( int );
void updatePosition( const MidiTime & _t );
@@ -104,15 +108,9 @@ private:
QScrollBar * m_leftRightScroll;
QWidget * m_toolBar;
ToolButton * m_playButton;
ToolButton * m_recordButton;
ToolButton * m_recordAccompanyButton;
ToolButton * m_stopButton;
LcdSpinBox * m_tempoSpinBox;
Timeline * m_timeLine;
TimeLineWidget * m_timeLine;
MeterDialog * m_timeSigDisplay;
AutomatableSlider * m_masterVolumeSlider;
@@ -121,22 +119,44 @@ private:
TextFloat * m_mvsStatus;
TextFloat * m_mpsStatus;
ToolButton * m_addBBTrackButton;
ToolButton * m_addSampleTrackButton;
ToolButton * m_addAutomationTrackButton;
ToolButton * m_drawModeButton;
ToolButton * m_editModeButton;
ComboBox * m_zoomingComboBox;
positionLine * m_positionLine;
ComboBoxModel* m_zoomingModel;
bool m_scrollBack;
bool m_smoothScroll;
EditMode m_mode;
friend class SongEditorWindow;
} ;
class SongEditorWindow : public Editor
{
Q_OBJECT
public:
SongEditorWindow(Song* song);
QSize sizeHint() const;
SongEditor* m_editor;
protected slots:
void play();
void record();
void recordAccompany();
void stop();
private:
QAction* m_addBBTrackAction;
QAction* m_addSampleTrackAction;
QAction* m_addAutomationTrackAction;
QAction* m_drawModeAction;
QAction* m_selectModeAction;
ComboBox * m_zoomingComboBox;
};
#endif

View File

@@ -1,5 +1,5 @@
/*
* Timeline.h - class timeLine, representing a time-line with position marker
* TimeLineWidget.h - class timeLine, representing a time-line with position marker
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
@@ -32,11 +32,12 @@
class QPixmap;
class QToolBar;
class NStateButton;
class TextFloat;
class Timeline : public QWidget, public JournallingObject
class TimeLineWidget : public QWidget, public JournallingObject
{
Q_OBJECT
public:
@@ -60,9 +61,9 @@ public:
} ;
Timeline( int _xoff, int _yoff, float _ppt, Song::playPos & _pos,
TimeLineWidget( int _xoff, int _yoff, float _ppt, Song::playPos & _pos,
const MidiTime & _begin, QWidget * _parent );
virtual ~Timeline();
virtual ~TimeLineWidget();
inline Song::playPos & pos()
{
@@ -111,7 +112,7 @@ public:
update();
}
void addToolButtons( QWidget * _tool_bar );
void addToolButtons(QToolBar* _tool_bar );
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );

View File

@@ -34,48 +34,16 @@ class ToolButton : public QToolButton
{
Q_OBJECT
public:
ToolButton( const QPixmap & _pixmap, const QString & _tooltip,
QObject * _receiver, const char * _slot,
QWidget * _parent );
ToolButton(const QPixmap & _pixmap, const QString & _tooltip,
QObject * _receiver=nullptr, const char * _slot=nullptr,
QWidget * _parent=nullptr);
inline ToolButton( QWidget * _parent ) :
QToolButton( _parent ),
m_colorStandard( s_stdColor ),
m_colorHighlighted( s_hlColor )
{
// setup colors
leaveEvent( NULL );
}
inline ToolButton(QWidget * _parent) :
QToolButton(_parent)
{ }
virtual ~ToolButton();
inline void setStandardColor( const QColor & _color )
{
m_colorStandard = _color;
}
inline void setHighlightedColor( const QColor & _color )
{
m_colorHighlighted = _color;
}
protected:
virtual void enterEvent( QEvent * _ev );
virtual void leaveEvent( QEvent * _ev );
private slots:
void toggledBool( bool _on );
private:
static const QColor s_stdColor;
static const QColor s_hlColor;
QColor m_colorStandard;
QColor m_colorHighlighted;
} ;
#endif

View File

@@ -26,6 +26,7 @@
#include "Fader.h"
#include "EffectControls.h"
#include "MainWindow.h"
#include "GuiApplication.h"
#include "qwidget.h"
#include "TextFloat.h"
#include "qlist.h"
@@ -46,7 +47,7 @@ public:
resize( 23, 116 );
m_lPeak = lPeak;
m_rPeak = rPeak;
connect( Engine::mainWindow(), SIGNAL( periodicUpdate() ), this, SLOT( updateVuMeters() ) );
connect( gui->mainWindow(), SIGNAL( periodicUpdate() ), this, SLOT( updateVuMeters() ) );
m_model = model;
setPeak_L( 0 );
setPeak_R( 0 );

View File

@@ -37,6 +37,7 @@
#include "ConfigManager.h"
#include "Pattern.h"
#include "Instrument.h"
#include "GuiApplication.h"
#include "MainWindow.h"
#include "MidiTime.h"
#include "debug.h"
@@ -99,7 +100,7 @@ bool MidiImport::tryImport( TrackContainer* tc )
if( Engine::hasGUI() &&
ConfigManager::inst()->defaultSoundfont().isEmpty() )
{
QMessageBox::information( Engine::mainWindow(),
QMessageBox::information( gui->mainWindow(),
tr( "Setup incomplete" ),
tr( "You do not have set up a default soundfont in "
"the settings dialog (Edit->Settings). "
@@ -111,7 +112,7 @@ bool MidiImport::tryImport( TrackContainer* tc )
#else
if( Engine::hasGUI() )
{
QMessageBox::information( Engine::mainWindow(),
QMessageBox::information( gui->mainWindow(),
tr( "Setup incomplete" ),
tr( "You did not compile LMMS with support for "
"SoundFont2 player, which is used to add default "
@@ -268,7 +269,7 @@ bool MidiImport::readSMF( TrackContainer* tc )
const int preTrackSteps = 2;
QProgressDialog pd( TrackContainer::tr( "Importing MIDI-file..." ),
TrackContainer::tr( "Cancel" ), 0, preTrackSteps, Engine::mainWindow() );
TrackContainer::tr( "Cancel" ), 0, preTrackSteps, gui->mainWindow() );
pd.setWindowTitle( TrackContainer::tr( "Please wait..." ) );
pd.setWindowModality(Qt::WindowModal);
pd.setMinimumDuration( 0 );

View File

@@ -27,6 +27,7 @@
#include "SpectrumAnalyzer.h"
#include "MainWindow.h"
#include "GuiApplication.h"
#include "LedCheckbox.h"
#include "embed.h"
@@ -59,7 +60,7 @@ public:
m_background( PLUGIN_NAME::getIconPixmap( "spectrum_background" ).toImage() )
{
setFixedSize( 249, 151 );
connect( Engine::mainWindow(), SIGNAL( periodicUpdate() ), this, SLOT( update() ) );
connect( gui->mainWindow(), SIGNAL( periodicUpdate() ), this, SLOT( update() ) );
setAttribute( Qt::WA_OpaquePaintEvent, true );
}

View File

@@ -28,6 +28,7 @@
#include "VstEffect.h"
#include "MainWindow.h"
#include "GuiApplication.h"
#include <QMdiArea>
#include <QApplication>
@@ -309,7 +310,7 @@ manageVSTEffectView::manageVSTEffectView( VstEffect * _eff, VstEffectControls *
m_vi->m_scrollArea = new QScrollArea( widget );
l = new QGridLayout( widget );
m_vi->m_subWindow = Engine::mainWindow()->workspace()->addSubWindow(new QMdiSubWindow, Qt::SubWindow |
m_vi->m_subWindow = gui->mainWindow()->workspace()->addSubWindow(new QMdiSubWindow, Qt::SubWindow |
Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
m_vi->m_subWindow->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
m_vi->m_subWindow->setFixedSize( 960, 300);

View File

@@ -35,6 +35,7 @@
#include "Engine.h"
#include "Song.h"
#include "MainWindow.h"
#include "GuiApplication.h"
#include "InstrumentTrack.h"
#include "NotePlayHandle.h"
#include "interpolation.h"
@@ -241,7 +242,7 @@ void audioFileProcessor::loadSettings( const QDomElement & _this )
{
QString message = tr( "Sample not found: %1" ).arg( m_sampleBuffer.audioFile() );
Engine::mainWindow()->collectError( message );
gui->mainWindow()->collectError( message );
}
}
else if( _this.attribute( "sampledata" ) != "" )

View File

@@ -37,7 +37,7 @@ DelayControls::DelayControls( DelayEffect* effect ):
m_lfoTimeModel(2.0, 0.01, 20.0, 0.0001, 20000.0, this, tr( "Lfo Frequency" ) ),
m_lfoAmountModel(0.0, 0.0, 2.0, 0.0001, 2000.0, this, tr ( "Lfo Amount" ) )
{
connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( changeSampleRate() ) );
connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( changeSampleRate() ) );
}

View File

@@ -46,12 +46,12 @@ DelayControlsDialog::DelayControlsDialog( DelayControls *controls ) :
sampleDelayKnob->setLabel( tr( "Delay" ) );
sampleDelayKnob->setHintText( tr( "Delay Time" ) + " ", " s" );
Knob * feedbackKnob = new Knob( knobBright_26, this );
feedbackKnob->move( 63,10 );
feedbackKnob->setVolumeKnob( true) ;
feedbackKnob->setModel( &controls->m_feedbackModel);
feedbackKnob->setLabel( tr( "Regen" ) );
feedbackKnob->setHintText( tr ( "Feedback Amount" ) + " " , "" );
Knob * feedbackKnob = new Knob( knobBright_26, this );
feedbackKnob->move( 63,10 );
feedbackKnob->setVolumeKnob( true) ;
feedbackKnob->setModel( &controls->m_feedbackModel);
feedbackKnob->setLabel( tr( "Regen" ) );
feedbackKnob->setHintText( tr ( "Feedback Amount" ) + " " , "" );
TempoSyncKnob * lfoFreqKnob = new TempoSyncKnob( knobBright_26, this );
lfoFreqKnob->move( 106,10 );

View File

@@ -43,6 +43,7 @@
#include "FxMixer.h"
#include "FxMixerView.h"
#include "GroupBox.h"
#include "GuiApplication.h"
#include "Instrument.h"
#include "InstrumentTrack.h"
#include "EnvelopeAndLfoParameters.h"
@@ -1418,7 +1419,7 @@ else
{
Engine::fxMixer()->createChannel();
}
Engine::fxMixerView()->refreshDisplay();
gui->fxMixerView()->refreshDisplay();
// set global parameters
Engine::getSong()->setMasterVolume( p.mainVolume );
@@ -1426,7 +1427,7 @@ else
Engine::getSong()->setTempo( p.tempo );
// set project notes
Engine::getProjectNotes()->setText( p.projectNotes );
gui->getProjectNotes()->setText( p.projectNotes );
progressDialog.setMaximum( p.maxPatterns + p.channels.size() +

View File

@@ -38,6 +38,7 @@
#include "InstrumentTrack.h"
#include "VstPlugin.h"
#include "MainWindow.h"
#include "GuiApplication.h"
#include "PixmapButton.h"
#include "StringPairDrag.h"
#include "TextFloat.h"
@@ -873,7 +874,7 @@ manageVestigeInstrumentView::manageVestigeInstrumentView( Instrument * _instrume
widget = new QWidget(this);
l = new QGridLayout( this );
m_vi->m_subWindow = Engine::mainWindow()->workspace()->addSubWindow(new QMdiSubWindow, Qt::SubWindow |
m_vi->m_subWindow = gui->mainWindow()->workspace()->addSubWindow(new QMdiSubWindow, Qt::SubWindow |
Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
m_vi->m_subWindow->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::MinimumExpanding );
m_vi->m_subWindow->setFixedWidth( 960 );

View File

@@ -46,7 +46,7 @@
#endif
#include "ConfigManager.h"
#include "Engine.h"
#include "GuiApplication.h"
#include "MainWindow.h"
#include "Song.h"
#include "templates.h"
@@ -189,7 +189,7 @@ void VstPlugin::tryLoad( const QString &remoteVstPluginExecutable )
{
target->setFixedSize( m_pluginGeometry );
vstSubWin * sw = new vstSubWin(
Engine::mainWindow()->workspace() );
gui->mainWindow()->workspace() );
sw->setWidget( helper );
helper->setWindowTitle( name() );
m_pluginWidget = helper;
@@ -238,7 +238,7 @@ void VstPlugin::showEditor( QWidget * _parent, bool isEffect )
if( _parent == NULL )
{
vstSubWin * sw = new vstSubWin(
Engine::mainWindow()->workspace() );
gui->mainWindow()->workspace() );
if( isEffect )
{
sw->setAttribute( Qt::WA_TranslucentBackground );

View File

@@ -25,12 +25,9 @@
*/
#include <QDomElement>
#include <QMouseEvent>
#include <QPainter>
#include "AutomationPattern.h"
#include "AutomationPatternView.h"
#include "AutomationEditor.h"
#include "AutomationTrack.h"
#include "ProjectJournal.h"
#include "BBTrackContainer.h"
@@ -38,7 +35,7 @@
#include "TextFloat.h"
#include "embed.h"
int AutomationPattern::s_quantization = 1;
const float AutomationPattern::DEFAULT_MIN_VALUE = 0;
const float AutomationPattern::DEFAULT_MAX_VALUE = 1;
@@ -106,11 +103,6 @@ AutomationPattern::AutomationPattern( const AutomationPattern & _pat_to_copy ) :
AutomationPattern::~AutomationPattern()
{
if( Engine::automationEditor() &&
Engine::automationEditor()->currentPattern() == this )
{
Engine::automationEditor()->setCurrentPattern( NULL );
}
}
@@ -213,10 +205,9 @@ MidiTime AutomationPattern::putValue( const MidiTime & _time,
{
cleanObjects();
MidiTime newTime = _quant_pos && Engine::automationEditor() ?
Note::quantized( _time,
Engine::automationEditor()->quantization() ) :
_time;
MidiTime newTime = _quant_pos ?
Note::quantized( _time, quantization() ) :
_time;
m_timeMap[newTime] = _value;
timeMap::const_iterator it = m_timeMap.find( newTime );
@@ -246,10 +237,9 @@ void AutomationPattern::removeValue( const MidiTime & _time,
{
cleanObjects();
MidiTime newTime = _quant_pos && Engine::automationEditor() ?
Note::quantized( _time,
Engine::automationEditor()->quantization() ) :
_time;
MidiTime newTime = _quant_pos ?
Note::quantized( _time, quantization() ) :
_time;
m_timeMap.remove( newTime );
m_tangents.remove( newTime );
@@ -286,10 +276,9 @@ MidiTime AutomationPattern::setDragValue( const MidiTime & _time, const float _v
{
if( m_dragging == false )
{
MidiTime newTime = _quant_pos && Engine::automationEditor() ?
Note::quantized( _time,
Engine::automationEditor()->quantization() ) :
_time;
MidiTime newTime = _quant_pos ?
Note::quantized( _time, quantization() ) :
_time;
this->removeValue( newTime );
m_oldTimeMap = m_timeMap;
m_dragging = true;
@@ -440,9 +429,15 @@ void AutomationPattern::flipY( int min, int max )
}
generateTangents();
Engine::automationEditor()->update();
emit dataChanged();
}
void AutomationPattern::flipY()
{
flipY(getMin(), getMax());
}
@@ -512,7 +507,6 @@ void AutomationPattern::flipX( int length )
m_timeMap = tempMap;
generateTangents();
Engine::automationEditor()->update();
emit dataChanged();
}
@@ -810,22 +804,6 @@ void AutomationPattern::clear()
m_tangents.clear();
emit dataChanged();
if( Engine::automationEditor() &&
Engine::automationEditor()->currentPattern() == this )
{
Engine::automationEditor()->update();
}
}
void AutomationPattern::openInAutomationEditor()
{
Engine::automationEditor()->setCurrentPattern( this );
Engine::automationEditor()->parentWidget()->show();
Engine::automationEditor()->setFocus();
}

View File

@@ -24,55 +24,39 @@
#include "Engine.h"
#include "AutomationEditor.h"
#include "BBEditor.h"
#include "BBTrackContainer.h"
#include "ConfigManager.h"
#include "ControllerRackView.h"
#include "FxMixer.h"
#include "FxMixerView.h"
#include "InstrumentTrack.h"
#include "Ladspa2LMMS.h"
#include "MainWindow.h"
#include "Mixer.h"
#include "Pattern.h"
#include "PianoRoll.h"
#include "PresetPreviewPlayHandle.h"
#include "ProjectJournal.h"
#include "ProjectNotes.h"
#include "Plugin.h"
#include "SongEditor.h"
#include "Song.h"
#include "BandLimitedWave.h"
#include "GuiApplication.h"
bool Engine::s_hasGUI = true;
bool Engine::s_suppressMessages = false;
float Engine::s_framesPerTick;
Mixer* Engine::s_mixer = NULL;
FxMixer * Engine::s_fxMixer = NULL;
FxMixerView * Engine::s_fxMixerView = NULL;
MainWindow * Engine::s_mainWindow = NULL;
BBTrackContainer * Engine::s_bbTrackContainer = NULL;
Song * Engine::s_song = NULL;
SongEditor* Engine::s_songEditor = NULL;
AutomationEditor * Engine::s_automationEditor = NULL;
BBEditor * Engine::s_bbEditor = NULL;
PianoRoll* Engine::s_pianoRoll = NULL;
ProjectNotes * Engine::s_projectNotes = NULL;
ProjectJournal * Engine::s_projectJournal = NULL;
Ladspa2LMMS * Engine::s_ladspaManager = NULL;
DummyTrackContainer * Engine::s_dummyTC = NULL;
ControllerRackView * Engine::s_controllerRackView = NULL;
QMap<QString, QString> Engine::s_pluginFileHandling;
void Engine::init( const bool _has_gui )
void Engine::init()
{
s_hasGUI = _has_gui;
// generate (load from file) bandlimited wavetables
BandLimitedWave::generateWaves();
@@ -90,20 +74,6 @@ void Engine::init( const bool _has_gui )
s_mixer->initDevices();
if( s_hasGUI )
{
s_mainWindow = new MainWindow;
s_songEditor = new SongEditor( s_song );
s_fxMixerView = new FxMixerView;
s_controllerRackView = new ControllerRackView;
s_projectNotes = new ProjectNotes;
s_bbEditor = new BBEditor( s_bbTrackContainer );
s_pianoRoll = new PianoRoll;
s_automationEditor = new AutomationEditor;
s_mainWindow->finalize();
}
PresetPreviewPlayHandle::init();
s_dummyTC = new DummyTrackContainer;
@@ -118,15 +88,7 @@ void Engine::destroy()
s_projectJournal->stopAllJournalling();
s_mixer->stopProcessing();
deleteHelper( &s_projectNotes );
deleteHelper( &s_songEditor );
deleteHelper( &s_bbEditor );
deleteHelper( &s_pianoRoll );
deleteHelper( &s_automationEditor );
deleteHelper( &s_fxMixerView );
PresetPreviewPlayHandle::cleanup();
InstrumentTrackView::cleanupWindowCache();
s_song->clearProject();
@@ -141,13 +103,16 @@ void Engine::destroy()
//delete ConfigManager::inst();
deleteHelper( &s_projectJournal );
s_mainWindow = NULL;
deleteHelper( &s_song );
delete ConfigManager::inst();
}
bool Engine::hasGUI()
{
return gui != nullptr;
}

View File

@@ -37,6 +37,7 @@
#include "Engine.h"
#include "ConfigManager.h"
#include "SamplePlayHandle.h"
#include "GuiApplication.h"
#include "PianoRoll.h"
// platform-specific audio-interface-classes
@@ -323,7 +324,7 @@ const surroundSampleFrame * Mixer::renderNextBuffer()
Song::playPos p = Engine::getSong()->getPlayPos(
Song::Mode_PlayPattern );
if( Engine::getSong()->playMode() == Song::Mode_PlayPattern &&
Engine::pianoRoll()->isRecording() == true &&
gui->pianoRoll()->isRecording() == true &&
p != last_metro_pos )
{
if ( p.getTicks() % (MidiTime::ticksPerTact() / 1 ) == 0 )

View File

@@ -209,14 +209,6 @@ void Note::loadSettings( const QDomElement & _this )
void Note::editDetuningPattern()
{
createDetuning();
m_detuning->automationPattern()->openInAutomationEditor();
}
void Note::createDetuning()
{

View File

@@ -30,6 +30,7 @@
#include "Plugin.h"
#include "embed.h"
#include "Engine.h"
#include "GuiApplication.h"
#include "Mixer.h"
#include "ConfigManager.h"
#include "DummyPlugin.h"
@@ -127,7 +128,7 @@ Plugin * Plugin::instantiate( const QString & pluginName, Model * parent,
void Plugin::collectErrorForUI( QString err_msg )
{
Engine::mainWindow()->collectError( err_msg );
gui->mainWindow()->collectError( err_msg );
}

View File

@@ -22,6 +22,8 @@
*
*/
#include "Song.h"
#include <QCoreApplication>
#include <QFile>
#include <QFileInfo>
@@ -30,7 +32,6 @@
#include <math.h>
#include "Song.h"
#include "AutomationTrack.h"
#include "AutomationEditor.h"
#include "BBEditor.h"
@@ -44,6 +45,7 @@
#include "ExportProjectDialog.h"
#include "FxMixer.h"
#include "FxMixerView.h"
#include "GuiApplication.h"
#include "ImportFilter.h"
#include "InstrumentTrack.h"
#include "MainWindow.h"
@@ -60,7 +62,7 @@
#include "SongEditor.h"
#include "templates.h"
#include "TextFloat.h"
#include "Timeline.h"
#include "TimeLineWidget.h"
#include "PeakController.h"
@@ -181,7 +183,7 @@ void Song::setTimeSignature()
void Song::savePos()
{
Timeline * tl = m_playPos[m_playMode].m_timeLine;
TimeLineWidget * tl = m_playPos[m_playMode].m_timeLine;
if( tl != NULL )
{
@@ -248,7 +250,7 @@ void Song::processNextBuffer()
}
// check for looping-mode and act if necessary
Timeline * tl = m_playPos[m_playMode].m_timeLine;
TimeLineWidget * tl = m_playPos[m_playMode].m_timeLine;
bool check_loop = tl != NULL && m_exporting == false &&
tl->loopPointsEnabled();
if( check_loop )
@@ -586,7 +588,7 @@ void Song::stop()
return;
}
Timeline * tl = m_playPos[m_playMode].m_timeLine;
TimeLineWidget * tl = m_playPos[m_playMode].m_timeLine;
m_playing = false;
m_paused = false;
m_recording = true;
@@ -596,12 +598,12 @@ void Song::stop()
switch( tl->behaviourAtStop() )
{
case Timeline::BackToZero:
case TimeLineWidget::BackToZero:
m_playPos[m_playMode].setTicks( 0 );
m_elapsedMilliSeconds = 0;
break;
case Timeline::BackToStart:
case TimeLineWidget::BackToStart:
if( tl->savedPos() >= 0 )
{
m_playPos[m_playMode].setTicks( tl->savedPos().getTicks() );
@@ -610,7 +612,7 @@ void Song::stop()
}
break;
case Timeline::KeepStopPosition:
case TimeLineWidget::KeepStopPosition:
default:
break;
}
@@ -756,17 +758,17 @@ void Song::clearProject()
Engine::mixer()->lock();
if( Engine::getBBEditor() )
if( gui->getBBEditor() )
{
Engine::getBBEditor()->clearAllTracks();
gui->getBBEditor()->trackContainerView()->clearAllTracks();
}
if( Engine::songEditor() )
if( gui->songEditor() )
{
Engine::songEditor()->clearAllTracks();
gui->songEditor()->m_editor->clearAllTracks();
}
if( Engine::fxMixerView() )
if( gui->fxMixerView() )
{
Engine::fxMixerView()->clear();
gui->fxMixerView()->clear();
}
QCoreApplication::sendPostedEvents();
Engine::getBBTrackContainer()->clearAllTracks();
@@ -774,14 +776,14 @@ void Song::clearProject()
Engine::fxMixer()->clear();
if( Engine::automationEditor() )
if( gui->automationEditor() )
{
Engine::automationEditor()->setCurrentPattern( NULL );
gui->automationEditor()->setCurrentPattern( NULL );
}
if( Engine::pianoRoll() )
if( gui->pianoRoll() )
{
Engine::pianoRoll()->reset();
gui->pianoRoll()->reset();
}
m_tempoModel.reset();
@@ -797,9 +799,9 @@ void Song::clearProject()
Engine::mixer()->unlock();
if( Engine::getProjectNotes() )
if( gui->getProjectNotes() )
{
Engine::getProjectNotes()->clear();
gui->getProjectNotes()->clear();
}
// Move to function
@@ -878,9 +880,9 @@ void Song::createNewProject()
m_modified = false;
if( Engine::mainWindow() )
if( gui->mainWindow() )
{
Engine::mainWindow()->resetWindowTitle();
gui->mainWindow()->resetWindowTitle();
}
}
@@ -894,9 +896,9 @@ void Song::createNewProjectFromTemplate( const QString & _template )
// saving...
m_fileName = m_oldFileName = "";
// update window title
if( Engine::mainWindow() )
if( gui->mainWindow() )
{
Engine::mainWindow()->resetWindowTitle();
gui->mainWindow()->resetWindowTitle();
}
}
@@ -912,9 +914,9 @@ void Song::loadProject( const QString & _file_name )
m_loadingProject = true;
Engine::projectJournal()->setJournalling( false );
if( Engine::mainWindow() )
if( gui )
{
Engine::mainWindow()->clearErrors();
gui->mainWindow()->clearErrors();
}
m_fileName = _file_name;
@@ -963,7 +965,7 @@ void Song::loadProject( const QString & _file_name )
if( Engine::hasGUI() )
{
// refresh FxMixerView
Engine::fxMixerView()->refreshDisplay();
gui->fxMixerView()->refreshDisplay();
}
}
@@ -982,21 +984,21 @@ void Song::loadProject( const QString & _file_name )
}
else if( Engine::hasGUI() )
{
if( node.nodeName() == Engine::getControllerRackView()->nodeName() )
if( node.nodeName() == gui->getControllerRackView()->nodeName() )
{
Engine::getControllerRackView()->restoreState( node.toElement() );
gui->getControllerRackView()->restoreState( node.toElement() );
}
else if( node.nodeName() == Engine::pianoRoll()->nodeName() )
else if( node.nodeName() == gui->pianoRoll()->nodeName() )
{
Engine::pianoRoll()->restoreState( node.toElement() );
gui->pianoRoll()->restoreState( node.toElement() );
}
else if( node.nodeName() == Engine::automationEditor()->nodeName() )
else if( node.nodeName() == gui->automationEditor()->m_editor->nodeName() )
{
Engine::automationEditor()->restoreState( node.toElement() );
gui->automationEditor()->m_editor->restoreState( node.toElement() );
}
else if( node.nodeName() == Engine::getProjectNotes()->nodeName() )
else if( node.nodeName() == gui->getProjectNotes()->nodeName() )
{
Engine::getProjectNotes()->SerializingObject::restoreState( node.toElement() );
gui->getProjectNotes()->SerializingObject::restoreState( node.toElement() );
}
else if( node.nodeName() == m_playPos[Mode_PlaySong].m_timeLine->nodeName() )
{
@@ -1027,17 +1029,17 @@ void Song::loadProject( const QString & _file_name )
emit projectLoaded();
if( Engine::mainWindow() )
if( gui )
{
Engine::mainWindow()->showErrors( tr( "The following errors occured while loading: " ) );
gui->mainWindow()->showErrors( tr( "The following errors occured while loading: " ) );
}
m_loadingProject = false;
m_modified = false;
if( Engine::mainWindow() )
if( gui->mainWindow() )
{
Engine::mainWindow()->resetWindowTitle();
gui->mainWindow()->resetWindowTitle();
}
}
@@ -1060,10 +1062,10 @@ bool Song::saveProjectFile( const QString & _filename )
Engine::fxMixer()->saveState( dataFile, dataFile.content() );
if( Engine::hasGUI() )
{
Engine::getControllerRackView()->saveState( dataFile, dataFile.content() );
Engine::pianoRoll()->saveState( dataFile, dataFile.content() );
Engine::automationEditor()->saveState( dataFile, dataFile.content() );
Engine::getProjectNotes()->SerializingObject::saveState( dataFile, dataFile.content() );
gui->getControllerRackView()->saveState( dataFile, dataFile.content() );
gui->pianoRoll()->saveState( dataFile, dataFile.content() );
gui->automationEditor()->m_editor->saveState( dataFile, dataFile.content() );
gui->getProjectNotes()->SerializingObject::saveState( dataFile, dataFile.content() );
m_playPos[Mode_PlaySong].m_timeLine->saveState( dataFile, dataFile.content() );
}
@@ -1088,7 +1090,7 @@ bool Song::guiSaveProject()
2000 );
ConfigManager::inst()->addRecentlyOpenedProject( m_fileName );
m_modified = false;
Engine::mainWindow()->resetWindowTitle();
gui->mainWindow()->resetWindowTitle();
}
else if( Engine::hasGUI() )
{
@@ -1191,7 +1193,7 @@ void Song::exportProject(bool multiExport)
{
if( isEmpty() )
{
QMessageBox::information( Engine::mainWindow(),
QMessageBox::information( gui->mainWindow(),
tr( "Empty project" ),
tr( "This project is empty so exporting makes "
"no sense. Please put some items into "
@@ -1199,7 +1201,7 @@ void Song::exportProject(bool multiExport)
return;
}
FileDialog efd( Engine::mainWindow() );
FileDialog efd( gui->mainWindow() );
if (multiExport)
{
efd.setFileMode( FileDialog::Directory);
@@ -1259,7 +1261,7 @@ void Song::exportProject(bool multiExport)
}
const QString export_file_name = efd.selectedFiles()[0] + suffix;
ExportProjectDialog epd( export_file_name, Engine::mainWindow(), multiExport );
ExportProjectDialog epd( export_file_name, gui->mainWindow(), multiExport );
epd.exec();
}
}
@@ -1280,10 +1282,10 @@ void Song::setModified()
if( !m_loadingProject )
{
m_modified = true;
if( Engine::mainWindow() &&
QThread::currentThread() == Engine::mainWindow()->thread() )
if( Engine::hasGUI() && gui->mainWindow() &&
QThread::currentThread() == gui->mainWindow()->thread() )
{
Engine::mainWindow()->resetWindowTitle();
gui->mainWindow()->resetWindowTitle();
}
}
}

View File

@@ -56,6 +56,7 @@
#include "Clipboard.h"
#include "embed.h"
#include "Engine.h"
#include "GuiApplication.h"
#include "gui_templates.h"
#include "InstrumentTrack.h"
#include "MainWindow.h"
@@ -1122,7 +1123,7 @@ void TrackContentWidget::update()
*/
void TrackContentWidget::changePosition( const MidiTime & _new_pos )
{
if( m_trackView->trackContainerView() == Engine::getBBEditor() )
if( m_trackView->trackContainerView() == gui->getBBEditor()->trackContainerView() )
{
const int cur_bb = Engine::getBBTrackContainer()->currentBB();
setUpdatesEnabled( false );
@@ -1459,7 +1460,7 @@ void TrackContentWidget::paintEvent( QPaintEvent * _pe )
int ppt = static_cast<int>( tcv->pixelsPerTact() );
QPainter p( this );
// Don't draw background on BB-Editor
if( m_trackView->trackContainerView() != Engine::getBBEditor() )
if( m_trackView->trackContainerView() != gui->getBBEditor()->trackContainerView() )
{
p.drawTiledPixmap( rect(), m_background, QPoint(
tcv->currentPosition().getTact() * ppt, 0 ) );

View File

@@ -30,7 +30,7 @@
#include "TrackContainer.h"
#include "InstrumentTrack.h"
#include "Engine.h"
#include "GuiApplication.h"
#include "MainWindow.h"
#include "Song.h"
@@ -89,7 +89,7 @@ void TrackContainer::loadSettings( const QDomElement & _this )
pd = new QProgressDialog( tr( "Loading project..." ),
tr( "Cancel" ), 0,
_this.childNodes().count(),
Engine::mainWindow() );
gui->mainWindow() );
pd->setWindowModality( Qt::ApplicationModal );
pd->setWindowTitle( tr( "Please wait..." ) );
pd->show();

View File

@@ -32,8 +32,8 @@
#include <stdlib.h>
#include "debug.h"
#include "Engine.h"
#include "GuiApplication.h"
#include "templates.h"
#include "gui_templates.h"
#include "ConfigManager.h"
@@ -106,7 +106,7 @@ void AudioJack::restartAfterZombified()
{
m_active = false;
startProcessing();
QMessageBox::information( Engine::mainWindow(),
QMessageBox::information( gui->mainWindow(),
tr( "JACK client restarted" ),
tr( "LMMS was kicked by JACK for some reason. "
"Therefore the JACK backend of LMMS has been "
@@ -115,7 +115,7 @@ void AudioJack::restartAfterZombified()
}
else
{
QMessageBox::information( Engine::mainWindow(),
QMessageBox::information( gui->mainWindow(),
tr( "JACK server down" ),
tr( "The JACK server seems to have been shutdown "
"and starting a new instance failed. "

View File

@@ -69,6 +69,7 @@
#include "NotePlayHandle.h"
#include "embed.h"
#include "Engine.h"
#include "GuiApplication.h"
#include "LmmsStyle.h"
#include "ImportFilter.h"
#include "MainWindow.h"
@@ -102,7 +103,7 @@ int main( int argc, char * * argv )
// initialize memory managers
MemoryManager::init();
NotePlayHandleManager::init();
// intialize RNG
srand( getpid() + time( 0 ) );
@@ -418,28 +419,7 @@ int main( int argc, char * * argv )
if( render_out.isEmpty() )
{
// init style and palette
LmmsStyle * lmmsstyle = new LmmsStyle();
QApplication::setStyle( lmmsstyle );
LmmsPalette * lmmspal = new LmmsPalette( NULL, lmmsstyle );
QPalette lpal = lmmspal->palette();
QApplication::setPalette( lpal );
LmmsStyle::s_palette = &lpal;
// show splash screen
QSplashScreen splashScreen( embed::getIconPixmap( "splash" ) );
splashScreen.show();
splashScreen.showMessage( MainWindow::tr( "Version %1" ).arg( LMMS_VERSION ),
Qt::AlignRight | Qt::AlignBottom, Qt::white );
qApp->processEvents();
// init central engine which handles all components of LMMS
Engine::init();
splashScreen.hide();
new GuiApplication();
// re-intialize RNG - shared libraries might have srand() or
// srandom() calls in their init procedure
@@ -449,7 +429,7 @@ int main( int argc, char * * argv )
QString recoveryFile = ConfigManager::inst()->recoveryFile();
if( QFileInfo(recoveryFile).exists() &&
QMessageBox::question( Engine::mainWindow(), MainWindow::tr( "Project recovery" ),
QMessageBox::question( gui->mainWindow(), MainWindow::tr( "Project recovery" ),
MainWindow::tr( "It looks like the last session did not end properly. "
"Do you want to recover the project of this session?" ),
QMessageBox::Yes | QMessageBox::No ) == QMessageBox::Yes )
@@ -460,10 +440,10 @@ int main( int argc, char * * argv )
// we try to load given file
if( !file_to_load.isEmpty() )
{
Engine::mainWindow()->show();
gui->mainWindow()->show();
if( fullscreen )
{
Engine::mainWindow()->showMaximized();
gui->mainWindow()->showMaximized();
}
if( file_to_load == recoveryFile )
{
@@ -482,10 +462,10 @@ int main( int argc, char * * argv )
return 0;
}
Engine::mainWindow()->show();
gui->mainWindow()->show();
if( fullscreen )
{
Engine::mainWindow()->showMaximized();
gui->mainWindow()->showMaximized();
}
}
else
@@ -494,17 +474,18 @@ int main( int argc, char * * argv )
// [Settel] workaround: showMaximized() doesn't work with
// FVWM2 unless the window is already visible -> show() first
Engine::mainWindow()->show();
gui->mainWindow()->show();
if( fullscreen )
{
Engine::mainWindow()->showMaximized();
gui->mainWindow()->showMaximized();
}
}
}
else
{
// we're going to render our song
Engine::init( false );
Engine::init();
printf( "loading project...\n" );
Engine::getSong()->loadProject( file_to_load );
@@ -536,9 +517,9 @@ int main( int argc, char * * argv )
const int ret = app->exec();
delete app;
// cleanup memory managers
MemoryManager::cleanup();
return( ret );
}

View File

@@ -2,7 +2,7 @@
* AboutDialog.cpp - implementation of about-dialog
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
*
* This file is part of LMMS - http://lmms.io
*
* This program is free software; you can redistribute it and/or
@@ -26,14 +26,12 @@
#include "lmmsversion.h"
#include "AboutDialog.h"
#include "embed.h"
#include "Engine.h"
#include "MainWindow.h"
#include "versioninfo.h"
AboutDialog::AboutDialog() :
QDialog( Engine::mainWindow() ),
AboutDialog::AboutDialog(QWidget* parent) :
QDialog(parent),
Ui::AboutDialog()
{
setupUi( this );

55
src/gui/ActionGroup.cpp Normal file
View File

@@ -0,0 +1,55 @@
/*
* Editor.h - declaration of Editor class
*
* Copyright (c) 2014 Lukas W <lukaswhl/at/gmail.com>
*
* This file is part of LMMS - http://lmms.io
*
* 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.
*
* 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 (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#include "ActionGroup.h"
ActionGroup::ActionGroup(QObject* parent) : QActionGroup(parent)
{
connect(this, SIGNAL(triggered(QAction*)), this, SLOT(actionTriggered_(QAction*)));
}
QAction* ActionGroup::addAction(QAction* a)
{
a->setCheckable(true);
return QActionGroup::addAction(a);
}
QAction* ActionGroup::addAction(const QString& text)
{
return addAction(new QAction(text, this));
}
QAction* ActionGroup::addAction(const QIcon& icon, const QString& text)
{
return addAction(new QAction(icon, text, this));
}
void ActionGroup::actionTriggered_(QAction* action)
{
Q_ASSERT(action != 0);
Q_ASSERT(actions().contains(action));
emit triggered(actions().indexOf(action));
}

View File

@@ -30,9 +30,12 @@
#include "ControllerConnectionDialog.h"
#include "ControllerConnection.h"
#include "embed.h"
#include "GuiApplication.h"
#include "MainWindow.h"
#include "StringPairDrag.h"
#include "AutomationEditor.h"
AutomatableModelView::AutomatableModelView( ::Model* model, QWidget* _this ) :
@@ -177,7 +180,7 @@ void AutomatableModelViewSlots::execConnectionDialog()
AutomatableModel* m = m_amv->modelUntyped();
m->displayName();
ControllerConnectionDialog d( (QWidget*) Engine::mainWindow(), m );
ControllerConnectionDialog d( gui->mainWindow(), m );
if( d.exec() == 1 )
{
@@ -224,7 +227,9 @@ void AutomatableModelViewSlots::removeConnection()
void AutomatableModelViewSlots::editSongGlobalAutomation()
{
AutomationPattern::globalAutomationPattern( m_amv->modelUntyped() )->openInAutomationEditor();
gui->automationEditor()->open(
AutomationPattern::globalAutomationPattern(m_amv->modelUntyped())
);
}

View File

@@ -30,7 +30,7 @@
#include "AutomationEditor.h"
#include "AutomationPattern.h"
#include "embed.h"
#include "Engine.h"
#include "GuiApplication.h"
#include "gui_templates.h"
#include "ProjectJournal.h"
#include "RenameDialog.h"
@@ -49,7 +49,7 @@ AutomationPatternView::AutomationPatternView( AutomationPattern * _pattern,
{
connect( m_pat, SIGNAL( dataChanged() ),
this, SLOT( update() ) );
connect( Engine::automationEditor(), SIGNAL( currentPatternChanged() ),
connect( gui->automationEditor(), SIGNAL( currentPatternChanged() ),
this, SLOT( update() ) );
setAttribute( Qt::WA_OpaquePaintEvent, true );
@@ -122,9 +122,9 @@ void AutomationPatternView::disconnectObject( QAction * _a )
update();
//If automation editor is opened, update its display after disconnection
if( Engine::automationEditor() )
if( gui->automationEditor() )
{
Engine::automationEditor()->updateAfterPatternChange();
gui->automationEditor()->m_editor->updateAfterPatternChange();
}
//if there is no more connection connected to the AutomationPattern
@@ -229,7 +229,7 @@ void AutomationPatternView::mouseDoubleClickEvent( QMouseEvent * _me )
_me->ignore();
return;
}
m_pat->openInAutomationEditor();
gui->automationEditor()->open(m_pat);
}
@@ -273,7 +273,7 @@ void AutomationPatternView::paintEvent( QPaintEvent * )
lingrad.setColorAt( 0, c );
p.setBrush( lingrad );
if( Engine::automationEditor()->currentPattern() == m_pat )
if( gui->automationEditor()->currentPattern() == m_pat )
p.setPen( c.lighter( 160 ) );
else
p.setPen( c.lighter( 130 ) );
@@ -356,7 +356,7 @@ void AutomationPatternView::paintEvent( QPaintEvent * )
// outer edge
p.setBrush( QBrush() );
if( Engine::automationEditor()->currentPattern() == m_pat )
if( gui->automationEditor()->currentPattern() == m_pat )
p.setPen( c.lighter( 130 ) );
else
p.setPen( c.darker( 300 ) );
@@ -417,10 +417,10 @@ void AutomationPatternView::dropEvent( QDropEvent * _de )
}
update();
if( Engine::automationEditor() &&
Engine::automationEditor()->currentPattern() == m_pat )
if( gui->automationEditor() &&
gui->automationEditor()->currentPattern() == m_pat )
{
Engine::automationEditor()->setCurrentPattern( m_pat );
gui->automationEditor()->setCurrentPattern( m_pat );
}
}
else

View File

@@ -28,7 +28,7 @@
#include "ExportProjectDialog.h"
#include "Song.h"
#include "Engine.h"
#include "GuiApplication.h"
#include "MainWindow.h"
#include "BBTrackContainer.h"
#include "BBTrack.h"
@@ -282,7 +282,7 @@ void ExportProjectDialog::render( ProjectRenderer* renderer )
connect( renderer, SIGNAL( progressChanged( int ) ), progressBar, SLOT( setValue( int ) ) );
connect( renderer, SIGNAL( progressChanged( int ) ), this, SLOT( updateTitleBar( int ) )) ;
connect( renderer, SIGNAL( finished() ), this, SLOT( accept() ) );
connect( renderer, SIGNAL( finished() ), Engine::mainWindow(), SLOT( resetWindowTitle() ) );
connect( renderer, SIGNAL( finished() ), gui->mainWindow(), SLOT( resetWindowTitle() ) );
renderer->startProcessing();
}
@@ -341,6 +341,6 @@ void ExportProjectDialog::startBtnClicked()
void ExportProjectDialog::updateTitleBar( int _prog )
{
Engine::mainWindow()->setWindowTitle(
gui->mainWindow()->setWindowTitle(
tr( "Rendering: %1%" ).arg( _prog ) );
}

View File

@@ -38,6 +38,7 @@
#include "debug.h"
#include "embed.h"
#include "Engine.h"
#include "GuiApplication.h"
#include "gui_templates.h"
#include "ImportFilter.h"
#include "Instrument.h"
@@ -549,7 +550,7 @@ void FileBrowserTreeWidget::handleFile(FileItem * f, InstrumentTrack * it )
switch( f->handling() )
{
case FileItem::LoadAsProject:
if( Engine::mainWindow()->mayChangeProject() )
if( gui->mainWindow()->mayChangeProject() )
{
Engine::getSong()->loadProject( f->fullName() );
}
@@ -580,7 +581,7 @@ void FileBrowserTreeWidget::handleFile(FileItem * f, InstrumentTrack * it )
case FileItem::ImportAsProject:
if( f->type() == FileItem::FlpFile &&
!Engine::mainWindow()->mayChangeProject() )
!gui->mainWindow()->mayChangeProject() )
{
break;
}
@@ -663,7 +664,7 @@ void FileBrowserTreeWidget::sendToActiveInstrumentTrack( void )
{
// get all windows opened in the workspace
QList<QMdiSubWindow*> pl =
Engine::mainWindow()->workspace()->
gui->mainWindow()->workspace()->
subWindowList( QMdiArea::StackingOrder );
QListIterator<QMdiSubWindow *> w( pl );
w.toBack();

View File

@@ -41,6 +41,7 @@
#include "Knob.h"
#include "Engine.h"
#include "embed.h"
#include "GuiApplication.h"
#include "MainWindow.h"
#include "gui_templates.h"
#include "InstrumentTrack.h"
@@ -141,13 +142,13 @@ FxMixerView::FxMixerView() :
updateGeometry();
// timer for updating faders
connect( Engine::mainWindow(), SIGNAL( periodicUpdate() ),
connect( gui->mainWindow(), SIGNAL( periodicUpdate() ),
this, SLOT( updateFaders() ) );
// add ourself to workspace
QMdiSubWindow * subWin =
Engine::mainWindow()->workspace()->addSubWindow( this );
gui->mainWindow()->workspace()->addSubWindow( this );
Qt::WindowFlags flags = subWin->windowFlags();
flags &= ~Qt::WindowMaximizeButtonHint;
subWin->setWindowFlags( flags );

View File

@@ -0,0 +1,94 @@
/*
* GuiApplication.cpp
*
* Copyright (c) 2014 Lukas W <lukaswhl/at/gmail.com>
*
* This file is part of LMMS - http://lmms.io
*
* 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.
*
* 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 (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#include "GuiApplication.h"
#include "lmmsversion.h"
#include "LmmsStyle.h"
#include "LmmsPalette.h"
#include "AutomationEditor.h"
#include "BBEditor.h"
#include "ControllerRackView.h"
#include "FxMixerView.h"
#include "InstrumentTrack.h"
#include "MainWindow.h"
#include "PianoRoll.h"
#include "ProjectNotes.h"
#include "SongEditor.h"
#include <QApplication>
#include <QSplashScreen>
GuiApplication* GuiApplication::s_instance = nullptr;
GuiApplication* GuiApplication::instance()
{
return s_instance;
}
GuiApplication::GuiApplication()
{
// Init style and palette
LmmsStyle* lmmsstyle = new LmmsStyle();
QApplication::setStyle(lmmsstyle);
LmmsPalette* lmmspal = new LmmsPalette(nullptr, lmmsstyle);
QPalette* lpal = new QPalette(lmmspal->palette());
QApplication::setPalette( *lpal );
LmmsStyle::s_palette = lpal;
// Show splash screen
QSplashScreen splashScreen( embed::getIconPixmap( "splash" ) );
splashScreen.show();
splashScreen.showMessage( MainWindow::tr( "Version %1" ).arg( LMMS_VERSION ),
Qt::AlignRight | Qt::AlignBottom, Qt::white );
qApp->processEvents();
// Init central engine which handles all components of LMMS
Engine::init();
s_instance = this;
m_mainWindow = new MainWindow;
m_songEditor = new SongEditorWindow(Engine::getSong());
m_fxMixerView = new FxMixerView;
m_controllerRackView = new ControllerRackView;
m_projectNotes = new ProjectNotes;
m_bbEditor = new BBEditor(Engine::getBBTrackContainer());
m_pianoRoll = new PianoRollWindow();
m_automationEditor = new AutomationEditorWindow;
m_mainWindow->finalize();
splashScreen.finish(m_mainWindow);
}
GuiApplication::~GuiApplication()
{
InstrumentTrackView::cleanupWindowCache();
s_instance = nullptr;
}

View File

@@ -22,6 +22,7 @@
*
*/
#include "MainWindow.h"
#include <QDomElement>
#include <QUrl>
@@ -36,7 +37,7 @@
#include <QWhatsThis>
#include "lmmsversion.h"
#include "MainWindow.h"
#include "GuiApplication.h"
#include "BBEditor.h"
#include "SongEditor.h"
#include "Song.h"
@@ -530,6 +531,29 @@ void MainWindow::finalize()
SetupDialog sd( SetupDialog::AudioSettings );
sd.exec();
}
// Add editor subwindows
for (QWidget* widget : QList<QWidget*>{
gui->automationEditor(),
gui->getBBEditor(),
gui->pianoRoll(),
gui->songEditor()
})
{
QMdiSubWindow* window = workspace()->addSubWindow(widget);
window->setWindowIcon(widget->windowIcon());
window->setAttribute(Qt::WA_DeleteOnClose, false);
window->resize(widget->sizeHint());
}
gui->automationEditor()->parentWidget()->hide();
gui->getBBEditor()->parentWidget()->move( 610, 5 );
gui->getBBEditor()->parentWidget()->show();
gui->pianoRoll()->parentWidget()->move(5, 5);
gui->pianoRoll()->parentWidget()->hide();
gui->songEditor()->parentWidget()->move(5, 5);
gui->songEditor()->parentWidget()->show();
// reset window title every time we change the state of a subwindow to show the correct title
foreach( QMdiSubWindow * subWindow, workspace()->subWindowList() )
{
@@ -855,7 +879,7 @@ void MainWindow::showSettingsDialog()
void MainWindow::aboutLMMS()
{
AboutDialog().exec();
AboutDialog(this).exec();
}
@@ -912,10 +936,10 @@ void MainWindow::refocus()
{
QList<QWidget*> editors;
editors
<< Engine::songEditor()->parentWidget()
<< Engine::getBBEditor()->parentWidget()
<< Engine::pianoRoll()->parentWidget()
<< Engine::automationEditor()->parentWidget();
<< gui->songEditor()->parentWidget()
<< gui->getBBEditor()->parentWidget()
<< gui->pianoRoll()->parentWidget()
<< gui->automationEditor()->parentWidget();
bool found = false;
QList<QWidget*>::Iterator editor;
@@ -937,7 +961,7 @@ void MainWindow::refocus()
void MainWindow::toggleBBEditorWin( bool forceShow )
{
toggleWindow( Engine::getBBEditor(), forceShow );
toggleWindow( gui->getBBEditor(), forceShow );
}
@@ -945,7 +969,7 @@ void MainWindow::toggleBBEditorWin( bool forceShow )
void MainWindow::toggleSongEditorWin()
{
toggleWindow( Engine::songEditor() );
toggleWindow( gui->songEditor() );
}
@@ -953,7 +977,7 @@ void MainWindow::toggleSongEditorWin()
void MainWindow::toggleProjectNotesWin()
{
toggleWindow( Engine::getProjectNotes() );
toggleWindow( gui->getProjectNotes() );
}
@@ -961,7 +985,7 @@ void MainWindow::toggleProjectNotesWin()
void MainWindow::togglePianoRollWin()
{
toggleWindow( Engine::pianoRoll() );
toggleWindow( gui->pianoRoll() );
}
@@ -969,7 +993,7 @@ void MainWindow::togglePianoRollWin()
void MainWindow::toggleAutomationEditorWin()
{
toggleWindow( Engine::automationEditor() );
toggleWindow( gui->automationEditor() );
}
@@ -977,7 +1001,7 @@ void MainWindow::toggleAutomationEditorWin()
void MainWindow::toggleFxMixerWin()
{
toggleWindow( Engine::fxMixerView() );
toggleWindow( gui->fxMixerView() );
}
@@ -985,7 +1009,7 @@ void MainWindow::toggleFxMixerWin()
void MainWindow::toggleControllerRack()
{
toggleWindow( Engine::getControllerRackView() );
toggleWindow( gui->getControllerRackView() );
}
@@ -993,29 +1017,29 @@ void MainWindow::toggleControllerRack()
void MainWindow::updatePlayPauseIcons()
{
Engine::songEditor()->setPauseIcon( false );
Engine::automationEditor()->setPauseIcon( false );
Engine::getBBEditor()->setPauseIcon( false );
Engine::pianoRoll()->setPauseIcon( false );
gui->songEditor()->setPauseIcon( false );
gui->automationEditor()->setPauseIcon( false );
gui->getBBEditor()->setPauseIcon( false );
gui->pianoRoll()->setPauseIcon( false );
if( Engine::getSong()->isPlaying() )
{
switch( Engine::getSong()->playMode() )
{
case Song::Mode_PlaySong:
Engine::songEditor()->setPauseIcon( true );
gui->songEditor()->setPauseIcon( true );
break;
case Song::Mode_PlayAutomationPattern:
Engine::automationEditor()->setPauseIcon( true );
gui->automationEditor()->setPauseIcon( true );
break;
case Song::Mode_PlayBB:
Engine::getBBEditor()->setPauseIcon( true );
gui->getBBEditor()->setPauseIcon( true );
break;
case Song::Mode_PlayPattern:
Engine::pianoRoll()->setPauseIcon( true );
gui->pianoRoll()->setPauseIcon( true );
break;
default:

View File

@@ -31,7 +31,7 @@
#include "StringPairDrag.h"
#include "Engine.h"
#include "GuiApplication.h"
#include "MainWindow.h"
@@ -64,9 +64,9 @@ StringPairDrag::~StringPairDrag()
{
// during a drag, we might have lost key-press-events, so reset
// modifiers of main-win
if( Engine::mainWindow() )
if( gui->mainWindow() )
{
Engine::mainWindow()->clearKeyModifiers();
gui->mainWindow()->clearKeyModifiers();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Timeline.cpp - class timeLine, representing a time-line with position marker
* TimeLineWidget.cpp - class timeLine, representing a time-line with position marker
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
@@ -29,14 +29,15 @@
#include <QLayout>
#include <QMouseEvent>
#include <QPainter>
#include <QToolBar>
#include "Timeline.h"
#include "TimeLineWidget.h"
#include "embed.h"
#include "Engine.h"
#include "templates.h"
#include "NStateButton.h"
#include "MainWindow.h"
#include "GuiApplication.h"
#include "TextFloat.h"
@@ -45,12 +46,12 @@
#endif
QPixmap * Timeline::s_timeLinePixmap = NULL;
QPixmap * Timeline::s_posMarkerPixmap = NULL;
QPixmap * Timeline::s_loopPointBeginPixmap = NULL;
QPixmap * Timeline::s_loopPointEndPixmap = NULL;
QPixmap * TimeLineWidget::s_timeLinePixmap = NULL;
QPixmap * TimeLineWidget::s_posMarkerPixmap = NULL;
QPixmap * TimeLineWidget::s_loopPointBeginPixmap = NULL;
QPixmap * TimeLineWidget::s_loopPointEndPixmap = NULL;
Timeline::Timeline( const int _xoff, const int _yoff, const float _ppt,
TimeLineWidget::TimeLineWidget( const int _xoff, const int _yoff, const float _ppt,
Song::playPos & _pos, const MidiTime & _begin,
QWidget * _parent ) :
QWidget( _parent ),
@@ -109,9 +110,9 @@ Timeline::Timeline( const int _xoff, const int _yoff, const float _ppt,
Timeline::~Timeline()
TimeLineWidget::~TimeLineWidget()
{
if( Engine::songEditor() )
if( gui->songEditor() )
{
m_pos.m_timeLine = NULL;
}
@@ -121,7 +122,7 @@ Timeline::~Timeline()
void Timeline::addToolButtons( QWidget * _tool_bar )
void TimeLineWidget::addToolButtons( QToolBar * _tool_bar )
{
NStateButton * autoScroll = new NStateButton( _tool_bar );
autoScroll->setGeneralToolTip( tr( "Enable/disable auto-scrolling" ) );
@@ -152,16 +153,15 @@ void Timeline::addToolButtons( QWidget * _tool_bar )
connect( behaviourAtStop, SIGNAL( changedState( int ) ), this,
SLOT( toggleBehaviourAtStop( int ) ) );
QBoxLayout * layout = dynamic_cast<QBoxLayout *>( _tool_bar->layout() );
layout->addWidget( autoScroll );
layout->addWidget( loopPoints );
layout->addWidget( behaviourAtStop );
_tool_bar->addWidget( autoScroll );
_tool_bar->addWidget( loopPoints );
_tool_bar->addWidget( behaviourAtStop );
}
void Timeline::saveSettings( QDomDocument & _doc, QDomElement & _this )
void TimeLineWidget::saveSettings( QDomDocument & _doc, QDomElement & _this )
{
_this.setAttribute( "lp0pos", (int) loopBegin() );
_this.setAttribute( "lp1pos", (int) loopEnd() );
@@ -171,7 +171,7 @@ void Timeline::saveSettings( QDomDocument & _doc, QDomElement & _this )
void Timeline::loadSettings( const QDomElement & _this )
void TimeLineWidget::loadSettings( const QDomElement & _this )
{
m_loopPos[0] = _this.attribute( "lp0pos" ).toInt();
m_loopPos[1] = _this.attribute( "lp1pos" ).toInt();
@@ -184,7 +184,7 @@ void Timeline::loadSettings( const QDomElement & _this )
void Timeline::updatePosition( const MidiTime & )
void TimeLineWidget::updatePosition( const MidiTime & )
{
const int new_x = markerX( m_pos );
@@ -200,7 +200,7 @@ void Timeline::updatePosition( const MidiTime & )
void Timeline::toggleAutoScroll( int _n )
void TimeLineWidget::toggleAutoScroll( int _n )
{
m_autoScroll = static_cast<AutoScrollStates>( _n );
}
@@ -208,7 +208,7 @@ void Timeline::toggleAutoScroll( int _n )
void Timeline::toggleLoopPoints( int _n )
void TimeLineWidget::toggleLoopPoints( int _n )
{
m_loopPoints = static_cast<LoopPointStates>( _n );
update();
@@ -217,7 +217,7 @@ void Timeline::toggleLoopPoints( int _n )
void Timeline::toggleBehaviourAtStop( int _n )
void TimeLineWidget::toggleBehaviourAtStop( int _n )
{
m_behaviourAtStop = static_cast<BehaviourAtStopStates>( _n );
}
@@ -225,7 +225,7 @@ void Timeline::toggleBehaviourAtStop( int _n )
void Timeline::paintEvent( QPaintEvent * )
void TimeLineWidget::paintEvent( QPaintEvent * )
{
QPainter p( this );
@@ -274,7 +274,7 @@ void Timeline::paintEvent( QPaintEvent * )
void Timeline::mousePressEvent( QMouseEvent* event )
void TimeLineWidget::mousePressEvent( QMouseEvent* event )
{
if( event->x() < m_xOffset )
{
@@ -332,7 +332,7 @@ void Timeline::mousePressEvent( QMouseEvent* event )
void Timeline::mouseMoveEvent( QMouseEvent* event )
void TimeLineWidget::mouseMoveEvent( QMouseEvent* event )
{
const MidiTime t = m_begin + static_cast<int>( qMax( event->x() - m_xOffset - m_moveXOff, 0 ) * MidiTime::ticksPerTact() / m_ppt );
@@ -382,7 +382,7 @@ void Timeline::mouseMoveEvent( QMouseEvent* event )
void Timeline::mouseReleaseEvent( QMouseEvent* event )
void TimeLineWidget::mouseReleaseEvent( QMouseEvent* event )
{
delete m_hint;
m_hint = NULL;

View File

@@ -31,13 +31,14 @@
#include "embed.h"
#include "Engine.h"
#include "GuiApplication.h"
#include "MainWindow.h"
ToolPluginView::ToolPluginView( ToolPlugin * _toolPlugin ) :
PluginView( _toolPlugin, NULL )
{
Engine::mainWindow()->workspace()->addSubWindow( this );
gui->mainWindow()->workspace()->addSubWindow( this );
parentWidget()->setAttribute( Qt::WA_DeleteOnClose, false );
setWindowTitle( _toolPlugin->displayName() );

View File

@@ -22,7 +22,7 @@
*
*/
#include <QAction>
#include <QKeyEvent>
#include <QLabel>
#include <QLayout>
@@ -33,7 +33,6 @@
#include "embed.h"
#include "MainWindow.h"
#include "Song.h"
#include "ToolButton.h"
#include "ConfigManager.h"
#include "DataFile.h"
#include "StringPairDrag.h"
@@ -44,27 +43,13 @@
BBEditor::BBEditor( BBTrackContainer* tc ) :
TrackContainerView( tc ),
m_bbtc( tc )
Editor(false),
m_trackContainerView( new BBTrackContainerView(tc) )
{
// create toolbar
m_toolBar = new QWidget;
m_toolBar->setFixedHeight( 32 );
m_toolBar->move( 0, 0 );
m_toolBar->setAutoFillBackground( true );
QPalette pal;
pal.setBrush( m_toolBar->backgroundRole(),
embed::getIconPixmap( "toolbar_bg" ) );
m_toolBar->setPalette( pal );
static_cast<QVBoxLayout *>( layout() )->insertWidget( 0, m_toolBar );
QHBoxLayout * tb_layout = new QHBoxLayout( m_toolBar );
tb_layout->setSpacing( 0 );
tb_layout->setMargin( 0 );
setWindowIcon( embed::getIconPixmap( "bb_track_btn" ) );
setWindowTitle( tr( "Beat+Bassline Editor" ) );
setCentralWidget(m_trackContainerView);
// TODO: Use style sheet
if( ConfigManager::inst()->value( "ui",
"compacttrackbuttons" ).toInt() )
@@ -79,45 +64,14 @@ BBEditor::BBEditor( BBTrackContainer* tc ) :
}
m_playButton = new ToolButton( embed::getIconPixmap( "play" ),
tr( "Play/pause current beat/bassline (Space)" ),
this, SLOT( play() ), m_toolBar );
m_playAction->setToolTip(tr( "Play/pause current beat/bassline (Space)" ));
m_stopAction->setToolTip(tr( "Stop playback of current beat/bassline (Space)" ));
m_stopButton = new ToolButton( embed::getIconPixmap( "stop" ),
tr( "Stop playback of current beat/bassline (Space)" ),
this, SLOT( stop() ), m_toolBar );
m_playButton->setObjectName( "playButton" );
m_stopButton->setObjectName( "stopButton" );
ToolButton * add_bb_track = new ToolButton(
embed::getIconPixmap( "add_bb_track" ),
tr( "Add beat/bassline" ),
Engine::getSong(), SLOT( addBBTrack() ),
m_toolBar );
ToolButton * add_automation_track = new ToolButton(
embed::getIconPixmap( "add_automation" ),
tr( "Add automation-track" ),
this, SLOT( addAutomationTrack() ), m_toolBar );
ToolButton * remove_bar = new ToolButton(
embed::getIconPixmap( "step_btn_remove" ),
tr( "Remove steps" ),
this, SLOT( removeSteps() ), m_toolBar );
ToolButton * add_bar = new ToolButton(
embed::getIconPixmap( "step_btn_add" ),
tr( "Add steps" ),
this, SLOT( addSteps() ), m_toolBar );
m_playButton->setWhatsThis(
m_playAction->setWhatsThis(
tr( "Click here to play the current "
"beat/bassline. The beat/bassline is automatically "
"looped when its end is reached." ) );
m_stopButton->setWhatsThis(
m_stopAction->setWhatsThis(
tr( "Click here to stop playing of current "
"beat/bassline." ) );
@@ -125,88 +79,57 @@ BBEditor::BBEditor( BBTrackContainer* tc ) :
m_bbComboBox->setFixedSize( 200, 22 );
m_bbComboBox->setModel( &tc->m_bbComboBoxModel );
tb_layout->addSpacing( 5 );
tb_layout->addWidget( m_playButton );
tb_layout->addWidget( m_stopButton );
tb_layout->addSpacing( 20 );
tb_layout->addWidget( m_bbComboBox );
tb_layout->addSpacing( 10 );
tb_layout->addWidget( add_bb_track );
tb_layout->addWidget( add_automation_track );
tb_layout->addStretch();
tb_layout->addWidget( remove_bar );
tb_layout->addWidget( add_bar );
tb_layout->addSpacing( 15 );
m_toolBar->addSeparator();
m_toolBar->addWidget( m_bbComboBox );
Engine::mainWindow()->workspace()->addSubWindow( this );
parentWidget()->setAttribute( Qt::WA_DeleteOnClose, false );
parentWidget()->layout()->setSizeConstraint( QLayout::SetMinimumSize );
parentWidget()->resize( minimumWidth(), 300 );
parentWidget()->move( 610, 5 );
parentWidget()->show();
m_toolBar->addSeparator();
m_toolBar->addAction(embed::getIconPixmap("add_bb_track"), tr("Add beat/bassline"),
Engine::getSong(), SLOT(addBBTrack()));
m_toolBar->addAction(embed::getIconPixmap("add_automation"), tr("Add automation-track"),
m_trackContainerView, SLOT(addAutomationTrack()));
QWidget* stretch = new QWidget(m_toolBar);
stretch->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
m_toolBar->addWidget(stretch);
m_toolBar->addAction(embed::getIconPixmap("step_btn_remove"), tr("Remove steps"),
m_trackContainerView, SLOT(removeSteps()));
m_toolBar->addAction(embed::getIconPixmap("step_btn_add"), tr("Add steps"),
m_trackContainerView, SLOT(addSteps()));
m_toolBar->addSeparator();
setModel( tc );
connect( &tc->m_bbComboBoxModel, SIGNAL( dataChanged() ),
this, SLOT( updatePosition() ) );
m_trackContainerView, SLOT( updatePosition() ) );
QAction* viewNext = new QAction(this);
connect(viewNext, SIGNAL(triggered()), m_bbComboBox, SLOT(selectNext()));
viewNext->setShortcut(Qt::Key_Plus);
addAction(viewNext);
QAction* viewPrevious = new QAction(this);
connect(viewPrevious, SIGNAL(triggered()), m_bbComboBox, SLOT(selectPrevious()));
viewPrevious->setShortcut(Qt::Key_Minus);
addAction(viewPrevious);
}
BBEditor::~BBEditor()
{
}
void BBEditor::dropEvent( QDropEvent * de )
QSize BBEditor::sizeHint() const
{
QString type = StringPairDrag::decodeKey( de );
QString value = StringPairDrag::decodeValue( de );
if( type.left( 6 ) == "track_" )
{
DataFile dataFile( value.toUtf8() );
Track * t = Track::create( dataFile.content().firstChild().toElement(), model() );
t->deleteTCOs();
m_bbtc->updateAfterTrackAdd();
de->accept();
}
else
{
TrackContainerView::dropEvent( de );
}
return {minimumWidth()+10, 300};
}
void BBEditor::removeBBView( int _bb )
void BBEditor::removeBBView( int bb )
{
foreach( TrackView* view, trackViews() )
{
view->getTrackContentWidget()->removeTCOView( _bb );
}
m_trackContainerView->removeBBView(bb);
}
void BBEditor::setPauseIcon( bool pause )
{
if( pause == true )
{
m_playButton->setIcon( embed::getIconPixmap( "pause" ) );
}
else
{
m_playButton->setIcon( embed::getIconPixmap( "play" ) );
}
}
void BBEditor::play()
{
if( Engine::getSong()->playMode() != Song::Mode_PlayBB )
@@ -220,8 +143,6 @@ void BBEditor::play()
}
void BBEditor::stop()
{
Engine::getSong()->stop();
@@ -230,24 +151,21 @@ void BBEditor::stop()
void BBEditor::updatePosition()
BBTrackContainerView::BBTrackContainerView(BBTrackContainer* tc) :
TrackContainerView(tc),
m_bbtc(tc)
{
//realignTracks();
emit positionChanged( m_currentPosition );
setModel( tc );
}
void BBEditor::addAutomationTrack()
{
(void) Track::create( Track::AutomationTrack, model() );
}
void BBEditor::addSteps()
void BBTrackContainerView::addSteps()
{
TrackContainer::TrackList tl = model()->tracks();
@@ -265,7 +183,7 @@ void BBEditor::addSteps()
void BBEditor::removeSteps()
void BBTrackContainerView::removeSteps()
{
TrackContainer::TrackList tl = model()->tracks();
@@ -283,44 +201,54 @@ void BBEditor::removeSteps()
void BBEditor::keyPressEvent( QKeyEvent * _ke )
void BBTrackContainerView::addAutomationTrack()
{
if ( _ke->key() == Qt::Key_Space )
{
if( Engine::getSong()->isPlaying() )
{
stop();
}
else
{
play();
}
}
else if ( _ke->key() == Qt::Key_Plus )
{
if( m_bbtc->currentBB()+ 1 < m_bbtc->numOfBBs() )
{
m_bbtc->setCurrentBB( m_bbtc->currentBB() + 1 );
}
}
else if ( _ke->key() == Qt::Key_Minus )
{
if( m_bbtc->currentBB() > 0 )
{
m_bbtc->setCurrentBB( m_bbtc->currentBB() - 1 );
}
}
else
{
// ignore event and pass to parent-widget
_ke->ignore();
}
(void) Track::create( Track::AutomationTrack, model() );
}
void BBTrackContainerView::removeBBView(int bb)
{
foreach( TrackView* view, trackViews() )
{
view->getTrackContentWidget()->removeTCOView( bb );
}
}
void BBTrackContainerView::dropEvent(QDropEvent* de)
{
QString type = StringPairDrag::decodeKey( de );
QString value = StringPairDrag::decodeValue( de );
if( type.left( 6 ) == "track_" )
{
DataFile dataFile( value.toUtf8() );
Track * t = Track::create( dataFile.content().firstChild().toElement(), model() );
t->deleteTCOs();
m_bbtc->updateAfterTrackAdd();
de->accept();
}
else
{
TrackContainerView::dropEvent( de );
}
}
void BBTrackContainerView::updatePosition()
{
//realignTracks();
emit positionChanged( m_currentPosition );
}
void BBEditor::closeEvent( QCloseEvent * _ce )
{

View File

@@ -0,0 +1,98 @@
/*
* Editor.cpp - implementation of Editor class
*
* Copyright (c) 2014 Lukas W <lukaswhl/at/gmail.com>
*
* This file is part of LMMS - http://lmms.io
*
* 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.
*
* 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 (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#include "Editor.h"
#include "MainWindow.h"
#include "embed.h"
#include <QAction>
#include <QActionGroup>
#include <QMdiArea>
#include <QShortcut>
void Editor::setPauseIcon(bool displayPauseIcon)
{
// If we're playing, show a pause icon
if (displayPauseIcon)
m_playAction->setIcon(embed::getIconPixmap("pause"));
else
m_playAction->setIcon(embed::getIconPixmap("play"));
}
void Editor::togglePlayStop()
{
if (Engine::getSong()->isPlaying())
stop();
else
play();
}
Editor::Editor(bool record) :
m_toolBar(new QToolBar(this)),
m_playAction(nullptr),
m_recordAction(nullptr),
m_recordAccompanyAction(nullptr),
m_stopAction(nullptr)
{
m_toolBar->setContextMenuPolicy(Qt::PreventContextMenu);
m_toolBar->setMovable(false);
auto addButton = [this](QAction* action, QString objectName) {
m_toolBar->addAction(action);
m_toolBar->widgetForAction(action)->setObjectName(objectName);
};
// Set up play and record actions
m_playAction = new QAction(embed::getIconPixmap("play"), tr("Play (Space)"), this);
m_stopAction = new QAction(embed::getIconPixmap("stop"), tr("Stop (Space)"), this);
m_recordAction = new QAction(embed::getIconPixmap("record"), tr("Record"), this);
m_recordAccompanyAction = new QAction(embed::getIconPixmap("record_accompany"), tr("Record while playing"), this);
// Set up connections
connect(m_playAction, SIGNAL(triggered()), this, SLOT(play()));
connect(m_recordAction, SIGNAL(triggered()), this, SLOT(record()));
connect(m_recordAccompanyAction, SIGNAL(triggered()), this, SLOT(recordAccompany()));
connect(m_stopAction, SIGNAL(triggered()), this, SLOT(stop()));
new QShortcut(Qt::Key_Space, this, SLOT(togglePlayStop()));
// Add toolbar to window
addToolBar(Qt::TopToolBarArea, m_toolBar);
// Add actions to toolbar
addButton(m_playAction, "playButton");
if (record)
{
addButton(m_recordAction, "recordButton");
addButton(m_recordAccompanyAction, "recordAccompanyButton");
}
addButton(m_stopAction, "stopButton");
}
Editor::~Editor()
{
}

File diff suppressed because it is too large Load Diff

View File

@@ -22,6 +22,8 @@
*
*/
#include "SongEditor.h"
#include <QTimeLine>
#include <QAction>
#include <QButtonGroup>
@@ -35,18 +37,18 @@
#include <math.h>
#include "SongEditor.h"
#include "ActionGroup.h"
#include "AutomatableSlider.h"
#include "ComboBox.h"
#include "ConfigManager.h"
#include "CPULoadWidget.h"
#include "embed.h"
#include "GuiApplication.h"
#include "LcdSpinBox.h"
#include "MainWindow.h"
#include "MeterDialog.h"
#include "TextFloat.h"
#include "Timeline.h"
#include "ToolButton.h"
#include "TimeLineWidget.h"
#include "ToolTip.h"
#include "VisualizationWidget.h"
#include "TimeDisplayWidget.h"
@@ -77,21 +79,17 @@ void positionLine::paintEvent( QPaintEvent * _pe )
SongEditor::SongEditor( Song * _song ) :
TrackContainerView( _song ),
m_song( _song ),
m_zoomingModel(new ComboBoxModel()),
m_scrollBack( false ),
m_smoothScroll( ConfigManager::inst()->value( "ui", "smoothscroll" ).toInt() )
m_smoothScroll( ConfigManager::inst()->value( "ui", "smoothscroll" ).toInt() ),
m_mode(DrawMode)
{
setWindowTitle( tr( "Song-Editor" ) );
setWindowIcon( embed::getIconPixmap( "songeditor" ) );
setFocusPolicy( Qt::StrongFocus );
setFocus();
// create time-line
int widgetTotal = ConfigManager::inst()->value( "ui",
"compacttrackbuttons" ).toInt()==1 ?
DEFAULT_SETTINGS_WIDGET_WIDTH_COMPACT + TRACK_OP_WIDTH_COMPACT :
DEFAULT_SETTINGS_WIDGET_WIDTH + TRACK_OP_WIDTH;
m_timeLine = new Timeline( widgetTotal, 32,
m_timeLine = new TimeLineWidget( widgetTotal, 32,
pixelsPerTact(),
m_song->m_playPos[Song::Mode_PlaySong],
m_currentPosition, this );
@@ -103,6 +101,8 @@ SongEditor::SongEditor( Song * _song ) :
m_positionLine = new positionLine( this );
static_cast<QVBoxLayout *>( layout() )->insertWidget( 1, m_timeLine );
// let's get notified when loading a project
connect( m_song, SIGNAL( projectLoaded() ),
@@ -110,9 +110,9 @@ SongEditor::SongEditor( Song * _song ) :
// add some essential widgets to global tool-bar
QWidget * tb = Engine::mainWindow()->toolBar();
QWidget * tb = gui->mainWindow()->toolBar();
Engine::mainWindow()->addSpacingToToolBar( 10 );
gui->mainWindow()->addSpacingToToolBar( 10 );
m_tempoSpinBox = new LcdSpinBox( 3, tb, tr( "Tempo" ) );
m_tempoSpinBox->setModel( &m_song->m_tempoModel );
@@ -127,7 +127,7 @@ SongEditor::SongEditor( Song * _song ) :
"should be played within a minute (or how many measures "
"should be played within four minutes)." ) );
int tempoSpinBoxCol = Engine::mainWindow()->addWidgetToToolBar( m_tempoSpinBox, 0 );
int tempoSpinBoxCol = gui->mainWindow()->addWidgetToToolBar( m_tempoSpinBox, 0 );
#if 0
toolButton * hq_btn = new toolButton( embed::getIconPixmap( "hq_mode" ),
@@ -137,18 +137,18 @@ SongEditor::SongEditor( Song * _song ) :
connect( hq_btn, SIGNAL( toggled( bool ) ),
this, SLOT( setHighQuality( bool ) ) );
hq_btn->setFixedWidth( 42 );
Engine::mainWindow()->addWidgetToToolBar( hq_btn, 1, col );
gui->mainWindow()->addWidgetToToolBar( hq_btn, 1, col );
#endif
Engine::mainWindow()->addWidgetToToolBar( new TimeDisplayWidget, 1, tempoSpinBoxCol );
gui->mainWindow()->addWidgetToToolBar( new TimeDisplayWidget, 1, tempoSpinBoxCol );
Engine::mainWindow()->addSpacingToToolBar( 10 );
gui->mainWindow()->addSpacingToToolBar( 10 );
m_timeSigDisplay = new MeterDialog( this, true );
m_timeSigDisplay->setModel( &m_song->m_timeSigModel );
Engine::mainWindow()->addWidgetToToolBar( m_timeSigDisplay );
gui->mainWindow()->addWidgetToToolBar( m_timeSigDisplay );
Engine::mainWindow()->addSpacingToToolBar( 10 );
gui->mainWindow()->addSpacingToToolBar( 10 );
QLabel * master_vol_lbl = new QLabel( tb );
@@ -165,23 +165,23 @@ SongEditor::SongEditor( Song * _song ) :
ToolTip::add( m_masterVolumeSlider, tr( "master volume" ) );
connect( m_masterVolumeSlider, SIGNAL( logicValueChanged( int ) ), this,
SLOT( masterVolumeChanged( int ) ) );
SLOT( setMasterVolume( int ) ) );
connect( m_masterVolumeSlider, SIGNAL( sliderPressed() ), this,
SLOT( masterVolumePressed() ) );
SLOT( showMasterVolumeFloat()) );
connect( m_masterVolumeSlider, SIGNAL( logicSliderMoved( int ) ), this,
SLOT( masterVolumeMoved( int ) ) );
SLOT( updateMasterVolumeFloat( int ) ) );
connect( m_masterVolumeSlider, SIGNAL( sliderReleased() ), this,
SLOT( masterVolumeReleased() ) );
SLOT( hideMasterVolumeFloat() ) );
m_mvsStatus = new TextFloat;
m_mvsStatus->setTitle( tr( "Master volume" ) );
m_mvsStatus->setPixmap( embed::getIconPixmap( "master_volume" ) );
Engine::mainWindow()->addWidgetToToolBar( master_vol_lbl );
Engine::mainWindow()->addWidgetToToolBar( m_masterVolumeSlider );
gui->mainWindow()->addWidgetToToolBar( master_vol_lbl );
gui->mainWindow()->addWidgetToToolBar( m_masterVolumeSlider );
Engine::mainWindow()->addSpacingToToolBar( 10 );
gui->mainWindow()->addSpacingToToolBar( 10 );
QLabel * master_pitch_lbl = new QLabel( tb );
@@ -197,22 +197,22 @@ SongEditor::SongEditor( Song * _song ) :
m_masterPitchSlider->setTickInterval( 12 );
ToolTip::add( m_masterPitchSlider, tr( "master pitch" ) );
connect( m_masterPitchSlider, SIGNAL( logicValueChanged( int ) ), this,
SLOT( masterPitchChanged( int ) ) );
SLOT( setMasterPitch( int ) ) );
connect( m_masterPitchSlider, SIGNAL( sliderPressed() ), this,
SLOT( masterPitchPressed() ) );
SLOT( showMasterPitchFloat() ) );
connect( m_masterPitchSlider, SIGNAL( logicSliderMoved( int ) ), this,
SLOT( masterPitchMoved( int ) ) );
SLOT( updateMasterPitchFloat( int ) ) );
connect( m_masterPitchSlider, SIGNAL( sliderReleased() ), this,
SLOT( masterPitchReleased() ) );
SLOT( hideMasterPitchFloat() ) );
m_mpsStatus = new TextFloat;
m_mpsStatus->setTitle( tr( "Master pitch" ) );
m_mpsStatus->setPixmap( embed::getIconPixmap( "master_pitch" ) );
Engine::mainWindow()->addWidgetToToolBar( master_pitch_lbl );
Engine::mainWindow()->addWidgetToToolBar( m_masterPitchSlider );
gui->mainWindow()->addWidgetToToolBar( master_pitch_lbl );
gui->mainWindow()->addWidgetToToolBar( m_masterPitchSlider );
Engine::mainWindow()->addSpacingToToolBar( 10 );
gui->mainWindow()->addSpacingToToolBar( 10 );
// create widget for visualization- and cpu-load-widget
QWidget * vc_w = new QWidget( tb );
@@ -227,156 +227,9 @@ SongEditor::SongEditor( Song * _song ) :
vcw_layout->addWidget( new CPULoadWidget( vc_w ) );
vcw_layout->addStretch();
Engine::mainWindow()->addWidgetToToolBar( vc_w );
// create own toolbar
m_toolBar = new QWidget( this );
m_toolBar->setFixedHeight( 32 );
m_toolBar->setAutoFillBackground( true );
QPalette pal;
pal.setBrush( m_toolBar->backgroundRole(),
embed::getIconPixmap( "toolbar_bg" ) );
m_toolBar->setPalette( pal );
static_cast<QVBoxLayout *>( layout() )->insertWidget( 0, m_toolBar );
static_cast<QVBoxLayout *>( layout() )->insertWidget( 1, m_timeLine );
QHBoxLayout * tb_layout = new QHBoxLayout( m_toolBar );
tb_layout->setMargin( 0 );
tb_layout->setSpacing( 0 );
// fill own tool-bar
m_playButton = new ToolButton( embed::getIconPixmap( "play" ),
tr( "Play song (Space)" ),
this, SLOT( play() ), m_toolBar );
m_playButton->setObjectName( "playButton" );
m_recordButton = new ToolButton( embed::getIconPixmap( "record" ),
tr( "Record samples from Audio-device" ),
this, SLOT( record() ), m_toolBar );
m_recordButton->setObjectName( "recordButton" );
m_recordAccompanyButton = new ToolButton(
embed::getIconPixmap( "record_accompany" ),
tr( "Record samples from Audio-device while playing "
"song or BB track" ),
this, SLOT( recordAccompany() ), m_toolBar );
m_recordAccompanyButton->setObjectName( "recordAccompanyButton" );
// FIXME: disable record button while it is not implemented
m_recordButton->setDisabled( true );
// disable record buttons if capturing is not supported
if( !Engine::mixer()->audioDev()->supportsCapture() )
{
m_recordButton->setDisabled( true );
m_recordAccompanyButton->setDisabled( true );
}
m_stopButton = new ToolButton( embed::getIconPixmap( "stop" ),
tr( "Stop song (Space)" ),
this, SLOT( stop() ), m_toolBar );
m_stopButton->setObjectName( "stopButton" );
m_addBBTrackButton = new ToolButton( embed::getIconPixmap(
"add_bb_track" ),
tr( "Add beat/bassline" ),
m_song, SLOT( addBBTrack() ),
m_toolBar );
m_addSampleTrackButton = new ToolButton( embed::getIconPixmap(
"add_sample_track" ),
tr( "Add sample-track" ),
m_song, SLOT( addSampleTrack() ),
m_toolBar );
m_addAutomationTrackButton = new ToolButton( embed::getIconPixmap(
"add_automation" ),
tr( "Add automation-track" ),
m_song, SLOT( addAutomationTrack() ),
m_toolBar );
m_drawModeButton = new ToolButton( embed::getIconPixmap(
"edit_draw" ),
tr( "Draw mode" ),
NULL, NULL, m_toolBar );
m_drawModeButton->setCheckable( true );
m_drawModeButton->setChecked( true );
m_editModeButton = new ToolButton( embed::getIconPixmap(
"edit_select" ),
tr( "Edit mode (select and move)" ),
NULL, NULL, m_toolBar );
m_editModeButton->setCheckable( true );
QButtonGroup * tool_button_group = new QButtonGroup( this );
tool_button_group->addButton( m_drawModeButton );
tool_button_group->addButton( m_editModeButton );
tool_button_group->setExclusive( true );
#if 0
#warning TODO
QWhatsThis::add( m_playButton, tr( "Click here, if you want to play "
"your whole song. Playing will "
"be started at the "
"song-position-marker (green). "
"You can also move it while "
"playing." ) );
QWhatsThis::add( m_stopButton, tr ( "Click here, if you want to stop "
"playing of your song. The "
"song-position-marker will be "
"set to the start of your song."
) );
/* QWhatsThis::add( m_insertBarButton, tr( "If you click here, a "
"bar will "
"be inserted at the "
"current bar." ) );
QWhatsThis::add( m_removeBarButton, tr( "If you click here, the "
"current bar will be "
"removed." ) );*/
#endif
QLabel * zoom_lbl = new QLabel( m_toolBar );
zoom_lbl->setPixmap( embed::getIconPixmap( "zoom" ) );
// setup zooming-stuff
m_zoomingComboBox = new ComboBox( m_toolBar );
m_zoomingComboBox->setFixedSize( 80, 22 );
m_zoomingComboBox->move( 580, 4 );
for( int i = 0; i < 7; ++i )
{
m_zoomingComboBox->model()->addItem(
QString::number( 25 << i ) + "%" );
}
m_zoomingComboBox->model()->setInitValue(
m_zoomingComboBox->model()->findText( "100%" ) );
connect( m_zoomingComboBox->model(), SIGNAL( dataChanged() ),
this, SLOT( zoomingChanged() ) );
tb_layout->addSpacing( 5 );
tb_layout->addWidget( m_playButton );
tb_layout->addWidget( m_recordButton );
tb_layout->addWidget( m_recordAccompanyButton );
tb_layout->addWidget( m_stopButton );
tb_layout->addSpacing( 10 );
tb_layout->addWidget( m_addBBTrackButton );
tb_layout->addWidget( m_addSampleTrackButton );
tb_layout->addWidget( m_addAutomationTrackButton );
tb_layout->addSpacing( 10 );
tb_layout->addWidget( m_drawModeButton );
tb_layout->addWidget( m_editModeButton );
tb_layout->addSpacing( 10 );
m_timeLine->addToolButtons( m_toolBar );
tb_layout->addSpacing( 15 );
tb_layout->addWidget( zoom_lbl );
tb_layout->addSpacing( 5 );
tb_layout->addWidget( m_zoomingComboBox );
tb_layout->addStretch();
gui->mainWindow()->addWidgetToToolBar( vc_w );
static_cast<QVBoxLayout *>( layout() )->insertWidget( 0, m_timeLine );
m_leftRightScroll = new QScrollBar( Qt::Horizontal, this );
m_leftRightScroll->setMinimum( 0 );
@@ -389,12 +242,19 @@ SongEditor::SongEditor( Song * _song ) :
connect( m_song, SIGNAL( lengthChanged( int ) ),
this, SLOT( updateScrollBar( int ) ) );
// Set up zooming model
for( int i = 0; i < 7; ++i )
{
m_zoomingModel->addItem(
QString::number( 25 << i ) + "%" );
}
m_zoomingModel->setInitValue(
m_zoomingModel->findText( "100%" ) );
connect( m_zoomingModel, SIGNAL( dataChanged() ),
this, SLOT( zoomingChanged() ) );
Engine::mainWindow()->workspace()->addSubWindow( this );
parentWidget()->setAttribute( Qt::WA_DeleteOnClose, false );
parentWidget()->resize( 600, 300 );
parentWidget()->move( 5, 5 );
parentWidget()->show();
setFocusPolicy( Qt::StrongFocus );
setFocus();
}
@@ -426,56 +286,19 @@ void SongEditor::scrolled( int _new_pos )
void SongEditor::setPauseIcon( bool pause )
void SongEditor::setEditMode(EditMode mode)
{
if( pause == true )
{
m_playButton->setIcon( embed::getIconPixmap( "pause" ) );
}
else
{
m_playButton->setIcon( embed::getIconPixmap( "play" ) );
}
m_mode = mode;
}
void SongEditor::play()
void SongEditor::setEditModeDraw()
{
if( Engine::getSong()->playMode() != Song::Mode_PlaySong )
{
Engine::getSong()->playSong();
}
else
{
Engine::getSong()->togglePause();
}
setEditMode(DrawMode);
}
void SongEditor::record()
void SongEditor::setEditModeSelect()
{
m_song->record();
}
void SongEditor::recordAccompany()
{
m_song->playAndRecord();
}
void SongEditor::stop()
{
m_song->stop();
Engine::pianoRoll()->stopRecording();
setEditMode(SelectMode);
}
@@ -484,13 +307,13 @@ void SongEditor::stop()
void SongEditor::keyPressEvent( QKeyEvent * _ke )
{
if( /*_ke->modifiers() & Qt::ShiftModifier*/
Engine::mainWindow()->isShiftPressed() == true &&
gui->mainWindow()->isShiftPressed() == true &&
_ke->key() == Qt::Key_Insert )
{
m_song->insertBar();
}
else if(/* _ke->modifiers() & Qt::ShiftModifier &&*/
Engine::mainWindow()->isShiftPressed() == true &&
gui->mainWindow()->isShiftPressed() == true &&
_ke->key() == Qt::Key_Delete )
{
m_song->removeBar();
@@ -511,17 +334,6 @@ void SongEditor::keyPressEvent( QKeyEvent * _ke )
m_song->setPlayPos( t, Song::Mode_PlaySong );
}
}
else if( _ke->key() == Qt::Key_Space )
{
if( m_song->isPlaying() )
{
stop();
}
else
{
play();
}
}
else if( _ke->key() == Qt::Key_Home )
{
m_song->setPlayPos( 0, Song::Mode_PlaySong );
@@ -537,7 +349,7 @@ void SongEditor::keyPressEvent( QKeyEvent * _ke )
void SongEditor::wheelEvent( QWheelEvent * _we )
{
if( Engine::mainWindow()->isCtrlPressed() == true )
if( gui->mainWindow()->isCtrlPressed() == true )
{
if( _we->delta() > 0 )
{
@@ -549,8 +361,8 @@ void SongEditor::wheelEvent( QWheelEvent * _we )
setPixelsPerTact( (int) pixelsPerTact() / 2 );
}
// update combobox with zooming-factor
m_zoomingComboBox->model()->setValue(
m_zoomingComboBox->model()->findText(
m_zoomingModel->setValue(
m_zoomingModel->findText(
QString::number(
static_cast<int>( pixelsPerTact() *
100 / DEFAULT_PIXELS_PER_TACT ) ) +
@@ -561,7 +373,7 @@ void SongEditor::wheelEvent( QWheelEvent * _we )
// and make sure, all TCO's are resized and relocated
realignTracks();
}
else if( Engine::mainWindow()->isShiftPressed() == true )
else if( gui->mainWindow()->isShiftPressed() == true )
{
m_leftRightScroll->setValue( m_leftRightScroll->value() -
_we->delta() / 30 );
@@ -592,9 +404,8 @@ void SongEditor::closeEvent( QCloseEvent * _ce )
void SongEditor::masterVolumeChanged( int _new_val )
void SongEditor::setMasterVolume( int _new_val )
{
masterVolumeMoved( _new_val );
if( m_mvsStatus->isVisible() == false && m_song->m_loadingProject == false
&& m_masterVolumeSlider->showStatus() )
{
@@ -608,18 +419,18 @@ void SongEditor::masterVolumeChanged( int _new_val )
void SongEditor::masterVolumePressed( void )
void SongEditor::showMasterVolumeFloat( void )
{
m_mvsStatus->moveGlobal( m_masterVolumeSlider,
QPoint( m_masterVolumeSlider->width() + 2, -2 ) );
m_mvsStatus->show();
masterVolumeMoved( m_song->m_masterVolumeModel.value() );
updateMasterVolumeFloat( m_song->m_masterVolumeModel.value() );
}
void SongEditor::masterVolumeMoved( int _new_val )
void SongEditor::updateMasterVolumeFloat( int _new_val )
{
m_mvsStatus->setText( tr( "Value: %1%" ).arg( _new_val ) );
}
@@ -627,7 +438,7 @@ void SongEditor::masterVolumeMoved( int _new_val )
void SongEditor::masterVolumeReleased( void )
void SongEditor::hideMasterVolumeFloat( void )
{
m_mvsStatus->hide();
}
@@ -635,9 +446,9 @@ void SongEditor::masterVolumeReleased( void )
void SongEditor::masterPitchChanged( int _new_val )
void SongEditor::setMasterPitch( int _new_val )
{
masterPitchMoved( _new_val );
updateMasterPitchFloat( _new_val );
if( m_mpsStatus->isVisible() == false && m_song->m_loadingProject == false
&& m_masterPitchSlider->showStatus() )
{
@@ -650,18 +461,18 @@ void SongEditor::masterPitchChanged( int _new_val )
void SongEditor::masterPitchPressed( void )
void SongEditor::showMasterPitchFloat( void )
{
m_mpsStatus->moveGlobal( m_masterPitchSlider,
QPoint( m_masterPitchSlider->width() + 2, -2 ) );
m_mpsStatus->show();
masterPitchMoved( m_song->m_masterPitchModel.value() );
updateMasterPitchFloat( m_song->m_masterPitchModel.value() );
}
void SongEditor::masterPitchMoved( int _new_val )
void SongEditor::updateMasterPitchFloat( int _new_val )
{
m_mpsStatus->setText( tr( "Value: %1 semitones").arg( _new_val ) );
@@ -670,7 +481,7 @@ void SongEditor::masterPitchMoved( int _new_val )
void SongEditor::masterPitchReleased( void )
void SongEditor::hideMasterPitchFloat( void )
{
m_mpsStatus->hide();
}
@@ -732,7 +543,7 @@ void SongEditor::updatePosition( const MidiTime & _t )
}
if( ( m_song->isPlaying() && m_song->m_playMode == Song::Mode_PlaySong
&& m_timeLine->autoScroll() == Timeline::AutoScrollEnabled) ||
&& m_timeLine->autoScroll() == TimeLineWidget::AutoScrollEnabled) ||
m_scrollBack == true )
{
const int w = width() - widgetWidth
@@ -774,7 +585,7 @@ void SongEditor::updatePosition( const MidiTime & _t )
void SongEditor::zoomingChanged()
{
const QString & zfac = m_zoomingComboBox->model()->currentText();
const QString & zfac = m_zoomingModel->currentText();
setPixelsPerTact( zfac.left( zfac.length() - 1 ).toInt() *
DEFAULT_PIXELS_PER_TACT / 100 );
m_song->m_playPos[Song::Mode_PlaySong].m_timeLine->
@@ -792,7 +603,7 @@ void SongEditor::adjustUiAfterProjectLoad()
// make sure to bring us to front as the song editor is the central
// widget in a song and when just opening a song in order to listen to
// it, it's very annyoing to manually bring up the song editor each time
Engine::mainWindow()->workspace()->setActiveSubWindow(
gui->mainWindow()->workspace()->setActiveSubWindow(
qobject_cast<QMdiSubWindow *>( parentWidget() ) );
}
scrolled( 0 );
@@ -803,5 +614,114 @@ void SongEditor::adjustUiAfterProjectLoad()
bool SongEditor::allowRubberband() const
{
return( m_editModeButton->isChecked() );
return m_mode == SelectMode;
}
SongEditorWindow::SongEditorWindow(Song* song) :
Editor(Engine::mixer()->audioDev()->supportsCapture()),
m_editor(new SongEditor(song))
{
setWindowTitle( tr( "Song-Editor" ) );
setWindowIcon( embed::getIconPixmap( "songeditor" ) );
setCentralWidget(m_editor);
// Set up buttons
m_playAction->setToolTip(tr("Play song (Space)"));
m_recordAction->setToolTip(tr("Record samples from Audio-device"));
m_recordAccompanyAction->setToolTip(tr( "Record samples from Audio-device while playing song or BB track"));
m_stopAction->setToolTip(tr( "Stop song (Space)" ));
m_addBBTrackAction = new QAction(embed::getIconPixmap("add_bb_track"),
tr("Add beat/bassline"), this);
m_addSampleTrackAction = new QAction(embed::getIconPixmap("add_sample_track"),
tr("Add sample-track"), this);
m_addAutomationTrackAction = new QAction(embed::getIconPixmap("add_automation"),
tr("Add automation-track"), this);
connect(m_addBBTrackAction, SIGNAL(triggered()), m_editor->m_song, SLOT(addBBTrack()));
connect(m_addSampleTrackAction, SIGNAL(triggered()), m_editor->m_song, SLOT(addSampleTrack()));
connect(m_addAutomationTrackAction, SIGNAL(triggered()), m_editor->m_song, SLOT(addAutomationTrack()));
ActionGroup* editModeGroup = new ActionGroup(this);
m_drawModeAction = editModeGroup->addAction(embed::getIconPixmap("edit_draw"), tr("Draw mode"));
m_selectModeAction = editModeGroup->addAction(embed::getIconPixmap("edit_select"), tr("Edit mode (select and move)"));
m_drawModeAction->setChecked(true);
connect(m_drawModeAction, SIGNAL(triggered()), m_editor, SLOT(setEditModeDraw()));
connect(m_selectModeAction, SIGNAL(triggered()), m_editor, SLOT(setEditModeSelect()));
m_playAction->setWhatsThis(
tr("Click here, if you want to play your whole song. "
"Playing will be started at the song-position-marker (green). "
"You can also move it while playing."));
m_stopAction->setWhatsThis(
tr("Click here, if you want to stop playing of your song. "
"The song-position-marker will be set to the start of your song."));
QLabel * zoom_lbl = new QLabel( m_toolBar );
zoom_lbl->setPixmap( embed::getIconPixmap( "zoom" ) );
// setup zooming-stuff
m_zoomingComboBox = new ComboBox( m_toolBar );
m_zoomingComboBox->setFixedSize( 80, 22 );
m_zoomingComboBox->move( 580, 4 );
m_zoomingComboBox->setModel(m_editor->m_zoomingModel);
m_toolBar->addSeparator();
m_toolBar->addAction( m_addBBTrackAction );
m_toolBar->addAction( m_addSampleTrackAction );
m_toolBar->addAction( m_addAutomationTrackAction );
m_toolBar->addSeparator();
m_toolBar->addAction( m_drawModeAction );
m_toolBar->addAction( m_selectModeAction );
m_toolBar->addSeparator();
m_editor->m_timeLine->addToolButtons(m_toolBar);
m_toolBar->addSeparator();
m_toolBar->addWidget( zoom_lbl );
m_toolBar->addWidget( m_zoomingComboBox );
}
QSize SongEditorWindow::sizeHint() const
{
return {600, 300};
}
void SongEditorWindow::play()
{
if( Engine::getSong()->playMode() != Song::Mode_PlaySong )
{
Engine::getSong()->playSong();
}
else
{
Engine::getSong()->togglePause();
}
}
void SongEditorWindow::record()
{
m_editor->m_song->record();
}
void SongEditorWindow::recordAccompany()
{
m_editor->m_song->playAndRecord();
}
void SongEditorWindow::stop()
{
m_editor->m_song->stop();
gui->pianoRoll()->stopRecording();
}

View File

@@ -105,6 +105,22 @@ QSize ComboBox::sizeHint() const
void ComboBox::selectNext()
{
model()->setInitValue( model()->value() + 1 );
}
void ComboBox::selectPrevious()
{
model()->setInitValue( model()->value() - 1 );
}
void ComboBox::contextMenuEvent( QContextMenuEvent * event )
{
if( model() == NULL || event->x() <= width() - CB_ARROW_BTN_WIDTH )
@@ -157,13 +173,13 @@ void ComboBox::mousePressEvent( QMouseEvent* event )
}
else if( event->button() == Qt::LeftButton )
{
model()->setInitValue( model()->value() + 1 );
selectNext();
update();
}
}
else if( event->button() == Qt::RightButton )
{
model()->setInitValue( model()->value() - 1 );
selectPrevious();
update();
}
else

View File

@@ -34,6 +34,7 @@
#include "Song.h"
#include "embed.h"
#include "GuiApplication.h"
#include "MainWindow.h"
#include "GroupBox.h"
#include "ControllerRackView.h"
@@ -75,7 +76,7 @@ ControllerRackView::ControllerRackView( ) :
this->setLayout( layout );
QMdiSubWindow * subWin =
Engine::mainWindow()->workspace()->addSubWindow( this );
gui->mainWindow()->workspace()->addSubWindow( this );
// No maximize button
Qt::WindowFlags flags = subWin->windowFlags();

View File

@@ -39,6 +39,7 @@
#include "gui_templates.h"
#include "embed.h"
#include "Engine.h"
#include "GuiApplication.h"
#include "LedCheckbox.h"
#include "MainWindow.h"
#include "ToolTip.h"
@@ -62,9 +63,9 @@ ControllerView::ControllerView( Controller * _model, QWidget * _parent ) :
connect( ctls_btn, SIGNAL( clicked() ),
this, SLOT( editControls() ) );
m_controllerDlg = getController()->createDialog( Engine::mainWindow()->workspace() );
m_controllerDlg = getController()->createDialog( gui->mainWindow()->workspace() );
m_subWindow = Engine::mainWindow()->workspace()->addSubWindow(
m_subWindow = gui->mainWindow()->workspace()->addSubWindow(
m_controllerDlg );
Qt::WindowFlags flags = m_subWindow->windowFlags();

View File

@@ -37,6 +37,7 @@
#include "EffectControlDialog.h"
#include "embed.h"
#include "Engine.h"
#include "GuiApplication.h"
#include "gui_templates.h"
#include "Knob.h"
#include "LedCheckbox.h"
@@ -109,7 +110,7 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) :
m_controlView = effect()->controls()->createView();
if( m_controlView )
{
m_subWindow = Engine::mainWindow()->workspace()->addSubWindow(
m_subWindow = gui->mainWindow()->workspace()->addSubWindow(
m_controlView,
Qt::SubWindow | Qt::CustomizeWindowHint |
Qt::WindowTitleHint | Qt::WindowSystemMenuHint );

View File

@@ -35,6 +35,7 @@
#include "FxMixerView.h"
#include "embed.h"
#include "Engine.h"
#include "GuiApplication.h"
#include "SendButtonIndicator.h"
#include "gui_templates.h"
#include "CaptionMenu.h"
@@ -229,28 +230,28 @@ void FxLine::renameChannel()
void FxLine::removeChannel()
{
FxMixerView * mix = Engine::fxMixerView();
FxMixerView * mix = gui->fxMixerView();
mix->deleteChannel( m_channelIndex );
}
void FxLine::removeUnusedChannels()
{
FxMixerView * mix = Engine::fxMixerView();
FxMixerView * mix = gui->fxMixerView();
mix->deleteUnusedChannels();
}
void FxLine::moveChannelLeft()
{
FxMixerView * mix = Engine::fxMixerView();
FxMixerView * mix = gui->fxMixerView();
mix->moveChannelLeft( m_channelIndex );
}
void FxLine::moveChannelRight()
{
FxMixerView * mix = Engine::fxMixerView();
FxMixerView * mix = gui->fxMixerView();
mix->moveChannelRight( m_channelIndex );
}

View File

@@ -43,6 +43,7 @@
#include "embed.h"
#include "Engine.h"
#include "gui_templates.h"
#include "GuiApplication.h"
#include "MainWindow.h"
#include "ProjectJournal.h"
#include "Song.h"
@@ -458,15 +459,15 @@ float Knob::getValue( const QPoint & _p )
{
float value;
// arcane mathemagicks for calculating knob movement
// arcane mathemagicks for calculating knob movement
value = ( ( _p.y() + _p.y() * qMin( qAbs( _p.y() / 2.5f ), 6.0f ) ) ) / 12.0f;
// if shift pressed we want slower movement
if( Engine::mainWindow()->isShiftPressed() )
if( gui->mainWindow()->isShiftPressed() )
{
value /= 4.0f;
value = qBound( -4.0f, value, 4.0f );
}
}
return value * pageSize();
}
@@ -483,7 +484,7 @@ void Knob::contextMenuEvent( QContextMenuEvent * )
CaptionMenu contextMenu( model()->displayName(), this );
addDefaultActions( &contextMenu );
contextMenu.addAction( QPixmap(),
contextMenu.addAction( QPixmap(),
model()->isScaleLogarithmic() ? tr( "Set linear" ) : tr( "Set logarithmic" ),
this, SLOT( toggleScale() ) );
contextMenu.addSeparator();
@@ -561,7 +562,7 @@ void Knob::mousePressEvent( QMouseEvent * _me )
m_buttonPressed = true;
}
else if( _me->button() == Qt::LeftButton &&
Engine::mainWindow()->isShiftPressed() == true )
gui->mainWindow()->isShiftPressed() == true )
{
new StringPairDrag( "float_value",
QString::number( model()->value() ),
@@ -681,7 +682,7 @@ void Knob::setPosition( const QPoint & _p )
if( model()->isScaleLogarithmic() ) // logarithmic code
{
const float pos = model()->minValue() < 0
const float pos = model()->minValue() < 0
? oldValue / qMax( qAbs( model()->maxValue() ), qAbs( model()->minValue() ) )
: ( oldValue - model()->minValue() ) / model()->range();
const float ratio = 0.1f + qAbs( pos ) * 15.f;
@@ -697,11 +698,11 @@ void Knob::setPosition( const QPoint & _p )
}
}
else // linear code
{
if( qAbs( value ) >= step )
{
{
model()->setValue( oldValue - value );
m_leftOver = 0.0f;
}

View File

@@ -35,6 +35,7 @@
#include "CaptionMenu.h"
#include "Engine.h"
#include "embed.h"
#include "GuiApplication.h"
#include "gui_templates.h"
#include "templates.h"
#include "MainWindow.h"
@@ -126,7 +127,7 @@ void LcdSpinBox::mouseMoveEvent( QMouseEvent* event )
if( m_mouseMoving )
{
int dy = event->globalY() - m_origMousePos.y();
if( Engine::mainWindow()->isShiftPressed() )
if( gui->mainWindow()->isShiftPressed() )
dy = qBound( -4, dy/4, 4 );
if( dy > 1 || dy < -1 )
{

View File

@@ -39,13 +39,14 @@
#include "embed.h"
#include "Engine.h"
#include "GuiApplication.h"
#include "MainWindow.h"
#include "Song.h"
ProjectNotes::ProjectNotes() :
QMainWindow( Engine::mainWindow()->workspace() )
QMainWindow( gui->mainWindow()->workspace() )
{
m_edit = new QTextEdit( this );
m_edit->setAutoFillBackground( true );
@@ -70,7 +71,7 @@ ProjectNotes::ProjectNotes() :
setWindowTitle( tr( "Project notes" ) );
setWindowIcon( embed::getIconPixmap( "project_notes" ) );
Engine::mainWindow()->workspace()->addSubWindow( this );
gui->mainWindow()->workspace()->addSubWindow( this );
parentWidget()->setAttribute( Qt::WA_DeleteOnClose, false );
parentWidget()->move( 700, 10 );
parentWidget()->resize( 400, 300 );

View File

@@ -30,6 +30,7 @@
#include "Engine.h"
#include "CaptionMenu.h"
#include "embed.h"
#include "GuiApplication.h"
#include "MainWindow.h"
#include "MeterDialog.h"
#include "Song.h"
@@ -86,10 +87,10 @@ void TempoSyncKnob::contextMenuEvent( QContextMenuEvent * )
CaptionMenu contextMenu( model()->displayName(), this );
addDefaultActions( &contextMenu );
contextMenu.addSeparator();
float limit = 60000.0f / ( Engine::getSong()->getTempo() *
model()->m_scale );
QMenu * syncMenu = contextMenu.addMenu( m_tempoSyncIcon,
m_tempoSyncDescription );
if( limit / 8.0f <= model()->maxValue() )
@@ -149,7 +150,7 @@ void TempoSyncKnob::contextMenuEvent( QContextMenuEvent * )
contextMenu.addHelpAction();
contextMenu.exec( QCursor::pos() );
delete syncMenu;
}
@@ -163,7 +164,7 @@ void TempoSyncKnob::updateDescAndIcon()
switch( model()->m_tempoSyncMode )
{
case TempoSyncKnobModel::SyncCustom:
m_tempoSyncDescription = tr( "Custom " ) +
m_tempoSyncDescription = tr( "Custom " ) +
"(" +
QString::number( model()->m_custom.numeratorModel().value() ) +
"/" +
@@ -291,8 +292,8 @@ void TempoSyncKnob::showCustom()
{
if( m_custom == NULL )
{
m_custom = new MeterDialog( Engine::mainWindow()->workspace() );
Engine::mainWindow()->workspace()->addSubWindow( m_custom );
m_custom = new MeterDialog( gui->mainWindow()->workspace() );
gui->mainWindow()->workspace()->addSubWindow( m_custom );
m_custom->setWindowTitle( "Meter" );
m_custom->setModel( &model()->m_custom );
}

View File

@@ -28,13 +28,14 @@
#include "TextFloat.h"
#include "gui_templates.h"
#include "GuiApplication.h"
#include "MainWindow.h"
#include "Engine.h"
TextFloat::TextFloat() :
QWidget( Engine::mainWindow(), Qt::ToolTip ),
QWidget( gui->mainWindow(), Qt::ToolTip ),
m_title(),
m_text(),
m_pixmap()
@@ -89,7 +90,7 @@ void TextFloat::setVisibilityTimeOut( int _msecs )
TextFloat * TextFloat::displayMessage( const QString & _msg, int _timeout,
QWidget * _parent, int _add_y_margin )
{
QWidget * mw = Engine::mainWindow();
QWidget * mw = gui->mainWindow();
TextFloat * tf = new TextFloat;
if( _parent != NULL )
{

View File

@@ -25,6 +25,7 @@
#include <QMouseEvent>
#include "TimeDisplayWidget.h"
#include "GuiApplication.h"
#include "MainWindow.h"
#include "Engine.h"
#include "ToolTip.h"
@@ -53,7 +54,7 @@ TimeDisplayWidget::TimeDisplayWidget() :
// update labels of LCD spinboxes
setDisplayMode( m_displayMode );
connect( Engine::mainWindow(), SIGNAL( periodicUpdate() ),
connect( gui->mainWindow(), SIGNAL( periodicUpdate() ),
this, SLOT( updateTime() ) );
}

View File

@@ -27,24 +27,12 @@
#include "ToolTip.h"
const QColor ToolButton::s_stdColor = QColor( 216, 216, 216 );
const QColor ToolButton::s_hlColor = QColor( 240, 240, 240 );
ToolButton::ToolButton( const QPixmap & _pixmap, const QString & _tooltip,
QObject * _receiver, const char * _slot,
QWidget * _parent ) :
QToolButton( _parent ),
m_colorStandard( s_stdColor ),
m_colorHighlighted( s_hlColor )
QToolButton( _parent )
{
setAutoFillBackground( false );
QPalette pal = palette();
pal.setColor( backgroundRole(), m_colorStandard );
pal.setColor( QPalette::Window, m_colorStandard );
pal.setColor( QPalette::Button, m_colorStandard );
setPalette( pal );
if( _receiver != NULL && _slot != NULL )
{
@@ -53,9 +41,6 @@ ToolButton::ToolButton( const QPixmap & _pixmap, const QString & _tooltip,
ToolTip::add( this, _tooltip );
setFixedSize( 30, 30 );
setIcon( _pixmap );
leaveEvent( NULL );
connect( this, SIGNAL( toggled( bool ) ), this,
SLOT( toggledBool( bool ) ) );
}
@@ -68,40 +53,5 @@ ToolButton::~ToolButton()
void ToolButton::enterEvent( QEvent * )
{
QPalette pal = palette();
pal.setColor( backgroundRole(), m_colorHighlighted );
pal.setColor( QPalette::Window, m_colorHighlighted );
pal.setColor( QPalette::Button, m_colorHighlighted );
setPalette( pal );
}
void ToolButton::leaveEvent( QEvent * )
{
QPalette pal = palette();
pal.setColor( backgroundRole(), m_colorStandard );
pal.setColor( QPalette::Window, m_colorStandard );
pal.setColor( QPalette::Button, m_colorStandard );
setPalette( pal );
}
void ToolButton::toggledBool( bool _on )
{
if( _on == true )
{
emit( clicked() );
}
}

View File

@@ -27,6 +27,7 @@
#include <QPainter>
#include "VisualizationWidget.h"
#include "GuiApplication.h"
#include "gui_templates.h"
#include "MainWindow.h"
#include "embed.h"
@@ -90,7 +91,7 @@ void VisualizationWidget::setActive( bool _active )
m_active = _active;
if( m_active )
{
connect( Engine::mainWindow(),
connect( gui->mainWindow(),
SIGNAL( periodicUpdate() ),
this, SLOT( update() ) );
connect( Engine::mixer(),
@@ -99,7 +100,7 @@ void VisualizationWidget::setActive( bool _active )
}
else
{
disconnect( Engine::mainWindow(),
disconnect( gui->mainWindow(),
SIGNAL( periodicUpdate() ),
this, SLOT( update() ) );
disconnect( Engine::mixer(),

View File

@@ -34,6 +34,7 @@
#include "Engine.h"
#include "gui_templates.h"
#include "MainWindow.h"
#include "GuiApplication.h"
#include "Mixer.h"
#include "RenameDialog.h"
#include "Song.h"
@@ -281,7 +282,7 @@ void BBTCOView::openInBBEditor()
{
Engine::getBBTrackContainer()->setCurrentBB( m_bbTCO->bbTrackIndex() );
Engine::mainWindow()->toggleBBEditorWin( true );
gui->mainWindow()->toggleBBEditorWin( true );
}
@@ -316,7 +317,7 @@ void BBTCOView::changeColor()
if( isSelected() )
{
QVector<selectableObject *> selected =
Engine::songEditor()->selectedObjects();
gui->songEditor()->m_editor->selectedObjects();
for( QVector<selectableObject *>::iterator it =
selected.begin();
it != selected.end(); ++it )
@@ -605,7 +606,7 @@ BBTrackView::BBTrackView( BBTrack * _bbt, TrackContainerView* tcv ) :
BBTrackView::~BBTrackView()
{
Engine::getBBEditor()->removeBBView( BBTrack::s_infoMap[m_bbTrack] );
gui->getBBEditor()->removeBBView( BBTrack::s_infoMap[m_bbTrack] );
}
@@ -613,7 +614,7 @@ BBTrackView::~BBTrackView()
bool BBTrackView::close()
{
Engine::getBBEditor()->removeBBView( BBTrack::s_infoMap[m_bbTrack] );
gui->getBBEditor()->removeBBView( BBTrack::s_infoMap[m_bbTrack] );
return TrackView::close();
}
@@ -623,7 +624,7 @@ bool BBTrackView::close()
void BBTrackView::clickedTrackLabel()
{
Engine::getBBTrackContainer()->setCurrentBB( m_bbTrack->index() );
Engine::getBBEditor()->show();
gui->getBBEditor()->show();
/* foreach( bbTrackView * tv,
trackContainerView()->findChildren<bbTrackView *>() )
{

View File

@@ -53,6 +53,7 @@
#include "FileBrowser.h"
#include "FxMixer.h"
#include "FxMixerView.h"
#include "GuiApplication.h"
#include "InstrumentSoundShaping.h"
#include "InstrumentSoundShapingView.h"
#include "FadeButton.h"
@@ -941,7 +942,7 @@ InstrumentTrackWindow * InstrumentTrackView::topLevelInstrumentTrackWindow()
{
InstrumentTrackWindow * w = NULL;
foreach( QMdiSubWindow * sw,
Engine::mainWindow()->workspace()->subWindowList(
gui->mainWindow()->workspace()->subWindowList(
QMdiArea::ActivationHistoryOrder ) )
{
if( sw->isVisible() && sw->widget()->inherits( "InstrumentTrackWindow" ) )
@@ -1135,10 +1136,10 @@ class fxLineLcdSpinBox : public LcdSpinBox
protected:
virtual void mouseDoubleClickEvent ( QMouseEvent * _me )
{
Engine::fxMixerView()->setCurrentFxLine( model()->value() );
gui->fxMixerView()->setCurrentFxLine( model()->value() );
Engine::fxMixerView()->show();// show fxMixer window
Engine::fxMixerView()->setFocus();// set focus to fxMixer window
gui->fxMixerView()->show();// show fxMixer window
gui->fxMixerView()->setFocus();// set focus to fxMixer window
//engine::getFxMixerView()->raise();
}
};
@@ -1280,7 +1281,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) :
setFixedWidth( INSTRUMENT_WIDTH );
resize( sizeHint() );
QMdiSubWindow * subWin = Engine::mainWindow()->workspace()->addSubWindow( this );
QMdiSubWindow * subWin = gui->mainWindow()->workspace()->addSubWindow( this );
Qt::WindowFlags flags = subWin->windowFlags();
flags |= Qt::MSWindowsFixedSizeDialogHint;
flags &= ~Qt::WindowMaximizeButtonHint;
@@ -1306,7 +1307,7 @@ InstrumentTrackWindow::~InstrumentTrackWindow()
delete m_instrumentView;
if( Engine::mainWindow()->workspace() )
if( gui->mainWindow()->workspace() )
{
parentWidget()->hide();
parentWidget()->deleteLater();
@@ -1472,7 +1473,7 @@ void InstrumentTrackWindow::closeEvent( QCloseEvent* event )
{
event->ignore();
if( Engine::mainWindow()->workspace() )
if( gui->mainWindow()->workspace() )
{
parentWidget()->hide();
}

View File

@@ -38,7 +38,7 @@
#include "templates.h"
#include "gui_templates.h"
#include "embed.h"
#include "Engine.h"
#include "GuiApplication.h"
#include "PianoRoll.h"
#include "TrackContainer.h"
#include "RenameDialog.h"
@@ -183,9 +183,9 @@ MidiTime Pattern::beatPatternLength() const
Note * Pattern::addNote( const Note & _new_note, const bool _quant_pos )
{
Note * new_note = new Note( _new_note );
if( _quant_pos && Engine::pianoRoll() )
if( _quant_pos && gui->pianoRoll() )
{
new_note->quantizePos( Engine::pianoRoll()->quantization() );
new_note->quantizePos( gui->pianoRoll()->quantization() );
}
instrumentTrack()->lock();
@@ -559,9 +559,9 @@ void Pattern::updateBBTrack()
Engine::getBBTrackContainer()->updateBBTrack( this );
}
if( Engine::pianoRoll() && Engine::pianoRoll()->currentPattern() == this )
if( gui->pianoRoll() && gui->pianoRoll()->currentPattern() == this )
{
Engine::pianoRoll()->update();
gui->pianoRoll()->update();
}
}
@@ -627,7 +627,7 @@ PatternView::PatternView( Pattern* pattern, TrackView* parent ) :
m_paintPixmap(),
m_needsUpdate( true )
{
connect( Engine::pianoRoll(), SIGNAL( currentPatternChanged() ),
connect( gui->pianoRoll(), SIGNAL( currentPatternChanged() ),
this, SLOT( update() ) );
if( s_stepBtnOn == NULL )
@@ -687,9 +687,10 @@ void PatternView::update()
void PatternView::openInPianoRoll()
{
Engine::pianoRoll()->setCurrentPattern( m_pat );
Engine::pianoRoll()->parentWidget()->show();
Engine::pianoRoll()->setFocus();
gui->pianoRoll()->setCurrentPattern( m_pat );
gui->pianoRoll()->parentWidget()->show();
gui->pianoRoll()->show();
gui->pianoRoll()->setFocus();
}
@@ -820,9 +821,9 @@ void PatternView::mousePressEvent( QMouseEvent * _me )
Engine::getSong()->setModified();
update();
if( Engine::pianoRoll()->currentPattern() == m_pat )
if( gui->pianoRoll()->currentPattern() == m_pat )
{
Engine::pianoRoll()->update();
gui->pianoRoll()->update();
}
}
else
@@ -881,9 +882,9 @@ void PatternView::wheelEvent( QWheelEvent * _we )
Engine::getSong()->setModified();
update();
if( Engine::pianoRoll()->currentPattern() == m_pat )
if( gui->pianoRoll()->currentPattern() == m_pat )
{
Engine::pianoRoll()->update();
gui->pianoRoll()->update();
}
}
_we->accept();
@@ -950,7 +951,7 @@ void PatternView::paintEvent( QPaintEvent * )
}
p.setBrush( lingrad );
if( Engine::pianoRoll()->currentPattern() == m_pat && m_pat->m_patternType != Pattern::BeatPattern )
if( gui->pianoRoll()->currentPattern() == m_pat && m_pat->m_patternType != Pattern::BeatPattern )
p.setPen( c.lighter( 130 ) );
else
p.setPen( c.darker( 300 ) );
@@ -959,7 +960,7 @@ void PatternView::paintEvent( QPaintEvent * )
p.setBrush( QBrush() );
if( m_pat->m_patternType != Pattern::BeatPattern )
{
if( Engine::pianoRoll()->currentPattern() == m_pat )
if( gui->pianoRoll()->currentPattern() == m_pat )
p.setPen( c.lighter( 160 ) );
else
p.setPen( c.lighter( 130 ) );

View File

@@ -44,6 +44,7 @@
#include "StringPairDrag.h"
#include "Knob.h"
#include "MainWindow.h"
#include "GuiApplication.h"
#include "EffectRackView.h"
#include "TrackLabelButton.h"
#include "ConfigManager.h"
@@ -588,7 +589,7 @@ SampleTrackView::SampleTrackView( SampleTrack * _t, TrackContainerView* tcv ) :
m_effectRack = new EffectRackView( _t->audioPort()->effects() );
m_effectRack->setFixedSize( 240, 242 );
m_effWindow = Engine::mainWindow()->workspace()->addSubWindow( m_effectRack );
m_effWindow = gui->mainWindow()->workspace()->addSubWindow( m_effectRack );
m_effWindow->setAttribute( Qt::WA_DeleteOnClose, false );
m_effWindow->layout()->setSizeConstraint( QLayout::SetFixedSize );
m_effWindow->setWindowTitle( _t->name() );