Commits

Nicholas Laver  committed 5e02137

Added open/close thresholds back. Added indicators.

  • Participants
  • Parent commits 0d82454

Comments (0)

Files changed (6)

File MainWindow.cxx

 #endif
 		markerInput->SetValue(plot->getCurrentMarker());
 	}
+	wxString tmp;
+	tmp.Printf(_("%.2f"), plot->verticalMarkers[THRESHOLD_OPEN]);
+	openDisplay->SetLabel(tmp);
+	tmp.Printf(_("%.2f"), plot->verticalMarkers[THRESHOLD_CLOSED]);
+	closedDisplay->SetLabel(tmp);
+	tmp.Printf(_("%.2f"), plot->verticalMarkers[BASELINE]);
+	baseDisplay->SetLabel(tmp);
 }		
 
 void MainWindow::loadWhenReady(wxString file) {
 
 void MainWindow::updateViewSizeDisplay () {
 	wxString tmp;
-	tmp.Printf(_("%.2f ms"), plot->viewSize*plot->standardFile.interval/1000);
+	tmp.Printf(_("%.0f ms"), plot->viewSize*plot->standardFile.interval/1000);
 	viewSizeDisplay->SetLabel(tmp);
 }
 
 }
 
 	MainWindow::MainWindow(const wxString& title, const wxPoint& pos, const wxSize& size)
