+}
+void ProxWidget::vchange_dthr_down(int v)
+{
+ printf("vchange_dthr_down(%d)", v);
+ int up = opsController->horizontalSlider_dirthr_up->value();
+ directionalThreshold(GraphBuffer,s_Buff, GraphTraceLen, v, up);
+ RepaintGraphWindow();
+
+}
+ProxWidget::ProxWidget(QWidget *parent, ProxGuiQT *master) : QWidget(parent)
+{
+ this->master = master;
+ resize(800,500);
+
+ /** Setup the controller widget **/
+
+ QWidget* controlWidget = new QWidget();
+ opsController = new Ui::Form();
+ opsController->setupUi(controlWidget);
+ //Due to quirks in QT Designer, we need to fiddle a bit
+ opsController->horizontalSlider_dirthr_down->setMinimum(-128);
+ opsController->horizontalSlider_dirthr_down->setMaximum(0);
+ opsController->horizontalSlider_dirthr_down->setValue(-20);
+
+
+ QObject::connect(opsController->pushButton_apply, SIGNAL(clicked()), this, SLOT(applyOperation()));
+ QObject::connect(opsController->pushButton_sticky, SIGNAL(clicked()), this, SLOT(stickOperation()));
+ QObject::connect(opsController->horizontalSlider_window, SIGNAL(valueChanged(int)), this, SLOT(vchange_autocorr(int)));
+ QObject::connect(opsController->horizontalSlider_dirthr_up, SIGNAL(valueChanged(int)), this, SLOT(vchange_dthr_up(int)));
+ QObject::connect(opsController->horizontalSlider_dirthr_down, SIGNAL(valueChanged(int)), this, SLOT(vchange_dthr_down(int)));
+
+ controlWidget->show();
+
+ // Set up the plot widget, which does the actual plotting
+
+ plot = new Plot(this);
+ /*
+ QSlider* slider = new QSlider(Qt::Horizontal);
+ slider->setFocusPolicy(Qt::StrongFocus);
+ slider->setTickPosition(QSlider::TicksBothSides);
+ slider->setTickInterval(10);
+ slider->setSingleStep(1);
+ */
+ QVBoxLayout *layout = new QVBoxLayout;
+ //layout->addWidget(slider);
+ layout->addWidget(plot);
+ setLayout(layout);
+ //printf("Proxwidget Constructor just set layout\r\n");
+}
+
+
+//----------- Plotting
+
+int Plot::xCoordOf(int i, QRect r )
+{
+ return r.left() + (int)((i - GraphStart)*GraphPixelsPerPoint);
+}
+
+int Plot::yCoordOf(int v, QRect r, int maxVal)
+{
+ int z = (r.bottom() - r.top())/2;
+ return -(z * v) / maxVal + z;
+}
+
+int Plot::valueOf_yCoord(int y, QRect r, int maxVal)
+{
+ int z = (r.bottom() - r.top())/2;
+ return (y-z) * maxVal / z;
+}
+static const QColor GREEN = QColor(100,255,100);
+static const QColor RED = QColor(255,100,100);
+static const QColor BLUE = QColor(100,100,255);
+static const QColor GRAY = QColor(240,240,240);
+
+QColor Plot::getColor(int graphNum)
+{
+ switch (graphNum) {
+ case 0: return GREEN; //Green
+ case 1: return RED; //Red
+ case 2: return BLUE; //Blue
+ default: return GRAY; //Gray