Exemplo n.º 1
0
void updatestate()
{
        char star[6];
        sprintf(star,"    ");
        if(phase == 0)                sprintf(star,"*   ");
        if(phase == 1)                sprintf(star,"**  ");
        if(phase == 2)                sprintf(star,"*** ");        
        if(phase == 3)                sprintf(star,"****");        
        if(IS_BORE_MODE){                 
                sprintf(strbuf,"(%s:ch%2i,%d,%s)",rname2b(sysdata.rid[ch_to_search]),ch_to_search+1, dlg_cnt/ONESEC,star);        
        }else{
                sprintf(strbuf,"(%s:ch%2i,%d,%s)",tname2b(sysdata.tid[ch_to_search]),ch_to_search+1, dlg_cnt/ONESEC,star);                
        }
                
/*                
        if(IS_BORE_MODE){         
                if(IS_MODE_KTT)                                                   
                        sprintf(strbuf,"(ch%2i,%2d,%s)",ch_to_search+1,dlg_cnt/ONESEC,star);
                else
                        sprintf(strbuf,"(ch%2i,%2d,%s)",ch_to_search+1,dlg_cnt/ONESEC,star);                        
        }else{                                                                      
                sprintf(strbuf,"(ch:%2i,%2d,%s)",ch_to_search+1,dlg_cnt/ONESEC,star);
        }      
*/        
        draw_label(&statelbl,SW_NORMAL);
}
Exemplo n.º 2
0
void Flu_Wrap_Group :: draw()
{
  // we first try to fit all children assuming no scrollbar. if they do not all fit,
  // we have to turn the scrollbar on and try again
  if( layout( false, false ) )
    {
      scrollbar.show();
      layout( true, false );
    }
  else
    scrollbar.hide();

  // hack to look right when resizing smaller
  if( scrollbar.value() > scrollbar.maximum() )
    {
      ((Fl_Valuator*)&scrollbar)->value( scrollbar.maximum() );
      layout( scrollbar.visible(), scrollTo!=NULL );
    }
  else if( scrollTo )
    layout( scrollbar.visible(), true );

  scrollTo = NULL;

  if( damage() & ~FL_DAMAGE_CHILD)
    {
      draw_box();
      draw_label();
    }
  fl_push_clip( x()+Fl::box_dx(box()), y()+Fl::box_dy(box()),
		w()-Fl::box_dw(box()), h()-Fl::box_dh(box()) );
  draw_children();
  fl_pop_clip();
}
Exemplo n.º 3
0
void
Fl_Arc_Dial::draw ( void )
{
    int X = x();
    int Y = y();
    int W = w();
    int H = h();

    draw_box();
    draw_label();

    X += Fl::box_dx(box());
    Y += Fl::box_dy(box());
    W -= Fl::box_dw(box());
    H -= Fl::box_dh(box());

    double angle = ( angle2() - angle1() ) * ( value() - minimum()) / ( maximum() - minimum() ) + angle1();

    fl_line_style( FL_SOLID, W / 6 );

    X += W / 8;
    Y += H / 8;
    W -= W / 4;
    H -= H / 4;

    if ( box() == FL_NO_BOX )
    {
        /* draw backgrond arc */
        fl_color( fl_color_average( FL_BLACK, selection_color(), 0.80f ) );
        fl_arc( X, Y, W, H, 270 - angle1(), 270 - angle2() );
    }

    fl_color( selection_color() );
//    fl_color( fl_color_average( FL_RED, selection_color(), ( value() - minimum() ) / ( maximum() - minimum() ) ) );


    if ( type() == FL_FILL_DIAL )
        fl_arc( X, Y, W, H, 270 - angle1(), 270 - angle  );
    else
    {
        const int d = 6;

        /* account for edge conditions */
        angle = angle < angle1() + d ? angle1() + d : angle;
        angle = angle > angle2() - d ? angle2() - d : angle;

        fl_arc( X, Y, W, H, 270 - (angle - d), 270 - (angle + d) );
    }

    fl_line_style( FL_SOLID, 0 );

    fl_color( labelcolor() );

    char s[10];

    fl_font( FL_HELVETICA, 8 );

    snprintf( s, sizeof( s ), "%.1f", value() );
    fl_draw( s, X, Y, W, H, FL_ALIGN_BOTTOM );
}
Exemplo n.º 4
0
Arquivo: ntk-perf.C Projeto: 0mk/non
   void draw ( void )
        {          
            if ( use_cairo )
                fl_push_use_cairo(true);

            fl_rectf( x(), y(), w(), h(), FL_BLACK );

            unsigned long long then = get_ts();

            fl_push_clip( x(), y(), w(), h() );

            int count = 400;

            /* draw stuff */
            int i = 0;
            for ( ; i < count; ++i )
                fl_draw_box( boxtype, x(), y(), w(), h(), fl_lighter( FL_BLACK ) );

            fl_pop_clip();

            unsigned long long now = get_ts();

            double elapsedms = (now - then) / 1000.0;

            static char text[256];
            sprintf( text, "Drew %i boxes in in %fms", i, elapsedms );

            fl_color( FL_RED );
            fl_draw( text, x(), y(), w(), h(), FL_ALIGN_CENTER | FL_ALIGN_INSIDE );

            draw_label();

            if ( use_cairo )
                fl_pop_use_cairo();
        }
