GUI: unreliable version of #63
This commit is contained in:
		
							parent
							
								
									720f046f28
								
							
						
					
					
						commit
						d6333af330
					
				| 
						 | 
					@ -514,11 +514,13 @@ const char* FurnaceGUI::getSystemName(DivSystem which) {
 | 
				
			||||||
void FurnaceGUI::updateScroll(int amount) {
 | 
					void FurnaceGUI::updateScroll(int amount) {
 | 
				
			||||||
  float lineHeight=(patFont->FontSize+2*dpiScale);
 | 
					  float lineHeight=(patFont->FontSize+2*dpiScale);
 | 
				
			||||||
  nextScroll=lineHeight*amount;
 | 
					  nextScroll=lineHeight*amount;
 | 
				
			||||||
 | 
					  haveHitBounds=false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void FurnaceGUI::addScroll(int amount) {
 | 
					void FurnaceGUI::addScroll(int amount) {
 | 
				
			||||||
  float lineHeight=(patFont->FontSize+2*dpiScale);
 | 
					  float lineHeight=(patFont->FontSize+2*dpiScale);
 | 
				
			||||||
  nextAddScroll=lineHeight*amount;
 | 
					  nextAddScroll=lineHeight*amount;
 | 
				
			||||||
 | 
					  haveHitBounds=false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void FurnaceGUI::setFileName(String name) {
 | 
					void FurnaceGUI::setFileName(String name) {
 | 
				
			||||||
| 
						 | 
					@ -3618,6 +3620,7 @@ FurnaceGUI::FurnaceGUI():
 | 
				
			||||||
  scaleMax(100.0f),
 | 
					  scaleMax(100.0f),
 | 
				
			||||||
  fadeMode(false),
 | 
					  fadeMode(false),
 | 
				
			||||||
  randomMode(false),
 | 
					  randomMode(false),
 | 
				
			||||||
 | 
					  haveHitBounds(false),
 | 
				
			||||||
  oldOrdersLen(0),
 | 
					  oldOrdersLen(0),
 | 
				
			||||||
  sampleZoom(1.0),
 | 
					  sampleZoom(1.0),
 | 
				
			||||||
  prevSampleZoom(1.0),
 | 
					  prevSampleZoom(1.0),
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1009,7 +1009,7 @@ class FurnaceGUI {
 | 
				
			||||||
  int dummyRows, demandX;
 | 
					  int dummyRows, demandX;
 | 
				
			||||||
  int transposeAmount, randomizeMin, randomizeMax, fadeMin, fadeMax;
 | 
					  int transposeAmount, randomizeMin, randomizeMax, fadeMin, fadeMax;
 | 
				
			||||||
  float scaleMax;
 | 
					  float scaleMax;
 | 
				
			||||||
  bool fadeMode, randomMode;
 | 
					  bool fadeMode, randomMode, haveHitBounds;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  int oldOrdersLen;
 | 
					  int oldOrdersLen;
 | 
				
			||||||
  DivOrders oldOrders;
 | 
					  DivOrders oldOrders;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,6 +17,7 @@
 | 
				
			||||||
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 | 
					 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <imgui.h>
 | 
				
			||||||
#define _USE_MATH_DEFINES
 | 
					#define _USE_MATH_DEFINES
 | 
				
			||||||
#include "gui.h"
 | 
					#include "gui.h"
 | 
				
			||||||
#include "../ta-log.h"
 | 
					#include "../ta-log.h"
 | 
				
			||||||
| 
						 | 
					@ -652,6 +653,45 @@ void FurnaceGUI::drawPattern() {
 | 
				
			||||||
        demandScrollX=false;
 | 
					        demandScrollX=false;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      scrollX=ImGui::GetScrollX();
 | 
					      scrollX=ImGui::GetScrollX();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      // overflow changes order
 | 
				
			||||||
 | 
					      if (!e->isPlaying()) {
 | 
				
			||||||
 | 
					        if (wheelY!=0) {
 | 
				
			||||||
 | 
					          if (wheelY>0) {
 | 
				
			||||||
 | 
					            if (ImGui::GetScrollY()<=0) {
 | 
				
			||||||
 | 
					              logV("scroll %d",wheelY);
 | 
				
			||||||
 | 
					              if (haveHitBounds) {
 | 
				
			||||||
 | 
					                if (e->getOrder()>0) {
 | 
				
			||||||
 | 
					                  e->setOrder(e->getOrder()-1);
 | 
				
			||||||
 | 
					                  ImGui::SetScrollY(ImGui::GetScrollMaxY());
 | 
				
			||||||
 | 
					                  updateScroll(e->song.patLen);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                haveHitBounds=false;
 | 
				
			||||||
 | 
					              } else {
 | 
				
			||||||
 | 
					                haveHitBounds=true;
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					              haveHitBounds=false;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					          } else {
 | 
				
			||||||
 | 
					            if (ImGui::GetScrollY()>=ImGui::GetScrollMaxY()) {
 | 
				
			||||||
 | 
					              logV("scroll %d",wheelY);
 | 
				
			||||||
 | 
					              if (haveHitBounds) {
 | 
				
			||||||
 | 
					                if (e->getOrder()<e->song.ordersLen) {
 | 
				
			||||||
 | 
					                  e->setOrder(e->getOrder()+1);
 | 
				
			||||||
 | 
					                  ImGui::SetScrollY(0);
 | 
				
			||||||
 | 
					                  updateScroll(0);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                haveHitBounds=false;
 | 
				
			||||||
 | 
					              } else {
 | 
				
			||||||
 | 
					                haveHitBounds=true;
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					              haveHitBounds=false;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
      ImGui::EndTable();
 | 
					      ImGui::EndTable();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue