void MainWindow::Execute(void* p) { Fl_Double_Window* window = new Fl_Double_Window(ALIAS_WINDOW); if ( window != NULL ) { extern HINSTANCE fl_display; window->icon((char *)LoadIcon(fl_display, MAKEINTRESOURCE(IDI_ICON_MAIN))); window->label("Automatic Upgrader WIN32"); window->labelsize(DEFAULT_FONT_SIZE); window->begin(); createComponents(); window->end(); window->show( _argc, _argv ); window->callback(window_callback); Fl::add_timeout(0.5f, timer_cb, this); Fl::scheme("plastic"); returnCode = Fl::run(); } stillAlive = false; }
int main (int argc, char ** argv) { Fl_Double_Window *window; fl_register_images(); //static Fl_GIF_Image image_img1 ("lines.gif"); window = new Fl_Double_Window (850, 590,"RC Practice Utility v1.0"); #ifdef WIN32 window->icon((char*)LoadIcon(fl_display, MAKEINTRESOURCE(101))); #endif /*WIN32*/ Fl_Button *But_Nxt,*But_Prev, *But_random; p_no = new Fl_Input(90,5,50,30); But_A= new Fl_Button( 430, 510, 80, 30, "A" ); But_A->labelsize(16); But_A->labelfont(FL_BOLD); But_A->callback(Btn_A); But_B= new Fl_Button( 512, 510, 80, 30, "B" ); But_B->labelsize(16); But_B->labelfont(FL_BOLD); But_B->callback(Btn_B); But_C= new Fl_Button( 594, 510, 80, 30, "C" ); But_C->labelsize(16); But_C->labelfont(FL_BOLD); But_C->callback(Btn_C); But_D= new Fl_Button( 676, 510, 80, 30, "D" ); But_D->labelsize(16); But_D->labelfont(FL_BOLD); But_D->callback(Btn_D); But_E= new Fl_Button( 758, 510, 80, 30, "E" ); But_E->labelsize(16); But_E->labelfont(FL_BOLD); But_E->callback(Btn_E); info_box = new Fl_Help_View(425,510,420,50,0); info_box->box(FL_FLAT_BOX); info_box->color(FL_BACKGROUND_COLOR); info_box->hide(); info_box->scrollbar_size(1); nxt_question= new Fl_Button( 430, 550, 160, 30, "Next Question" ); nxt_question->deactivate(); nxt_question->callback(Btn_nxt_question,(void*)window); Fl_Button *about_btn= new Fl_Button( 676, 550, 160, 30, "About" ); about_btn->callback(Btn_about_CB,(void*)window); But_Nxt= new Fl_Button( 150, 4, 80, 30, "Next" ); But_Nxt->callback((Fl_Callback*)Btn_Nxt_CB, (void*)(0)); But_random= new Fl_Button( 240, 4, 80, 30, "Random" ); But_random->callback((Fl_Callback*)Btn_random_CB, (void*)(0)); But_Prev= new Fl_Button( 4, 4, 80, 30, "Previous" ); But_Prev->callback((Fl_Callback*)Btn_Prev_CB, (void*)(0)); clock1 = new Fl_Text_Display(425,10,350,30,0); clock1->box(FL_NO_BOX); clock1->color(FL_BACKGROUND_COLOR); clock1->textsize(16); p_no->textsize(16); p_no->callback((Fl_Callback*)pid_no_input_CB, (void*)(0)); p_no->when(FL_WHEN_ENTER_KEY|FL_WHEN_NOT_CHANGED); q=new Fl_Help_View(425,40,420,460,0); q->box(FL_THIN_DOWN_BOX); p=new Fl_Help_View(3,40,423,500,0); p->box(FL_THIN_DOWN_BOX); FILE *fp; rapidxml::xml_document<> doc; pid=0; totalq=0; totalp=0; cur_qid=0; cur_ans=0; rs=0; usr_ans=-1; enable_timer=0; cur_progress p(5, 550,423, 30,0); obj_progress = (cur_progress*)window->child(15); int i=strlen(argv[0]); for(;i>0;i--) { if(argv[0][i]=='/') { argv[0][i+1]='\0'; break; } } i=i+2; current_path=(char*)malloc(i*sizeof(char)); strcpy(current_path,argv[0]); #ifdef __APPLE__ char *file_path=NULL; file_path = (char*)malloc((i+9)*sizeof(char)); strcpy(file_path,current_path); strcat(file_path,"data.xml"); rapidxml::file<> f(file_path); #else rapidxml::file<> f("data.xml"); #endif //printf("Ok till this point"); doc.parse<0>(f.data()); node = doc.first_node("passages"); totalp=total_psg(); //printf("%d",totalp); srand (time(NULL)); populate_psg((int)(rand() % totalp)); //printf("PID = %s\n",get_attr_value(pid,"val")); //printf("P_DATA = %s\n",get_attr_value(data,"txt")); enable_timer=1; Fl::add_timeout(1, Timer_CB); // setup a timer window->end (); window->show (argc, argv); return(Fl::run()); return 0; }