mirror of
https://github.com/LMMS/lmms.git
synced 2025-12-23 22:58:33 -05:00
Follow-Up of 7db3fa94a1 .
This was done by setting `CMAKE_C_INCLUDE_WHAT_YOU_USE` and
`CMAKE_CXX_INCLUDE_WHAT_YOU_USE` to (broken down into multiple lines here,
note, all below `FL/x.h` is not required for C):
```
include-what-you-use;
-Xiwyu;--mapping_file=/usr/share/include-what-you-use/qt5_11.imp;
-Xiwyu;--keep=*/xmmintrin.h;
-Xiwyu;--keep=*/lmmsconfig.h;
-Xiwyu;--keep=*/weak_libjack.h;
-Xiwyu;--keep=*/sys/*;
-Xiwyu;--keep=*/debug.h;
-Xiwyu;--keep=*/SDL/*;
-Xiwyu;--keep=*/alsa/*;
-Xiwyu;--keep=*/FL/x.h;
-Xiwyu;--keep=*/MidiApple.h;
-Xiwyu;--keep=*/MidiWinMM.h;
-Xiwyu;--keep=*/AudioSoundIo.h;
-Xiwyu;--keep=*/OpulenZ/adplug/*;
-Xiwyu;--keep=QPainterPath;
-Xiwyu;--keep=QtTest
```
FAQ:
* Q: Does this speed-up a completely fresh compile?
* A: No, I measured it.
* Q: Does it speed up anything else?
* A: Yes. If you change one header, it can reduce the number of CPP files
that your compiler needs to recompile, or your IDE has to re-scan.
* Q: What other reasons are for this PR?
* A: It's idiomatic to only include headers if you need them. Also, it will
reduce output for those who want to use IWYU for new PRs.
Background:
This is just a remainder PR of what I planned. My original idea was to setup
a CI which warns you of useless includes (but not of all issues that IWYU
complains about). However, I could not see that this was favored on Discord.
A full IWYU CI also has the problem that it (possibly??) needs to compile
with `make -j 1`, which would make CI really slow.
However, for that plan, I had to fix the whole code base to be IWYU
compliant - which it now is.
188 lines
5.0 KiB
C++
188 lines
5.0 KiB
C++
/*
|
|
* TrackContentWidget.h - declaration of TrackContentWidget class
|
|
*
|
|
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
|
*
|
|
* This file is part of LMMS - https://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 LMMS_GUI_TRACK_CONTENT_WIDGET_H
|
|
#define LMMS_GUI_TRACK_CONTENT_WIDGET_H
|
|
|
|
#include <QWidget>
|
|
|
|
#include "JournallingObject.h"
|
|
#include "TimePos.h"
|
|
|
|
class QMimeData; // IWYU pragma: keep
|
|
|
|
|
|
namespace lmms
|
|
{
|
|
|
|
class Track;
|
|
|
|
namespace gui
|
|
{
|
|
|
|
class ClipView; // IWYU pragma: keep
|
|
class TrackView;
|
|
|
|
class TrackContentWidget : public QWidget, public JournallingObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
// qproperties for track background gradients
|
|
Q_PROPERTY(QBrush darkerColor READ darkerColor WRITE setDarkerColor)
|
|
Q_PROPERTY(QBrush lighterColor READ lighterColor WRITE setLighterColor)
|
|
Q_PROPERTY(QBrush coarseGridColor READ coarseGridColor WRITE setCoarseGridColor)
|
|
Q_PROPERTY(QBrush fineGridColor READ fineGridColor WRITE setFineGridColor)
|
|
Q_PROPERTY(QBrush horizontalColor READ horizontalColor WRITE setHorizontalColor)
|
|
Q_PROPERTY(QBrush embossColor READ embossColor WRITE setEmbossColor)
|
|
|
|
Q_PROPERTY(int coarseGridWidth READ coarseGridWidth WRITE setCoarseGridWidth)
|
|
Q_PROPERTY(int fineGridWidth READ fineGridWidth WRITE setFineGridWidth)
|
|
Q_PROPERTY(int horizontalWidth READ horizontalWidth WRITE setHorizontalWidth)
|
|
Q_PROPERTY(int embossWidth READ embossWidth WRITE setEmbossWidth)
|
|
|
|
Q_PROPERTY(int embossOffset READ embossOffset WRITE setEmbossOffset)
|
|
|
|
public:
|
|
TrackContentWidget( TrackView * parent );
|
|
~TrackContentWidget() override = default;
|
|
|
|
void addClipView( ClipView * clipv );
|
|
void removeClipView( ClipView * clipv );
|
|
void removeClipView( int clipNum )
|
|
{
|
|
if( clipNum >= 0 && clipNum < m_clipViews.size() )
|
|
{
|
|
removeClipView( m_clipViews[clipNum] );
|
|
}
|
|
}
|
|
|
|
bool canPasteSelection( TimePos clipPos, const QDropEvent *de );
|
|
bool canPasteSelection( TimePos clipPos, const QMimeData *md, bool allowSameBar = false );
|
|
bool pasteSelection( TimePos clipPos, QDropEvent * de );
|
|
bool pasteSelection( TimePos clipPos, const QMimeData * md, bool skipSafetyCheck = false );
|
|
|
|
TimePos endPosition( const TimePos & posStart );
|
|
|
|
// qproperty access methods
|
|
|
|
QBrush darkerColor() const;
|
|
QBrush lighterColor() const;
|
|
QBrush coarseGridColor() const;
|
|
QBrush fineGridColor() const;
|
|
QBrush horizontalColor() const;
|
|
QBrush embossColor() const;
|
|
|
|
int coarseGridWidth() const;
|
|
int fineGridWidth() const;
|
|
int horizontalWidth() const;
|
|
int embossWidth() const;
|
|
|
|
int embossOffset() const;
|
|
|
|
void setDarkerColor(const QBrush & c);
|
|
void setLighterColor(const QBrush & c);
|
|
void setCoarseGridColor(const QBrush & c);
|
|
void setFineGridColor(const QBrush & c);
|
|
void setHorizontalColor(const QBrush & c);
|
|
void setEmbossColor(const QBrush & c);
|
|
|
|
void setCoarseGridWidth(int c);
|
|
void setFineGridWidth(int c);
|
|
void setHorizontalWidth(int c);
|
|
void setEmbossWidth(int c);
|
|
|
|
void setEmbossOffset(int c);
|
|
|
|
public slots:
|
|
void update();
|
|
void changePosition( const lmms::TimePos & newPos = TimePos( -1 ) );
|
|
/*! \brief Updates the background tile pixmap. */
|
|
void updateBackground();
|
|
|
|
protected:
|
|
enum class ContextMenuAction
|
|
{
|
|
Paste
|
|
};
|
|
|
|
void contextMenuEvent( QContextMenuEvent * cme ) override;
|
|
void contextMenuAction( QContextMenuEvent * cme, ContextMenuAction action );
|
|
void dragEnterEvent( QDragEnterEvent * dee ) override;
|
|
void dropEvent( QDropEvent * de ) override;
|
|
void mousePressEvent( QMouseEvent * me ) override;
|
|
void mouseReleaseEvent( QMouseEvent * me ) override;
|
|
void paintEvent( QPaintEvent * pe ) override;
|
|
void resizeEvent( QResizeEvent * re ) override;
|
|
|
|
QString nodeName() const override
|
|
{
|
|
return "trackcontentwidget";
|
|
}
|
|
|
|
void saveSettings( QDomDocument& doc, QDomElement& element ) override
|
|
{
|
|
Q_UNUSED(doc)
|
|
Q_UNUSED(element)
|
|
}
|
|
|
|
void loadSettings( const QDomElement& element ) override
|
|
{
|
|
Q_UNUSED(element)
|
|
}
|
|
|
|
|
|
private:
|
|
Track * getTrack();
|
|
TimePos getPosition( int mouseX );
|
|
|
|
TrackView * m_trackView;
|
|
|
|
using clipViewVector = QVector<ClipView*>;
|
|
clipViewVector m_clipViews;
|
|
|
|
QPixmap m_background;
|
|
|
|
// qproperty fields
|
|
QBrush m_darkerColor;
|
|
QBrush m_lighterColor;
|
|
QBrush m_coarseGridColor;
|
|
QBrush m_fineGridColor;
|
|
QBrush m_horizontalColor;
|
|
QBrush m_embossColor;
|
|
|
|
int m_coarseGridWidth;
|
|
int m_fineGridWidth;
|
|
int m_horizontalWidth;
|
|
int m_embossWidth;
|
|
|
|
int m_embossOffset;
|
|
} ;
|
|
|
|
|
|
} // namespace gui
|
|
|
|
} // namespace lmms
|
|
|
|
#endif // LMMS_GUI_TRACK_CONTENT_WIDGET_H
|