int main() { Fl_Double_Window *win = new Fl_Double_Window(720,486); Fl_Scroll *scroll = new Fl_Scroll(10,10,win->w()-20,win->h()-20); scroll->box(FL_DOWN_BOX); { const int deskw = 15000; const int deskh = 15000; Fl_OpDesk *opdesk = new Fl_OpDesk(0,0,deskw,deskh); opdesk->begin(); { printf("Creating %d boxes\n", (deskw/200)*(deskh/200)); for ( int x=30; x<deskw; x+=200 ) { for ( int y=30; y<deskh; y+=200 ) { char s[80]; sprintf(s,"Box %d/%d",x,y); Fl_OpBox *opbox = new Fl_OpBox(x,y,180,120,strdup(s)); opbox->begin(); { /*Fl_OpButton *a =*/ new Fl_OpButton("A", FL_OP_INPUT_BUTTON); /*Fl_OpButton *b =*/ new Fl_OpButton("B", FL_OP_INPUT_BUTTON); /*Fl_OpButton *c =*/ new Fl_OpButton("CCC", FL_OP_INPUT_BUTTON); /*Fl_OpButton *d =*/ new Fl_OpButton("OUT1", FL_OP_OUTPUT_BUTTON); /*Fl_OpButton *e =*/ new Fl_OpButton("OUT2", FL_OP_OUTPUT_BUTTON); } opbox->end(); } } } opdesk->end(); } scroll->end(); win->resizable(win); win->show(); return(Fl::run()); }
void ShowModsGUI() { Fl_Double_Window* wind = make_mods_window(); wind->callback([](Fl_Widget* window) { if(visible_callback) { visible_callback(false); } if(window) { delete (Fl_Double_Window*)window; mods_window = nullptr; } if(appended_ai_tree) { Fl_Tree_Item* first = appended_ai_tree->first(); if(first) { for(int i = 0; i < first->children(); i++) { delete (int*)(first->child(i)->user_data()); } } appended_ai_tree = nullptr; } }); wind->show(); visible_callback(true); }
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 *win = new Fl_Double_Window( 100, 100, 300, 300, "Flu_Spinner_Try" ); Flu_Spinner *c = new Flu_Spinner( 100, 30, 70, 25, "Float Spinner" ); c->callback( update ); //c->deactivate(); c = new Flu_Spinner( 100, 70, 70, 25, "Int Spinner" ); //c->editable( false ); c->callback( update ); c->step( 1 ); c->range( 0, 10 ); c = new Flu_Spinner( 100, 110, 70, 25, "X: " ); c->callback( update ); c->align( FL_ALIGN_INSIDE ); c->value( 0.5f ); c = new Flu_Spinner( 100, 150, 70, 25, "Wrap Spinner" ); c->callback( update ); c->wrap_range( true ); c->step( 1 ); c->range( 0, 10 ); win->end(); win->resizable( win ); win->show(); return( Fl::run() ); }
int main(int argc, char **argv) { //Fl::get_system_colors(); Fl::background(0xEE,0xEE,0xEE); Fl::background2(0xFF,0xFF,0xFF); Fl::scheme("gtk+"); CrashHandlerDlg dlg; Fl_Double_Window* window = dlg.create_window(); dlg.stack_output->buffer(&buffer); #ifndef _WIN32 std::string path = getenv("HOME"); path += "/.neoeditor/logfile.txt"; buffer.loadfile(path.c_str()); #else std::string path = getenv("APPDATA"); path += "\\neoeditor\\logfile.txt"; buffer.loadfile(path.c_str()); #endif window->show(); return Fl::run(); }
int main(int argc, char* argv[]) { Fl_Double_Window *w = new Fl_Double_Window( 340, 160, "uPlayBack" ); Fl_Group *pG = new CPlaybackWindow(0,0,340,160,""); w->end(); w->resizable(pG); w->show(argc, argv); return Fl::run(); }
ImageWindow::ImageWindow() { Fl_Double_Window* w; { Fl_Double_Window* o = new Fl_Double_Window(930, 580, "Total Counts"); w = o; o->user_data((void*)(this)); { new Fl_Button(30, 190, 285, 30, "Save Image"); } // Fl_Button* o { new Fl_Button(30, 240, 285, 30, "Reset Image"); } // Fl_Button* o { new Fl_Light_Button(85, 492, 175, 40, "Analyze Pointing"); } // Fl_Light_Button* o { new Fl_Value_Output(127, 384, 115, 25, "RA"); } // Fl_Value_Output* o { new Fl_Value_Output(127, 419, 115, 25, "Dec"); } // Fl_Value_Output* o { new Fl_Value_Output(127, 455, 115, 25, "Roll"); } // Fl_Value_Output* o { Fl_Box* o = new Fl_Box(25, 359, 300, 214, "Current Pointing"); o->box(FL_THIN_UP_FRAME); o->labelfont(1); o->align(Fl_Align(FL_ALIGN_TOP)); } // Fl_Box* o { Fl_Choice* o = new Fl_Choice(456, 535, 155, 25, "Image Scaling"); o->down_box(FL_BORDER_BOX); } // Fl_Choice* o { new Fl_Value_Output(199, 55, 115, 25, "Total Counts"); } // Fl_Value_Output* o { Fl_Value_Output* o = new Fl_Value_Output(199, 97, 115, 25, "Average Count Rate"); o->align(Fl_Align(132)); } // Fl_Value_Output* o { Fl_Value_Output* o = new Fl_Value_Output(199, 140, 115, 25, "Bright Pixel Count Rate"); o->align(Fl_Align(132)); } // Fl_Value_Output* o { Fl_Box* o = new Fl_Box(23, 37, 300, 258, "Image Statistics"); o->box(FL_THIN_UP_FRAME); o->labelfont(1); o->align(Fl_Align(FL_ALIGN_TOP)); } // Fl_Box* o { new Fl_Progress(30, 540, 290, 30); } // Fl_Progress* o { Fl_Box* o = new Fl_Box(365, 40, 530, 475, "Detector Image"); o->box(FL_THIN_UP_FRAME); o->labelfont(1); o->align(Fl_Align(FL_ALIGN_TOP)); } // Fl_Box* o { Fl_Choice* o = new Fl_Choice(760, 535, 155, 25, "Pixel Arrangement"); o->down_box(FL_BORDER_BOX); } // Fl_Choice* o plot = new plotWindow (100,100,500,500); o->end(); w->show(); } // Fl_Double_Window* o }
int main(int argc, char **argv) { Fl_Double_Window* w; { Fl_Double_Window* o = window_main = new Fl_Double_Window(305, 135, "FLTK window"); w = o; o->align(FL_ALIGN_CLIP|FL_ALIGN_INSIDE); input = new Fl_Input(145, 10, 150, 25, "Please enter value:"); { Fl_Button* o = btnTest = new Fl_Button(10, 100, 100, 25, "Test"); o->callback((Fl_Callback*)bt_callback, (void*)("test")); } { Fl_Return_Button* o = btnClose = new Fl_Return_Button(195, 100, 100, 25, "Close"); o->callback((Fl_Callback*)bt_callback, (void*)("close")); } o->end(); } w->show(argc, argv); return Fl::run(); }
int main( int argc, char **argv ) { Fl_Double_Window *win = new Fl_Double_Window( 100, 100, 400, 300, "Flu_Chat_Buffer_Try" ); Flu_Chat_Buffer *b = new Flu_Chat_Buffer( 0, 0, 400, 200 ); Fl_Input *in = new Fl_Input( 80, 210, 100, 30, "Send:" ); in->when( FL_WHEN_ENTER_KEY_ALWAYS ); in->callback( sendMsg, b ); win->end(); win->resizable( win ); b->addSystemMessage( "System message" ); b->addRemoteMessage( "<Remote User> ", "Remote user's message" ); b->addLocalMessage( "<Local User> ", "Local user's message" ); win->show(); return( Fl::run() ); }
int main( int argc, char **argv ) { Fl_Double_Window *win = new Fl_Double_Window( 100, 100, 300, 300, "Flu_Progress_Try" ); Flu_Progress *p1 = new Flu_Progress( 80, 40, 150, 20, "Progress" ); p1->value( 0.25 ); Flu_Progress *p2 = new Flu_Progress( 80, 100, 150, 30, "Progress" ); p2->value( 0.5 ); Flu_Progress *p3 = new Flu_Progress( 80, 170, 150, 20, "Progress" ); p3->value( 0.75 ); Fl_Button *b = new Fl_Button( 130, 220, 40, 30, "Go" ); b->callback( go ); win->end(); win->resizable( win ); win->show(); return( Fl::run() ); }
int main(int argc, char **argv) { Fl::background(0xEE,0xEE,0xEE); Fl::background2(0xFF,0xFF,0xFF); //Fl::get_system_colors(); Fl::scheme("gtk+"); #ifdef WIN32 WSADATA wsa; if (WSAStartup(MAKEWORD(2, 2), &wsa) != 0) { cout << "WSAStartup failed: " << WSAGetLastError() << endl; return 1; } #endif NeoStore dlg; Fl_Double_Window* window = dlg.create_window(); RepositoryManager* repoMgr = RepositoryManager::getInstance(); Repository mainRepo; mainRepo.setServer(DEFAULT_HOST); repoMgr->addRepository(mainRepo); repoMgr->updatePackageInformation(); vector<Repository::Package> packages; repoMgr->getPackageList(&packages); for(int i = 0; i < packages.size(); i++) { Repository::Package* p = (Repository::Package*) malloc(sizeof(Repository::Package)); new(p) Repository::Package(); *p = packages[i]; dlg.available_packages->add(packages[i].name.c_str(), (void*) p); cout << "Got package: " << packages[i].name << endl; } window->show(); return Fl::run(); }
int main() { fl_open_display(); Fl_Double_Window* win = new Fl_Double_Window(295, 144, "Notify test"); win->begin(); txt = new Fl_Input(10, 15, 275, 25); txt->align(FL_ALIGN_TOP_LEFT); color_button = new Fl_Button(260, 50, 25, 25, "Color"); color_button->align(FL_ALIGN_LEFT); color_button->callback(color_cb); Fl_Box* bx = new Fl_Box(10, 50, 164, 85, "Type some text and choose color, then press Send. " "Desktop should get notified about this."); bx->align(FL_ALIGN_WRAP); Fl_Button* send_button = new Fl_Button(195, 110, 90, 25, "&Send"); send_button->callback(send_cb); win->end(); win->show(); return Fl::run(); }
bool Module::show_analysis_window ( void ) { /* use a large window for more accuracy at low frequencies */ nframes_t nframes = sample_rate() / 2; float *buf = new float[nframes]; memset( buf, 0, sizeof(float) * nframes ); buf[0] = 1; if ( ! get_impulse_response( buf, nframes ) ) { // return false; } Fl_Double_Window *w = new Fl_Double_Window( 1000, 500 ); { SpectrumView * o = new SpectrumView( 25,25, 1000 - 50, 500 - 50, label() ); o->labelsize(10); o->align(FL_ALIGN_RIGHT|FL_ALIGN_TOP); o->sample_rate( sample_rate() ); o->data( buf, nframes ); } w->end(); w->show(); while ( w->shown() ) Fl::wait(); delete w; return true; }
int main(void) { Fl_Double_Window* win = new Fl_Double_Window(240, 165, "SevenSeg sample"); win->begin(); seg = new edelib::SevenSeg(10, 10, 70, 92); seg->box(FL_UP_BOX); seg->value(0); counter = new Fl_Counter(95, 20, 135, 20, "value"); counter->type(1); counter->step(1); counter->minimum(-1); counter->maximum(9); counter->align(FL_ALIGN_TOP_LEFT); counter->callback(change_cb); slider = new Fl_Value_Slider(95, 65, 135, 20, "width"); slider->type(1); slider->step(1); slider->minimum(2); slider->maximum(20); slider->value(seg->bar_width()); slider->align(FL_ALIGN_TOP_LEFT); slider->callback(slide_cb); color_button = new Fl_Button(205, 95, 25, 25, "color"); color_button->align(FL_ALIGN_LEFT); color_button->callback(color_cb); color_button->color(seg->color()); chk = new Fl_Check_Button(95, 130, 135, 25, "deactivate"); chk->down_box(FL_DOWN_BOX); chk->callback(deactivate_cb); win->end(); win->show(); return Fl::run(); }
int main(int argc, char* argv[]) { UserInterface* ui = new UserInterface(); Fl_Double_Window* window = ui->makeWindow(); window->show(); return Fl::run(); }
int main( int argc, char **argv ) { //FL_NORMAL_SIZE = 12; Fl_Double_Window *win = new Fl_Double_Window( 500, 460, "Flu_Tree_Browser_Try" ); tree = new Flu_Tree_Browser( 200, 0, 300, 460 ); tree->box( FL_DOWN_BOX ); tree->allow_dnd( true ); //tree->when( FL_WHEN_RELEASE ); tree->callback( tree_callback ); //tree->color( FL_GRAY ); Fl_Group *g = new Fl_Group( 0, 0, 200, 460 ); g->resizable( NULL ); showConnectors = new Fl_Check_Button( 10, 10, 140, 20, "Show Connectors" ); showConnectors->value( tree->show_connectors() ); showConnectors->callback( callback, 0 ); showRoot = new Fl_Check_Button( 10, 30, 100, 20, "Show Root" ); showRoot->value( tree->show_root() ); showRoot->callback( callback, 0 ); rootAlwaysOpen = new Fl_Check_Button( 10, 50, 140, 20, "Root Always Open" ); rootAlwaysOpen->value( tree->get_root()->always_open() ); rootAlwaysOpen->callback( callback, 0 ); showLeaves = new Fl_Check_Button( 10, 70, 110, 20, "Show Leaves" ); showLeaves->value( tree->show_leaves() ); showLeaves->callback( callback, 0 ); showBranches = new Fl_Check_Button( 10, 90, 120, 20, "Show Branches" ); showBranches->value( tree->show_branches() ); showBranches->callback( callback, 0 ); openOnSelect = new Fl_Check_Button( 10, 110, 130, 20, "Open On Select" ); openOnSelect->value( tree->open_on_select() ); openOnSelect->callback( callback, 0 ); active = new Fl_Check_Button( 10, 130, 100, 20, "Active" ); active->value( tree->active() ); active->callback( callback, 0 ); animate = new Fl_Check_Button( 10, 150, 100, 20, "Animate" ); animate->value( tree->animate() ); animate->callback( callback, 0 ); collapseTime = new Fl_Float_Input( 55, 170, 50, 20, "Time" ); { char buf[32]; sprintf( buf, "%.2f", tree->collapse_time() ); collapseTime->value( buf ); } collapseTime->callback( callback, 0 ); collapseTime->deactivate(); frameRate = new Fl_Float_Input( 140, 170, 50, 20, "FPS" ); { char buf[32]; sprintf( buf, "%.2f", tree->frame_rate() ); frameRate->value( buf ); } frameRate->callback( callback, 0 ); frameRate->deactivate(); shaded = new Fl_Check_Button( 10, 190, 130, 20, "Shaded Entries" ); shaded->value( 0 ); shaded->callback( callback, 0 ); shadedEvenColor = new Fl_Button( 70, 210, 20, 20, "Even" ); shadedEvenColor->align( FL_ALIGN_LEFT ); shadedEvenColor->color( FL_LIGHT2 ); shadedEvenColor->callback( shadedColorCB ); shadedEvenColor->deactivate(); shadedOddColor = new Fl_Button( 150, 210, 20, 20, "Odd" ); shadedOddColor->align( FL_ALIGN_LEFT ); shadedOddColor->color( FL_WHITE ); shadedOddColor->callback( shadedColorCB ); shadedOddColor->deactivate(); selectionMode = new Fl_Choice( 110, 235, 85, 25, "Selection Mode" ); selectionMode->add( "NO_SELECT" ); selectionMode->add( "SINGLE_SELECT" ); selectionMode->add( "MULTI_SELECT" ); selectionMode->value( 2 ); selectionMode->callback( mode_callback, 0 ); selectionDragMode = new Fl_Choice( 110, 265, 85, 25, "Selection Drag" ); selectionDragMode->add( "DRAG_IGNORE" ); selectionDragMode->add( "DRAG_TO_SELECT" ); if( tree->have_dnd() ) selectionDragMode->add( "DRAG_TO_MOVE" ); selectionDragMode->value( 1 ); selectionDragMode->callback( mode_callback, 0 ); insertionMode = new Fl_Choice( 110, 295, 85, 25, "Insertion Mode" ); insertionMode->add( "INSERT_FRONT" ); insertionMode->add( "INSERT_BACK" ); insertionMode->add( "INSERT_SORTED" ); insertionMode->add( "INSERT_SORTED_REVERSE" ); insertionMode->value( 2 ); insertionMode->callback( mode_callback, 0 ); hGap = new Fl_Counter( 105, 325, 90, 20, "Horizontal Gap" ); hGap->type( FL_SIMPLE_COUNTER ); hGap->align( FL_ALIGN_LEFT ); hGap->precision( 0 ); hGap->range( 0, 20 ); hGap->value( tree->horizontal_gap() ); hGap->callback( callback, 0 ); vGap = new Fl_Counter( 105, 350, 90, 20, "Vertical Gap" ); vGap->type( FL_SIMPLE_COUNTER ); vGap->align( FL_ALIGN_LEFT ); vGap->precision( 0 ); vGap->range( 0, 20 ); vGap->value( tree->vertical_gap() ); vGap->callback( callback, 0 ); wGap = new Fl_Counter( 105, 375, 90, 20, "Widget Gap" ); wGap->type( FL_SIMPLE_COUNTER ); wGap->align( FL_ALIGN_LEFT ); wGap->precision( 0 ); wGap->range( 0, 20 ); wGap->value( tree->widget_gap() ); wGap->callback( callback, 0 ); if( tree->have_dnd() ) newNode = new Fl_Input( 50, 400, 50, 20, "New" ); rebuildTree = new Fl_Button( 10, 405, 120, 20, "Rebuild Tree" ); rebuildTree->callback( rebuildTreeCB, NULL ); deleteNode = new Fl_Button( 10, 430, 120, 20, "Delete Selected" ); deleteNode->callback( deleteNodeCB, NULL ); g->end(); win->end(); win->resizable( tree ); win->show( argc, argv ); makeTree(); //Fl::dnd_text_ops( 1 ); printf( "sizeof(Flu_Tree_Browser::Node): %d\n", sizeof(Flu_Tree_Browser::Node) ); return( Fl::run() ); }
//heres the money..... int main(int argc, char* argv[]) { //make the frame Fl_Double_Window *w = new Fl_Double_Window( 820, 460, "uMS" ); w->size_range(DEFAULT_WIDTH,DEFAULT_HEIGHT); //OK - lets build a whole set of panes std::string sWho; { //note scoping Fl_Preferences app( Fl_Preferences::USER, "MOOS", "uMS" ); char Space[2048]; app.get("Communities",Space,"Unnamed:9000@LOCALHOST",sizeof(Space)); sWho = std::string(Space); } Fl_Tabs* pTab = new Fl_Tabs(10, 10, 800, 400); while(!sWho.empty()) { std::string sChunk = MOOSChomp(sWho,","); std::string sName = MOOSChomp(sChunk,":"); int nPort = atoi(MOOSChomp(sChunk,"@").c_str()); std::string sHost = sChunk; if(!sChunk.empty() && nPort>0) { Fl_Group *pG = MakeCommunityPane(10,30,800,390,(char*)sName.c_str()); CScopeTabPane * pTabPane = (CScopeTabPane*)(pG); pTabPane->SetMOOSInfo(sHost,nPort); Fl_Group::current()->resizable(pG); } } if(pTab->children()==0) { MakeCommunityPane(10,30,800,390,"Unnamed"); } w->end(); //and add some buttons to control them.... w->begin(); { //add Fl_Button * pNewCommunityButton = new Fl_Button(10,420,160,30,"Add Community"); pNewCommunityButton->callback(OnAddCommunity,pTab); //delete Fl_Button * pDelCommunityButton = new Fl_Button(180,420,160,30,"Remove Community"); pDelCommunityButton->callback(OnRemoveCommunity,pTab); //save Fl_Button * pSaveButton = new Fl_Button(350,420,160,30,"Save Layout"); pSaveButton->callback(OnSave,pTab); pSaveButton->callback(); //rename Fl_Button * pRenameButton = new Fl_Button(520,420,160,30,"Rename"); pRenameButton->callback(OnRenameCommunity,pTab); pRenameButton->callback(); } w->end(); //need to do more work on resizing - maybe even read the manual w->resizable(pTab); //and GO! w->show(argc, argv); return Fl::run(); }
void SynthModular::LoadPlugins (string pluginPath) { int Width = 35; int Height = 35; int SWidth = 256; int SHeight = 256; Fl_Pixmap pic (SSM_xpm); Fl_Double_Window* Splash = new Fl_Double_Window ((Fl::w()/2) - (SWidth/2), (Fl::h()/2) - (SHeight/2), SWidth, SHeight, "SSM"); Splash->border(0); Fl_Box* pbut = new Fl_Box (0, 8, SWidth, SHeight, ""); pbut->box (FL_NO_BOX); pic.label (pbut); Fl_Box *splashtext = new Fl_Box (5, SHeight-20, 200, 20, "Loading..."); splashtext->labelsize (10); splashtext->box (FL_NO_BOX); splashtext->align (FL_ALIGN_INSIDE | FL_ALIGN_LEFT); Splash->add (pbut); Splash->add (splashtext); Splash->show(); int ID=-1; vector<string> PluginVector; if (SpiralInfo::USEPLUGINLIST) PluginVector = SpiralInfo::PLUGINVEC; else { if (pluginPath.empty()) PluginVector = BuildPluginList (SpiralInfo::PLUGIN_PATH); else { string::iterator i = pluginPath.end() - 1; if (*i != '/') pluginPath += '/'; PluginVector = BuildPluginList (pluginPath); } } for (vector<string>::iterator i=PluginVector.begin(); i!=PluginVector.end(); i++) { string Fullpath; if (pluginPath=="") Fullpath=SpiralInfo::PLUGIN_PATH+*i; else Fullpath = pluginPath + *"/" + *i; ID = PluginManager::Get()->LoadPlugin (Fullpath.c_str()); if (ID!=PluginError) { #ifdef DEBUG_PLUGINS cerr << ID << " = Plugin [" << *i << "]" << endl; #endif Fl_ToolButton *NewButton = new Fl_ToolButton (0, 0, Width, Height, ""); // we can't set user data, because the callback uses it // NewButton->user_data ((void*)(this)); NewButton->labelsize (1); Fl_Pixmap *tPix = new Fl_Pixmap (PluginManager::Get()->GetPlugin(ID)->GetIcon()); NewButton->image(tPix->copy(tPix->w(),tPix->h())); delete tPix; const char * gName = PluginManager::Get()->GetPlugin(ID)->GetGroupName(); string GroupName(gName); Fl_Pack* the_group=NULL; // find or create this group, and add an icon map<string,Fl_Pack*>::iterator gi = m_PluginGroupMap.find (GroupName); if (gi == m_PluginGroupMap.end()) { the_group = new Fl_Pack (m_GroupTab->x(), 16, m_GroupTab->w(), m_GroupTab->h() - 15, gName); the_group->type(FL_HORIZONTAL); the_group->labelsize(8); the_group->color(SpiralInfo::GUICOL_Button); the_group->user_data((void*)(this)); //m_GroupTab->add(the_group); m_GroupTab->value(the_group); m_PluginGroupMap[GroupName]=the_group; } else the_group = gi->second; NewButton->type (0); NewButton->box (FL_NO_BOX); NewButton->down_box (FL_NO_BOX); //NewButton->color(SpiralInfo::GUICOL_Button); //NewButton->selection_color(SpiralInfo::GUICOL_Button); the_group->add (NewButton); // we need to keep tooltips stored outside their widgets - widgets just have a pointer // I haven't done anything about cleaning up these strings - which may cause memory leaks? // But m_DeviceVec - which, I assume, would be used to keep track of / clean up the dynamicly // created NewButton widgets isn't cleaned up either, so we might have 2 memory leaks // involved? - but then again, they might be automatically deallocated because they're // in another widget, in which case there's just one memory leak to deal with. (andy) string* PluginName = new string (*i); // find the first slash, if there is one, and get rid of everything before and including it unsigned int p = PluginName->find ('/'); if (p < PluginName->length()) PluginName->erase (0, p); // find last . and get rid of everything after and including it p = PluginName->rfind ('.'); unsigned int l = PluginName->length (); if (p < l) PluginName->erase (p, l); NewButton->tooltip (PluginName->c_str()); // Slashes have significance to the menu widgets, remove them from the GroupName while ((p = GroupName.find ('/')) < PluginName->length()) GroupName = GroupName.replace (p, 1, " and "); string MenuEntry = "Plugins/" + GroupName + "/" + *PluginName; m_MainMenu->add (MenuEntry.c_str(), 0, cb_NewDeviceFromMenu, &Numbers[ID], 0); // when help is working better - this will put the plugins into the help menu // MenuEntry = "Help/" + MenuEntry; // m_MainMenu->add (MenuEntry.c_str(), 0, NULL, &Numbers[ID], 0); // Add the plugins to the canvas menu m_Canvas->AddPluginName (MenuEntry, PluginManager::Get()->GetPlugin(ID)->ID); // this overwrites the widget's user_data with that specified for the callback // so we can't use it for other purposes NewButton->callback ((Fl_Callback*)cb_NewDevice, &Numbers[ID]); NewButton->show(); // Nothing else ever touches m_DeviceVec - is this right??? (andy) m_DeviceVec.push_back (NewButton); the_group->redraw(); // m_NextPluginButton++; Fl::check(); splashtext->label (PluginName->c_str()); Splash->redraw(); } } map<string,Fl_Pack*>::iterator PlugGrp; for (PlugGrp = m_PluginGroupMap.begin(); PlugGrp!= m_PluginGroupMap.end(); ++PlugGrp) { m_GroupTab->add (PlugGrp->second); PlugGrp->second->add (new Fl_Box (0, 0, 600, 100, "")); } // try to show the SpiralSound group PlugGrp = m_PluginGroupMap.find("SpiralSound"); // can't find it - show the first plugin group if (PlugGrp==m_PluginGroupMap.end()) PlugGrp=m_PluginGroupMap.begin(); m_GroupTab->value(PlugGrp->second); bool found_dummy; int i; do { found_dummy = false; for (i=0; i<m_MainMenu->size(); i++) { if (m_MainMenu->text (i) != NULL) { found_dummy = (strcmp ("dummy", m_MainMenu->text (i)) == 0); if (found_dummy) break; } } if (found_dummy) m_MainMenu->remove (i); } while (found_dummy); Splash->hide(); delete Splash; }
int main ( int argc, char **argv ) { bool no_ui = false; fl_display = 0; printf( "%s %s %s -- %s\n", APP_TITLE, VERSION, "", COPYRIGHT ); Thread::init(); Thread thread( "UI" ); thread.set(); ensure_dirs(); signal( SIGTERM, sigterm_handler ); signal( SIGHUP, sigterm_handler ); signal( SIGINT, sigterm_handler ); Fl_Tooltip::color( FL_BLACK ); Fl_Tooltip::textcolor( FL_YELLOW ); Fl_Tooltip::size( 14 ); Fl_Tooltip::hoverdelay( 0.1f ); LOG_REGISTER_CREATE( Mixer_Strip ); LOG_REGISTER_CREATE( Chain ); LOG_REGISTER_CREATE( Plugin_Module ); LOG_REGISTER_CREATE( Gain_Module ); LOG_REGISTER_CREATE( Spatializer_Module ); LOG_REGISTER_CREATE( Meter_Module ); LOG_REGISTER_CREATE( JACK_Module ); LOG_REGISTER_CREATE( Mono_Pan_Module ); LOG_REGISTER_CREATE( Meter_Indicator_Module ); LOG_REGISTER_CREATE( Controller_Module ); LOG_REGISTER_CREATE( AUX_Module ); LOG_REGISTER_CREATE( Spatialization_Console ); LOG_REGISTER_CREATE( Group ); signal( SIGPIPE, SIG_IGN ); const char *osc_port = NULL; nsm = new NSM_Client; instance_name = strdup( APP_NAME ); bool instance_override = false; static struct option long_options[] = { { "help", no_argument, 0, '?' }, { "instance", required_argument, 0, 'i' }, { "osc-port", required_argument, 0, 'p' }, { "no-ui", no_argument, 0, 'u' }, { 0, 0, 0, 0 } }; int option_index = 0; int c = 0; while ( ( c = getopt_long_only( argc, argv, "", long_options, &option_index ) ) != -1 ) { switch ( c ) { case 'p': DMESSAGE( "Using OSC port %s", optarg ); osc_port = optarg; break; case 'i': DMESSAGE( "Using OSC port %s", optarg ); free( instance_name ); instance_name = strdup( optarg ); instance_override = true; break; case 'u': DMESSAGE( "Disabling user interface" ); no_ui = true; break; case '?': printf( "\nUsage: %s [--instance instance_name] [--osc-port portnum] [path_to_project]\n\n", argv[0] ); exit(0); break; } } { char *name = strdup( argv[0] ); char *n = basename( name ); if ( ! strcmp( n, "non-mixer-noui" ) ) no_ui = true; free( name ); } if ( ! no_ui ) { Fl::visual( FL_DOUBLE | FL_RGB ); Fl::visible_focus( 0 ); fl_register_images(); } Fl::lock(); Fl_Double_Window *main_window; { Fl_Double_Window *o = main_window = new Fl_Double_Window( 800, 600, "Non Mixer" ); { main_window->xclass( APP_NAME ); { Fl_Widget *o = mixer = new Mixer( 0, 0, main_window->w(), main_window->h(), NULL ); Fl_Group::current()->resizable(o); } } o->end(); o->size_range( main_window->w(), mixer->min_h(), 0, 0 ); o->callback( (Fl_Callback*)cb_main, main_window ); if ( ! no_ui ) { o->show( 0,0 ); } } Plugin_Module::spawn_discover_thread(); mixer->init_osc( osc_port ); char *nsm_url = getenv( "NSM_URL" ); if ( nsm_url ) { if ( ! nsm->init( nsm_url ) ) { if ( instance_override ) WARNING( "--instance option is not available when running under session management, ignoring." ); if ( optind < argc ) WARNING( "Loading files from the command-line is incompatible with session management, ignoring." ); nsm->announce( APP_NAME, ":switch:dirty:", argv[0] ); /* if ( ! no_ui ) */ /* { */ // poll so we can keep OSC handlers running in the GUI thread and avoid extra sync Fl::add_timeout( NSM_CHECK_INTERVAL, check_nsm, NULL ); /* } */ } } else { if ( optind < argc ) { MESSAGE( "Waiting for plugins..." ); Plugin_Module::join_discover_thread(); MESSAGE( "Loading \"%s\"", argv[optind] ); if ( ! mixer->command_load( argv[optind] ) ) { fl_alert( "Error opening project specified on commandline" ); } } } Fl::add_timeout( 0.1f, check_sigterm ); Fl::dnd_text_ops( 0 ); if ( ! no_ui ) { DMESSAGE( "Running UI..." ); Fl::run(); } else { DMESSAGE( "Not Running UI..." ); while ( ! got_sigterm ) { Fl::check(); usleep( 200 * 1000 ); } } delete main_window; main_window = NULL; MESSAGE( "Your fun is over" ); }
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; }