Exemplo n.º 5
0
void
Control_Point::draw_box ( void )
{
    if ( selected() )
        fl_color( selection_color() );
    else
        fl_color( box_color() );

    fl_pie( x() - w() / 2, y() - h() / 2, w(), h(), 0, 360 );

    if ( this == Sequence_Widget::belowmouse() ||
         this == Sequence_Widget::pushed() )
    {
        char val[10];
        snprintf( val, sizeof( val ), "%+.2f", 1.0 - _y * 2 );

        Fl_Align a = 0;

        if ( x() < _sequence->x() + ( _sequence->w() / 2 ) )
            a |= FL_ALIGN_RIGHT;
        else
            a |= FL_ALIGN_LEFT;

        if ( y() < _sequence->y() + ( _sequence->h() / 2 ) )
            a |= FL_ALIGN_BOTTOM;
        else
            a |= FL_ALIGN_TOP;
            
        draw_label( val, a, FL_FOREGROUND_COLOR );
    }
}
Exemplo n.º 6
0
// Draws only inside labels, but allows the caller to specify the box.
// Also allows the caller to turn on some extra flags.
void Fl_Widget::draw_inside_label(int X, int Y, int W, int H, Fl_Flags f) const
{
	if (!(flags()&15) || (flags() & FL_ALIGN_INSIDE))
	{
		if (W > 11 && (flags()&(FL_ALIGN_LEFT|FL_ALIGN_RIGHT)) && !(flags()&(FL_ALIGN_TILED|FL_ALIGN_SCALE)) ) {X += 3; W -= 6;}
		draw_label(X, Y, W, H, f|flags()&FL_ALIGN_MASK);
	}
}
Exemplo n.º 7
0
//display a message box
void wnd_msgbox(LABEL *lbl)
{
	LCD_ClsBlock(lbl->x - 10,lbl->y - 3,lbl->x + lbl->width * 16 -14 , lbl->y+19);
	draw_label(lbl, SW_NORMAL);	
	LCD_Rectange(lbl->x - 10,lbl->y - 3,lbl->x + lbl->width * 16 -14, lbl->y+19);
	LCD_Rectange(lbl->x - 8,lbl->y - 1,lbl->x + lbl->width * 16 - 16 , lbl->y+17);

}
Exemplo n.º 8
0
void anchor_watch_window_load(Window *window) {
      Layer *window_layer = window_get_root_layer(window);
	  TextLayer *t;

	  drift_label_layer = text_layer_create(GRect(0, 0, 144, 68));
      draw_label(drift_label_layer, "Distance Drifted");
      layer_add_child(window_layer, text_layer_get_layer(drift_label_layer));
	
	  t = create_field_layer(15);
      text_layer_set_font(t, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD));
      layer_add_child(window_layer, text_layer_get_layer(t));
	  anchorWatchFieldLayers[0] = t;
	
	  instruction_label_layer = text_layer_create(GRect(0, 75, 144, 68));
      draw_label(instruction_label_layer, "Click Centre Button To Set Position");
      layer_add_child(window_layer, text_layer_get_layer(instruction_label_layer));
}
Exemplo n.º 9
0
 void Window::draw_title()
 {
   size_t totalpad = (_cols - _title.length() ) / 2;
   std::string pad{"                                                                                          ",
                       totalpad};
   std::string fulltitle = pad + _title + pad ;
   draw_label(_wptr, 0,0, fulltitle);
 }
Exemplo n.º 10
0
// The normal call for a draw() method. Draws the label inside the
// widget's box, if the align is set to draw an inside label.
void Fl_Widget::draw_inside_label() const
{
	if (!(flags()&15) || (flags() & FL_ALIGN_INSIDE))
	{
		int X=0; int Y=0; int W=w_; int H=h_; box()->inset(X,Y,W,H);
		if (W > 11 && (flags()&(FL_ALIGN_LEFT|FL_ALIGN_RIGHT)) && !(flags()&(FL_ALIGN_TILED|FL_ALIGN_SCALE)) ) {X += 3; W -= 6;}
		draw_label(X, Y, W, H, flags());
	}
}
Exemplo n.º 11
0
    void draw() {
        if(!(damage()&FL_DAMAGE_ALL)) return;

        int X=0,Y=0,W=w(),H=h();
        box()->inset(X,Y,W,H);

        if(image()) {
            draw_frame();
            fl_push_clip(X,Y,W,H);

            Fl_Image *im = image();

            W=im->width();
            H=im->height();
            int pbw = w() - 10;
            int pbh = h() - 10;
            if(W > pbw || H > pbh) {
                W = pbw;
                H = W * im->height() / im->width();
                if(H > pbh) {
                    H = pbh;
                    W = H * im->width() / im->height();
                }
            }
            X=(w()/2)-W/2;
            Y=(h()/2)-H/2;
            if(X<5) X=5;
            if(Y<5) Y=5;

            im->mask_type(MASK_NONE);
            im->draw(X,Y,W,H,FL_ALIGN_SCALE);

            fl_clip_out(X,Y,W,H);

            X=0,Y=0,W=w(),H=h();
            box()->inset(X,Y,W,H);

            fl_color(color());
            fl_rectf(X,Y,W,H);

            fl_pop_clip();

        } else {

            draw_box();

            if(w()<=120) label_size(8);
            if(w()>120) label_size(10);
            if(w()>180) label_size(12);
            if(w()>250) label_size(14);

            if(label()[0]=='?'&&label()[1]=='\0') label_size(100);

            draw_label(X, Y, W, H, align());
        }
    }
