new stuff idk

This commit is contained in:
Ryzerth
2021-02-10 21:35:56 +01:00
parent 9e410e3856
commit 3541b8a0dd
7 changed files with 245 additions and 11 deletions

View File

@ -24,7 +24,8 @@ namespace sdrpp_credits {
const char* patrons[] = {
"SignalsEverywhere",
"Lee Donaghy"
"Lee Donaghy",
"Daniele D'Agnelli"
};
const int contributorCount = sizeof(contributors) / sizeof(char*);

View File

@ -186,12 +186,8 @@ namespace ImGui {
if (IS_IN_AREA(mPos, wfMin, wfMax)) {
for (auto const& [name, vfo] : vfos) {
ImVec2 nVfoRectMin(vfo->rectMin.x, wfMin.y);
ImVec2 nVfoRectMax(vfo->rectMax.x, wfMax.y);
ImVec2 nVfoLineMin(vfo->lineMin.x, wfMin.y);
ImVec2 nVfoLineMax(vfo->lineMin.x, wfMax.y);
window->DrawList->AddRectFilled(nVfoRectMin, nVfoRectMax, IM_COL32(255, 255, 255, 50));
window->DrawList->AddLine(nVfoLineMin, nVfoLineMax, (name == selectedVFO) ? IM_COL32(255, 0, 0, 255) : IM_COL32(255, 255, 0, 255));
window->DrawList->AddRectFilled(vfo->wfRectMin, vfo->wfRectMax, IM_COL32(255, 255, 255, 50));
window->DrawList->AddLine(vfo->wfLineMin, vfo->wfLineMax, (name == selectedVFO) ? IM_COL32(255, 0, 0, 255) : IM_COL32(255, 255, 0, 255));
}
}
}
@ -201,6 +197,10 @@ namespace ImGui {
if (vfo->redrawRequired) {
vfo->redrawRequired = false;
vfo->updateDrawingVars(viewBandwidth, dataWidth, viewOffset, widgetPos, fftHeight);
vfo->wfRectMin = ImVec2(vfo->rectMin.x, wfMin.y);
vfo->wfRectMax = ImVec2(vfo->rectMax.x, wfMax.y);
vfo->wfLineMin = ImVec2(vfo->lineMin.x, wfMin.y);
vfo->wfLineMax = ImVec2(vfo->lineMax.x, wfMax.y);
}
vfo->draw(window, name == selectedVFO);
}
@ -247,9 +247,7 @@ namespace ImGui {
if (name == selectedVFO) {
continue;
}
ImVec2 nVfoRectMin(_vfo->rectMin.x, wfMin.y);
ImVec2 nVfoRectMax(_vfo->rectMax.x, wfMax.y);
if (IS_IN_AREA(mousePos, _vfo->rectMin, _vfo->rectMax) || IS_IN_AREA(mousePos, nVfoRectMin, nVfoRectMax)) {
if (IS_IN_AREA(mousePos, _vfo->rectMin, _vfo->rectMax) || IS_IN_AREA(mousePos, _vfo->wfRectMin, _vfo->wfRectMax)) {
selectedVFO = name;
selectedVFOChanged = true;
return;
@ -257,7 +255,7 @@ namespace ImGui {
}
if (vfo != NULL) {
int refCenter = mousePos.x - (widgetPos.x + 50);
if (refCenter >= 0 && refCenter < dataWidth /* && ( (mousePos.y > widgetPos.y && mousePos.y < (widgetPos.y + widgetSize.y)) || (IS_IN_AREA(mousePos, nVfoRectMin, nVfoRectMax)) ) */ ) {
if (refCenter >= 0 && refCenter < dataWidth) {
double off = ((((double)refCenter / ((double)dataWidth / 2.0)) - 1.0) * (viewBandwidth / 2.0)) + viewOffset;
off += centerFreq;
off = (round(off / vfo->snapInterval) * vfo->snapInterval) - centerFreq;
@ -766,6 +764,10 @@ namespace ImGui {
void WaterFall::updateAllVFOs() {
for (auto const& [name, vfo] : vfos) {
vfo->updateDrawingVars(viewBandwidth, dataWidth, viewOffset, widgetPos, fftHeight);
vfo->wfRectMin = ImVec2(vfo->rectMin.x, wfMin.y);
vfo->wfRectMax = ImVec2(vfo->rectMax.x, wfMax.y);
vfo->wfLineMin = ImVec2(vfo->lineMin.x, wfMin.y);
vfo->wfLineMax = ImVec2(vfo->lineMax.x, wfMax.y);
}
}

View File

@ -38,6 +38,10 @@ namespace ImGui {
ImVec2 rectMax;
ImVec2 lineMin;
ImVec2 lineMax;
ImVec2 wfRectMin;
ImVec2 wfRectMax;
ImVec2 wfLineMin;
ImVec2 wfLineMax;
bool centerOffsetChanged = false;
bool lowerOffsetChanged = false;