Skip to content

Commit

Permalink
sanity check dome for:
Browse files Browse the repository at this point in the history
free envelope window
formant window
resonance window
  • Loading branch information
abrolag committed Nov 18, 2020
1 parent 3be4df4 commit c4e5f8e
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 63 deletions.
22 changes: 8 additions & 14 deletions src/UI/ADnoteUI.fl
Original file line number Diff line number Diff line change
Expand Up @@ -2261,7 +2261,7 @@ send_data(0, ADDSYNTH::control::stereo, o->value(), TOPLEVEL::type::Integer);}
voicelistitem[i]->refreshlist();
int fetchW, fetchH, fetchX, fetchY, fetchO;
loadWin(synth, fetchW, fetchH, fetchX, fetchY, fetchO, "AddSynth-list");

if (fetchW < listDW || fetchH < listDH)
{
fetchW = listDW;
Expand All @@ -2283,7 +2283,7 @@ send_data(0, ADDSYNTH::control::stereo, o->value(), TOPLEVEL::type::Integer);}
callback {//
voicelistitem[nvoice]->refreshlist();
int fetchW, fetchH, fetchX, fetchY, fetchO;

if (!voiceSeen)
{
loadWin(synth, fetchW, fetchH, fetchX, fetchY, fetchO, "AddSynth-voice");
Expand All @@ -2296,13 +2296,13 @@ send_data(0, ADDSYNTH::control::stereo, o->value(), TOPLEVEL::type::Integer);}
//addVoiceRtext();
checkSane(fetchX, fetchY, fetchW, fetchH, voiceDW, voiceDH);
}

ADnoteVoice->redraw();
ADnoteVoice->show();
lastvoiceW = 0;
voiceSeen = true;


synth->getGuiMaster()->partui->adnoteui->fromVoiceList = false;
if ((Fl::event_button() == 3))
ADnoteGlobalParameters->hide();}
Expand All @@ -2328,7 +2328,7 @@ send_data(0, ADDSYNTH::control::stereo, o->value(), TOPLEVEL::type::Integer);}
label Resonance
callback {//
resui->resonancewindow->redraw();
resui->Show(true);
resui->Show();
if ((Fl::event_button() == 3))
ADnoteGlobalParameters->hide();}
tooltip {Resonance. Right click: also close this} xywh {318 375 90 25} labelfont 1 labelsize 12
Expand Down Expand Up @@ -2792,8 +2792,8 @@ switch (num)
fetchH = addDH;
}
checkSane(fetchX, fetchY, fetchW, fetchH, addDW, addDH);


lastglobalW = 0;
ADnoteGlobalParameters->resize(fetchX, fetchY, fetchW, fetchH);
ADnoteGlobalParameters->show();
Expand Down Expand Up @@ -2828,12 +2828,6 @@ switch (num)
freqenv->wincheck();
filterenv->wincheck();

if (!ADnoteGlobalParameters->visible())
{
resui->resonancewindow->hide(); // will need to add envelope/filter inserts
return;
}

if (lastglobalW < 3)
{
++lastglobalW;
Expand Down Expand Up @@ -2915,7 +2909,7 @@ switch (num)

if (!ADnoteVoice->visible())
return;

if (lastvoiceW < 2)
{
++lastvoiceW;
Expand Down
37 changes: 20 additions & 17 deletions src/UI/EnvelopeUI.fl
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,10 @@ class EnvelopeUI {: {public Fl_Group,PresetsUI_}
Function {make_freemode_edit_window()} {} {
Fl_Window freemodeeditwindow {
label Envelope
callback {freeClose->do_callback();}
xywh {614 158 575 180} type Double hide resizable
code0 {freeDW = o->w(); freeDH = o->h();}
code1 {o->size_range(freeDW, freeDH, 0, 0, 0, 0, 1);}
} {
Fl_Box freeedit {
label Envelope
Expand Down Expand Up @@ -1249,17 +1252,19 @@ saveWin(synth, freemodeeditwindow->w(), freemodeeditwindow->h(), freemodeeditwin
}
Function {showfree()} {} {
code {//
int fetchW, fetchH, fetchX, fetchY, fetchO;
loadWin(synth, fetchW, fetchH, fetchX, fetchY, fetchO, "xEnvelope-free " + to_string(engine) + " " + to_string(group));
freemodeeditwindow->show();
if (fetchW > 0 && fetchH > 0)
{
freemodeeditwindow->resize(fetchX, fetchY, fetchW, fetchH);
envfreeRtext();
}
else
freemodeeditwindow->position(fetchX, fetchY);
freemodeeditwindow->size_range(575, 180, 0, 0, 0, 0, 1);} {}
int fetchW, fetchH, fetchX, fetchY, fetchO;
loadWin(synth, fetchW, fetchH, fetchX, fetchY, fetchO, "xEnvelope-free " + to_string(engine) + " " + to_string(group));

if (fetchW < freeDW || fetchH < freeDH)
{
fetchW = freeDW;
fetchH = freeDH;
}
checkSane(fetchX, fetchY, fetchW, fetchH, freeDW, freeDH);

freemodeeditwindow->resize(fetchX, fetchY, fetchW, fetchH);
freemodeeditwindow->show();
envfreeRtext();} {}
}
Function {wincheck()} {} {
code {//
Expand All @@ -1274,12 +1279,6 @@ saveWin(synth, freemodeeditwindow->w(), freemodeeditwindow->h(), freemodeeditwin
}
Function {envfreeRtext()} {} {
code {//

if(freemodeeditwindow->x() > Fl::w() - 10 || freemodeeditwindow->y() > Fl::h() - 10)
freemodeeditwindow->position(30, 30);

//int W = Fl::w();
//int H = Fl::h();
int w = freemodeeditwindow->w();
int h = freemodeeditwindow->h();
float defW = 575;
Expand Down Expand Up @@ -1404,4 +1403,8 @@ saveWin(synth, freemodeeditwindow->w(), freemodeeditwindow->h(), freemodeeditwin
}
decl {int lastfreeW;} {private local
}
decl {int freeDW;} {private local
}
decl {int freeDH;} {private local
}
}
13 changes: 6 additions & 7 deletions src/UI/FilterUI.fl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Street, Fifth Floor, Boston, MA 02110-1301, USA.

This file is derivative of ZynAddSubFX original code

} {selected in_source in_header
} {in_source in_header
}

decl {\#include <iostream>} {public local
Expand Down Expand Up @@ -377,7 +377,7 @@ return Fl_Box::handle(event);} {}
}
}

class FilterUI {: {public Fl_Group,PresetsUI_}
class FilterUI {open : {public Fl_Group,PresetsUI_}
} {
Function {FilterUI(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} {
code {synth = NULL;
Expand All @@ -395,7 +395,7 @@ pars=NULL;
delete (formantparswindow);} {}
}
Function {make_window()} {} {
Fl_Window filterui {open
Fl_Window filterui {
xywh {460 79 275 75} type Double color 247 labelfont 1 labelsize 12 hide
class Fl_Group
} {
Expand Down Expand Up @@ -567,6 +567,7 @@ pars=NULL;
W = formantDW;
H = formantDH;
}
checkSane(X, Y, W, H , formantDW, formantDH);
formantparswindow->resize(X, Y, W, H);
lastformantX = 0;
lastformantY = 0;
Expand Down Expand Up @@ -812,7 +813,8 @@ pars=NULL;
else
vowel_counter->deactivate();

vowel_counter->value(pars->Psequence[nseqpos].nvowel);} {}
vowel_counter->value(pars->Psequence[nseqpos].nvowel);} {selected
}
}
Function {refresh()} {} {
code {//
Expand Down Expand Up @@ -919,9 +921,6 @@ pars=NULL;
lastformantY = formantparswindow->y();
lastformantW = formantparswindow->w();

if(formantparswindow->x() > Fl::w() - 10 || formantparswindow->y() > Fl::h() - 10)
formantparswindow->position(30, 30);

//std::cout << "formant seen" << std::endl;
float dScale = formantparswindow->w() / float(formantDW);

Expand Down
22 changes: 12 additions & 10 deletions src/UI/PADnoteUI.fl
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class PADnoteHarmonicProfile {: {public Fl_Box}
//draw the graph
int step = 2 * scale;
fl_line_style(0, step);

for (int i = 0; i < lx; i += step)
{
int val = int((ly - 2) * smps[i]);
Expand All @@ -132,15 +132,15 @@ class PADnoteHarmonicProfile {: {public Fl_Box}
fl_line(ox + i, oy + ly, ox + i, oy + ly - val);

}

int oi = 0;
float ov = 0;

for (int i = 0; i < lx; i++)
{
int ni = ox + i;
float nv = (ly - 2) * smps[i];

if (active)
fl_color(0, 0, 100);
else
Expand Down Expand Up @@ -463,7 +463,7 @@ class PADnoteUI {: {public PresetsUI_}
label Resonance
callback {//
resui->resonancewindow->redraw();
resui->Show(false);
resui->Show();
resui->setcbwidget(cbwidget, applybutton);
if ((Fl::event_button() == 3))
padnotewindow->hide();}
Expand Down Expand Up @@ -1123,6 +1123,7 @@ class PADnoteUI {: {public PresetsUI_}
}
Function {padRtext()} {} {
code {//
static int lastResuiW = 0;
if (oscui)
{
if (oscui->osceditUI->visible() && lastWaveW != oscui->osceditUI->w())
Expand All @@ -1132,14 +1133,15 @@ class PADnoteUI {: {public PresetsUI_}
}
}

if (resui->resonancewindow->visible() && lastResuiW != resui->resonancewindow->w())
{
resui->resonanceRtext();
lastResuiW = resui->resonancewindow->w();
}

ampenv->wincheck();
freqenv->wincheck();
filterenv->wincheck();
if (!padnotewindow->visible())
{
resui->resonancewindow->hide();
return;
}

if(padnotewindow->x() > Fl::w() - 10 || padnotewindow->y() > Fl::h() - 10)
padnotewindow->position(30, 30);
Expand Down
24 changes: 9 additions & 15 deletions src/UI/ResonanceUI.fl
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ decl {\#include <iostream>} {private local
decl {\#include "UI/MiscGui.h"} {public local
}

decl {\#include "UI/YoshiWin.h"} {public local
}

decl {\#include "UI/WidgetPDial.h"} {public local
}

Expand Down Expand Up @@ -465,7 +462,7 @@ class ResonanceUI {: PresetsUI_
resSeen = false;
if ((Fl::event_button() == 3))
{
if (ADvsPAD)
if (engine == PART::engine::addSynth)
synth->getGuiMaster()->partui->adnoteui->ADnoteGlobalParameters->show();
else
synth->getGuiMaster()->partui->padnoteui->padnotewindow->show();
Expand Down Expand Up @@ -624,32 +621,31 @@ class ResonanceUI {: PresetsUI_
p1st->value(respar->Pprotectthefundamental);
rg->redraw();} {}
}
Function {Show(bool _ADvsPAD)} {} {
Function {Show()} {} {
code {//
ADvsPAD = _ADvsPAD;
string tname;
if (engine == 0)
if (engine == PART::engine::addSynth)
tname = "AddSynth Resonance";
else
tname = "PadSynth Resonance ";
resonancewindow->copy_label(synth->getGuiMaster()->setPartWindowTitle(tname).c_str());
resonancewindow->show();
;
int fetchW, fetchH, fetchX, fetchY, fetchO;
loadWin(synth, fetchW, fetchH, fetchX, fetchY, fetchO, "Resonance " + to_string(engine));
if(fetchW < resDW || fetchH < resDH)
{
fetchW = resDW;
fetchH = resDH;
}
resSeen = true;
checkSane(fetchX, fetchY, fetchW, fetchH, resDW, resDH);

resonancewindow->resize(fetchX, fetchY, fetchW, fetchH);
resonanceRtext();} {}
resonancewindow->show();
resonanceRtext();
resSeen = true;} {}
}
Function {resonanceRtext()} {} {
code {//
if(resonancewindow->x() > Fl::w() - 10 || resonancewindow->y() > Fl::h() - 10)
resonancewindow->position(30, 30);

float dScale = resonancewindow->w() / resDW;

if (dScale < 0.2f)
Expand Down Expand Up @@ -700,8 +696,6 @@ class ResonanceUI {: PresetsUI_
}
decl {int engine;} {private local
}
decl {bool ADvsPAD;} {private local
}
decl {bool resSeen;} {private local
}
decl {float resDW;} {private local
Expand Down

0 comments on commit c4e5f8e

Please sign in to comment.