+ //printf("ApplyOperation()");
+ save_restoreGB(GRAPH_SAVE);
+ memcpy(GraphBuffer, s_Buff, sizeof(int) * GraphTraceLen);
+ RepaintGraphWindow();
+}
+void ProxWidget::stickOperation()
+{
+ save_restoreGB(GRAPH_RESTORE);
+ //printf("stickOperation()");
+}
+void ProxWidget::vchange_autocorr(int v)
+{
+ int ans;
+ ans = AutoCorrelate(GraphBuffer, s_Buff, GraphTraceLen, v, true, false);
+ if (g_debugMode) printf("vchange_autocorr(w:%d): %d\n", v, ans);
+ g_useOverlays = true;
+ RepaintGraphWindow();
+}
+void ProxWidget::vchange_askedge(int v)
+{
+ int ans;
+ //extern int AskEdgeDetect(const int *in, int *out, int len, int threshold);
+ ans = AskEdgeDetect(GraphBuffer, s_Buff, GraphTraceLen, v);
+ if (g_debugMode) printf("vchange_askedge(w:%d)%d\n", v, ans);
+ g_useOverlays = true;
+ RepaintGraphWindow();
+}
+void ProxWidget::vchange_dthr_up(int v)
+{
+ int down = opsController->horizontalSlider_dirthr_down->value();
+ directionalThreshold(GraphBuffer, s_Buff, GraphTraceLen, v, down);
+ //printf("vchange_dthr_up(%d)", v);
+ g_useOverlays = true;
+ RepaintGraphWindow();
+}
+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);
+ g_useOverlays = true;
+ RepaintGraphWindow();
+}
+ProxWidget::ProxWidget(QWidget *parent, ProxGuiQT *master) : QWidget(parent)
+{
+ this->master = master;
+ resize(800,500);
+
+ // Setup the controller widget
+ 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);
+ opsController->horizontalSlider_dirthr_up->setMinimum(-40);
+ opsController->horizontalSlider_dirthr_up->setMaximum(128);
+ opsController->horizontalSlider_dirthr_up->setValue(20);
+ opsController->horizontalSlider_askedge->setValue(25);
+ opsController->horizontalSlider_window->setValue(4000);
+
+
+ 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)));
+ QObject::connect(opsController->horizontalSlider_askedge, SIGNAL(valueChanged(int)), this, SLOT(vchange_askedge(int)));
+
+ // Set up the plot widget, which does the actual plotting
+ plot = new Plot(this);
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(plot);
+ setLayout(layout);
+ show(); // places the window on the screen.
+
+ // Move controller widget below plot
+ controlWidget->move(x(),y()+frameSize().height());
+ controlWidget->resize(size().width(), controlWidget->size().height());
+ controlWidget->show();
+}
+
+// not 100% sure what i need in this block
+// feel free to fix - marshmellow...
+ProxWidget::~ProxWidget(void)
+{
+ if (controlWidget) {
+ controlWidget->close();
+ delete controlWidget;
+ controlWidget = NULL;
+ }