GUI: add "cursor follows wheel" option
needs testing
This commit is contained in:
parent
2f0f30f2f4
commit
d411c9caba
|
|
@ -1521,6 +1521,7 @@ class FurnaceGUI {
|
|||
int pullDeleteRow;
|
||||
int newSongBehavior;
|
||||
int memUsageUnit;
|
||||
int cursorFollowsWheel;
|
||||
unsigned int maxUndoSteps;
|
||||
String mainFontPath;
|
||||
String patFontPath;
|
||||
|
|
@ -1674,6 +1675,7 @@ class FurnaceGUI {
|
|||
pullDeleteRow(1),
|
||||
newSongBehavior(0),
|
||||
memUsageUnit(1),
|
||||
cursorFollowsWheel(0),
|
||||
maxUndoSteps(100),
|
||||
mainFontPath(""),
|
||||
patFontPath(""),
|
||||
|
|
|
|||
|
|
@ -412,7 +412,7 @@ void FurnaceGUI::drawPattern() {
|
|||
ImGui::SetNextWindowPos(patWindowPos);
|
||||
ImGui::SetNextWindowSize(patWindowSize);
|
||||
}
|
||||
if (ImGui::Begin("Pattern",&patternOpen,globalWinFlags|(settings.avoidRaisingPattern?ImGuiWindowFlags_NoBringToFrontOnFocus:0))) {
|
||||
if (ImGui::Begin("Pattern",&patternOpen,globalWinFlags|(settings.avoidRaisingPattern?ImGuiWindowFlags_NoBringToFrontOnFocus:0)|(settings.cursorFollowsWheel?ImGuiWindowFlags_NoScrollWithMouse:0))) {
|
||||
if (!mobileUI) {
|
||||
patWindowPos=ImGui::GetWindowPos();
|
||||
patWindowSize=ImGui::GetWindowSize();
|
||||
|
|
@ -951,9 +951,16 @@ void FurnaceGUI::drawPattern() {
|
|||
demandScrollX=false;
|
||||
}
|
||||
|
||||
// cursor follows wheel
|
||||
if (settings.cursorFollowsWheel && (!e->isPlaying() || !followPattern) && ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows)) {
|
||||
if (wheelX!=0 || wheelY!=0) {
|
||||
moveCursor(wheelX,wheelY,false);
|
||||
}
|
||||
}
|
||||
|
||||
// overflow changes order
|
||||
// TODO: this is very unreliable and sometimes it can warp you out of the song
|
||||
if (settings.scrollChangesOrder && (!e->isPlaying() || !followPattern) && ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows)) {
|
||||
if (settings.scrollChangesOrder && (!e->isPlaying() || !followPattern) && ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows) && !settings.cursorFollowsWheel) {
|
||||
if (wheelY!=0) {
|
||||
if (wheelY>0) {
|
||||
if (ImGui::GetScrollY()<=0) {
|
||||
|
|
|
|||
|
|
@ -587,6 +587,11 @@ void FurnaceGUI::drawSettings() {
|
|||
settings.cursorMoveNoScroll=cursorMoveNoScrollB;
|
||||
}
|
||||
|
||||
bool cursorFollowsWheelB=settings.cursorFollowsWheel;
|
||||
if (ImGui::Checkbox("Move cursor with scroll wheel",&cursorFollowsWheelB)) {
|
||||
settings.cursorFollowsWheel=cursorFollowsWheelB;
|
||||
}
|
||||
|
||||
bool doubleClickColumnB=settings.doubleClickColumn;
|
||||
if (ImGui::Checkbox("Double click selects entire column",&doubleClickColumnB)) {
|
||||
settings.doubleClickColumn=doubleClickColumnB;
|
||||
|
|
@ -2804,6 +2809,7 @@ void FurnaceGUI::syncSettings() {
|
|||
settings.pullDeleteRow=e->getConfInt("pullDeleteRow",1);
|
||||
settings.newSongBehavior=e->getConfInt("newSongBehavior",0);
|
||||
settings.memUsageUnit=e->getConfInt("memUsageUnit",1);
|
||||
settings.cursorFollowsWheel=e->getConfInt("cursorFollowsWheel",0);
|
||||
|
||||
clampSetting(settings.mainFontSize,2,96);
|
||||
clampSetting(settings.patFontSize,2,96);
|
||||
|
|
@ -2931,6 +2937,7 @@ void FurnaceGUI::syncSettings() {
|
|||
clampSetting(settings.pullDeleteRow,0,1);
|
||||
clampSetting(settings.newSongBehavior,0,1);
|
||||
clampSetting(settings.memUsageUnit,0,1);
|
||||
clampSetting(settings.cursorFollowsWheel,0,1);
|
||||
|
||||
if (settings.exportLoops<0.0) settings.exportLoops=0.0;
|
||||
if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0;
|
||||
|
|
@ -3154,6 +3161,7 @@ void FurnaceGUI::commitSettings() {
|
|||
e->setConf("pullDeleteRow",settings.pullDeleteRow);
|
||||
e->setConf("newSongBehavior",settings.newSongBehavior);
|
||||
e->setConf("memUsageUnit",settings.memUsageUnit);
|
||||
e->setConf("cursorFollowsWheel",settings.cursorFollowsWheel);
|
||||
|
||||
// colors
|
||||
for (int i=0; i<GUI_COLOR_MAX; i++) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue