co_rc_t console_window_t::start() { window = new console_main_window_t(this); window->callback(console_window_cb, this); Fl_Menu_Item console_menuitems[] = { { "File", 0, 0, 0, FL_SUBMENU }, { "Quit", 0, (Fl_Callback *)console_quit_cb, this }, { 0 }, { "Monitor", 0, 0, 0, FL_SUBMENU }, { "Select", 0, (Fl_Callback *)console_select_cb, this, FL_MENU_DIVIDER }, { "Attach", 0, (Fl_Callback *)console_attach_cb, this, }, { "Detach", 0, (Fl_Callback *)console_detach_cb, this, FL_MENU_DIVIDER }, { "Pause", 0, (Fl_Callback *)console_pause_cb, this, }, { "Resume", 0, (Fl_Callback *)console_resume_cb, this, }, { "Terminate", 0, (Fl_Callback *)console_terminate_cb, this, }, { "Send Ctrl-Alt-Del", 0, (Fl_Callback *)console_send_ctrl_alt_del_cb, this, }, { 0 }, { "Inspect", 0, 0, 0, FL_SUBMENU }, { 0 }, { "Help", 0, 0, 0, FL_SUBMENU }, { "About", 0, (Fl_Callback *)console_about_cb, this, }, { 0 }, { 0 } }; unsigned int i; for (i=0; i < sizeof(console_menuitems)/sizeof(console_menuitems[0]); i++) console_menuitems[i].user_data((void *)this); int swidth = 640; int sheight = 480; menu = new Fl_Menu_Bar(0, 0, swidth, 30); menu->box(FL_UP_BOX); menu->align(FL_ALIGN_CENTER); menu->when(FL_WHEN_RELEASE_ALWAYS); menu->copy(console_menuitems, window); Fl_Group *tile = new Fl_Group(0, 30, swidth, sheight-30); widget = new console_widget_t(0, 30, swidth, sheight-120); text_widget = new Fl_Text_Display(0, sheight-120+30, swidth, 70); Fl_Group *tile2 = new Fl_Group(0, sheight-120+30, swidth, 90); text_widget->buffer(new Fl_Text_Buffer()); text_widget->insert_position(0); Fl_Box *box = new Fl_Box(0, sheight-20, swidth, 20); box->label(""); box->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); tile2->end(); tile->resizable(widget); tile->end(); window->resizable(tile); window->end(); window->show(); menu_item_activate(console_select_cb); menu_item_deactivate(console_pause_cb); menu_item_deactivate(console_resume_cb); menu_item_deactivate(console_terminate_cb); menu_item_deactivate(console_detach_cb); menu_item_deactivate(console_attach_cb); // Default Font is "Terminal" with size 18 // Sample WinNT environment: set COLINUX_CONSOLE_FONT=Lucida Console:12 // Change only font size: set COLINUX_CONSOLE_FONT=:12 char * env_font = getenv ("COLINUX_CONSOLE_FONT"); if (env_font) { char *p = strchr (env_font, ':'); if (p) { int size = atoi (p+1); if (size >= 4 && size <= 24) { // Set size widget->set_font_size(size); } *p = 0; // End for Fontname } // Set new font style if (strlen (env_font)) { // Remember: set_font need a non stack buffer! // Environment is global static. Fl::set_font(FL_SCREEN, env_font); // Now check font width fl_font(FL_SCREEN, 18); // Use default High for test here if ((int)fl_width('i') != (int)fl_width('W')) { Fl::set_font(FL_SCREEN, "Terminal"); // Restore standard font log("%s: is not fixed font. Using 'Terminal'\n", env_font); } } } log("Cooperative Linux console started\n"); if (start_parameters.attach_id != CO_INVALID_ID) attached_id = start_parameters.attach_id; if (attached_id == CO_INVALID_ID) attached_id = find_first_monitor(); if (attached_id != CO_INVALID_ID) attach(); /* Ignore errors, as we can attach latter */ return CO_RC(OK); }
virtual void redraw() { format((char *)(b.label())); b.redraw(); Fl_Adjuster::redraw(); }
void MainWindow::createComponents() { Fl_Group* grpSequence = new Fl_Group(10,20,150,120, "Sequence :"); if ( grpSequence != NULL ) { grpSequence->box(FL_DOWN_BOX); grpSequence->align(Fl_Align(FL_ALIGN_TOP_LEFT)); grpSequence->labelsize(DEFAULT_FONT_SIZE); grpSequence->begin(); seqPreparing = new Fl_Box(20,30,130,20,"1. Preparing update ..."); if ( seqPreparing != NULL ) { seqPreparing->align( FL_ALIGN_LEFT | FL_ALIGN_INSIDE ); seqPreparing->labelsize(DEFAULT_FONT_SIZE); seqPreparing->deactivate(); } seqRetrieving = new Fl_Box(20,50,130,20,"2. Retrieving data ..."); if ( seqRetrieving != NULL ) { seqRetrieving->align( FL_ALIGN_LEFT | FL_ALIGN_INSIDE ); seqRetrieving->labelsize(DEFAULT_FONT_SIZE); seqRetrieving->deactivate(); } seqProcessing = new Fl_Box(20,70,130,20,"3. Processing data ..."); if ( seqProcessing != NULL ) { seqProcessing->align( FL_ALIGN_LEFT | FL_ALIGN_INSIDE ); seqProcessing->labelsize(DEFAULT_FONT_SIZE); seqProcessing->deactivate(); } seqUpdating = new Fl_Box(20,90,130,20,"4. Updating ..."); if ( seqUpdating != NULL ) { seqUpdating->align( FL_ALIGN_LEFT | FL_ALIGN_INSIDE ); seqUpdating->labelsize(DEFAULT_FONT_SIZE); seqUpdating->deactivate(); } seqFinalizing = new Fl_Box(20,110,130,20,"5. Finalizing ..."); if ( seqFinalizing != NULL ) { seqFinalizing->align( FL_ALIGN_LEFT | FL_ALIGN_INSIDE ); seqFinalizing->labelsize(DEFAULT_FONT_SIZE); seqFinalizing->deactivate(); } grpSequence->end(); progBar = new Fl_Progress(10,150,150,10); if ( progBar != NULL ) { progBar->color2(FL_BLUE); progBar->maximum(5); progBar->minimum(0); progBar->value(0); } mli_info = new Fl_Box(170,20,220,140,""); if ( mli_info != NULL ) { mli_info->box( FL_DOWN_BOX ); mli_info->align( FL_ALIGN_TOP_LEFT | FL_ALIGN_INSIDE ); mli_info->labelsize(DEFAULT_FONT_SIZE); } Fl_Box* boxCopyright = new Fl_Box(10,165,380,35); if ( boxCopyright != NULL ) { boxCopyright->box(FL_DOWN_BOX); boxCopyright->align( FL_ALIGN_TOP_LEFT | FL_ALIGN_INSIDE ); boxCopyright->labelsize(COPYRIGHT_FONT_SIZE); boxCopyright->label("Automatic Updater, (C)Copyright 2013 Rageworx freeware.\n" "All rights reserved, [email protected]"); } } }
void Track::init ( void ) { _row = 0; _sequence = NULL; _name = NULL; _selected = false; _size = 1; record_ds = NULL; playback_ds = NULL; labeltype( FL_NO_LABEL ); // clear_visible_focus(); Fl_Group::size( timeline->w(), height() ); Track *o = this; o->box( FL_FLAT_BOX ); { Track_Header *o = new Track_Header( x(), y(), w(), h() ); name_field = o->name_input; record_button = o->rec_button; mute_button = o->mute_button; solo_button = o->solo_button; menu_button = o->menu_button; show_all_takes_button = o->show_all_takes_button; overlay_controls_button = o->overlay_controls_button; name_field->callback( cb_button, this ); record_button->callback( cb_button, this ); mute_button->callback( cb_button, this ); solo_button->callback( cb_button, this ); show_all_takes_button->callback( cb_button, this ); overlay_controls_button->callback( cb_button, this ); menu_button->callback( cb_button, this ); resizable( o ); // o->color( (Fl_Color)53 ); } { /* this pack holds the active sequence, annotation sequence, control sequences and takes */ Fl_Pack *o = pack = new Fl_Pack( x(), y(), w(), h() ); o->type( Fl_Pack::VERTICAL ); o->labeltype( FL_NO_LABEL ); /* o->resize( x() + width(), y(), w() - width(), h() ); */ /* resizable( o ); */ { Fl_Pack *o = annotation = new Fl_Pack( 0, 0, pack->w(), 1 ); o->type( Fl_Pack::VERTICAL ); o->end(); } { { Fl_Group *o = controls_heading = new Fl_Group( 0, 0, pack->w(), 10 ); o->box( FL_FLAT_BOX ); o->color( fl_color_add_alpha( fl_rgb_color( 1,1,1 ), 127 ) ); { Fl_Box *o = new Fl_Box( 0,0, Track::width(), 10 ); o->label( "Controls" ); o->align( FL_ALIGN_RIGHT | FL_ALIGN_INSIDE ); o->labelsize( 10 ); } o->hide(); o->end(); o->resizable( 0 ); } { Fl_Sometimes_Pack *o = control = new Fl_Sometimes_Pack( 0, 0, pack->w(), 1 ); o->spacing( 1 ); o->box( FL_NO_BOX ); o->color( FL_BACKGROUND_COLOR ); o->type( Fl_Pack::VERTICAL ); o->pack( true ); o->hide(); o->align( FL_ALIGN_TOP | FL_ALIGN_LEFT ); o->end(); } } { { Fl_Group *o = takes_heading = new Fl_Group( 0, 0, pack->w(), 10 ); o->box( FL_FLAT_BOX ); o->color( fl_color_add_alpha( fl_rgb_color( 1,1,1 ), 127 ) ); { Fl_Box *o = new Fl_Box( 0,0, Track::width(), 10 ); o->label( "Takes" ); o->align( FL_ALIGN_RIGHT | FL_ALIGN_INSIDE ); o->labelsize( 10 ); } o->hide(); o->end(); o->resizable( 0 ); } { Fl_Pack *o = takes = new Fl_Pack( 0, 0, pack->w(), 1 ); o->type( Fl_Pack::VERTICAL ); o->end(); o->hide(); o->align( FL_ALIGN_TOP | FL_ALIGN_LEFT ); } } o->end(); } end(); }
int run_main (int argc, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("FlReactor_Test")); Fl_Window window (300, 370); Test_Window tw (10, 75, window.w () - 20, window.h ()-90); window.resizable (&tw); Fl_Hor_Slider slider (60, 5, window.w () - 70, 30, "Sides:"); slider.align (FL_ALIGN_LEFT); slider.callback (sides_cb, &tw); slider.value (tw.sides ()); slider.step (1); slider.bounds (3, 10); ACE_FlReactor reactor; ACE_Reactor r (&reactor); Fl_Box *box = new Fl_Box (FL_UP_BOX, 10, 40, window.w () - 20, 30, "Setting up"); box->labelfont (FL_BOLD); Acceptor acceptor (&tw, box); ACE_INET_Addr address; if (acceptor.open (address, &r) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open acceptor"), -1); acceptor.acceptor ().get_local_addr (address); const int bufsiz = 128; ACE_TCHAR buf[bufsiz]; address.addr_to_string (buf, bufsiz, 0); char msg[2 * bufsiz]; ACE_OS::sprintf (msg, "Listening on <%s>\n", ACE_TEXT_ALWAYS_CHAR (buf)); box->label (msg); box->redraw (); window.end (); ACE_Argv_Type_Converter ct (argc, argv); window.show (argc, ct.get_ASCII_argv ()); tw.show (); int const retval = Fl::run (); ACE_END_TEST; return retval; }
co_rc_t console_window_t::start() { window = new console_main_window_t(this); window->callback(console_window_cb, this); Fl_Menu_Item console_menuitems[] = { { "File", 0, 0, 0, FL_SUBMENU }, { "Quit", 0, (Fl_Callback *)console_quit_cb, this }, { 0 }, { "Monitor", 0, 0, 0, FL_SUBMENU }, { "Select", 0, (Fl_Callback *)console_select_cb, this, FL_MENU_DIVIDER }, { "Attach", 0, (Fl_Callback *)console_attach_cb, this, }, { "Detach", 0, (Fl_Callback *)console_detach_cb, this, FL_MENU_DIVIDER }, { "Pause", 0, (Fl_Callback *)console_pause_cb, this, }, { "Resume", 0, (Fl_Callback *)console_resume_cb, this, }, { "Terminate", 0, (Fl_Callback *)console_terminate_cb, this, }, { "Send Ctrl-Alt-Del", 0, (Fl_Callback *)console_send_ctrl_alt_del_cb, this, }, { 0 }, { "Inspect", 0, 0, 0, FL_SUBMENU }, { 0 }, { "Help", 0, 0, 0, FL_SUBMENU }, { "About", 0, (Fl_Callback *)console_about_cb, this, }, { 0 }, { 0 } }; unsigned int i; for (i=0; i < sizeof(console_menuitems)/sizeof(console_menuitems[0]); i++) console_menuitems[i].user_data((void *)this); int swidth = 640; int sheight = 480; menu = new Fl_Menu_Bar(0, 0, swidth, 30); menu->box(FL_UP_BOX); menu->align(FL_ALIGN_CENTER); menu->when(FL_WHEN_RELEASE_ALWAYS); menu->copy(console_menuitems, window); Fl_Group *tile = new Fl_Group(0, 30, swidth, sheight-30); widget = new console_widget_t(0, 30, swidth, sheight-120); text_widget = new Fl_Text_Display(0, sheight-120+30, swidth, 70); Fl_Group *tile2 = new Fl_Group(0, sheight-120+30, swidth, 90); text_widget->buffer(new Fl_Text_Buffer()); text_widget->insert_position(0); Fl_Box *box = new Fl_Box(0, sheight-20, swidth, 20); box->label(""); box->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); tile2->end(); tile->resizable(widget); tile->end(); window->resizable(tile); window->end(); window->show(); menu_item_activate(console_select_cb); menu_item_deactivate(console_pause_cb); menu_item_deactivate(console_resume_cb); menu_item_deactivate(console_terminate_cb); menu_item_deactivate(console_detach_cb); menu_item_deactivate(console_attach_cb); log("Cooperative Linux console started\n"); if (start_parameters.attach_id != CO_INVALID_ID) attached_id = start_parameters.attach_id; if (attached_id != CO_INVALID_ID) return attach(); return CO_RC(OK); }
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; }
Mixer::Mixer ( int X, int Y, int W, int H, const char *L ) : Fl_Group( X, Y, W, H, L ) { Loggable::dirty_callback( &Mixer::handle_dirty, this ); _rows = 1; box( FL_FLAT_BOX ); labelsize( 96 ); { Fl_Group *o = new Fl_Group( X, Y, W, 24 ); { Fl_Menu_Bar *o = menubar = new Fl_Menu_Bar( X, Y, W, 24 ); o->add( "&Project/&New" ); o->add( "&Project/&Open" ); o->add( "&Project/&Save", FL_CTRL + 's', 0, 0 ); o->add( "&Project/&Quit", FL_CTRL + 'q', 0, 0 ); o->add( "&Mixer/&Add Strip", 'a', 0, 0 ); o->add( "&Mixer/Add &N Strips" ); o->add( "&Mixer/&Import Strip" ); o->add( "&Mixer/&Rows/One", '1', 0, 0 ); o->add( "&Mixer/&Rows/Two", '2', 0, 0 ); o->add( "&Mixer/&Rows/Three", '3', 0, 0 ); o->add( "&View/&Theme", 0, 0, 0 ); o->add( "_&Options/&Display/&Knobs/&Arc", 0, 0, 0, FL_MENU_RADIO ); o->add( "_&Options/&Display/&Knobs/&Burnished", 0, 0, 0, FL_MENU_RADIO ); o->add( "_&Options/&Display/&Knobs/&Plastic", 0, 0, 0, FL_MENU_RADIO | FL_MENU_VALUE ); o->add( "_&Options/&Display/&Sliders/&Nice", 0, 0, 0, FL_MENU_RADIO | FL_MENU_VALUE ); o->add( "_&Options/&Display/&Sliders/&Fill", 0, 0, 0, FL_MENU_RADIO ); o->add( "_&Options/&Display/&Sliders/&Simple", 0, 0, 0, FL_MENU_RADIO ); o->add( "_&Options/&Display/&Colors/&System", 0, 0, 0, FL_MENU_RADIO ); o->add( "&Help/&Manual" ); o->add( "&Help/&About" ); o->callback( cb_menu, this ); } { Fl_Box *o = project_name = new Fl_Box( X + 150, Y, W, 24 ); o->labelfont( FL_HELVETICA_ITALIC ); o->label( 0 ); o->align( FL_ALIGN_INSIDE | FL_ALIGN_CENTER ); o->labeltype( FL_SHADOW_LABEL ); Fl_Group::current()->resizable( o ); } { sm_blinker = new Fl_Button( ( X + W) - 37, Y + 4, 35, 15, "SM"); sm_blinker->box(FL_ROUNDED_BOX); sm_blinker->down_box(FL_ROUNDED_BOX); sm_blinker->color(FL_DARK2); sm_blinker->selection_color((Fl_Color)93); sm_blinker->labeltype(FL_NORMAL_LABEL); sm_blinker->labelfont(3); sm_blinker->labelsize(14); sm_blinker->labelcolor(FL_DARK3); sm_blinker->align(Fl_Align(FL_ALIGN_CENTER)); sm_blinker->when(FL_WHEN_RELEASE); sm_blinker->deactivate(); } // Fl_Blink_Button* sm_blinker o->end(); } { Fl_Scroll *o = scroll = new Fl_Scroll( X, Y + 24, W, H - 24 ); o->box( FL_FLAT_BOX ); // o->type( Fl_Scroll::HORIZONTAL_ALWAYS ); // o->box( Fl_Scroll::BOTH ); { Fl_Flowpack *o = mixer_strips = new Fl_Flowpack( X, Y + 24, W, H - 18 - 24 ); // label( "Non-Mixer" ); align( (Fl_Align)(FL_ALIGN_CENTER | FL_ALIGN_INSIDE) ); o->box( FL_FLAT_BOX ); o->type( Fl_Pack::HORIZONTAL ); o->hspacing( 2 ); o->vspacing( 2 ); o->end(); Fl_Group::current()->resizable( o ); } o->end(); Fl_Group::current()->resizable( o ); } end(); // Fl::add_timeout( STATUS_UPDATE_FREQ, update_cb, this ); update_menu(); load_options(); }
void Splash::run(void) { E_ASSERT(slist != NULL); if(!show_splash) { while(next_client_nosplash()) ; return; } fl_register_images(); String path, splash_theme_path; #ifdef USE_LOCAL_CONFIG splash_theme_path = "splash-themes/"; #else splash_theme_path = Resource::find_data("themes/splash-themes", RES_SYS_ONLY); if(splash_theme_path.empty()) { E_WARNING(E_STRLOC ": Unable to locate splash themes in $XDG_DATA_DIRS directories\n"); return; } #endif splash_theme_path += E_DIR_SEPARATOR; splash_theme_path += *splash_theme; if(!file_test(splash_theme_path.c_str(), FILE_TEST_IS_DIR)) { E_WARNING(E_STRLOC ": Unable to locate '%s' in '%s' theme directory\n", splash_theme->c_str(), splash_theme_path.c_str()); return; } /* setup widgets */ begin(); Fl_Box* bimg = new Fl_Box(0, 0, w(), h()); Fl_Image* splash_img = 0; path = build_filename(splash_theme_path.c_str(), "background.png"); splash_img = Fl_Shared_Image::get(path.c_str()); if(splash_img) { int W = splash_img->w(); int H = splash_img->h(); /* update window and Box sizes */ size(W, H); bimg->size(W, H); bimg->image(splash_img); } /* * place message box at the bottom with * nice offset (10 px) from window borders */ msgbox = new Fl_Box(10, h() - 25 - 10, w() - 20, 25); /* * Setup icons positions, based on position of msgbox assuming someone * will not abuse splash to start hundrets of programs, since icons will * be placed only in horizontal order, one line, so in case their large * number, some of them will go out of window borders. * * Icon box will be 64x64 so larger icons can fit too. * * This code will use Fl_Group (moving group, later, will move all icons * saving me from code mess), but will not update it's w() for two reasons: * icons does not use it, and will be drawn correctly, and second, setting * width will initiate fltk layout engine which will mess everything up. */ Fl_Group* icon_group = new Fl_Group(10, msgbox->y() - 10 - 64, 0, 64); int X = icon_group->x(); int Y = icon_group->y(); /* offset between icons */ int ioffset = 5; /* FIXME: use malloc/something instead this */ icons = new Fl_Box*[slist->size()]; icon_group->begin(); int i = 0; const char* imgpath; Fl_Image* iconimg = 0; for(StartupItemListIter it = slist->begin(); it != slist->end(); ++it, ++i) { Fl_Box* bb = new Fl_Box(X, Y, 64, 64); path = build_filename(splash_theme_path.c_str(), (*it)->icon.c_str()); imgpath = path.c_str(); iconimg = Fl_Shared_Image::get(imgpath); if(!iconimg) { bb->label(_("No image")); bb->align(FL_ALIGN_INSIDE | FL_ALIGN_WRAP); } else bb->image(iconimg); bb->hide(); X += bb->w() + ioffset; icons[i] = bb; } icon_group->end(); /* see X as width of all icons */ int gx = w()/2 - X/2; /* gx can be negative */ gx = (gx > 10) ? gx : 10; icon_group->position(gx, Y); end(); clear_border(); /* * If set_override() is used, message boxes will be * popped behind splash. Using it or not ??? */ set_override(); // make sure window is centered int sw = DisplayWidth(fl_display, fl_screen); int sh = DisplayHeight(fl_display, fl_screen); position(sw/2 - w()/2, sh/2 - h()/2); show(); Fl::add_timeout(TIMEOUT_START, runner_cb, this); // to keep splash at the top #ifndef EDEWM_HAVE_NET_SPLASH global_splash = this; XSelectInput(fl_display, RootWindow(fl_display, fl_screen), SubstructureNotifyMask); Fl::add_handler(splash_xmessage_handler); #endif while(shown()) Fl::wait(); #ifndef EDEWM_HAVE_NET_SPLASH Fl::remove_handler(splash_xmessage_handler); #endif }
void Board :: draw(){ for(int i=0; i<xmaxtiles; i++) { for(int j=0; j<ymaxtiles; j++) { if(occupancy [i] [j]==0) {fl_draw_box(FL_FLAT_BOX, i*tilesize, j*tilesize, tilesize, tilesize, bgcolor);} else fl_draw_box(FL_BORDER_BOX, i*tilesize, j*tilesize, tilesize, tilesize, occupancy [i] [j]); } } for(int i=0; i<4; i++) { fl_draw_box(FL_BORDER_BOX, (p->tileSet[i].x)*tilesize, (p->tileSet[i].y)*tilesize, tilesize, tilesize, (p->color)); } for(int i=xmaxtiles+1; i<xmaxtiles+7; i++) { for(int j=10; j<17; j++) { fl_draw_box(FL_FLAT_BOX, i*tilesize, j*tilesize, tilesize, tilesize, bgcolor); } } for(int i=0; i<4; i++) { fl_draw_box(FL_BORDER_BOX, ((next->tileSet[i].x)+xmaxtiles/2+3)*tilesize, ((next->tileSet[i].y)+11)*tilesize, tilesize, tilesize, next->color); } if(termination()) { for(int i=xmaxtiles; i>=0; i--) { for(int j=ymaxtiles-1; j>=0; j--) { fl_draw_box(FL_FLAT_BOX, i*tilesize, j*tilesize, tilesize, tilesize, 21); } } for(int i=xmaxtiles+1; i<xmaxtiles+7; i++) { for(int j=10; j<17; j++) { fl_draw_box(FL_FLAT_BOX, i*tilesize, j*tilesize, tilesize, tilesize, bgcolor); } } //G for(int i=3; i<8; i++){ fl_draw_box(FL_BORDER_BOX, 0*tilesize/2, i*tilesize/2, tilesize/2, tilesize/2, 2); } for(int i=1; i<4; i++){ fl_draw_box(FL_BORDER_BOX, i*tilesize/2, 3*tilesize/2, tilesize/2, tilesize/2, 2); fl_draw_box(FL_BORDER_BOX, i*tilesize/2, 7*tilesize/2, tilesize/2, tilesize/2, 2); } for(int i=2; i<4; i++){ fl_draw_box(FL_BORDER_BOX, i*tilesize/2, 7*tilesize/2, tilesize/2, tilesize/2, 2); fl_draw_box(FL_BORDER_BOX, i*tilesize/2, 5*tilesize/2, tilesize/2, tilesize/2, 2); } fl_draw_box(FL_BORDER_BOX, 3*tilesize/2, 6*tilesize/2, tilesize/2, tilesize/2, 2); //A for(int i=3; i<8; i++) { fl_draw_box(FL_BORDER_BOX, 5*tilesize/2, i*tilesize/2, tilesize/2, tilesize/2, 2); fl_draw_box(FL_BORDER_BOX, 7*tilesize/2, i*tilesize/2, tilesize/2, tilesize/2, 2); } fl_draw_box(FL_BORDER_BOX, 6*tilesize/2, 3*tilesize/2, tilesize/2, tilesize/2, 2); fl_draw_box(FL_BORDER_BOX, 6*tilesize/2, 5*tilesize/2, tilesize/2, tilesize/2, 2); //M for(int i=3; i<8; i++) { fl_draw_box(FL_BORDER_BOX, 9*tilesize/2, i*tilesize/2, tilesize/2, tilesize/2, 2); fl_draw_box(FL_BORDER_BOX, 13*tilesize/2, i*tilesize/2, tilesize/2, tilesize/2, 2); } for(int i=3; i<6; i++) { fl_draw_box(FL_BORDER_BOX, 11*tilesize/2, i*tilesize/2, tilesize/2, tilesize/2, 2); } fl_draw_box(FL_BORDER_BOX, 10*tilesize/2, 3*tilesize/2, tilesize/2, tilesize/2, 2); fl_draw_box(FL_BORDER_BOX, 12*tilesize/2, 3*tilesize/2, tilesize/2, tilesize/2, 2); //E for(int i=3; i<8; i++) { fl_draw_box(FL_BORDER_BOX, 15*tilesize/2, i*tilesize/2, tilesize/2, tilesize/2, 2); } for(int i=3; i<8; i=i+2) { fl_draw_box(FL_BORDER_BOX, 16*tilesize/2, i*tilesize/2, tilesize/2, tilesize/2, 2); fl_draw_box(FL_BORDER_BOX, 17*tilesize/2, i*tilesize/2, tilesize/2, tilesize/2, 2); } //O for(int i=10; i<15; i++) { fl_draw_box(FL_BORDER_BOX, 3*tilesize/2, i*tilesize/2, tilesize/2, tilesize/2, 2); fl_draw_box(FL_BORDER_BOX, 5*tilesize/2, i*tilesize/2, tilesize/2, tilesize/2, 2); } fl_draw_box(FL_BORDER_BOX, 4*tilesize/2, 10*tilesize/2, tilesize/2, tilesize/2, 2); fl_draw_box(FL_BORDER_BOX, 4*tilesize/2, 14*tilesize/2, tilesize/2, tilesize/2, 2); //V for(int i=10; i<13; i++) { fl_draw_box(FL_BORDER_BOX, 7*tilesize/2, i*tilesize/2, tilesize/2, tilesize/2, 2); fl_draw_box(FL_BORDER_BOX, 9*tilesize/2, i*tilesize/2, tilesize/2, tilesize/2, 2); } fl_draw_box(FL_BORDER_BOX, 7.5*tilesize/2, 13*tilesize/2, tilesize/2, tilesize/2, 2); fl_draw_box(FL_BORDER_BOX, 8.5*tilesize/2, 13*tilesize/2, tilesize/2, tilesize/2, 2); fl_draw_box(FL_BORDER_BOX, 8*tilesize/2, 14*tilesize/2, tilesize/2, tilesize/2, 2); //E for(int i=10; i<15; i++) { fl_draw_box(FL_BORDER_BOX, 11*tilesize/2, i*tilesize/2, tilesize/2, tilesize/2, 2); } for(int i=10; i<15; i=i+2) { fl_draw_box(FL_BORDER_BOX, 12*tilesize/2, i*tilesize/2, tilesize/2, tilesize/2, 2); fl_draw_box(FL_BORDER_BOX, 13*tilesize/2, i*tilesize/2, tilesize/2, tilesize/2, 2); } //R for(int i=10; i<15; i++) { fl_draw_box(FL_BORDER_BOX, 15*tilesize/2, i*tilesize/2, tilesize/2, tilesize/2, 2); } fl_draw_box(FL_BORDER_BOX, 16*tilesize/2, 10*tilesize/2, tilesize/2, tilesize/2, 2); fl_draw_box(FL_BORDER_BOX, 16*tilesize/2, 12*tilesize/2, tilesize/2, tilesize/2, 2); fl_draw_box(FL_BORDER_BOX, 17*tilesize/2, 10*tilesize/2, tilesize/2, tilesize/2, 2); fl_draw_box(FL_BORDER_BOX, 17*tilesize/2, 11*tilesize/2, tilesize/2, tilesize/2, 2); fl_draw_box(FL_BORDER_BOX, 17*tilesize/2, 12*tilesize/2, tilesize/2, tilesize/2, 2); fl_draw_box(FL_BORDER_BOX, 17.5*tilesize/2, 13*tilesize/2, tilesize/2, tilesize/2, 2); fl_draw_box(FL_BORDER_BOX, 18*tilesize/2, 14*tilesize/2, tilesize/2, tilesize/2, 2); stringstream strs; string temp_str = strs.str(); strcpy(scoreLabel,"Press Escape to Exit "); scoreBox->label(scoreLabel); } }
co_rc_t console_window_t::start() { window = new console_main_window_t(this); window->callback(console_window_cb, this); // read font and font size from registry reg_font = ReadRegistry(REGISTRY_FONT); reg_font_size = ReadRegistry(REGISTRY_FONT_SIZE); reg_copyspaces = ReadRegistry(REGISTRY_COPYSPACES); reg_exitdetach = ReadRegistry(REGISTRY_EXITDETACH); if(reg_font==-1) reg_font = FL_SCREEN; if(reg_font_size==-1) reg_font_size = 18; if(reg_copyspaces==-1) reg_copyspaces = 1; if(reg_exitdetach==-1) reg_exitdetach = 0; Fl_Menu_Item console_menuitems[] = { { "File", 0, NULL, NULL, FL_SUBMENU }, { "Select" , 0, (Fl_Callback*)console_select_cb, this, FL_MENU_DIVIDER }, { "Attach" , 0, (Fl_Callback*)console_attach_cb, this, }, { "Detach" , 0, (Fl_Callback*)console_detach_cb, this, FL_MENU_DIVIDER }, { "Power off", 0, (Fl_Callback*)console_send_poweroff_cb, this, }, { "Reboot - Ctrl-Alt-Del", 0, (Fl_Callback *)console_send_ctrl_alt_del_cb, this, }, { "Shutdown" , 0, (Fl_Callback*)console_send_shutdown_cb, this, FL_MENU_DIVIDER }, { "Quit", 0, (Fl_Callback *)console_quit_cb, this }, { 0 }, { "Edit" , 0, NULL, NULL, FL_SUBMENU }, { "Copy (WinKey+C)", 0, (Fl_Callback*)console_copy_cb, this, }, { "Paste (WinKey+V)", 0, (Fl_Callback*)console_paste_cb, this, }, { 0 }, { "View" , 0, NULL, NULL, FL_SUBMENU }, { "Page up (WinKey+PgUp, mouse wheel)", 0, (Fl_Callback*)console_scrollpageup_cb, this, }, { "Page down (WinKey+PgDn, mouse wheel)", 0, (Fl_Callback*)console_scrollpagedown_cb, this, }, { 0 }, { "Config" , 0, NULL, NULL, FL_SUBMENU }, { "Font..." , 0, (Fl_Callback*)console_font_cb, this, FL_MENU_DIVIDER }, { "Copy trailing spaces", 0, (Fl_Callback*)console_copyspaces_cb, this, FL_MENU_TOGGLE | ((reg_copyspaces) ? FL_MENU_VALUE : 0)}, { "Exit on Detach", 0, (Fl_Callback*)console_exitdetach_cb, this, FL_MENU_TOGGLE | ((reg_exitdetach) ? FL_MENU_VALUE : 0)}, { 0 }, { "Help" , 0, NULL, NULL, FL_SUBMENU }, { "About", 0, (Fl_Callback*)console_about_cb, this, }, { 0 }, { 0 } }; unsigned int i; for (i = 0; i < sizeof(console_menuitems) / sizeof(console_menuitems[0]); i++) console_menuitems[i].user_data((void*)this); int swidth = 640; int sheight = 480; menu = new Fl_Menu_Bar(0, 0, swidth, MENU_SIZE_PIXELS); menu->box(FL_UP_BOX); menu->align(FL_ALIGN_CENTER); menu->when(FL_WHEN_RELEASE_ALWAYS); menu->copy(console_menuitems, window); Fl_Group* tile = new Fl_Group(0, MENU_SIZE_PIXELS, swidth, sheight-MENU_SIZE_PIXELS); widget = new console_widget_t(0, MENU_SIZE_PIXELS, swidth, sheight - 120); if(widget->get_copy_spaces()!=reg_copyspaces) widget->toggle_copy_spaces(); text_widget = new Fl_Text_Display(0, sheight - 120 + MENU_SIZE_PIXELS, swidth, 70); Fl_Group* tile2 = new Fl_Group(0, sheight - 120 + MENU_SIZE_PIXELS, swidth, 90); text_widget->buffer(new Fl_Text_Buffer()); text_widget->insert_position(0); Fl_Box* box = new Fl_Box(0, sheight - 20, swidth, 20); box->label(""); box->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); tile2->end(); tile->resizable(widget); tile->end(); window->resizable(tile); window->end(); window->show(); menu_item_activate(console_select_cb); menu_item_deactivate(console_send_poweroff_cb); menu_item_deactivate(console_send_ctrl_alt_del_cb); menu_item_deactivate(console_send_shutdown_cb); menu_item_deactivate(console_detach_cb); menu_item_deactivate(console_attach_cb); // Default Font is "Terminal" with size 18 // Sample WinNT environment: set COLINUX_CONSOLE_FONT=Lucida Console:12 // Change only font size: set COLINUX_CONSOLE_FONT=:12 char* env_font = getenv("COLINUX_CONSOLE_FONT"); if (env_font) { char* p = strchr (env_font, ':'); if (p) { int size = atoi (p+1); if (size >= 4 && size <= 24) { // Set size widget->set_font_size(size); } *p = 0; // End for Fontname } // Set new font style if(strlen(env_font)) { // Remember: set_font need a non stack buffer! // Environment is global static. Fl::set_font(FL_SCREEN, env_font); // Now check font width fl_font(FL_SCREEN, 18); // Use default High for test here if ((int)fl_width('i') != (int)fl_width('W')) { Fl::set_font(FL_SCREEN, "Terminal"); // Restore standard font log("%s: is not fixed font. Using 'Terminal'\n", env_font); } } } else { // use registry values and not environment variable widget->set_font_name(reg_font); widget->set_font_size(reg_font_size); } log("Cooperative Linux console started\n"); if (start_parameters.attach_id != CO_INVALID_ID) attached_id = start_parameters.attach_id; else attached_id = find_first_monitor(); if (attached_id != CO_INVALID_ID) attach(); /* Ignore errors, as we can attach latter */ return CO_RC(OK); }