-: wxFrame(NULL, -1, title, pos, size, wxFULL_REPAINT_ON_RESIZE | wxDEFAULT_FRAME_STYLE), lastGotoVal(0), ignoreNextMarkerEvent(true)
+: wxFrame(NULL, -1, title, pos, size, wxFULL_REPAINT_ON_RESIZE | wxDEFAULT_FRAME_STYLE), lastGotoVal(0), ignoreNextMarkerEvent(true), fileWaiting(false)
 {
 	// Start the timer
 	updateTimer = new wxTimer(this, ID_Timer);
-	updateTimer->Start(500);
+	updateTimer->Start(50);
 
 	SetIcon(wxIcon(wxT("logo.gif")));
 	// Create the menu
 
 	wxButton *markerClearButton = new wxButton(panel, ID_ClearMarkers, _("Clear Markers"));
 	viewSizeDisplay = new wxStaticText(panel, wxID_ANY, _("0 ms"));
+	openDisplay = new wxStaticText(panel, wxID_ANY, _(""));
+	closedDisplay = new wxStaticText(panel, wxID_ANY, _(""));
+	baseDisplay = new wxStaticText(panel, wxID_ANY, _(""));
 	staticTexts.push_back(new wxStaticText(panel, wxID_ANY, _("Dropout: ")));
 	staticTexts.push_back(new wxStaticText(panel, wxID_ANY, _("Position:")));
 	staticTexts.push_back(new wxStaticText(panel, wxID_ANY, _("Marker:")));
 	staticTexts.push_back(new wxStaticText(panel, wxID_ANY, _("View Size: ")));
 	staticTexts.push_back(viewSizeDisplay);
+	staticTexts.push_back(new wxStaticText(panel, wxID_ANY, _("Open: ")));
+	staticTexts.push_back(openDisplay);
+	staticTexts.push_back(new wxStaticText(panel, wxID_ANY, _("Closed: ")));
+	staticTexts.push_back(closedDisplay);
+	staticTexts.push_back(new wxStaticText(panel, wxID_ANY, _("Baseline: ")));
+	staticTexts.push_back(baseDisplay);
 
 	// Create the text boxes
 	dropoutInput = new wxTextCtrl (panel, ID_Dropout, _("1"), wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER);
 topControlSizer->Add(staticTexts[2], 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 10);
 topControlSizer->Add(markerInput, 0, wxALIGN_CENTER_VERTICAL);
 topControlSizer->Add(markerClearButton, 0, wxALIGN_CENTER_VERTICAL);
-topControlSizer->Add(staticTexts[3], 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 10);
-topControlSizer->Add(viewSizeDisplay, 0, wxALIGN_CENTER_VERTICAL);
+for (int i = 3; i < staticTexts.size(); i++) {
+	if (i%2== 1) {
+		topControlSizer->Add(staticTexts[i], 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 10);
+	} else {
+		topControlSizer->Add(staticTexts[i], 1, wxALIGN_CENTER_VERTICAL);
+	}
+}
 
 leftZoomSizer->Add(verticalZoom, 0, wxEXPAND);
 
 // Prepare the reduce window
 reduceWindow = new ReduceDialog(this, plot);
 
-updateTimer->Start(500);
+updateTimer->Start(50);
 }
 
 void MainWindow::OnClose(wxCloseEvent& event) {

File MainWindow.h

 		wxSpinCtrl* markerInput;
 		wxTimer *updateTimer;
 		wxStaticText* viewSizeDisplay;
+		wxStaticText* openDisplay;
+		wxStaticText* closedDisplay;
+		wxStaticText* baseDisplay;
 		FilterDialog *filterWindow;
 		ReduceDialog *reduceWindow;
 		std::vector<wxStaticText*> staticTexts;
 #include <algorithm>
 #include <iostream>
 
-#define THRESHOLD 0
-#define BASELINE 1
-
 using std::cout;
 using std::endl;
 
 PlotBox::PlotBox(wxWindow* parent, wxWindowID id, int* args, wxPoint pos, wxSize size, long style) :
 	wxGLCanvas(parent, id, pos, size, style, _(""), args),     
 	displayMax(50.0), displayMin(-100.0),
-	viewSize(500), previewFilter(NULL), verticalMarkers(2), readyToGL(false),
+	viewSize(500), previewFilter(NULL), verticalMarkers(3), readyToGL(false),
 	dropOut(1), dropoutInput(NULL)
 {
 	FileStruct * fstructs[2];
 	plotWithLines = config->Read(_("plotWithLines"), true);
 	defaultBaseline = config->Read(_("/Markers/Baseline"), (long)0);
 	defaultBaseline /= 1000;
-	defaultThreshold = config->Read(_("/Markers/Threshold"), (long)10000);
-	defaultThreshold /= 1000;
+	defaultThresholdOpen = config->Read(_("/Markers/ThresholdOpen"), (long)10000);
+	defaultThresholdOpen /= 1000;
+	defaultThresholdClosed = config->Read(_("/Markers/ThresholdClosed"), (long)-10000);
+	defaultThresholdClosed /= 1000;
 	delete config;
 }
 
 	config->Write(_("/Colours/marker"),         markerColour.GetAsString(wxC2S_HTML_SYNTAX));
 	config->Write(_("plotWithLines"),           plotWithLines);
 	config->Write(_("/Markers/Baseline"),       (long)(verticalMarkers[BASELINE]*1000));
-	config->Write(_("/Markers/Threshold"),      (long)(verticalMarkers[THRESHOLD]*1000));
+	config->Write(_("/Markers/ThresholdOpen"),      (long)(verticalMarkers[THRESHOLD_OPEN]*1000));
+	config->Write(_("/Markers/ThresholdClosed"),      (long)(verticalMarkers[THRESHOLD_CLOSED]*1000));
 	delete config;
 }
 
 	}
 
 	if (flag == USE_STANDARD_FSTRUCT) {
-		verticalMarkers[THRESHOLD] = defaultThreshold;
+		verticalMarkers[THRESHOLD_OPEN] = defaultThresholdOpen;
+		verticalMarkers[THRESHOLD_CLOSED] = defaultThresholdClosed;
 		verticalMarkers[BASELINE] = defaultBaseline;
 		horizontalMarkers.clear();
 		previewFilter = NULL;
 }
 
 void PlotBox::analyseData (wxString filename, MainWindow *win) {
+	wxMessageBox(_("Feature out of order. Try again later."));
+	return;
+#if 0
 	wxFFile outFile(filename, _("w"));
 	std::vector<AnalysisEntry> table;
 
 	wxFFile out2(path, mode);
 	out2.Write(outStr);
 	out2.Close();
+#endif
 }
 
 void PlotBox::invertData() {
 #ifndef _PLOTBOX_
 #define _PLOTBOX_
+
+#define THRESHOLD_OPEN 0
+#define THRESHOLD_CLOSED 2
+#define BASELINE 1
+
 class PlotBox;
 
 #include <wx/wx.h>
 		Filter *previewFilter;
 		wxColour plotAltColour, plotForegroundColour, plotBackgroundColour, markerColour;
 		bool plotWithLines;
-		int defaultBaseline, defaultThreshold;
+		int defaultBaseline, defaultThresholdOpen, defaultThresholdClosed;
 		std::vector<float> verticalMarkers;
 		std::vector<int> horizontalMarkers;
 
 
 	x = 0;
 	y = dc->GetSize().GetHeight() - ((plot->verticalMarkers[marker] - minimum) / totalsize * dc->GetSize().GetHeight()) - height/2;
-	w = dc->GetSize().GetWidth()/2*(2-marker);
+	w = dc->GetSize().GetWidth()/3*(3-marker);
 	h = height;
 }    
 
 	dc.Clear();
 	if(plot == NULL)return;
 
-	wxColour* markerColours[2] = {new wxColour(255, 0, 0), new wxColour(255, 255, 0)};
-	wxString names[2] = {_("T"), _("B")};
-	for(int i = 0; i < 2; i++){
+	wxColour* markerColours[3] = {new wxColour(255, 0, 0), new wxColour(255, 255, 0), new wxColour(0, 255, 255)};
+	wxString names[3] = {_("O"), _("B"), _("C")};
+	for(int i = 0; i < 3; i++){
 		markerBrush->SetColour(*markerColours[i]);
 		markerPen->SetColour(*markerColours[i]);
 		dc.SetPen(*markerPen);

File channel3.cxx

 }
 
 void Channel3::newWindow () {
-	win.push_back(new MainWindow(_(FULL_APP_NAME), wxPoint(50, 50), wxSize(900, 650)));
+	win.push_back(new MainWindow(_(FULL_APP_NAME), wxPoint(50, 50), wxSize(1100, 650)));
 	win[win.size()-1]->Show(true);
 	SetTopWindow(win[win.size()-1]);
 }