Skip to content
Merged

h #18

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
4d9e5e3
Sampletrack activity indicator
serdnab Nov 5, 2019
caaeb62
Moved the activity indicator mute code to parent class
serdnab Nov 7, 2019
e056ecb
Added to sampletrackview the code needed for the activity indicator m…
serdnab Nov 8, 2019
229de18
Fixed triggering of stop animation when not playing
serdnab Nov 18, 2019
df3e388
Fix triggering of stop animation when playing no samples after stoppi…
serdnab Nov 19, 2019
2aea19f
Add "Open containing folder" (#5453)
michaelgregorius Apr 14, 2020
b85aef2
Code review changes
michaelgregorius Apr 19, 2020
c37fdd0
Code review changes (comment added)
michaelgregorius Apr 21, 2020
abcfee1
disable drag after drawing line (#5315)
tecknixia Apr 22, 2020
31996fe
Merge pull request #5454 from michaelgregorius/5453-OpenContainingFolder
michaelgregorius Apr 23, 2020
aec0dd3
If AutomationPattern has a single tick at 0, set it's length to 1 bar.
Veratil Apr 26, 2020
a4f6773
Add comments and reduce unnecessary code
Veratil Apr 26, 2020
9efb6f9
Merge pull request #5469 from Veratil/issue-5254
Spekular Apr 26, 2020
e199f72
Fix crash on drawing line on the end of a graph (#5471)
PhysSong Apr 28, 2020
7c2c77c
Mergefix
Spekular Apr 29, 2020
b46ea0e
refactor
Spekular Apr 29, 2020
5821466
Fix indicator in BB editor
Spekular Apr 29, 2020
c755b56
Piano roll vertical zoom (#5442)
akimaze Apr 30, 2020
ae2af96
Use nullptr instead of NULL
Spekular Apr 30, 2020
aaf94ef
Formatting chananges
Spekular Apr 30, 2020
0c180b8
Nicer spacing in activity indicator's setGeometry call
Spekular May 1, 2020
9ed5f80
Refactor palette update on un/mute
Spekular May 1, 2020
e643f83
Merge branch 'SampleIndicator' of https://github.com/Spekular/lmms in…
Spekular May 1, 2020
c18edd4
Use local cursor instead of global one in PianoRoll (#5200)
PhysSong May 3, 2020
6095bbc
Merge pull request #5477 from Spekular/SampleIndicator
Spekular May 4, 2020
1a6f4c1
Add option to move SideBar to right side of window (#5114)
Veratil May 5, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/AutomationEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ protected slots:

EditModes m_editMode;

bool m_mouseDownLeft;
bool m_mouseDownRight; //true if right click is being held down

TimeLineWidget * m_timeLine;
Expand Down
1 change: 1 addition & 0 deletions include/FadeButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class FadeButton : public QAbstractButton

public slots:
void activate();
void activateOnce();
void noteEnd();


Expand Down
1 change: 1 addition & 0 deletions include/FileBrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ private slots:
void openInNewInstrumentTrackSE( void );
void sendToActiveInstrumentTrack( void );
void updateDirectory( QTreeWidgetItem * item );
void openContainingFolder();

} ;

Expand Down
5 changes: 4 additions & 1 deletion include/InstrumentTrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,6 @@ private slots:
void midiInSelected();
void midiOutSelected();
void midiConfigChanged();
void muteChanged();

void assignFxLine( int channelIndex );
void createFxLine();
Expand All @@ -357,6 +356,10 @@ private slots:

QPoint m_lastPos;

FadeButton * getActivityIndicator()
{
return m_activityIndicator;
}

friend class InstrumentTrackWindow;

Expand Down
14 changes: 13 additions & 1 deletion include/PianoRoll.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class PianoRoll : public QWidget
void focusOutEvent( QFocusEvent * ) override;

int getKey( int y ) const;
static void drawNoteRect( QPainter & p, int x, int y,
void drawNoteRect( QPainter & p, int x, int y,
int width, const Note * n, const QColor & noteCol, const QColor & noteTextColor,
const QColor & selCol, const int noteOpc, const bool borderless, bool drawNoteName );
void removeSelection();
Expand All @@ -192,6 +192,8 @@ class PianoRoll : public QWidget
// for entering values with dblclick in the vol/pan bars
void enterValue( NoteVector* nv );

void updateYScroll();

protected slots:
void play();
void record();
Expand All @@ -217,6 +219,7 @@ protected slots:
void updatePositionStepRecording(const MidiTime & t );

void zoomingChanged();
void zoomingYChanged();
void quantizeChanged();
void noteLengthChanged();
void quantizeNotes();
Expand Down Expand Up @@ -330,12 +333,14 @@ protected slots:
static TextFloat * s_textFloat;

ComboBoxModel m_zoomingModel;
ComboBoxModel m_zoomingYModel;
ComboBoxModel m_quantizeModel;
ComboBoxModel m_noteLenModel;
ComboBoxModel m_scaleModel;
ComboBoxModel m_chordModel;

static const QVector<double> m_zoomLevels;
static const QVector<double> m_zoomYLevels;

Pattern* m_pattern;
NoteVector m_ghostNotes;
Expand Down Expand Up @@ -385,6 +390,12 @@ protected slots:
int m_ppb; // pixels per bar
int m_totalKeysToScroll;

int m_keyLineHeight;
int m_octaveHeight;
int m_whiteKeySmallHeight;
int m_whiteKeyBigHeight;
int m_blackKeyHeight;

// remember these values to use them
// for the next note that is set
MidiTime m_lenOfNewNotes;
Expand Down Expand Up @@ -501,6 +512,7 @@ private slots:
PianoRoll* m_editor;

ComboBox * m_zoomingComboBox;
ComboBox * m_zoomingYComboBox;
ComboBox * m_quantizeComboBox;
ComboBox * m_noteLenComboBox;
ComboBox * m_scaleComboBox;
Expand Down
22 changes: 22 additions & 0 deletions include/SampleTrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <QLayout>

#include "AudioPort.h"
#include "FadeButton.h"
#include "FxMixer.h"
#include "FxLineLcdSpinBox.h"
#include "Track.h"
Expand Down Expand Up @@ -161,6 +162,20 @@ class SampleTrack : public Track
return "sampletrack";
}

bool isPlaying()
{
return m_isPlaying;
}

void setPlaying(bool playing)
{
if (m_isPlaying != playing) { emit playingChanged(); }
m_isPlaying = playing;
}

signals:
void playingChanged();

public slots:
void updateTcos();
void setPlayingTcos( bool isPlaying );
Expand All @@ -171,6 +186,7 @@ public slots:
FloatModel m_panningModel;
IntModel m_effectChannelModel;
AudioPort m_audioPort;
bool m_isPlaying;



Expand Down Expand Up @@ -209,6 +225,7 @@ class SampleTrackView : public TrackView

public slots:
void showEffects();
void updateIndicator();


protected:
Expand All @@ -230,9 +247,14 @@ private slots:
SampleTrackWindow * m_window;
Knob * m_volumeKnob;
Knob * m_panningKnob;
FadeButton * m_activityIndicator;

TrackLabelButton * m_tlb;

FadeButton * getActivityIndicator()
{
return m_activityIndicator;
}

friend class SampleTrackWindow;

Expand Down
2 changes: 2 additions & 0 deletions include/SetupDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ private slots:
void toggleNoteLabels(bool enabled);
void toggleCompactTrackButtons(bool enabled);
void toggleOneInstrumentTrackWindow(bool enabled);
void toggleSideBarOnRight(bool enabled);
void toggleMMPZ(bool enabled);
void toggleDisableBackup(bool enabled);
void toggleOpenLastProject(bool enabled);
Expand Down Expand Up @@ -130,6 +131,7 @@ private slots:
bool m_printNoteLabels;
bool m_compactTrackButtons;
bool m_oneInstrumentTrackWindow;
bool m_sideBarOnRight;
bool m_MMPZ;
bool m_disableBackup;
bool m_openLastProject;
Expand Down
8 changes: 8 additions & 0 deletions include/Track.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "AutomatableModel.h"
#include "ModelView.h"
#include "DataFile.h"
#include "FadeButton.h"


class QMenu;
Expand Down Expand Up @@ -739,12 +740,19 @@ public slots:

Actions m_action;

virtual FadeButton * getActivityIndicator()
{
return nullptr;
}

void setIndicatorMute(FadeButton* indicator, bool muted);

friend class TrackLabelButton;


private slots:
void createTCOView( TrackContentObject * tco );
void muteChanged();

} ;

Expand Down
26 changes: 13 additions & 13 deletions src/core/AutomationPattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,17 +178,25 @@ const AutomationPattern::objectVector& AutomationPattern::objects() const

MidiTime AutomationPattern::timeMapLength() const
{
if( m_timeMap.isEmpty() ) return 0;
MidiTime one_bar = MidiTime(1, 0);
if (m_timeMap.isEmpty()) { return one_bar; }

timeMap::const_iterator it = m_timeMap.end();
return MidiTime( MidiTime( (it-1).key() ).nextFullBar(), 0 );
tick_t last_tick = static_cast<tick_t>((it-1).key());
// if last_tick is 0 (single item at tick 0)
// return length as a whole bar to prevent disappearing TCO
if (last_tick == 0) { return one_bar; }

return MidiTime(last_tick);
}




void AutomationPattern::updateLength()
{
changeLength( timeMapLength() );
// Do not resize down in case user manually extended up
changeLength(qMax(length(), timeMapLength()));
}


Expand Down Expand Up @@ -223,12 +231,7 @@ MidiTime AutomationPattern::putValue( const MidiTime & time,
}
generateTangents( it, 3 );

// we need to maximize our length in case we're part of a hidden
// automation track as the user can't resize this pattern
if( getTrack() && getTrack()->type() == Track::HiddenAutomationTrack )
{
updateLength();
}
updateLength();

emit dataChanged();

Expand All @@ -251,10 +254,7 @@ void AutomationPattern::removeValue( const MidiTime & time )
}
generateTangents(it, 3);

if( getTrack() && getTrack()->type() == Track::HiddenAutomationTrack )
{
updateLength();
}
updateLength();

emit dataChanged();
}
Expand Down
23 changes: 22 additions & 1 deletion src/core/Track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void TrackContentObject::movePosition( const MidiTime & pos )

/*! \brief Change the length of this TrackContentObject
*
* If the track content object's length has chaanged, update it. We
* If the track content object's length has changed, update it. We
* also add a journal entry for undo and update the display.
*
* \param _length The new length of the track content object.
Expand Down Expand Up @@ -2719,6 +2719,9 @@ TrackView::TrackView( Track * track, TrackContainerView * tcv ) :
connect( &m_track->m_mutedModel, SIGNAL( dataChanged() ),
&m_trackContentWidget, SLOT( update() ) );

connect(&m_track->m_mutedModel, SIGNAL(dataChanged()),
this, SLOT(muteChanged()));

connect( &m_track->m_soloModel, SIGNAL( dataChanged() ),
m_track, SLOT( toggleSolo() ), Qt::DirectConnection );
// create views for already existing TCOs
Expand Down Expand Up @@ -3051,3 +3054,21 @@ void TrackView::createTCOView( TrackContentObject * tco )
}
tco->selectViewOnCreate( false );
}




void TrackView::muteChanged()
{
FadeButton * indicator = getActivityIndicator();
if (indicator) { setIndicatorMute(indicator, m_track->m_mutedModel.value()); }
}




void TrackView::setIndicatorMute(FadeButton* indicator, bool muted)
{
QPalette::ColorRole role = muted ? QPalette::Highlight : QPalette::BrightText;
indicator->setActiveColor(QApplication::palette().color(QPalette::Active, role));
}
67 changes: 50 additions & 17 deletions src/gui/FileBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/


#include <QDesktopServices>
#include <QHBoxLayout>
#include <QKeyEvent>
#include <QLineEdit>
Expand Down Expand Up @@ -363,25 +364,41 @@ QList<QString> FileBrowserTreeWidget::expandedDirs( QTreeWidgetItem * item ) con

void FileBrowserTreeWidget::contextMenuEvent(QContextMenuEvent * e )
{
FileItem * f = dynamic_cast<FileItem *>( itemAt( e->pos() ) );
if( f != NULL && ( f->handling() == FileItem::LoadAsPreset ||
f->handling() == FileItem::LoadByPlugin ) )
FileItem * f = dynamic_cast<FileItem *>(itemAt(e->pos()));
if (f == nullptr)
{
return;
}

if (f->handling() == FileItem::LoadAsPreset || f->handling() == FileItem::LoadByPlugin)
{
// Set the member to the current FileItem so that it is available during the
// execution of the slots of the context menu we are about to create and execute.
m_contextMenuItem = f;
QMenu contextMenu( this );
contextMenu.addAction( tr( "Send to active instrument-track" ),
this,
SLOT( sendToActiveInstrumentTrack() ) );
contextMenu.addAction( tr( "Open in new instrument-track/"
"Song Editor" ),
this,
SLOT( openInNewInstrumentTrackSE() ) );
contextMenu.addAction( tr( "Open in new instrument-track/"
"B+B Editor" ),
this,
SLOT( openInNewInstrumentTrackBBE() ) );
contextMenu.exec( e->globalPos() );
m_contextMenuItem = NULL;

QMenu contextMenu(this);

contextMenu.addAction(tr("Send to active instrument-track"),
this,
SLOT(sendToActiveInstrumentTrack()));
contextMenu.addAction(tr("Open in new instrument-track/Song Editor"),
this,
SLOT(openInNewInstrumentTrackSE()));
contextMenu.addAction(tr("Open in new instrument-track/B+B Editor"),
this,
SLOT(openInNewInstrumentTrackBBE()));

contextMenu.addSeparator();

contextMenu.addAction(QIcon(embed::getIconPixmap("folder")),
tr("Open containing folder"),
this,
SLOT(openContainingFolder()));

contextMenu.exec(e->globalPos());

// The context menu has been executed so we can reset this member back to nullptr.
m_contextMenuItem = nullptr;
}
}

Expand Down Expand Up @@ -671,6 +688,22 @@ void FileBrowserTreeWidget::openInNewInstrumentTrackSE( void )



void FileBrowserTreeWidget::openContainingFolder()
{
if (m_contextMenuItem)
{
// Delegate to QDesktopServices::openUrl with the directory of the selected file. Please note that
// this will only open the directory but not select the file as this is much more complicated due
// to different implementations that are needed for different platforms (Linux/Windows/MacOS).

// Using QDesktopServices::openUrl seems to be the most simple cross platform way which uses
// functionality that's already available in Qt.
QFileInfo fileInfo(m_contextMenuItem->fullName());
QDesktopServices::openUrl(QUrl::fromLocalFile(fileInfo.dir().path()));
}
}



void FileBrowserTreeWidget::sendToActiveInstrumentTrack( void )
{
Expand Down
Loading