Exemplo n.º 12
0
void Ca_Canvas::draw(){

  uchar damage_= damage();
  // int _b=border_/2;
  // int _x=x()+_b;
  // int _y=y()+_b;
  // int _w=w()-2*_b;
  // int _h=h()-2*_b;
  int replot=0;

  Ca_Axis_ *axis = last_axis_;

  /// something similar will go in the future into the lauout layer...
  while (axis){
    replot |= axis->update();
    axis=axis->previous_axis_;
  }
  ///
  if(damage_!=CA_DAMAGE_ADD)
    draw_box();

  if((damage_!=CA_DAMAGE_ADD)||replot){
    last_plotted_=0;
    axis=last_axis_;
    while(axis){
      if(!(axis->grid_visible()&CA_FRONT)&&(axis->visible()||(axis->grid_visible()&CA_ALWAYS_VISIBLE)))
        axis->draw_grid();
      axis=axis->previous_axis_;
    }
  }

  fl_clip(x()+Fl::box_dx(box())+dx_, y()+Fl::box_dy(box())+border_+dy_, w()-Fl::box_dw(box()) - dw_, h()-Fl::box_dh(box()) - dh_);
  if (last_plotted_)
    last_plotted_=last_plotted_->next;
  else
    last_plotted_=first_object_;
  while(last_plotted_){
    last_plotted_->object->draw();
    last_plotted_=last_plotted_->next;
  }
  last_plotted_=last_object_;
  fl_pop_clip();

  axis=last_axis_;
  while(axis){
    if((axis->grid_visible()&CA_FRONT)&&(axis->visible()||(axis->grid_visible()&CA_ALWAYS_VISIBLE)))
      axis->draw_grid();
    axis=axis->previous_axis_;
  }


  if (damage_&FL_DAMAGE_ALL)
    draw_label();
};
Exemplo n.º 13
0
void Fl_ToggleTree::draw_node(int depth, int cy, Fl_Node* node) {
  Fl_ToggleNode* tnode = (Fl_ToggleNode*)node;

  if (damage() == FL_DAMAGE_CHILD && !tnode->changed_ && damaged_ == 0) {
    return;
  }

  tnode->changed_ = 0;
  if (tnode->selected_) {
    fl_color(selection_color());
    fl_rectf(x(), cy + 1, w(), height_(tnode) - 1);
  } else {
    fl_color((cy - y()) & 1 ? color() : alternate_color());
    fl_rectf(x(), cy + 1, w(), height_(tnode) - 1);
  }
  fl_color(trim_color());
  fl_line(x(), cy, x() + w(), cy);
  fl_color(FL_BLACK);

  if (draw_lines_)
    {
      int i;
      Fl_ToggleNode * n;
      fl_xyline(x()+depth*16+8, cy+8, x()+(depth+1)*16, cy+8); 
      if (tnode->next_) 
    fl_xyline(x()+depth*16+8, cy, x()+depth*16+8, cy+16); 
      else 
    fl_xyline(x()+depth*16+8, cy, x()+depth*16+8, cy+8); 
      for (i=depth-1, n = (Fl_ToggleNode*)tnode->up_; n; i--, 
         n = (Fl_ToggleNode*)n->up_) 
    if (n->next_) 
      fl_xyline(x()+i*16+8, cy, x()+i*16+8, cy+16); 
    }

  if (tnode->can_open_) {
    if (tnode->opened_)
      opened_pixmap_->draw(x() + depth*16, cy);
    else
      closed_pixmap_->draw(x() + depth*16, cy);
  }

  if (tnode->selected_)
    textcolor(selection_label_color());
  else
    textcolor(labelcolor());

  if (tnode->label_) {
    int D = depth * 16 + label_offset_;
    draw_label(tnode->label_, D, x(), cy, w(), 16);
  }
  if (tnode->pixmap_) {
    tnode->pixmap_->draw(x() + depth*16 + pixmap_offset_, cy + 1);
  }
}
Exemplo n.º 14
0
void draw_detections( image im,
                      int num,
                      float thresh,
                      box *boxes,
                      float **probs,
                      image *probs_labels,
                      char **names,
                      image *labels,
                      int classes
                    )
{
    int i;

    for(i = 0; i < num; ++i)
    {
        int i_class = max_index(probs[i], classes);
        float f_prob  = probs[i][i_class];
        if(f_prob > thresh)
        {
            printf("%d  - %s: %.2f\n", i_class, names[i_class], f_prob);
            int thickness = pow(f_prob, 1./2.)*10+1;

            // compute the color code of the box's category
            int offset  = i_class*17 % classes;
            //
            float red   = get_color(0,offset,classes);
            float green = get_color(1,offset,classes);
            float blue  = get_color(2,offset,classes);
            //
            float rgb[3];
            rgb[0] = red;
            rgb[1] = green;
            rgb[2] = blue;
            //
            box b  = boxes[i];

            int left  = (b.x-b.w/2.)*im.w;
            int right = (b.x+b.w/2.)*im.w;
            int top   = (b.y-b.h/2.)*im.h;
            int bot   = (b.y+b.h/2.)*im.h;

            if(left < 0) left = 0;
            if(right > im.w-1) right = im.w-1;
            if(top < 0) top = 0;
            if(bot > im.h-1) bot = im.h-1;

            draw_box_width(im, left, top, right, bot, thickness, red, green, blue);
            if (labels)
                draw_label(im, top + thickness, left, labels[i_class], probs_labels[(int)(100*f_prob)], rgb);
        }
    }
}
Exemplo n.º 15
0
int main (int argc, char *argv[]) {
	
	Image *image;
	image = image_new (300, 246);
	image_fill (image, 0);

	draw_label (image,   50,   50,   70,   70,  60); // Draw Label 1
	draw_label (image,   30,  100,   60,  130,  80); // Draw Label 2
	draw_label (image,  150,  120,  180,  150, 100); // Draw Label 3
	draw_label (image,  150,   10,  180,   30, 120); // Draw Label 4
	draw_label (image,  110,   80,  130,  110, 140); // Draw Label 5
	draw_label (image,   70,  150,  100,  170, 160); // Draw Label 6
	draw_label (image,  100,  220,  130,  240, 180); // Draw Label 7
	draw_label (image,  200,   50,  240,   90, 200); // Draw Label 8
	draw_label (image,  270,  100,  300,  130, 220); // Draw Label 9
	draw_label (image,  240,  170,  270,  200, 240); // Draw Label 10

	image_save (image, "label.pgm");
	image_free (image);

	return 0;
}
Exemplo n.º 16
0
// This method renders the GL texture used to visualize the sensor
// model's probability values.
void CalibrateLET::render_me()
{
    const SensorModel* looming  = &TTIEstimator::looming_sensor_model()  ;
    const SensorModel* blanking = &TTIEstimator::blanking_sensor_model() ;

    viz_lock() ;
    if (g_update_flag) {
        if (g_sensor_model == looming)
            looming_texture.update() ;
        else if (g_sensor_model == blanking)
            blanking_texture.update() ;
        g_update_flag = false ;
    }
    viz_unlock() ;

    setup_view_volume(0, looming_texture.width(),
                      -(blanking_texture.height() + 1),
                      looming_texture.height() + 1) ;
    looming_texture.render(0, looming_texture.width()  - 1,
                           1, looming_texture.height() - 1) ;
    blanking_texture.render(0, blanking_texture.width() - 1,
                            -blanking_texture.height() + 1, -1) ;

    glColor3f(1, 1, 0) ;
    glBegin(GL_LINES) ;
    glVertex2i(0, 0) ;
    glVertex2i(looming_texture.width(), 0) ;
    glEnd() ;

    glMatrixMode(GL_PROJECTION) ;
    glPopMatrix() ;
    glMatrixMode(GL_MODELVIEW) ;
    glPopMatrix() ;

    text_view_volume() ;
    if (g_sensor_model == looming)
        glColor3f(1, 0, 0) ;
    else
        glColor3f(0.5f, 0.5f, 0.5f) ;
    draw_label(3, 14, looming->name().c_str()) ;
    draw_label(3, 26, sigma_label(looming->sigma()).c_str()) ;
    draw_label(3, 38, prob_label(looming_texture.prob_range()).c_str()) ;

    const int y = m_geometry.height - 26 ;
    if (g_sensor_model == blanking)
        glColor3f(1, 0, 0) ;
    else
        glColor3f(0.5f, 0.5f, 0.5f) ;
    draw_label(3, y, blanking->name().c_str()) ;
    draw_label(3, y + 10, sigma_label(blanking->sigma()).c_str()) ;
    draw_label(3, y + 20, prob_label(blanking_texture.prob_range()).c_str());
    restore_view_volume() ;
}
Exemplo n.º 17
0
    static void drawArcs(SkCanvas* canvas)
    {
        SkPaint paint;
        SkRect  r;
        SkScalar w = SkIntToScalar(75);
        SkScalar h = SkIntToScalar(50);

        r.set(0, 0, w, h);
        paint.setAntiAlias(true);
        paint.setStyle(SkPaint::kStroke_Style);
        
        canvas->save();
        canvas->translate(SkIntToScalar(10), SkIntToScalar(300));
        
        paint.setStrokeWidth(SkIntToScalar(1));
        
        static const int gAngles[] = {
            0, 360,
            0, 45,
            0, -45,
            720, 135,
            -90, 269,
            -90, 270,
            -90, 271,
            -180, -270,
            225, 90
        };
        
        for (int i = 0; i < SK_ARRAY_COUNT(gAngles); i += 2)
        {
            paint.setColor(SK_ColorBLACK);
            drawRectWithLines(canvas, r, paint);

            paint.setColor(SK_ColorRED);
            canvas->drawArc(r, SkIntToScalar(gAngles[i]),
                            SkIntToScalar(gAngles[i+1]), false, paint);
            
            draw_label(canvas, r, gAngles[i], gAngles[i+1]);

            canvas->translate(w * 8 / 7, 0);
        }
        
        canvas->restore();
    }
