GUI: allow pat scroll by moving mouse outta window
had to fit 50 chars
This commit is contained in:
parent
7ba8607270
commit
c41435353a
|
@ -148,6 +148,11 @@ void FurnaceGUI::updateScroll(int amount) {
|
||||||
nextScroll=lineHeight*amount;
|
nextScroll=lineHeight*amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FurnaceGUI::addScroll(int amount) {
|
||||||
|
float lineHeight=(ImGui::GetTextLineHeight()+2*dpiScale);
|
||||||
|
nextAddScroll=lineHeight*amount;
|
||||||
|
}
|
||||||
|
|
||||||
void FurnaceGUI::updateWindowTitle() {
|
void FurnaceGUI::updateWindowTitle() {
|
||||||
if (e->song.name.empty()) {
|
if (e->song.name.empty()) {
|
||||||
SDL_SetWindowTitle(sdlWin,fmt::sprintf("Furnace (%s)",e->getSystemName(e->song.system)).c_str());
|
SDL_SetWindowTitle(sdlWin,fmt::sprintf("Furnace (%s)",e->getSystemName(e->song.system)).c_str());
|
||||||
|
@ -988,7 +993,9 @@ void FurnaceGUI::drawPattern() {
|
||||||
}
|
}
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding,ImVec2(0.0f,0.0f));
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding,ImVec2(0.0f,0.0f));
|
||||||
if (ImGui::Begin("Pattern",&patternOpen)) {
|
if (ImGui::Begin("Pattern",&patternOpen)) {
|
||||||
ImGui::SetWindowSize(ImVec2(scrW*dpiScale,scrH*dpiScale));
|
//ImGui::SetWindowSize(ImVec2(scrW*dpiScale,scrH*dpiScale));
|
||||||
|
patWindowPos=ImGui::GetWindowPos();
|
||||||
|
patWindowSize=ImGui::GetWindowSize();
|
||||||
char id[32];
|
char id[32];
|
||||||
ImGui::PushFont(patFont);
|
ImGui::PushFont(patFont);
|
||||||
unsigned char ord=e->isPlaying()?oldOrder:e->getOrder();
|
unsigned char ord=e->isPlaying()?oldOrder:e->getOrder();
|
||||||
|
@ -1007,6 +1014,12 @@ void FurnaceGUI::drawPattern() {
|
||||||
if (nextScroll>-0.5f) {
|
if (nextScroll>-0.5f) {
|
||||||
ImGui::SetScrollY(nextScroll);
|
ImGui::SetScrollY(nextScroll);
|
||||||
nextScroll=-1.0f;
|
nextScroll=-1.0f;
|
||||||
|
nextAddScroll=0.0f;
|
||||||
|
}
|
||||||
|
if (nextAddScroll!=0.0f) {
|
||||||
|
ImGui::SetScrollY(ImGui::GetScrollY()+nextAddScroll);
|
||||||
|
nextScroll=-1.0f;
|
||||||
|
nextAddScroll=0.0f;
|
||||||
}
|
}
|
||||||
ImGui::TableSetupScrollFreeze(1,1);
|
ImGui::TableSetupScrollFreeze(1,1);
|
||||||
for (int i=0; i<chans; i++) {
|
for (int i=0; i<chans; i++) {
|
||||||
|
@ -2090,7 +2103,12 @@ bool FurnaceGUI::loop() {
|
||||||
case SDL_MOUSEMOTION:
|
case SDL_MOUSEMOTION:
|
||||||
if (selecting) {
|
if (selecting) {
|
||||||
// detect whether we have to scroll
|
// detect whether we have to scroll
|
||||||
printf("motion: %d %d\n",ev.motion.x,ev.motion.y);
|
if (ev.motion.y<patWindowPos.y) {
|
||||||
|
addScroll(-1);
|
||||||
|
}
|
||||||
|
if (ev.motion.y>patWindowPos.y+patWindowSize.y) {
|
||||||
|
addScroll(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (macroDragActive) {
|
if (macroDragActive) {
|
||||||
if (macroDragLen>0) {
|
if (macroDragLen>0) {
|
||||||
|
@ -2477,7 +2495,8 @@ FurnaceGUI::FurnaceGUI():
|
||||||
macroDragMin(0),
|
macroDragMin(0),
|
||||||
macroDragMax(0),
|
macroDragMax(0),
|
||||||
macroDragActive(false),
|
macroDragActive(false),
|
||||||
nextScroll(-1.0f) {
|
nextScroll(-1.0f),
|
||||||
|
nextAddScroll(0.0f) {
|
||||||
uiColors[GUI_COLOR_BACKGROUND]=ImVec4(0.1f,0.1f,0.1f,1.0f);
|
uiColors[GUI_COLOR_BACKGROUND]=ImVec4(0.1f,0.1f,0.1f,1.0f);
|
||||||
uiColors[GUI_COLOR_FRAME_BACKGROUND]=ImVec4(0.0f,0.0f,0.0f,0.85f);
|
uiColors[GUI_COLOR_FRAME_BACKGROUND]=ImVec4(0.0f,0.0f,0.0f,0.85f);
|
||||||
uiColors[GUI_COLOR_CHANNEL_FM]=ImVec4(0.2f,0.8f,1.0f,1.0f);
|
uiColors[GUI_COLOR_CHANNEL_FM]=ImVec4(0.2f,0.8f,1.0f,1.0f);
|
||||||
|
|
|
@ -151,7 +151,9 @@ class FurnaceGUI {
|
||||||
int waveDragMin, waveDragMax;
|
int waveDragMin, waveDragMax;
|
||||||
bool waveDragActive;
|
bool waveDragActive;
|
||||||
|
|
||||||
float nextScroll;
|
float nextScroll, nextAddScroll;
|
||||||
|
|
||||||
|
ImVec2 patWindowPos, patWindowSize;
|
||||||
|
|
||||||
void updateWindowTitle();
|
void updateWindowTitle();
|
||||||
void prepareLayout();
|
void prepareLayout();
|
||||||
|
@ -197,6 +199,7 @@ class FurnaceGUI {
|
||||||
bool decodeNote(const char* what, short& note, short& octave);
|
bool decodeNote(const char* what, short& note, short& octave);
|
||||||
void bindEngine(DivEngine* eng);
|
void bindEngine(DivEngine* eng);
|
||||||
void updateScroll(int amount);
|
void updateScroll(int amount);
|
||||||
|
void addScroll(int amount);
|
||||||
bool loop();
|
bool loop();
|
||||||
bool finish();
|
bool finish();
|
||||||
bool init();
|
bool init();
|
||||||
|
|
Loading…
Reference in a new issue