KeyLayout::KeyLayout() : Fl_Button(0, 0, 30, 25) { should_show_flag = true; curr_layout = "us"; /* default layout */ img = NULL; box(FL_FLAT_BOX); labelfont(FL_HELVETICA_BOLD); labelsize(10); label("??"); align(FL_ALIGN_CLIP); tooltip(_("Current keyboard layout")); callback(click_cb); foreign_callback_add(window(), PANEL_APPLET_ID, update_flag_cb, this); path = Resource::find_data("icons/kbflags/21x14", RES_SYS_ONLY, NULL); do_key_layout(); update_flag(true); /* TODO: lock this */ keylayout_objects.push_back(this); /* with this, kb layout chages will be catched */ #if HAVE_XKBRULES if(!_XA_XKB_RF_NAMES_PROP_ATOM) _XA_XKB_RF_NAMES_PROP_ATOM = XInternAtom(fl_display, _XKB_RF_NAMES_PROP_ATOM, False); #endif Fl::add_handler(xkb_events); }
void FolderWindow::SetStructures(int folderIndex) { StructureManager* structureManager = RNAStructViz::GetInstance()->GetStructureManager(); Folder* folder = structureManager->GetFolderAt(folderIndex); m_folderIndex = folderIndex; int shift = 0; for( int ui = 0; ui < folder->structCount; ui++) { if(folder->folderStructs[(ui+shift)] == -1) { shift++; } int i = folder->folderStructs[(ui+shift)]; RNAStructure *strct = structureManager->GetStructure(i); AddStructure(strct->GetFilename(), i); } label(folder->folderName); char structLabel[MAX_BUFFER_SIZE]; snprintf(structLabel, MAX_BUFFER_SIZE - 1, " \n\n\n\n\n%s", folder->folderName); ConfigParser::nullTerminateString(structLabel); copy_label(structLabel); labelsize(1.25 * LOCAL_TEXT_SIZE); align(FL_ALIGN_TOP); }
void Module::init ( void ) { /* we use pointers to these vector elements for port auto connection stuff and need to prevent reallocation from invalidating them. */ audio_input.reserve(16); audio_output.reserve(16); control_input.reserve(16); control_output.reserve(16); aux_audio_input.reserve(16); aux_audio_output.reserve(16); // _latency = 0; _is_default = false; _editor = 0; _chain = 0; _instances = 1; _bypass = 0; box( FL_UP_BOX ); labeltype( FL_NO_LABEL ); align( FL_ALIGN_CENTER | FL_ALIGN_INSIDE ); set_visible_focus(); selection_color( FL_YELLOW ); labelsize(12); color( fl_rgb_color( 122,190,200 ) ); tooltip(); }
void GLWindow::draw() { // prevent nested calls to draw from creating infinite loops // Also prevents threads from creating invalid data // This is not atomic, so not perfect, but it should do the job for now if (isDrawing) return; isDrawing = true; // Set up fonts for drawing text float fColBack[4]; glGetFloatv( GL_COLOR_CLEAR_VALUE, fColBack ); gl_color( FL_BLACK ); gl_font(labelfont(), labelsize()); if (currentUI != 0) { gl_color( currentUI->fontColor() ); currentUI->draw(); } else { glClear(GL_COLOR_BUFFER_BIT); } // We're done, so allow other calls into this method. isDrawing = false; }
gBox::gBox(int x, int y, int w, int h, const char *L, Fl_Align al) : Fl_Box(x, y, w, h, L) { labelsize(11); box(FL_NO_BOX); labelcolor(COLOR_TEXT_0); if (al != 0) align(al | FL_ALIGN_INSIDE); }
MySpinner(int X, int Y, int W, int H, const char *L=NULL) : Fl_Spinner(X, Y, W, H, L) { align(FL_ALIGN_TOP_LEFT); labelsize(14); minimum(1); step(1); }
BankSlot::BankSlot(int x,int y, int w, int h, const char *label) :Fl_Button(x,y,w,h,label), nslot(-1) { memset(labelstr, 0, sizeof(labelstr)); box(FL_THIN_UP_BOX); labelfont(0); labelsize(13); align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE|FL_ALIGN_CLIP); }
gChoice::gChoice(int x, int y, int w, int h, const char *l, bool ang) : Fl_Choice(x, y, w, h, l), angle(ang) { labelsize(11); labelcolor(COLOR_TEXT_0); box(FL_BORDER_BOX); textsize(11); textcolor(COLOR_TEXT_0); color(COLOR_BG_0); }
geResizerBar::geResizerBar(int X, int Y, int W, int H, int minSize, bool type) : Fl_Box (X, Y, W, H), m_type (type), m_minSize(minSize), m_lastPos(0), m_hover (false) { if (m_type == VERTICAL) { m_origSize = H; labelsize(H); } else { m_origSize = W; labelsize(W); } align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE); labelfont(FL_COURIER); visible_focus(0); }
void value(float f) { sprintf(tip, "%.2f", f); // Recalc size of window fl_font(labelfont(), labelsize()); int W = w(), H = h(); fl_measure(tip, W, H, 0); W += 8; size(W, H); redraw(); }
void ImgTextButton::updateShape(){ // sf::Vector2f label_size = _label.getSize(); //unsigned int charSize = _label.getCharacterSize(); //_shape.setSize(sf::Vector2f(charSize*2+label_size.x, charSize*2+label_size.y)); _sprite.setScale(_shape.getSize().x/_sprite.getLocalBounds().width, _shape.getSize().y/_sprite.getLocalBounds().height ); sf::Vector2f labelsize(_shape.getSize().x,_shape.getSize().y/3); _label.setSize(labelsize); _label.setPosition(_shape.getSize().x/2-_label.getSize().x/2,_shape.getSize().y/2-_label.getSize().y/2); Widget::updateShape(); }
gDial::gDial(int x, int y, int w, int h, const char *L) : Fl_Dial(x, y, w, h, L) { labelsize(11); labelcolor(COLOR_TEXT_0); align(FL_ALIGN_LEFT); type(FL_FILL_DIAL); angles(0, 360); color(COLOR_BG_0); // background selection_color(COLOR_BG_1); // selection }
void DesktopIcon::update_label_size(void) { labelsize(gsettings->label_fontsize); lwidth = gsettings->label_maxwidth; lheight= 0; /* * make sure current font size/type is set (internaly to fltk) * so fl_measure() can correctly calculate label width and height */ int old = fl_font(); int old_sz = fl_size(); fl_font(labelfont(), labelsize()); fl_measure(label(), lwidth, lheight, align()); fl_font(old, old_sz); lwidth += 12; lheight += 5; }
gResizerBar::gResizerBar(int X,int Y,int W,int H) : Fl_Box(X,Y,W,H) { orig_h = H; last_y = 0; min_h = 30; align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE); labelfont(FL_COURIER); labelsize(H); visible_focus(0); box(FL_FLAT_BOX); }
gSlider::gSlider(int x, int y, int w, int h, const char *l) : Fl_Slider(x, y, w, h, l) { type(FL_HOR_FILL_SLIDER); labelsize(11); align(FL_ALIGN_LEFT); labelcolor(COLOR_TEXT_0); box(G_BOX); color(COLOR_BG_0); selection_color(COLOR_BD_0); }
gInput::gInput(int x, int y, int w, int h, const char *L) : Fl_Input(x, y, w, h, L) { //Fl::set_boxtype(G_BOX, gDrawBox, 1, 1, 2, 2); box(G_BOX); labelsize(11); labelcolor(COLOR_TEXT_0); color(COLOR_BG_DARK); textcolor(COLOR_TEXT_0); cursor_color(COLOR_TEXT_0); selection_color(COLOR_BD_0); textsize(11); }
internals_graphics::Drawable2DObject * Plot2DAxes::inserted(Fl_Group * & optionWin, int reqWidth) { /* create the option window */ optionWin = new Fl_Group(0, 0, reqWidth,60); // create the option group _gradButton = new Fl_Check_Button(25, 10, 90, 15, "Graduations."); _gradButton->labelfont(0); _gradButton->labelsize(11); _gradButton->color2(FL_RED); _gradButton->callback(_gradButtonCB_static, this); _gradButton->when(FL_WHEN_CHANGED); _gradButton->value(_gradStatus ? 1 : 0); _numButton = new Fl_Check_Button(25, 35, 90, 15, "Numbers."); _numButton->labelfont(0); _numButton->labelsize(11); _numButton->color2(FL_RED); _numButton->callback(_numButtonCB_static, this); _numButton->when(FL_WHEN_CHANGED); _numButton->value(_numStatus ? 1 : 0); _gradColorButton = new Fl_Button(10, 10, 15, 15); _gradColorButton->color2(_gradColor); _gradColorButton->color(_gradColor); _gradColorButton->callback(_gradColorButtonCB_static, this); _numColorButton = new Fl_Button(10, 35, 15, 15); _numColorButton->color2(_numColor); _numColorButton->color(_numColor); _numColorButton->callback(_numColorButtonCB_static, this); _scaleSlider = new Fl_Value_Slider(reqWidth - 150, 30, 140, 15); _scaleSlider->align(Fl_Align(FL_ALIGN_TOP)); _scaleSlider->box(FL_FLAT_BOX); _scaleSlider->type(FL_HOR_NICE_SLIDER); _scaleSlider->range(0.1, 5.0); _scaleSlider->step(0.1); _scaleSlider->value(_scaling); _scaleSlider->color2(FL_RED); _scaleSlider->callback(_scaleSliderCB_static, this); auto b = new Fl_Box(reqWidth - 105, 10, 80, 15, "scaling"); b->labelfont(0); b->labelsize(11); optionWin->end(); return this; }
Ca_Axis_::Ca_Axis_(int x, int y, int w, int h, const char * label) :Fl_Box(x,y,w,h,label), scale_(CA_LIN), valid_(0), k_(0), q_(0), label_format_(0), minor_grid_color_(FL_BLACK), major_grid_color_(FL_BLACK), label_grid_color_(FL_BLACK), minor_grid_style_(FL_SOLID), major_grid_style_(FL_SOLID), label_grid_style_(FL_SOLID), minor_grid_width_(0), major_grid_width_(0), label_grid_width_(0), minor_grid_dashes_(0), major_grid_dashes_(0),label_grid_dashes_(0), grid_visible_(0), tick_interval_(MINOR_INTERVAL), tick_separation_(MINOR_SEPARATION), tick_length_(0), tick_width_(0), major_step_(MAJOR_STEP),label_step_(LABEL_STEP), axis_align_(CA_BOTTOM),label_font_face_(FL_HELVETICA), label_font_size_(LABEL_SIZE), min_(0),max_(0),min_pos_(0),max_pos_(0),border_(AXIS_BORDER),axis_color_(FL_BLACK) { widget_ = 0; box(FL_NO_BOX); canvas_=Ca_Canvas::current(); if(canvas_){ previous_axis_=canvas_->last_axis_; canvas_->last_axis_=this; } labelsize(LABEL_SIZE); };
void TaskButton::draw(void) { Fl_Color col = value() ? selection_color() : color(); draw_box(value() ? (down_box() ? down_box() : fl_down(box())) : box(), col); if(image()) { int X, Y, lw, lh; X = x() + 5; Y = (y() + h() / 2) - (image()->h() / 2); image()->draw(X, Y); X += image()->w() + 5; if(label()) { fl_font(labelfont(), labelsize()); fl_color(labelcolor()); lw = lh = 0; fl_measure(label(), lw, lh, 0); /* use clipping so long labels do not be drawn on the right border, which looks ugly */ fl_push_clip(x() + Fl::box_dx(box()), y() + Fl::box_dy(box()), w() - Fl::box_dw(box()) - 5, h() - Fl::box_dh(box())); Y = (y() + h() / 2) - (lh / 2); fl_draw(label(), X, Y, lw, lh, align(), 0, 0); fl_pop_clip(); } } else { draw_label(); } if(Fl::focus() == this) draw_focus(); }
tabbar::tabbar(int x, int y, int w, int h): Fl_Widget(x, y, w, h), mousex(0), dragstartx(0), mousein(false), dragging(false), srctab(0) { labelsize(12); }
Spatializer_Module::Spatializer_Module ( ) : JACK_Module ( false ) { is_default( false ); _panner = 0; _early_panner = 0; { Port p( this, Port::INPUT, Port::CONTROL, "Azimuth" ); p.hints.type = Port::Hints::LINEAR; p.hints.ranged = true; p.hints.minimum = -180.0f; p.hints.maximum = 180.0f; p.hints.default_value = 0.0f; p.connect_to( new float ); p.control_value( p.hints.default_value ); add_port( p ); } { Port p( this, Port::INPUT, Port::CONTROL, "Elevation" ); p.hints.type = Port::Hints::LINEAR; p.hints.ranged = true; p.hints.minimum = -90.0f; p.hints.maximum = 90.0f; p.hints.default_value = 0.0f; p.connect_to( new float ); p.control_value( p.hints.default_value ); add_port( p ); } { Port p( this, Port::INPUT, Port::CONTROL, "Radius" ); p.hints.type = Port::Hints::LINEAR; p.hints.ranged = true; p.hints.minimum = 0.0f; p.hints.maximum = max_distance; p.hints.default_value = 1.0f; p.connect_to( new float ); p.control_value( p.hints.default_value ); add_port( p ); } { Port p( this, Port::INPUT, Port::CONTROL, "Highpass (Hz)" ); p.hints.type = Port::Hints::LINEAR; p.hints.ranged = true; p.hints.minimum = 0.0f; p.hints.maximum = 600.0f; p.hints.default_value = 0.0f; p.hints.visible = false; p.connect_to( new float ); p.control_value( p.hints.default_value ); add_port( p ); } { Port p( this, Port::INPUT, Port::CONTROL, "Width" ); p.hints.type = Port::Hints::LINEAR; p.hints.ranged = true; p.hints.minimum = -90.0f; p.hints.maximum = 90.0f; p.hints.default_value = 90.0f; p.connect_to( new float ); p.control_value( p.hints.default_value ); add_port( p ); } { Port p( this, Port::INPUT, Port::CONTROL, "Angle" ); p.hints.type = Port::Hints::LINEAR; p.hints.ranged = true; p.hints.minimum = -180.0f; p.hints.maximum = +180.0f; p.hints.default_value = 0.0f; p.connect_to( new float ); p.control_value( p.hints.default_value ); add_port( p ); } { Port p( this, Port::INPUT, Port::CONTROL, "Advanced Options" ); p.hints.type = Port::Hints::BOOLEAN; p.hints.ranged = true; p.hints.minimum = 0.0f; p.hints.maximum = 1.0f; p.hints.default_value = 0.0f; p.connect_to( new float ); p.control_value( p.hints.default_value ); add_port( p ); } { Port p( this, Port::INPUT, Port::CONTROL, "Speed of Sound" ); p.hints.type = Port::Hints::BOOLEAN; p.hints.ranged = true; p.hints.minimum = 0.0f; p.hints.maximum = 1.0f; p.hints.default_value = 1.0f; p.hints.visible = false; p.connect_to( new float ); p.control_value( p.hints.default_value ); add_port( p ); } { Port p( this, Port::INPUT, Port::CONTROL, "Late Gain (dB)" ); p.hints.type = Port::Hints::LOGARITHMIC; p.hints.ranged = true; p.hints.minimum = -70.0f; p.hints.maximum = 6.0f; p.hints.default_value = 0.0f; p.hints.visible = false; p.connect_to( new float ); p.control_value( p.hints.default_value ); add_port( p ); } { Port p( this, Port::INPUT, Port::CONTROL, "Early Gain (dB)" ); p.hints.type = Port::Hints::LOGARITHMIC; p.hints.ranged = true; p.hints.minimum = -70.0f; p.hints.maximum = 6.0f; p.hints.default_value = 0.0f; p.hints.visible = false; p.connect_to( new float ); p.control_value( p.hints.default_value ); add_port( p ); } log_create(); _panner = new ambisonic_panner(); _early_panner = new ambisonic_panner(); labelsize(9); color( FL_DARK1 ); copy_label( "Spatializer" ); align(FL_ALIGN_LEFT|FL_ALIGN_TOP|FL_ALIGN_INSIDE); gain_smoothing.sample_rate( sample_rate() ); late_gain_smoothing.sample_rate( sample_rate() ); early_gain_smoothing.sample_rate( sample_rate() ); delay_smoothing.cutoff( 0.5f ); delay_smoothing.sample_rate( sample_rate() ); }
/** * Override of the inserted method **/ virtual internals_graphics::Drawable2DObject * inserted(Fl_Group * & optionWin, int reqWidth) { /* create the option window */ optionWin = new Fl_Group(0, 0, reqWidth, 110); // create the option group Fl_Group * gr1 = new Fl_Group(0, 0, reqWidth, 110); // create the option group _checkButtonColor = new Fl_Round_Button(10, 5, reqWidth - 20, 15, "Use the getColor() method."); _checkButtonColor->align(Fl_Align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT)); _checkButtonColor->labelfont(0); _checkButtonColor->labelsize(11); _checkButtonColor->color2(FL_RED); _checkButtonColor->type(102); _checkButtonColor->callback(_roundButtonCB_static, this); _checkButtonColor->when(FL_WHEN_CHANGED); _checkButtonImage = new Fl_Round_Button(10, 85, reqWidth - 20, 15, "Use the getImage() method."); _checkButtonImage->align(Fl_Align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT)); _checkButtonImage->labelfont(0); _checkButtonImage->labelsize(11); _checkButtonImage->color2(FL_RED); _checkButtonImage->type(102); _checkButtonImage->callback(_roundButtonCB_static, this); _checkButtonImage->when(FL_WHEN_CHANGED); if (_LD->imageType() == _LD->TYPEIMAGE) { _checkButtonImage->setonly(); } else { _checkButtonColor->setonly(); } if (!_LD->hasImage()) _checkButtonImage->deactivate(); gr1->end(); auto label1 = new Fl_Box(30, 25, 50, 15, "Opacify"); label1->align(Fl_Align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT)); label1->labelfont(0); label1->labelsize(11); _opacifySlider = new Fl_Value_Slider(80, 25, reqWidth - 80 - 30, 15, nullptr); _opacifySlider->labelfont(0); _opacifySlider->labelsize(11); _opacifySlider->align(Fl_Align(FL_ALIGN_RIGHT)); _opacifySlider->box(FL_FLAT_BOX); _opacifySlider->type(FL_HOR_NICE_SLIDER); _opacifySlider->range(1.0, 4.0); _opacifySlider->step(0.05); _opacifySlider->value(_LD->opacify()); _opacifySlider->color2(FL_RED); _opacifySlider->callback(_opacifySliderCB_static, this); auto label2 = new Fl_Box(30, 45, 145, 15, "Remove transparent pixels :"); label2->align(Fl_Align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT)); label2->labelfont(0); label2->labelsize(11); int rem = _LD->transparentColor(); _checkWhite = new Fl_Check_Button(180, 45, reqWidth - 175 - 30, 15, "white"); _checkWhite->align(Fl_Align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT)); _checkWhite->labelfont(0); _checkWhite->labelsize(11); _checkWhite->value((rem == REMOVE_WHITE) ? 1 : 0); _checkWhite->callback(_checkWhiteCB_static, this); _checkBlack = new Fl_Check_Button(180, 65, reqWidth - 175 - 30, 15, "black"); _checkBlack->align(Fl_Align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT)); _checkBlack->labelfont(0); _checkBlack->labelsize(11); _checkBlack->value((rem == REMOVE_BLACK) ? 1 : 0); _checkBlack->callback(_checkBlackCB_static, this); optionWin->end(); return _LD; }
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(); }
// modified explicitly from Fl_Return_Button.cpp void Flu_Button :: draw() { if( type() == FL_HIDDEN_BUTTON ) return; if( !active() ) Fl_Button::color( col ); // draw the link text if( linkBtn ) { fl_draw_box( box(), x(), y(), w(), h(), color() ); labelSize[0] = labelSize[1] = labelSize[2] = labelSize[3] = 0; fl_font( labelfont(), labelsize() ); fl_measure( label(), labelSize[2], labelSize[3], 1 ); labelSize[0] += 2; labelSize[1] += h()/2 - labelsize()/2 - 2; fl_color( labelcolor() ); fl_draw( label(), x()+labelSize[0], y()+labelSize[1], labelSize[2], labelSize[3], FL_ALIGN_LEFT ); if( !overLink || ( overLink && hover ) ) { fl_line_style( FL_SOLID ); fl_line( x()+labelSize[0], y()+labelSize[1]+labelSize[3]-2, x()+labelSize[0]+labelSize[2], y()+labelSize[1]+labelSize[3]-2 ); fl_line_style( 0 ); } return; } Fl_Image *tmp = 0; if( active() && image_follows_value() ) { if( !value() ) { tmp = Fl_Button::image(); Fl_Button::image( Fl_Button::deimage() ); } } else if( active() && value() && downImg ) { tmp = Fl_Button::image(); Fl_Button::image( downImg ); } const char *lbl = label(); if( retBtn ) label(""); if( eBox != FL_NO_BOX && Fl::belowmouse() == this && active() ) { Fl_Boxtype oldbox = box(); box( eBox ); Fl_Button::draw(); box( oldbox ); } else Fl_Button::draw(); if( retBtn ) { int W = h(); if (w()/3 < W) W = w()/3; flu_return_arrow(x()+w()-W-4, y(), W, h()); label( lbl ); draw_label(x(), y(), w()-W+4, h()); } if( tmp ) Fl_Button::image( tmp ); }
FolderWindow::FolderWindow(int x, int y, int wid, int hgt, const char *label, int folderIndex) : Fl_Group(x, y, wid, hgt, label), folderScroll(NULL), folderPack(NULL), fileOpsLabel(NULL), fileLabel(NULL) { // label configuration: //labelcolor(GUI_TEXT_COLOR); labelfont(LOCAL_BFFONT); labelsize(LOCAL_TEXT_SIZE); // icon configuration: structureIcon = new Fl_RGB_Image(StructureOperationIcon.pixel_data, StructureOperationIcon.width, StructureOperationIcon.height, StructureOperationIcon.bytes_per_pixel); Fl_Box *structIconBox = new Fl_Box(x, y - 39, structureIcon->w(), structureIcon->h()); structIconBox->image(structureIcon); int dividerTextHeight = 0, spacingHeight = NAVBUTTONS_SPACING; int fileOpsLabelHeight = 2 * NAVBUTTONS_BHEIGHT; int fileOpsLabelWidth = 2 * NAVBUTTONS_BWIDTH + 2 * NAVBUTTONS_SPACING; int initYOffset = NAVBUTTONS_OFFSETY + RNAStructVizLogo.height + 5; // y + 36 + dividerTextHeight const char *fileOpsLabelText = "@reload Structure Operations.\nEach operation opens a new window."; fileOpsLabel = new Fl_Box(x + NAVBUTTONS_SPACING, initYOffset, fileOpsLabelWidth, fileOpsLabelHeight, fileOpsLabelText); fileOpsLabel->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_LEFT); fileOpsLabel->color(GUI_BGCOLOR); fileOpsLabel->labelcolor(GUI_BTEXT_COLOR); fileOpsLabel->labelfont(LOCAL_BFFONT); fileOpsLabel->labelsize(LOCAL_TEXT_SIZE); fileOpsLabel->box(FL_RSHADOW_BOX); int opButtonWidth = 110; int yOffset = initYOffset + fileOpsLabelHeight; Fl_Button* diagramButton = new Fl_Button(x + 20, yOffset + spacingHeight, opButtonWidth, 30, "Diagram @>|"); diagramButton->callback(DiagramCallback); diagramButton->labelcolor(GUI_BTEXT_COLOR); Fl_Button* statsButton = new Fl_Button(x + 20 + opButtonWidth + spacingHeight, yOffset + spacingHeight, opButtonWidth, 30, "Statistics @>|"); statsButton->callback(StatsCallback); statsButton->labelcolor(GUI_BTEXT_COLOR); const char *fileInstText = "@filenew Files.\nClick on the file buttons to view\nCT file contents in new window."; fileLabel = new Fl_Box(x + NAVBUTTONS_SPACING, y + yOffset + spacingHeight, fileOpsLabelWidth, fileOpsLabelHeight, fileInstText); fileLabel->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_LEFT); fileLabel->color(GUI_BGCOLOR); fileLabel->labelcolor(GUI_BTEXT_COLOR); fileLabel->labelfont(LOCAL_BFFONT); fileLabel->labelsize(LOCAL_TEXT_SIZE); fileLabel->box(FL_RSHADOW_BOX); folderScroll = new Fl_Scroll(x+10, y + yOffset + fileOpsLabelHeight + dividerTextHeight + 3 * spacingHeight, 280, 310 - 2 * fileOpsLabelHeight - dividerTextHeight - 2 * spacingHeight - NAVBUTTONS_BHEIGHT); folderScroll->type(Fl_Scroll::VERTICAL_ALWAYS); folderPack = new Fl_Pack(x+10, y + yOffset + fileOpsLabelHeight + dividerTextHeight + 3 * spacingHeight, 260, 290 - 2 * fileOpsLabelHeight - dividerTextHeight - 2 * spacingHeight - NAVBUTTONS_BHEIGHT); folderPack->type(Fl_Pack::VERTICAL); folderScroll->color((Fl_Color) GUI_WINDOW_BGCOLOR); folderScroll->labelcolor((Fl_Color) GUI_BTEXT_COLOR); this->resizable(folderScroll); this->color(GUI_WINDOW_BGCOLOR); SetStructures(folderIndex); }
void tabbar::draw() { const u32 startx = x(); const u32 endx = x() + w() - 1; const u32 gradarea = h() - 2; u32 i, j; // bg u32 r1 = 63, g1 = 72, b1 = 81; u32 r2 = 38, g2 = 48, b2 = 59; for (i = 0; i <= gradarea; i++) { const float pos = i / (float) gradarea; fl_color(mix(r1, r2, pos), mix(g1, g2, pos), mix(b1, b2, pos)); const u32 posy = y() + 1 + i; fl_line(startx, posy, endx, posy); } // Borders fl_color(37, 46, 52); fl_line(startx, y(), endx, y()); fl_line(startx, y() + h() - 1, endx, y() + h() - 1); // Tabs u32 max; u32 tabw = calctabw(&max, w()); bool highborder = false; if ((mousex - x()) % tabw > tabw / 2) highborder = true; u32 posx = x(); const u32 lowy = y(); const u32 highy = y() + h() - 1; for (i = 0; i < max; i++) { bool hover = false; // Borders fl_color(FL_BLACK); if (!i) fl_line(posx, lowy, posx, highy); fl_line(posx + tabw, lowy, posx + tabw, highy); // Bg r1 = 83, g1 = 92, b1 = 101; r2 = 58, g2 = 68, b2 = 79; if (i == g->curtab) { r1 = 100, g1 = 160, b1 = 191; r2 = 42, g2 = 100, b2 = 125; } else if ((mousein && mousex >= posx && mousex <= (posx + tabw - 1)) || (!firstpress && longorder.size() && longorder[longpress] == i)) { r1 = 150, g1 = 150, b1 = 191; r2 = 100, g2 = 100, b2 = 155; hover = true; } if (dragging && mousein && mousex >= posx && mousex <= (posx + tabw - 1)) { fl_color(FL_WHITE); if (!highborder) fl_line(posx, lowy, posx, highy); else fl_line(posx + tabw, lowy, posx + tabw, highy); } for (j = 0; j <= gradarea; j++) { const float pos = j / (float) gradarea; fl_color(mix(r1, r2, pos), mix(g1, g2, pos), mix(b1, b2, pos)); const u32 posy = y() + 1 + j; fl_line(posx + 1, posy, posx + tabw - 1, posy); } // Icon Fl_Image *img = g->tabs[i].icon; if (!img) img = Fl_Shared_Image::get("newtab.png"); const u32 imgy = y() + (h() - 16) / 2; img->draw(posx + 4, imgy, 16, 16); // Text fl_color(200, 200, 200); if (i == g->curtab) fl_color(FL_WHITE); else if (hover) fl_color(230, 230, 230); fl_font(labelfont(), labelsize()); char tmp[80]; memset(tmp, 0, 80); strncpy(tmp, g->tabs[i].title(), 79); int textw = 0, texth = 0; fl_measure(tmp, textw, texth, 0); const u32 textarea = tabw - 2 - 8 - 16 - 4; while ((u32) textw >= textarea) { // Shorten it until it fits const u32 len = strlen(tmp) - 1; tmp[len] = '\0'; tmp[len - 1] = '.'; tmp[len - 2] = '.'; tmp[len - 3] = '.'; textw = texth = 0; fl_measure(tmp, textw, texth, 0); } const u32 texty = y() - fl_descent() + fl_height() + (h() - fl_height())/2; fl_draw(tmp, posx + 2 + 8 + 16, texty); posx += tabw; } }
void DesktopIcon::draw(void) { // draw_box(FL_UP_BOX, FL_BLACK); if(image() && (damage() & FL_DAMAGE_ALL)) { Fl_Image* im = image(); /* center image in the box */ int ix = (w()/2) - (im->w()/2); int iy = (h()/2) - (im->h()/2); ix += x(); iy += y(); /* darker_img is always present if image() is present */ if(is_focused()) darker_img->draw(ix, iy); else im->draw(ix, iy); E_DEBUG(E_STRLOC ": DesktopIcon icon redraw\n"); } if(gsettings->label_draw && (damage() & (FL_DAMAGE_ALL | EDAMAGE_CHILD_LABEL))) { int X = x() + w()-(w()/2)-(lwidth/2); int Y = y() + h() + LABEL_OFFSET; Fl_Color old = fl_color(); if(!gsettings->label_transparent) { fl_color(gsettings->label_background); fl_rectf(X, Y, lwidth, lheight); } int old_font = fl_font(); int old_font_sz = fl_size(); /* draw with icon's font */ fl_font(labelfont(), labelsize()); /* pseudo-shadow */ fl_color(FL_BLACK); fl_draw(label(), X+1, Y+1, lwidth, lheight, align(), 0, 0); fl_color(gsettings->label_foreground); fl_draw(label(), X, Y, lwidth, lheight, align(), 0, 0); /* restore old font */ fl_font(old_font, old_font_sz); if(is_focused()) { /* draw focused box on our way so later this can be used to draw customised boxes */ fl_color(gsettings->label_foreground); fl_line_style(FL_DOT); fl_push_matrix(); fl_begin_loop(); fl_vertex(X, Y); fl_vertex(X + lwidth, Y); fl_vertex(X + lwidth, Y + lheight); fl_vertex(X, Y + lheight); fl_vertex(X, Y); fl_end_loop(); fl_pop_matrix(); /* revert to default line style */ fl_line_style(0); } /* revert to old color whatever that be */ fl_color(old); E_DEBUG(E_STRLOC ": DesktopIcon label redraw\n"); } }
void draw() { draw_box(FL_BORDER_BOX, 0, 0, w(), h(), Fl_Color(175)); fl_color(FL_BLACK); fl_font(labelfont(), labelsize()); fl_draw(tip, 3, 3, w()-6, h()-6, Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_WRAP)); }
/* Fl_Group( X, Y, W, H, L) */ Chain::Chain ( ) : Fl_Group( 0, 0, 100, 100, "") { /* not really deleting here, but reusing this variable */ _deleting = true; int X = 0; int Y = 0; int W = 100; int H = 100; /* _outs = 1; */ /* _ins = 1; */ _configure_outputs_callback = NULL; _strip = NULL; _name = NULL; labelsize( 10 ); align( FL_ALIGN_TOP ); { Fl_Flip_Button* o = tab_button = new Fl_Flip_Button( X, Y, W, 16, "chain/controls"); o->type(1); o->labelsize( 12 ); o->callback( cb_handle, this ); } Y += 18; H -= 18; { Fl_Group *o = chain_tab = new Fl_Group( X, Y, W, H, "" ); o->labeltype( FL_NO_LABEL ); o->box( FL_FLAT_BOX ); // o->color( fl_darker( FL_BACKGROUND_COLOR ) ); // o->color( FL_BACKGROUND_COLOR ); // o->box( FL_NO_BOX ); { Fl_Packscroller *o = new Fl_Packscroller( X, Y, W, H ); o->color( FL_BACKGROUND_COLOR ); // o->box( FL_FLAT_BOX ); o->box( FL_THIN_UP_BOX ); o->type( Fl_Scroll::VERTICAL ); { Fl_Pack *o = modules_pack = new Fl_Pack( X, Y, W, H ); o->type( Fl_Pack::VERTICAL ); o->spacing( 6 ); o->end(); Fl_Group::current()->resizable( o ); } o->end(); } o->end(); } { Fl_Group *o = control_tab = new Fl_Group( X, Y, W, H, "" ); o->box( FL_FLAT_BOX ); o->color( FL_BACKGROUND_COLOR ); o->labeltype( FL_NO_LABEL ); o->hide(); { Fl_Scroll *o = new Fl_Scroll( X, Y, W, H ); o->color( FL_BACKGROUND_COLOR ); o->box( FL_NO_BOX ); o->type( Fl_Scroll::VERTICAL ); { Fl_Pack *o = controls_pack = new Fl_Pack( X, Y, W, H ); o->type( Fl_Pack::VERTICAL ); o->spacing( 5 ); // o->color( FL_RED ); o->end(); Fl_Group::current()->resizable( o ); } o->end(); Fl_Group::current()->resizable( o ); } o->end(); o->hide(); Fl_Group::current()->resizable( o ); } end(); log_create(); _deleting = false; }
void Module::draw_label ( int tx, int ty, int tw, int th ) { bbox( tx, ty, tw, th ); if ( ! label() ) return; char *lab = strdup( label() ); Fl_Color c = fl_contrast( FL_FOREGROUND_COLOR, color() ); fl_color( active_r() && ! bypass() ? c : fl_inactive(c) ); fl_font( FL_HELVETICA, labelsize() ); char *di = strstr( lab, " -" ); if ( ! di ) di = strstr( lab, " " ); if ( di ) *di = '\0'; int LW = fl_width( lab ); char *s = NULL; bool initial = true; if ( LW > tw ) { s = new char[strlen(lab) + 1]; char *sp = s; const char *lp = lab; for ( ; *lp; ++lp ) { bool skip = false; switch ( *lp ) { case ' ': initial = true; skip = false; break; case 'i': case 'e': case 'o': case 'u': case 'a': skip = ! initial; initial = false; break; default: skip = false; initial = false; break; } if ( ! skip ) *(sp++) = *lp; } *sp = '\0'; } fl_draw( s ? s : lab, tx, ty, tw, th, align() | FL_ALIGN_CLIP ); if ( bypass() ) { fl_color( fl_color_add_alpha( fl_color(), 127 ) ); fl_line_style( FL_SOLID, 2 ); fl_line( tx, ty + th * 0.5, tx + tw, ty + th * 0.5 ); fl_line_style( FL_SOLID, 0 ); } free(lab); if ( s ) delete[] s; }