GUI: add ability to select entire row
when clicking on row number
This commit is contained in:
parent
297ab01d4c
commit
1ba5ac6766
1
TODO.md
1
TODO.md
|
@ -16,7 +16,6 @@
|
||||||
- try to find out why does VSlider not accept keyboard input
|
- try to find out why does VSlider not accept keyboard input
|
||||||
- finish lock layout
|
- finish lock layout
|
||||||
- if macros have release, note off should release them
|
- if macros have release, note off should release them
|
||||||
- add ability to select entire row when clicking on row number
|
|
||||||
- store edit/followOrders/followPattern state in config
|
- store edit/followOrders/followPattern state in config
|
||||||
- add ability to select a column by double clicking
|
- add ability to select a column by double clicking
|
||||||
- add ability to move selection by dragging
|
- add ability to move selection by dragging
|
||||||
|
|
|
@ -21,28 +21,48 @@
|
||||||
|
|
||||||
#include "actionUtil.h"
|
#include "actionUtil.h"
|
||||||
|
|
||||||
void FurnaceGUI::startSelection(int xCoarse, int xFine, int y) {
|
void FurnaceGUI::startSelection(int xCoarse, int xFine, int y, bool fullRow) {
|
||||||
|
DETERMINE_FIRST_LAST;
|
||||||
|
|
||||||
if (xCoarse!=selStart.xCoarse || xFine!=selStart.xFine || y!=selStart.y) {
|
if (xCoarse!=selStart.xCoarse || xFine!=selStart.xFine || y!=selStart.y) {
|
||||||
curNibble=false;
|
curNibble=false;
|
||||||
}
|
}
|
||||||
cursor.xCoarse=xCoarse;
|
|
||||||
cursor.xFine=xFine;
|
if (fullRow) {
|
||||||
cursor.y=y;
|
selStart.xCoarse=firstChannel;
|
||||||
selStart.xCoarse=xCoarse;
|
selStart.xFine=0;
|
||||||
selStart.xFine=xFine;
|
selEnd.xCoarse=lastChannel-1;
|
||||||
selStart.y=y;
|
selEnd.xFine=2+e->song.pat[selEnd.xCoarse].effectCols*2;
|
||||||
selEnd.xCoarse=xCoarse;
|
selStart.y=y;
|
||||||
selEnd.xFine=xFine;
|
selEnd.y=y;
|
||||||
selEnd.y=y;
|
} else {
|
||||||
|
cursor.xCoarse=xCoarse;
|
||||||
|
cursor.xFine=xFine;
|
||||||
|
cursor.y=y;
|
||||||
|
selStart.xCoarse=xCoarse;
|
||||||
|
selStart.xFine=xFine;
|
||||||
|
selStart.y=y;
|
||||||
|
selEnd.xCoarse=xCoarse;
|
||||||
|
selEnd.xFine=xFine;
|
||||||
|
selEnd.y=y;
|
||||||
|
}
|
||||||
selecting=true;
|
selecting=true;
|
||||||
|
selectingFull=fullRow;
|
||||||
e->setMidiBaseChan(cursor.xCoarse);
|
e->setMidiBaseChan(cursor.xCoarse);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FurnaceGUI::updateSelection(int xCoarse, int xFine, int y) {
|
void FurnaceGUI::updateSelection(int xCoarse, int xFine, int y, bool fullRow) {
|
||||||
if (!selecting) return;
|
if (!selecting) return;
|
||||||
selEnd.xCoarse=xCoarse;
|
if (selectingFull) {
|
||||||
selEnd.xFine=xFine;
|
DETERMINE_LAST;
|
||||||
selEnd.y=y;
|
selEnd.xCoarse=lastChannel-1;
|
||||||
|
selEnd.xFine=2+e->song.pat[selEnd.xCoarse].effectCols*2;
|
||||||
|
selEnd.y=y;
|
||||||
|
} else {
|
||||||
|
selEnd.xCoarse=xCoarse;
|
||||||
|
selEnd.xFine=xFine;
|
||||||
|
selEnd.y=y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FurnaceGUI::finishSelection() {
|
void FurnaceGUI::finishSelection() {
|
||||||
|
@ -66,6 +86,7 @@ void FurnaceGUI::finishSelection() {
|
||||||
selEnd.xFine^=selStart.xFine;
|
selEnd.xFine^=selStart.xFine;
|
||||||
}
|
}
|
||||||
selecting=false;
|
selecting=false;
|
||||||
|
selectingFull=false;
|
||||||
|
|
||||||
// boundary check
|
// boundary check
|
||||||
int chanCount=e->getTotalChannelCount();
|
int chanCount=e->getTotalChannelCount();
|
||||||
|
|
|
@ -2350,7 +2350,7 @@ bool FurnaceGUI::loop() {
|
||||||
}
|
}
|
||||||
sampleDragActive=false;
|
sampleDragActive=false;
|
||||||
if (selecting) {
|
if (selecting) {
|
||||||
cursor=selEnd;
|
if (!selectingFull) cursor=selEnd;
|
||||||
finishSelection();
|
finishSelection();
|
||||||
demandScrollX=true;
|
demandScrollX=true;
|
||||||
if (cursor.xCoarse==selStart.xCoarse && cursor.xFine==selStart.xFine && cursor.y==selStart.y &&
|
if (cursor.xCoarse==selStart.xCoarse && cursor.xFine==selStart.xFine && cursor.y==selStart.y &&
|
||||||
|
@ -3975,6 +3975,7 @@ FurnaceGUI::FurnaceGUI():
|
||||||
chanOscDocked(false),
|
chanOscDocked(false),
|
||||||
*/
|
*/
|
||||||
selecting(false),
|
selecting(false),
|
||||||
|
selectingFull(false),
|
||||||
curNibble(false),
|
curNibble(false),
|
||||||
orderNibble(false),
|
orderNibble(false),
|
||||||
followOrders(true),
|
followOrders(true),
|
||||||
|
|
|
@ -1016,7 +1016,7 @@ class FurnaceGUI {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SelectionPoint selStart, selEnd, cursor;
|
SelectionPoint selStart, selEnd, cursor;
|
||||||
bool selecting, curNibble, orderNibble, followOrders, followPattern, changeAllOrders, mobileUI;
|
bool selecting, selectingFull, curNibble, orderNibble, followOrders, followPattern, changeAllOrders, mobileUI;
|
||||||
bool collapseWindow, demandScrollX, fancyPattern, wantPatName, firstFrame, tempoView, waveHex, lockLayout, editOptsVisible, latchNibble, nonLatchNibble;
|
bool collapseWindow, demandScrollX, fancyPattern, wantPatName, firstFrame, tempoView, waveHex, lockLayout, editOptsVisible, latchNibble, nonLatchNibble;
|
||||||
FurnaceGUIWindows curWindow, nextWindow, curWindowLast;
|
FurnaceGUIWindows curWindow, nextWindow, curWindowLast;
|
||||||
float peak[2];
|
float peak[2];
|
||||||
|
@ -1121,7 +1121,7 @@ class FurnaceGUI {
|
||||||
ImVec2 patWindowPos, patWindowSize;
|
ImVec2 patWindowPos, patWindowSize;
|
||||||
|
|
||||||
// pattern view specific
|
// pattern view specific
|
||||||
ImVec2 threeChars, twoChars;
|
ImVec2 fourChars, threeChars, twoChars;
|
||||||
SelectionPoint sel1, sel2;
|
SelectionPoint sel1, sel2;
|
||||||
int dummyRows, demandX;
|
int dummyRows, demandX;
|
||||||
int transposeAmount, randomizeMin, randomizeMax, fadeMin, fadeMax;
|
int transposeAmount, randomizeMin, randomizeMax, fadeMin, fadeMax;
|
||||||
|
@ -1262,8 +1262,8 @@ class FurnaceGUI {
|
||||||
void commitSettings();
|
void commitSettings();
|
||||||
void processDrags(int dragX, int dragY);
|
void processDrags(int dragX, int dragY);
|
||||||
|
|
||||||
void startSelection(int xCoarse, int xFine, int y);
|
void startSelection(int xCoarse, int xFine, int y, bool fullRow=false);
|
||||||
void updateSelection(int xCoarse, int xFine, int y);
|
void updateSelection(int xCoarse, int xFine, int y, bool fullRow=false);
|
||||||
void finishSelection();
|
void finishSelection();
|
||||||
|
|
||||||
void moveCursor(int x, int y, bool select);
|
void moveCursor(int x, int y, bool select);
|
||||||
|
|
|
@ -88,11 +88,21 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// row number
|
// row number
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_Text,rowIndexColor);
|
||||||
|
|
||||||
if (settings.patRowsBase==1) {
|
if (settings.patRowsBase==1) {
|
||||||
ImGui::TextColored(rowIndexColor," %.2X ",i);
|
snprintf(id,31," %.2X ##PR_%d",i,i);
|
||||||
} else {
|
} else {
|
||||||
ImGui::TextColored(rowIndexColor,"%3d ",i);
|
snprintf(id,31,"%3d ##PR_%d",i,i);
|
||||||
}
|
}
|
||||||
|
ImGui::Selectable(id,false,ImGuiSelectableFlags_NoPadWithHalfSpacing,fourChars);
|
||||||
|
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) {
|
||||||
|
updateSelection(0,0,i,true);
|
||||||
|
}
|
||||||
|
if (ImGui::IsItemClicked()) {
|
||||||
|
startSelection(0,0,i,true);
|
||||||
|
}
|
||||||
|
ImGui::PopStyleColor();
|
||||||
// for each column
|
// for each column
|
||||||
for (int j=0; j<chans; j++) {
|
for (int j=0; j<chans; j++) {
|
||||||
// check if channel is not hidden
|
// check if channel is not hidden
|
||||||
|
@ -535,6 +545,7 @@ void FurnaceGUI::drawPattern() {
|
||||||
ImGui::TextColored(uiColors[GUI_COLOR_EE_VALUE]," %.2X",e->getExtValue());
|
ImGui::TextColored(uiColors[GUI_COLOR_EE_VALUE]," %.2X",e->getExtValue());
|
||||||
}
|
}
|
||||||
float oneCharSize=ImGui::CalcTextSize("A").x;
|
float oneCharSize=ImGui::CalcTextSize("A").x;
|
||||||
|
fourChars=ImVec2(oneCharSize*4.0f,lineHeight);
|
||||||
threeChars=ImVec2(oneCharSize*3.0f,lineHeight);
|
threeChars=ImVec2(oneCharSize*3.0f,lineHeight);
|
||||||
twoChars=ImVec2(oneCharSize*2.0f,lineHeight);
|
twoChars=ImVec2(oneCharSize*2.0f,lineHeight);
|
||||||
//ImVec2 oneChar=ImVec2(oneCharSize,lineHeight);
|
//ImVec2 oneChar=ImVec2(oneCharSize,lineHeight);
|
||||||
|
|
Loading…
Reference in a new issue