Exemplo n.º 18
0
Arquivo: view.c Projeto: codyd51/axle
void draw_view(View* view) {
	if (!view) return;

	//inform subviews that we're being redrawn
	//dirtied = 1;

	//fill view with its background color
	draw_rect(view->layer, rect_make(point_zero(), view->frame.size), view->background_color, THICKNESS_FILLED);

	//draw any bmps this view has
	for (int i = 0; i < view->bmps->size; i++) {
		Bmp* bmp = (Bmp*)array_m_lookup(view->bmps, i);
		if (bmp) {
			draw_bmp(view->layer, bmp);
		}
	}
	
	//draw any labels this view has
	for (int i = 0; i < view->labels->size; i++) {
		Label* label = (Label*)array_m_lookup(view->labels, i);
		draw_label(view->layer, label);
	}

	//draw buttons
	for (int i = 0; i < view->buttons->size; i++) {
		Button* button = (Button*)array_m_lookup(view->buttons, i);
		if (button) {
			draw_button(view->layer, button);
		}
	}

	//draw each subview of this view
	for (int i = 0; i < view->subviews->size; i++) {
		View* subview = (View*)array_m_lookup(view->subviews, i);
		draw_view(subview);
		blit_layer(view->layer, subview->layer, rect_make(subview->frame.origin, subview->layer->size), rect_make(point_zero(), subview->layer->size));
	}
	
	view->needs_redraw = 0;
}
Exemplo n.º 19
0
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();
}
Exemplo n.º 20
0
    void onDraw(SkCanvas* canvas) override {
        SkHighContrastConfig configs[] = {
            { false, InvertStyle::kNoInvert, 0.0f },
            { false, InvertStyle::kInvertBrightness, 0.0f },
            { false, InvertStyle::kInvertLightness, 0.0f },
            { false, InvertStyle::kInvertLightness, 0.2f },
            { true, InvertStyle::kNoInvert, 0.0f },
            { true, InvertStyle::kInvertBrightness, 0.0f },
            { true, InvertStyle::kInvertLightness, 0.0f },
            { true, InvertStyle::kInvertLightness, 0.2f },
        };

        for (size_t i = 0; i < SK_ARRAY_COUNT(configs); ++i) {
            SkScalar x = kSize * (i % 4);
            SkScalar y = kSize * (i / 4);
            canvas->save();
            canvas->translate(x, y);
            canvas->scale(kSize, kSize);
            draw_scene(canvas, configs[i]);
            draw_label(canvas, configs[i]);
            canvas->restore();
        }
    }
