1 #include "mussa_gui_conn_window.hh"
5 load_ana_cb(Fl_Button* o, void* v)
7 ConnWindow* T=(ConnWindow*)v;
13 ConnWindow::real_load_ana_cb()
19 cout << "Load! Load! Load, ye yellow-bellied seadogs!\n";
20 picked_file = fl_file_chooser("Find an Analysis", "", "", 1);
21 a_file_path = picked_file;
22 cout << picked_file << endl;
23 cout << a_file_path << endl;
24 cout << a_file_path.substr(0,a_file_path.find(".mu")) << endl;
27 an_analysis = new Mussa();
28 err_msg = an_analysis->load(a_file_path.substr(0,a_file_path.find(".mu")));
32 // relabel window with the analysis name
33 window_name = "Mussa: " + an_analysis->ana_name;
34 label((const char*)window_name.c_str());
35 // show the user the analysis
36 conn_box->setup(an_analysis->ana_name, an_analysis->seq_num,
37 an_analysis->window, &(an_analysis->the_Seqs),
38 &(an_analysis->the_paths));
39 conn_box->scale_paths();
43 fl_alert(err_msg.c_str());
44 cout << err_msg << endl;
50 do_ana_cb(Fl_Button* o, void* v)
52 ConnWindow* T=(ConnWindow*)v;
58 ConnWindow::real_do_ana_cb()
64 picked_file = fl_file_chooser("Analysis Config File", "", "", 1);
65 a_file_path = picked_file;
67 an_analysis = new Mussa();
68 err_msg = an_analysis->load_mupa_file(a_file_path);
72 err_msg = an_analysis->analyze(0, 0);
77 // relabel window with the analysis name
78 window_name = "Mussa: " + an_analysis->ana_name;
79 label((const char*)window_name.c_str());
80 // show the user the analysis
81 conn_box->setup(an_analysis->ana_name, an_analysis->seq_num,
82 an_analysis->window, &(an_analysis->the_Seqs),
83 &(an_analysis->the_paths));
84 conn_box->scale_paths();
88 fl_alert(err_msg.c_str());
94 setup_ana_cb(Fl_Button* o, void* v)
96 ConnWindow* T=(ConnWindow*)v;
97 T->real_setup_ana_cb();
101 ConnWindow::real_setup_ana_cb()
103 an_analysis = new Mussa();
104 setup_win = new SetupWindow(650,700,"Analysis Setup", an_analysis);
106 while(setup_win->visible())
108 cout << "Like a warm summer day\n";
110 // relabel window with the analysis name
111 window_name = "Mussa: " + an_analysis->ana_name;
112 label((const char*)window_name.c_str());
113 // is it this easy? what if setup window encounters an error...??
114 conn_box->setup(an_analysis->ana_name, an_analysis->seq_num,
115 an_analysis->window, &(an_analysis->the_Seqs),
116 &(an_analysis->the_paths));
117 cout << "Like a warm day in may\n";
118 conn_box->scale_paths();
121 // all the crap needed for dealing with the scale bars
123 toggle_scale_bars_cb(Fl_Button* o, void* v)
125 ConnWindow* T=(ConnWindow*)v;
126 T->real_toggle_bars_cb();
130 ConnWindow::real_toggle_bars_cb()
132 conn_box->toggle_bars();
136 set_bar_len_cb(Fl_Input* o, void* v)
138 ConnWindow* T=(ConnWindow*)v;
139 cout << "WAAAAAAAAA\n";
140 T->real_set_bar_len_cb(o);
144 ConnWindow::real_set_bar_len_cb(Fl_Input* o)
148 new_bar_len = atoi(o->value());
149 cout << "new bar len = " << new_bar_len << endl;
150 conn_box->set_bar_interval(new_bar_len);
154 // all the crap needed for dealing with the scale lines
156 toggle_scale_lines_cb(Fl_Button* o, void* v)
158 ConnWindow* T=(ConnWindow*)v;
159 T->real_toggle_lines_cb();
163 ConnWindow::real_toggle_lines_cb()
165 conn_box->toggle_lines();
169 set_line_len_cb(Fl_Input* o, void* v)
171 ConnWindow* T=(ConnWindow*)v;
172 cout << "WAAAAAAAAA\n";
173 T->real_set_line_len_cb(o);
177 ConnWindow::real_set_line_len_cb(Fl_Input* o)
181 new_line_len = atoi(o->value());
182 cout << "new line len = " << new_line_len << endl;
183 conn_box->set_line_interval(new_line_len);
188 ConnWindow::ConnWindow(int w, int h, const char* title):
189 Fl_Double_Window(w,h,title)
191 int button_len = 120;
192 Fl_Color a_color = fl_rgb_color(150, 200, 255);;
197 //fl_color(150,200,255);
202 // create file menu button
203 file_menu = new Fl_Menu_Button(padding, 2, button_len, 30, "File");
204 file_menu->color(FL_WHITE,a_color);
205 file_menu->box(FL_BORDER_BOX);
209 file_menu->add("Do Analysis", 0, (Fl_Callback *) do_ana_cb, this);
210 file_menu->add("Load Analysis", 0, (Fl_Callback *) load_ana_cb, this);
211 file_menu->add("Setup Analysis", 0, (Fl_Callback *) setup_ana_cb, this);
213 toggle_divs = new Fl_Button(padding+button_len, 2, button_len, 30, "Toggle Bars");
214 toggle_divs->color(FL_WHITE,a_color);
215 toggle_divs->box(FL_BORDER_BOX);
216 toggle_divs->callback((Fl_Callback*) toggle_scale_bars_cb, this);
218 new_input = new Fl_Input(padding+3*button_len, 2, button_len, 30, "Bar Length (bp)");
219 new_input->value("");
220 new_input->when(FL_WHEN_ENTER_KEY);
221 new_input->callback((Fl_Callback*)set_bar_len_cb, this);
223 toggle_lines = new Fl_Button(padding+4*button_len, 2, button_len, 30, "Toggle Lines");
224 toggle_lines->color(FL_WHITE,a_color);
225 toggle_lines->box(FL_BORDER_BOX);
226 toggle_lines->callback((Fl_Callback*) toggle_scale_lines_cb, this);
228 line_input = new Fl_Input(padding+6*button_len, 2, button_len, 30, "Line Length (bp)");
229 line_input->value("");
230 line_input->when(FL_WHEN_ENTER_KEY);
231 line_input->callback((Fl_Callback*)set_line_len_cb, this);
234 // create the connections box
235 conn_box = new ConnView(padding, padding + 30, w-2*padding, h-2*padding-30);
236 //conn_box = new ConnView(padding, padding, w-2*padding, h-2*padding);
243 ConnWindow::~ConnWindow()
248 ConnWindow::add_ana(Mussa *the_ana)
250 an_analysis = the_ana;
252 conn_box->setup(an_analysis->ana_name, an_analysis->seq_num,
253 an_analysis->window, &(an_analysis->the_Seqs),
254 &(an_analysis->the_paths));
255 conn_box->scale_paths();