mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-07-14 04:55:51 +02:00
Fixed scroll bug and added keybinds
This commit is contained in:
@ -155,7 +155,7 @@ void FrequencySelect::draw() {
|
||||
}
|
||||
if (onDigit) {
|
||||
hovered = true;
|
||||
if (rightClick) {
|
||||
if (rightClick || (ImGui::IsKeyPressed(GLFW_KEY_DELETE) || ImGui::IsKeyPressed(GLFW_KEY_ENTER) || ImGui::IsKeyPressed(GLFW_KEY_KP_ENTER))) {
|
||||
for (int j = i; j < 12; j++) {
|
||||
digits[j] = 0;
|
||||
}
|
||||
@ -167,7 +167,7 @@ void FrequencySelect::draw() {
|
||||
if (ImGui::IsKeyPressed(GLFW_KEY_DOWN)) {
|
||||
decrementDigit(i);
|
||||
}
|
||||
if (ImGui::IsKeyPressed(GLFW_KEY_LEFT) && i > 0) {
|
||||
if ((ImGui::IsKeyPressed(GLFW_KEY_LEFT) || ImGui::IsKeyPressed(GLFW_KEY_BACKSPACE)) && i > 0) {
|
||||
moveCursorToDigit(i - 1);
|
||||
}
|
||||
if (ImGui::IsKeyPressed(GLFW_KEY_RIGHT) && i < 11) {
|
||||
@ -180,23 +180,11 @@ void FrequencySelect::draw() {
|
||||
for (int j = 0; j < chars.Size; j++) {
|
||||
if (chars[j] >= '0' && chars[j] <= '9') {
|
||||
digits[i + j] = chars[j] - '0';
|
||||
if ((i + j) < 11) { moveCursorToDigit(i + j + 1); }
|
||||
frequencyChanged = true;
|
||||
}
|
||||
if ((i + j) < 11) { moveCursorToDigit(i + j + 1); }
|
||||
frequencyChanged = true;
|
||||
}
|
||||
|
||||
// Check each digit
|
||||
// if (ImGui::IsKeyPressed(GLFW_KEY_KP_0)) { digits[i] = 0; if (i < 11) { moveCursorToDigit(i + 1); frequencyChanged = true; } }
|
||||
// if (ImGui::IsKeyPressed(GLFW_KEY_KP_1)) { digits[i] = 1; if (i < 11) { moveCursorToDigit(i + 1); frequencyChanged = true; } }
|
||||
// if (ImGui::IsKeyPressed(GLFW_KEY_KP_2)) { digits[i] = 2; if (i < 11) { moveCursorToDigit(i + 1); frequencyChanged = true; } }
|
||||
// if (ImGui::IsKeyPressed(GLFW_KEY_KP_3)) { digits[i] = 3; if (i < 11) { moveCursorToDigit(i + 1); frequencyChanged = true; } }
|
||||
// if (ImGui::IsKeyPressed(GLFW_KEY_KP_4)) { digits[i] = 4; if (i < 11) { moveCursorToDigit(i + 1); frequencyChanged = true; } }
|
||||
// if (ImGui::IsKeyPressed(GLFW_KEY_KP_5)) { digits[i] = 5; if (i < 11) { moveCursorToDigit(i + 1); frequencyChanged = true; } }
|
||||
// if (ImGui::IsKeyPressed(GLFW_KEY_KP_6)) { digits[i] = 6; if (i < 11) { moveCursorToDigit(i + 1); frequencyChanged = true; } }
|
||||
// if (ImGui::IsKeyPressed(GLFW_KEY_KP_7)) { digits[i] = 7; if (i < 11) { moveCursorToDigit(i + 1); frequencyChanged = true; } }
|
||||
// if (ImGui::IsKeyPressed(GLFW_KEY_KP_8)) { digits[i] = 8; if (i < 11) { moveCursorToDigit(i + 1); frequencyChanged = true; } }
|
||||
// if (ImGui::IsKeyPressed(GLFW_KEY_KP_9)) { digits[i] = 9; if (i < 11) { moveCursorToDigit(i + 1); frequencyChanged = true; } }
|
||||
|
||||
if (mw != 0) {
|
||||
int count = abs(mw);
|
||||
for (int j = 0; j < count; j++) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <imutils.h>
|
||||
#include <algorithm>
|
||||
#include <volk/volk.h>
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
float DEFAULT_COLOR_MAP[][3] = {
|
||||
@ -390,6 +390,33 @@ namespace ImGui {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the left and right keys are pressed while hovering the freq scale, move it too
|
||||
if ((ImGui::IsKeyPressed(GLFW_KEY_LEFT) || ImGui::IsKeyPressed(GLFW_KEY_RIGHT)) && mouseInFreq) {
|
||||
viewOffset += ImGui::IsKeyPressed(GLFW_KEY_LEFT) ? (viewBandwidth / 20.0) : (-viewBandwidth / 20.0);
|
||||
|
||||
if (viewOffset + (viewBandwidth / 2.0) > wholeBandwidth / 2.0) {
|
||||
double freqOffset = (viewOffset + (viewBandwidth / 2.0)) - (wholeBandwidth / 2.0);
|
||||
viewOffset = (wholeBandwidth / 2.0) - (viewBandwidth / 2.0);
|
||||
centerFreq += freqOffset;
|
||||
centerFreqMoved = true;
|
||||
}
|
||||
if (viewOffset - (viewBandwidth / 2.0) < -(wholeBandwidth / 2.0)) {
|
||||
double freqOffset = (viewOffset - (viewBandwidth / 2.0)) + (wholeBandwidth / 2.0);
|
||||
viewOffset = (viewBandwidth / 2.0) - (wholeBandwidth / 2.0);
|
||||
centerFreq += freqOffset;
|
||||
centerFreqMoved = true;
|
||||
}
|
||||
|
||||
lowerFreq = (centerFreq + viewOffset) - (viewBandwidth / 2.0);
|
||||
upperFreq = (centerFreq + viewOffset) + (viewBandwidth / 2.0);
|
||||
|
||||
if (viewBandwidth != wholeBandwidth) {
|
||||
updateAllVFOs();
|
||||
if (_fullUpdate) { updateWaterfallFb(); };
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Finally, if nothing else was selected, just move the VFO
|
||||
if (ImGui::IsMouseDown(ImGuiMouseButton_Left) && (mouseInFFT|mouseInWaterfall)) {
|
||||
if (selVfo != NULL) {
|
||||
|
Reference in New Issue
Block a user