[Thplot-cvs] CVS: thplot/src/Gui ParameterSelect.cpp,1.3,1.4 ParameterSelect.h,1.2,1.3
Status: Pre-Alpha
Brought to you by:
apeden
From: Tony P. <ap...@us...> - 2002-07-03 13:24:53
|
Update of /cvsroot/thplot/thplot/src/Gui In directory usw-pr-cvs1:/tmp/cvs-serv24168/src/Gui Modified Files: ParameterSelect.cpp ParameterSelect.h Log Message: Allow multiple selection in available and dependents lists, do duplicate seleciton checking. Index: ParameterSelect.cpp =================================================================== RCS file: /cvsroot/thplot/thplot/src/Gui/ParameterSelect.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** ParameterSelect.cpp 2 Jul 2002 17:21:44 -0000 1.3 --- ParameterSelect.cpp 3 Jul 2002 13:24:50 -0000 1.4 *************** *** 55,58 **** --- 55,59 ---- run=true; dep_names.clear(); + dup_check.clear(); ind_name = ""; selected=false; *************** *** 81,85 **** avbox->align(FL_ALIGN_TOP|FL_ALIGN_INSIDE|FL_ALIGN_LEFT); ! available = new Fl_Select_Browser( avbox->x()+offset, avbox->y()+line_height, avbox->w()-2*offset, --- 82,86 ---- avbox->align(FL_ALIGN_TOP|FL_ALIGN_INSIDE|FL_ALIGN_LEFT); ! available = new Fl_Multi_Browser( avbox->x()+offset, avbox->y()+line_height, avbox->w()-2*offset, *************** *** 112,116 **** ! dependent = new Fl_Select_Browser( depbox->x()+offset, depbox->y()+line_height, depbox->w()-2*offset, --- 113,117 ---- ! dependent = new Fl_Multi_Browser( depbox->x()+offset, depbox->y()+line_height, depbox->w()-2*offset, *************** *** 170,181 **** void ParameterSelect::available_callback(Fl_Widget* flw) { ! if ( available->value() ) { ! if( !ind_selected ) { ! independent->add( available->text(available->value()) ); ! ind_selected=true; ! } else { ! dependent->add( available->text(available->value()) ); } ! } } --- 171,189 ---- void ParameterSelect::available_callback(Fl_Widget* flw) { ! for(int i=1;i<=available->size();i++) { ! if( available->selected(i) ) { ! if( !ind_selected ) { ! independent->add( available->text(i) ); ! ind_selected=true; ! dup_check[available->text(i)]=1; ! } else { ! if( dup_check[available->text(i)] == 0) { ! dup_check[available->text(i)]=1; ! dependent->add( available->text(i) ); ! } ! } ! available->deselect(i); } ! } } *************** *** 183,186 **** --- 191,195 ---- void ParameterSelect::independent_callback(Fl_Widget* flw) { if ( independent->value() ) { + dup_check[ independent->text(independent->value()) ]=0; independent->remove( independent->value() ); ind_selected=false; *************** *** 189,194 **** void ParameterSelect::dependent_callback(Fl_Widget* flw) { ! if ( dependent->value() ) { ! dependent->remove( dependent->value() ); ! } } --- 198,207 ---- void ParameterSelect::dependent_callback(Fl_Widget* flw) { ! for(int i=1;i<=available->size();i++) { ! if ( dependent->selected(i) ) { ! dup_check[dependent->text(i)]=0; ! dependent->remove( i ); ! ! } ! } } Index: ParameterSelect.h =================================================================== RCS file: /cvsroot/thplot/thplot/src/Gui/ParameterSelect.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** ParameterSelect.h 2 Jul 2002 17:21:44 -0000 1.2 --- ParameterSelect.h 3 Jul 2002 13:24:50 -0000 1.3 *************** *** 30,40 **** #define PARAMETERSELECT_H #include <FL/Fl_Window.H> #include <FL/Fl_Box.H> #include <FL/Fl_Select_Browser.H> #include <FL/Fl_Button.h> #include <FL/Fl_Return_Button.h> - #include <vector> - #include <string> #include <Main/Globals.h> --- 30,43 ---- #define PARAMETERSELECT_H + #include <vector> + #include <map> + #include <string> + #include <FL/Fl_Window.H> #include <FL/Fl_Box.H> #include <FL/Fl_Select_Browser.H> + #include <FL/Fl_Multi_Browser.H> #include <FL/Fl_Button.h> #include <FL/Fl_Return_Button.h> #include <Main/Globals.h> *************** *** 83,86 **** --- 86,90 ---- bool selected; int Nitems; + map<string,int> dup_check; string ind_name; ParamList dep_names; *************** *** 88,92 **** Fl_Window *window; Fl_Box *avbox, *indbox, *depbox; ! Fl_Select_Browser *available, *independent, *dependent; Fl_Button* cancel_button; --- 92,97 ---- Fl_Window *window; Fl_Box *avbox, *indbox, *depbox; ! Fl_Multi_Browser *available, *dependent; ! Fl_Select_Browser *independent; Fl_Button* cancel_button; |