Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix: hide selection changes in protocol #46

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 2 additions & 8 deletions src/gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@ void MainWindow::setFile(MidiFile* file)
connect(file, SIGNAL(recalcWidgetSize()), mw_matrixWidget, SLOT(calcSizes()));
connect(file->protocol(), SIGNAL(actionFinished()), this, SLOT(markEdited()));
connect(file->protocol(), SIGNAL(actionFinished()), eventWidget(), SLOT(reload()));
connect(eventWidget(), SIGNAL(selectionChangedByTool(bool)), eventWidget(), SLOT(reload()));
connect(file->protocol(), SIGNAL(actionFinished()), this, SLOT(checkEnableActionsForSelection()));
mw_matrixWidget->setFile(file);
updateChannelMenu();
Expand Down Expand Up @@ -1831,7 +1832,6 @@ void MainWindow::selectAllFromChannel(QAction* action)
return;
}
int channel = action->data().toInt();
file->protocol()->startNewAction("Select all events from channel " + QString::number(channel));
EventTool::clearSelection();
file->channel(channel)->setVisible(true);
foreach (MidiEvent* e, file->channel(channel)->eventMap()->values()) {
Expand All @@ -1840,8 +1840,6 @@ void MainWindow::selectAllFromChannel(QAction* action)
}
EventTool::selectEvent(e, false);
}

file->protocol()->endAction();
}

void MainWindow::selectAllFromTrack(QAction* action)
Expand All @@ -1852,7 +1850,6 @@ void MainWindow::selectAllFromTrack(QAction* action)
}

int track = action->data().toInt();
file->protocol()->startNewAction("Select all events from track " + QString::number(track));
EventTool::clearSelection();
file->track(track)->setHidden(false);
for (int channel = 0; channel < 16; channel++) {
Expand All @@ -1863,7 +1860,6 @@ void MainWindow::selectAllFromTrack(QAction* action)
}
}
}
file->protocol()->endAction();
}

void MainWindow::selectAll()
Expand All @@ -1873,15 +1869,13 @@ void MainWindow::selectAll()
return;
}

file->protocol()->startNewAction("Select all");

for (int i = 0; i < 16; i++) {
foreach (MidiEvent* event, file->channel(i)->eventMap()->values()) {
EventTool::selectEvent(event, false, true);
}
}

file->protocol()->endAction();
updateAll();
}

void MainWindow::transposeNSemitones()
Expand Down
4 changes: 0 additions & 4 deletions src/gui/SelectionNavigator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "../midi/MidiChannel.h"
#include "../midi/MidiFile.h"
#include "../midi/MidiTrack.h"
#include "../protocol/Protocol.h"
#include "../tool/EventTool.h"
#include "../tool/Selection.h"

Expand Down Expand Up @@ -87,10 +86,7 @@ void SelectionNavigator::navigate(qreal searchAngle)
}

if (!newSelectedEvent) return;
Protocol* protocol = file->protocol();
protocol->startNewAction("Tweak selection");
EventTool::selectEvent(newSelectedEvent, true);
protocol->endAction();
mainWindow->updateAll();
}

Expand Down
3 changes: 0 additions & 3 deletions src/tool/SelectTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "../MidiEvent/NoteOnEvent.h"
#include "../gui/MatrixWidget.h"
#include "../midi/MidiFile.h"
#include "../protocol/Protocol.h"
#include "StandardTool.h"

SelectTool::SelectTool(int type)
Expand Down Expand Up @@ -99,7 +98,6 @@ bool SelectTool::release()
if (!file()) {
return false;
}
file()->protocol()->startNewAction("Selection changed", image());
ProtocolEntry* toCopy = copy();

if (!QApplication::keyboardModifiers().testFlag(Qt::ShiftModifier) && !QApplication::keyboardModifiers().testFlag(Qt::ControlModifier)) {
Expand Down Expand Up @@ -153,7 +151,6 @@ bool SelectTool::release()
y_rect = 0;

protocol(toCopy, this);
file()->protocol()->endAction();
if (_standardTool) {
Tool::setCurrentTool(_standardTool);
_standardTool->move(mouseX, mouseY);
Expand Down
5 changes: 0 additions & 5 deletions src/tool/StandardTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "../MidiEvent/MidiEvent.h"
#include "../gui/MatrixWidget.h"
#include "../midi/MidiFile.h"
#include "../protocol/Protocol.h"
#include "Selection.h"

#define NO_ACTION 0
Expand Down Expand Up @@ -145,11 +144,9 @@ bool StandardTool::press(bool leftClick)

case SIZE_CHANGE_ACTION: {
if (!onSelectedEvent) {
file()->protocol()->startNewAction("Selection changed", image());
ProtocolEntry* toCopy = copy();
EventTool::selectEvent(event, !Selection::instance()->selectedEvents().contains(event));
protocol(toCopy, this);
file()->protocol()->endAction();
}
Tool::setCurrentTool(sizeChangeTool);
sizeChangeTool->move(mouseX, mouseY);
Expand All @@ -159,11 +156,9 @@ bool StandardTool::press(bool leftClick)

case MOVE_ACTION: {
if (!onSelectedEvent) {
file()->protocol()->startNewAction("Selection changed", image());
ProtocolEntry* toCopy = copy();
EventTool::selectEvent(event, !Selection::instance()->selectedEvents().contains(event));
protocol(toCopy, this);
file()->protocol()->endAction();
}
/* TODO reenable
if(altGrPressed){
Expand Down