Exemplo n.º 21
0
void Fl_Sparkline::draw(void)
{
    int i;
    int index;

    width = w() - padding * 2;
    height = h() - padding * 2;

    if (num_values == 0) {
        draw_box();
        return;
    }

    if (damage() == FL_DAMAGE_USER1) {
        index = num_values * (Fl::event_x() - x() - padding) / width;
        index = snap(index);
        tip->position(Fl::event_x_root() + 10, Fl::event_y_root() + 10);
        tip->value(values[index]);
        tip->show();

        drawCursor();
        return;
    }

    draw_box();

    fl_color(FL_BLACK);

    drawPeaks();
    fl_color(FL_BLACK);

    for (i = 0; i < width; i++) {
        drawPoint(i);
    }

    draw_label();
}
Exemplo n.º 22
0
void
Panner::draw ( void )
{
    draw_box();
//    draw_box( FL_FLAT_BOX, x(), y(), w(), h(), FL_BLACK );
    draw_label();


    if ( _bypassed )
    {
        fl_color( 0 );
        fl_font( FL_HELVETICA, 12 );
        fl_draw( "(bypass)", x(), y(), w(), h(), FL_ALIGN_CENTER );
        return;
    }

    int tw, th, tx, ty;

    bbox( tx, ty, tw, th );

    fl_push_clip( tx, ty, tw, th );

    fl_color( FL_RED );

    const int b = 10;

    tx += b;
    ty += b;
    tw -= b * 2;
    th -= b * 2;

    /* draw perimeter */
    {
        Fl_Color c1, c2;
        int iter;

        if ( Fl::belowmouse() == this )
        {
            iter = 12;
            c1 = fl_darker( FL_RED );
            c2 = FL_GRAY;
        }
        else
        {
            iter = 6;
            c1 = FL_GRAY;
            c2 = FL_BLACK;
        }

        Fl_Color c = c1;

        for ( int i = iter; i--; )
        {
            fl_color( c );

            fl_arc( tx + (i * (tw / iter)) / 2, ty + (i * (th / iter)) / 2, tw - (i * (tw / iter)), th - (i * ( th / iter )), 0, 360 );

            c = fl_color_average( c1, c2, (float)i / iter);
        }
    }

/*     fl_color( FL_WHITE ); */

/*     fl_arc( tx, ty, tw, th, 0, 360 ); */

    if ( _configs[ _outs ][0] >= 0 )
    {
        for ( int i = _outs; i--; )
        {
            int a = _configs[ _outs ][ i ];

            Point p( 1.2f, (float)a );

            float px, py;

            p.axes( &px, &py );

            fl_push_matrix();

            const int bx = tx + ((tw / 2) * px + (tw / 2));
            const int by = ty + ((th / 2) * py + (th / 2));

            fl_translate( bx, by );

            fl_scale( 5, 5 );

            a = 90 - a;

            fl_rotate( a );

            draw_speaker( FL_WHITE );

            fl_rotate( -a );

            fl_pop_matrix();

        }
    }

    /* ensure that points are drawn *inside* the circle */

    for ( int i = _ins; i--; )
    {
        Point *p = &_points[ i ];

        Fl_Color c = (Fl_Color)(10 + i);

        int px, py, pw, ph;
        point_bbox( p, &px, &py, &pw, &ph );

        /* draw point */
        if ( p != drag )
            fl_color( c );
        else
            fl_color( FL_WHITE );

        fl_pie( px, py, pw, ph, 0, 360 );

        /* draw echo */
        fl_color( c = fl_darker( c ) );
        fl_arc( px - 5, py - 5, pw + 10, ph + 10, 0, 360 );
        if ( Fl::belowmouse() == this )
        {
            fl_color( c = fl_darker( c ) );
            fl_arc( px - 10, py - 10, pw + 20, ph + 20, 0, 360 );
            fl_color( c = fl_darker( c ) );
            fl_arc( px - 30, py - 30, pw + 60, ph + 60, 0, 360 );
        }

        /* draw number */
        char pat[4];
        snprintf( pat, 4, "%d", i + 1 );

        fl_color( FL_BLACK );
        fl_font( FL_HELVETICA, ph + 2 );
        fl_draw( pat, px + 1, py + 1, pw - 1, ph - 1, FL_ALIGN_CENTER );

        /* draw line */

/*         fl_color( FL_WHITE ); */
/*         fl_line( bx + pw() / 2, by + ph() / 2, tx + (tw / 2), ty + (th / 2) ); */

    }

    fl_pop_clip();
}
Exemplo n.º 23
0
void Ca_X_Axis::draw(){
  if(min_==max_) return;
  int BD = 0;
  Fl_Widget * W_ = this;
  if(canvas_){
    BD = canvas_->border();
    W_ = canvas_;
  }else if(widget_){
    W_ = widget_;
  }
  int tick_index=-1;
  double tick_value;
  int tick_order;//, tick_number;
  double _interval=0;
  const char * label_format=label_format_;
  if(damage()|FL_DAMAGE_ALL)
    draw_label();
  if (damage()&(FL_DAMAGE_ALL|CA_DAMAGE_ALL)){
    update();
    if (box()==FL_NO_BOX){
      fl_color(parent()->color());
      fl_rectf(x(),y(),w(),h());
    }else
      draw_box();
    if(!valid_) return;
    fl_font(label_font_face_,label_font_size_);
    int l1=0;
    int l2=0;
    int m1=0;
    int m2=0;
    int l=0;
    int _y=0;
    int _w=0;
    int _h=0; //temporary coordinates for ticks
    double _pos,_x;

    //fl_clip(x()+Fl::box_dx(box()), y()+Fl::box_dy(box()), w()-Fl::box_dw(box()), h()-Fl::box_dh(box()));
    fl_color(axis_color_);
    int a=y()+Fl::box_dh(box())+border_;
    int b=a+h()-Fl::box_dh(box())-2*border_;

    switch(axis_align_ & CA_ALIGNMENT){
            case CA_BOTTOM:
              l=l1=m1=a;
              if(axis_align_&CA_NO_TICS)
                m2=m1;
              else
                if (tick_length_)
                  m2=m1+tick_length_;
                else
                  m2=m1+label_font_size_;
              l2=(m1+m2)/2;
              break;
            case CA_TOP:
              l=l2=m2=b-1;
              if(axis_align_&CA_NO_TICS)
                m1=m2;
              else
                if (tick_length_)
                  m1=m2-tick_length_;
                else
                  m1=m2-label_font_size_;
              l1=(m1+m2)/2;
              break;
            case CA_CENTER:
              m1=a;
              m2=b;
              l=(a+b)/2;
              l1=(a+l)/2;
              l2=(l+b)/2;
              break;
    }
    fl_line_style(FL_SOLID|FL_CAP_FLAT,tick_width_);
    double start_tick;
    double end_tick;
    bool tick_not_started = 1;

    while(next_tick(tick_index, tick_value, tick_order, _interval)){
      _pos=position(tick_value);
      if(scale_&CA_REV){
        if((_pos+1)<max_pos_-BD) break;
        if((_pos-1)>min_pos_+BD) continue;
      }else{
        if((_pos+1)<min_pos_-BD) continue;
        if((_pos-1)>max_pos_+BD) break;
      }
      if(!(axis_align_&CA_NO_TICS)){
        if(tick_index % major_step_){
          fl_begin_loop();
          fl_vertex(_pos,l1);
          fl_vertex(_pos,l2);
          fl_end_loop();
        }else{
          fl_begin_loop();
          fl_vertex(_pos,m1);
          fl_vertex(_pos,m2);
          fl_end_loop();
        }
        if(tick_not_started){
          tick_not_started = 0;
          start_tick = _pos;
        }
        end_tick = _pos;
      }

      if(!((tick_index % label_step_)|(axis_align_&CA_NO_LABELS))){
        char label[MAX_LABEL_LENGTH];
        char _label_format[MAX_LABEL_FORMAT];
        if(!label_format){
          int _tick_order;
          if (tick_order>=0)
            _tick_order=0;
          else
            _tick_order=-tick_order - 1;
          sprintf(_label_format,"%s.%if","%",_tick_order);
        }
        else
          strcpy(_label_format,label_format);
        sprintf(label, _label_format,tick_value);
        fl_measure(label,_w,_h);
        _x=_pos-_w/double(2);
        switch (axis_align_ & CA_ALIGNMENT){
                    case CA_TOP:
                      _y=m1-_h/3;
                      break;
                    case CA_BOTTOM:
                      _y=m2+_h;
                      break;
                    case CA_CENTER:
                      _y=l+_h/3;
                      Fl_Color _color=fl_color();
                      fl_color(color());
                      ca_rectf(_x-_h/6,l-_h/2,_w+_h/3,_h);
                      fl_color(_color);
                      break;
        }
        ca_text(label,_x,_y);
      }
    }
    if((axis_align_ & CA_LINE) && !tick_not_started){
      fl_begin_line();
      fl_vertex(start_tick,l);
      fl_vertex(end_tick,l);

      //fl_vertex(min_pos(),l);
      //fl_vertex(max_pos(),l);
      //fl_vertex(W_->x()+Fl::box_dx(W_->box()),l);
      //fl_vertex(W_->x()+W_->w()+Fl::box_dx(W_->box())-Fl::box_dw(W_->box()),l);

      fl_end_line();
    }
    fl_line_style(0,0);
      //fl_pop_clip();
  }
};
Exemplo n.º 24
0
// 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 );
}
Exemplo n.º 25
0
void wnd_inputbox(LABEL *lbl)
{
	LCD_ClsBlock(lbl->x - 10,lbl->y - 3,lbl->x + lbl->width * 16 , lbl->y+19);
	LCD_Rectange(lbl->x - 10,lbl->y - 3,lbl->x + lbl->width * 16 , lbl->y+19);
	draw_label(lbl, SW_NORMAL);	
}
Exemplo n.º 26
0
void wnd_sninput(char* oldbuf)
{
	uchar msg;
	key = MSG_INIT;
	while(1)
	{
		if(key != KEY_INVALID)
		{
			msg = key;
			key = KEY_INVALID;
		}else{
			continue;
		}
		if(msg == MSG_INIT) {
			LCD_Cls();
			databuf[0] = '\0';
			pos_databuf = 0;
			draw_label(&datalbl,SW_NORMAL);
			wnd_inputbox(&databox);
//			LCD_ShowCursor(databox.x,databox.y);
		}
		if(msg == KEY_TAB)
		{
			databuf[pos_databuf++] = '0';
			databuf[pos_databuf] = '\0';
			msg = MSG_REFRESH;
		}
		if(msg == KEY_CE) {	
			break;
		}
		if(pos_databuf >= max_databuf)
			continue;

		if(msg == KEY_DN) {
			if(pos_databuf == 0)
			{
				databuf[pos_databuf++] = '0';
				databuf[pos_databuf] = '\0';
			}

			if(databuf[pos_databuf-1] == '0')
				databuf[pos_databuf-1] = 'Z';
			else if (databuf[pos_databuf] == 'A')
				databuf[pos_databuf-1] = '9';
			else
				databuf[pos_databuf-1] -= 1;
			msg = MSG_REFRESH;
		}
		if(msg == KEY_UP) {
			if(pos_databuf == 0)
			{
				databuf[pos_databuf++] = '0';
				databuf[pos_databuf] = '\0';
			}

			if(databuf[pos_databuf-1] == '9')
				databuf[pos_databuf-1] = 'A';
			else if (databuf[pos_databuf-1] == 'Z')
				databuf[pos_databuf-1] = '0';
			else
				databuf[pos_databuf-1] +=1;
			msg = MSG_REFRESH;
		}
		if(msg >= KEY_NUM0 && msg <= KEY_NUM9) {
			databuf[pos_databuf++] = msg;
			databuf[pos_databuf] = '\0';
			msg = MSG_REFRESH;
		}
		if(msg == KEY_OK) {
			mystrcpy(oldbuf,databuf,pos_databuf);
			oldbuf[pos_databuf] = '\0';
			break;
		}

		if(msg == MSG_REFRESH) {
			draw_label(&databox,SW_NORMAL);
//			LCD_ShowCursor(databox.x+pos_databuf*16,databox.y);
		}
	}
//	LCD_HideCursor();
}
Exemplo n.º 27
0
double wnd_floatinput(double lastval)
{
	uchar msg;
	
	key = MSG_INIT;
	while(1)
	{
		if(key != KEY_INVALID)
		{
			msg = key;
			key = KEY_INVALID;
		}else{
			continue;
		}
		if(msg == MSG_INIT)
		{
			LCD_Cls();
			databuf[0] = '0';
			databuf[1] = '\0';
			pos_databuf = 0;
			draw_label(&datalbl,SW_NORMAL);
			wnd_inputbox(&databox);
//			LCD_ShowCursor(databox.x,databox.y);
		}

		if(msg == KEY_TAB)
		{
			databuf[pos_databuf++] = '0';
			databuf[pos_databuf] = '\0';
			msg = MSG_REFRESH;
		}
		if(pos_databuf >= max_databuf)
			continue;
		if(msg == KEY_DN) {
					if(pos_databuf == 0)
			{
				databuf[pos_databuf++] = '0';
				databuf[pos_databuf] = '\0';
			}

			if(databuf[pos_databuf-1] == '0')
				databuf[pos_databuf-1] = '9';
			else
				databuf[pos_databuf-1] -= 1;
			msg = MSG_REFRESH;
		}
		if(msg == KEY_UP) {
			if(databuf[pos_databuf-1] == '9')
				databuf[pos_databuf-1] = '0';
			else
				databuf[pos_databuf-1] += 1;
			msg = MSG_REFRESH;
		}
		if((msg >= KEY_NUM0 && msg <= KEY_NUM9) || msg == KEY_DOT) {
			databuf[pos_databuf++] = msg;
			databuf[pos_databuf] = '\0';
			msg = MSG_REFRESH;
		}
		if(msg == KEY_CE) {
//			LCD_HideCursor();
			return lastval;
		}
		if(msg == KEY_OK){
//			LCD_HideCursor();
			return buf2double();
		}
		if(msg == MSG_REFRESH) {
			draw_label(&databox,SW_NORMAL);
//			LCD_ShowCursor(databox.x+pos_databuf*16,databox.y);
		}
	}
}
Exemplo n.º 28
0
void
Fl_DialX::draw ( void )
{
    int X,Y,S;

    {
    int ox, oy, ww, hh, side;
    ox = x();
    oy = y();
    ww = w();
    hh = h();
    
    if (ww > hh)
    {
        side = hh;
        ox = ox + (ww - side) / 2;
    }
    else
    {
        side = ww;
        oy = oy + (hh - side) / 2;
    }
    side = w() > h() ? hh : ww;

    X = ox;
    Y = oy;
    S = side;
    }

    draw_box();
    draw_label();

    double angle = ( angle2() - angle1() ) * ( value() - minimum()) / ( maximum() - minimum() ) + angle1();

    fl_draw_box( box(), X, Y, S, S, color() );
    
    /* shrink a bit */
    int OX = x();
    int OY = y();
    X += S / 8;
    Y += S / 8;
    int OS = S;
    S -= S / 4;
    
    fl_line_style( FL_SOLID, S / 12 );
        
    /* background arc */
    fl_color( fl_darker( color() ) );
    fl_arc( X, Y, S, S, 270 - angle1(), 270 - angle2() );
        
    /* foreground arc */
    fl_color( selection_color() );
    fl_arc( X, Y, S, S, 270 - angle1(), 270 - angle  );


    fl_line_style( FL_SOLID, 0 );
 
    if ( active_r() )
    {
        int W = OS;
        int H = OS;

        fl_push_matrix();
        fl_translate(OX+W/2, OY+H/2);
        fl_scale(W, H);
        fl_rotate(310+angle);
        fl_color( fl_color_add_alpha( FL_WHITE, 127 ));
        fl_begin_polygon(); fl_circle(-0.26, 0.26, 0.12); fl_end_polygon();
        fl_color( FL_WHITE );
        fl_begin_polygon(); fl_circle(-0.26, 0.26, 0.06); fl_end_polygon();
            
        fl_pop_matrix();
    }
    
    fl_color( fl_contrast( labelcolor(), color() ) );
 
    if ( Fl::belowmouse() == this )
    {
        char s[10];
    
        fl_font( FL_HELVETICA, 10 );
    
        snprintf( s, sizeof( s ), "%.1f", value() );

        fl_color( FL_FOREGROUND_COLOR );
        fl_draw( s, X, Y, S, S, FL_ALIGN_CENTER );
    }
}
Exemplo n.º 29
0
void Reader::draw_label( QGLPainter *painter, const QVector3D& position ) { draw_label( painter, position, m_color, m_label ); }
Exemplo n.º 30
0
void Reader::draw_label( QGLPainter *painter, const QVector3D& position, const std::string& label ) { draw_label( painter, position, m_color, label ); }