1 #include "mussa_gui_annot_window.hh"
10 a_annot = new annot_color;
12 a_annot->color = (Fl_Color) 5;
13 //cout << "type: " << a_annot->type << endl;
20 cb_annot_color(Fl_Button* o, void* v)
22 annot_instance * blah = (annot_instance *) v;
23 AnnotWindow* T= blah->mw_ptr;
24 T->cb_annot_color_i(o,blah->index);
27 AnnotWindow::AnnotWindow(int w, int h, const char* title,
28 vector<annot_color> * some_annots):Fl_Window(w,h,title)
32 the_annots = some_annots;
35 annot_color_buttons.clear();
38 annot_input_pack = new Fl_Pack(0, 0, w, h);
39 annot_input_pack->spacing(4);
41 // button to add new annot inputs
42 add_annot = new Fl_Button(0,0,100,24,"Add Annot Slot");
43 add_annot->callback((Fl_Callback*)add_annot_cb, this);
44 annot_input_pack->add(add_annot);
45 // test button to make sure annot data is being stored
46 test = new Fl_Button(0,0,100,24,"show annots");
47 test->callback((Fl_Callback*)print_cb, this);
48 annot_input_pack->add(test);
50 // creat an initial set of annot input widgets and attach to annot vector
51 annot_num = some_annots->size();
52 for (i = 0; i < annot_num; i++)
58 add(annot_input_pack);
65 //tmp_input->user_data((void*) i);
67 AnnotWindow::~AnnotWindow(){}
70 AnnotWindow::add_annot_input(int index)
72 Fl_Output * new_input;
73 Fl_Button *new_color_button;
74 annot_instance * something;
75 Fl_Pack * annot_hor_pack;
78 something = new annot_instance;
79 something->mw_ptr = this;
80 something->index = index;
82 annot_hor_pack = new Fl_Pack(0, 0, w(), 24);
83 annot_hor_pack->type(Fl_Pack::HORIZONTAL);
84 annot_hor_pack->spacing(4);
86 // setup the color display/selection button
87 new_color_button = new Fl_Button(0, 0, 24, 24, "");
88 new_color_button->color((*the_annots)[index].color);
89 new_color_button->box(FL_FLAT_BOX);
90 new_color_button->callback((Fl_Callback*)cb_annot_color, (void*) something);
91 annot_color_buttons.push_back(new_color_button);
92 annot_hor_pack->add(new_color_button);
95 // setup the annot inputs
96 new_input = new Fl_Output(0, 0, 200, 24, "");
97 new_input->value( ((*the_annots)[index].type).c_str() );
98 //new_input->callback((Fl_Callback*)cb_annot_in, (void*) something);
99 annot_ins.push_back(new_input);
100 annot_hor_pack->add(new_input);
102 annot_input_pack->add(annot_hor_pack);
112 AnnotWindow::cb_annot_in_i(Fl_Input* o, int i)
114 (*the_annots)[i].type = o->value();
118 AnnotWindow::cb_annot_color_i(Fl_Button* o, int i)
120 //Fl_Color new_color;
122 (*the_annots)[i].color = fl_show_colormap((*the_annots)[i].color);
123 //annot_color_buttons[i]->
124 o->color((*the_annots)[i].color);
128 void AnnotWindow::add_annot_cb(Fl_Button* o, void* v)
130 AnnotWindow* T=(AnnotWindow*)v;
131 T->add_annot_cb_real(o,v);
135 void AnnotWindow::add_annot_cb_real(Fl_Button* , void*)
137 annot_color blank_annot;
139 //blank_annot.name = "";
140 //blank_annot.seq = "";
141 blank_annot = new_blank_annot();
142 (*the_annots).push_back(blank_annot);
143 add_annot_input(annot_count++);
148 void AnnotWindow::print_cb(Fl_Button* o, void* v)
150 AnnotWindow* T=(AnnotWindow*)v;
151 T->print_cb_real(o,v);
155 void AnnotWindow::print_cb_real(Fl_Button* , void*)
159 for (i = 0; i < annot_count; i++)
160 cout << (*the_annots)[i].type << endl;
165 cb_annot_in(Fl_Input* o, void* v)
167 annot_instance * blah = (annot_instance *) v;
168 AnnotWindow* T= blah->mw_ptr;
169 T->cb_annot_in_i(o,blah->index);