Browse Source

Merge branch 'master' of https://github.com/VCVRack/Rack into 2017-10-bontric-midiCC-fix

tags/v0.5.0
ben 7 years ago
parent
commit
9c93bdcccb
2 changed files with 18 additions and 11 deletions
  1. +6
    -5
      src/app/RackScrollWidget.cpp
  2. +12
    -6
      src/gui.cpp

+ 6
- 5
src/app/RackScrollWidget.cpp View File

@@ -6,18 +6,19 @@ namespace rack {




void RackScrollWidget::step() { void RackScrollWidget::step() {
Vec pos = gRackWidget->lastMousePos;
Vec pos = gMousePos;
Rect viewport = getViewport(box.zeroPos());
// Scroll rack if dragging cable near the edge of the screen // Scroll rack if dragging cable near the edge of the screen
if (gRackWidget->wireContainer->activeWire) { if (gRackWidget->wireContainer->activeWire) {
float margin = 20.0; float margin = 20.0;
float speed = 15.0; float speed = 15.0;
if (pos.x <= margin)
if (pos.x <= viewport.pos.x + margin)
offset.x -= speed; offset.x -= speed;
if (pos.x >= box.size.x - margin)
if (pos.x >= viewport.pos.x + viewport.size.x - margin)
offset.x += speed; offset.x += speed;
if (pos.y <= margin)
if (pos.y <= viewport.pos.y + margin)
offset.y -= speed; offset.y -= speed;
if (pos.y >= box.size.y - margin)
if (pos.y >= viewport.pos.y + viewport.size.y - margin)
offset.y += speed; offset.y += speed;
} }
ScrollWidget::step(); ScrollWidget::step();


+ 12
- 6
src/gui.cpp View File

@@ -36,6 +36,8 @@ bool gAllowCursorLock = true;
int gGuiFrame; int gGuiFrame;
Vec gMousePos; Vec gMousePos;


std::string lastWindowTitle;



void windowSizeCallback(GLFWwindow* window, int width, int height) { void windowSizeCallback(GLFWwindow* window, int width, int height) {
gScene->box.size = Vec(width, height); gScene->box.size = Vec(width, height);
@@ -252,7 +254,8 @@ void guiInit() {
// glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_MAXIMIZED, GLFW_TRUE); glfwWindowHint(GLFW_MAXIMIZED, GLFW_TRUE);
glfwWindowHint(GLFW_DOUBLEBUFFER, GLFW_TRUE); glfwWindowHint(GLFW_DOUBLEBUFFER, GLFW_TRUE);
gWindow = glfwCreateWindow(640, 480, "", NULL, NULL);
lastWindowTitle = "";
gWindow = glfwCreateWindow(640, 480, lastWindowTitle.c_str(), NULL, NULL);
if (!gWindow) { if (!gWindow) {
osdialog_message(OSDIALOG_ERROR, OSDIALOG_OK, "Cannot open window with OpenGL 2.0 renderer. Does your graphics card support OpenGL 2.0 or greater? If so, make sure you have the latest graphics drivers installed."); osdialog_message(OSDIALOG_ERROR, OSDIALOG_OK, "Cannot open window with OpenGL 2.0 renderer. Does your graphics card support OpenGL 2.0 or greater? If so, make sure you have the latest graphics drivers installed.");
exit(1); exit(1);
@@ -328,15 +331,18 @@ void guiRun() {
mouseButtonStickyPop(); mouseButtonStickyPop();


// Set window title // Set window title
std::string title = gApplicationName;
std::string windowTitle = gApplicationName;
if (!gApplicationVersion.empty()) { if (!gApplicationVersion.empty()) {
title += " v" + gApplicationVersion;
windowTitle += " v" + gApplicationVersion;
} }
if (!gRackWidget->lastPath.empty()) { if (!gRackWidget->lastPath.empty()) {
title += " - ";
title += extractFilename(gRackWidget->lastPath);
windowTitle += " - ";
windowTitle += extractFilename(gRackWidget->lastPath);
}
if (windowTitle != lastWindowTitle) {
glfwSetWindowTitle(gWindow, windowTitle.c_str());
lastWindowTitle = windowTitle;
} }
glfwSetWindowTitle(gWindow, title.c_str());


// Get framebuffer size // Get framebuffer size
int width, height; int width, height;


Loading…
Cancel
Save