Exemple #1
0
void gStatus::draw() {

	fl_rect(x(), y(), w(), h(), COLOR_BD_0);		          // reset border
	fl_rectf(x()+1, y()+1, w()-2, h()-2, COLOR_BG_0);		  // reset background

	if (ch != NULL) {
		if (ch->status    & (STATUS_WAIT | STATUS_ENDING | REC_ENDING | REC_WAITING) ||
				ch->recStatus & (REC_WAITING | REC_ENDING))
		{
			fl_rect(x(), y(), w(), h(), COLOR_BD_1);
		}
		else
		if (ch->status == STATUS_PLAY)
			fl_rect(x(), y(), w(), h(), COLOR_BD_1);
		else
			fl_rectf(x()+1, y()+1, w()-2, h()-2, COLOR_BG_0);     // status empty


		if (G_Mixer.chanInput == ch)
			fl_rectf(x()+1, y()+1, w()-2, h()-2, COLOR_BG_3);	    // take in progress
		else
		if (recorder::active && recorder::canRec(ch))
			fl_rectf(x()+1, y()+1, w()-2, h()-2, COLOR_BG_4);     // action record

		/* equation for the progress bar:
		 * ((chanTracker - chanStart) * w()) / (chanEnd - chanStart). */

		int pos = ch->getPosition();
		if (pos == -1)
			pos = 0;
		else
			pos = (pos * (w()-1)) / (ch->end - ch->begin);
		fl_rectf(x()+1, y()+1, pos, h()-2, COLOR_BG_2);
	}
}
Exemple #2
0
	void draw(){
		int i;
		int pitch, level;

		fl_color(FL_BLACK);
		fl_rectf(x(), y(), w(), h());
		if(c <= 0){
			return;
		}
		pitch = w() / c;

		fl_color(FL_GREEN);
		for(i = 0; i < c; i++){
			level = (center - s[i]) / 2 + h() / 2 + y();
			fl_rectf(
				i * pitch + x(),
				level,
				pitch > 1 ? pitch - 1 : pitch,
				h() + y() - level);
		}
		fl_color(FL_WHITE);
		fl_line(x(), h() / 2 + y(), w() + x(), h() / 2 + y());
		fl_font(FL_HELVETICA, 10);
		fl_draw(buf, x(), y() + 10);
	}
void orb_mapctrl::draw() 
{
    // Resize the viewport before drawing
    m_viewport->w(w());
    m_viewport->h(h());

    if ((damage() & FL_DAMAGE_ALL) == 0) 
        return;

    // Fill the area which the viewport does not cover
    fl_rectf(x(), y(), w(), h(), 80, 80, 80);

    // Create an offscreen drawing buffer and send all subsequent commands there
    Fl_Offscreen offscreen;
    offscreen = fl_create_offscreen(m_viewport->w(), m_viewport->h());
    fl_begin_offscreen(offscreen);

    fl_rectf(0, 0, m_viewport->w(), m_viewport->h(), 80, 80, 80);

    // Draw all the layers
    for (std::vector<orb_layer*>::iterator iter=m_layers.begin();iter!=m_layers.end();++iter)
        (*iter)->draw(*m_viewport);

    fl_end_offscreen();
   
    // Blit the generated viewport bitmap onto the widget (centered)
    int dpx = 0, dpy = 0;
    if (w() > (int)m_viewport->w())
        dpx = (w() - (int)m_viewport->w())/2;
    if (h() > (int)m_viewport->h())
        dpy = (h() - (int)m_viewport->h())/2;

    fl_copy_offscreen(x()+dpx, y()+dpy, m_viewport->w(), m_viewport->h(), offscreen, 0, 0);
    fl_delete_offscreen(offscreen);
}
void gAction::draw() {

	/* a singlepress action narrower than 8 pixel is useless. So check it.
	 * Warning: if an action is 8 px narrow, it has no body space to drag
	 * it. It's up to the user to zoom in and drag it. */


	if (G_Mixer.chanMode[parent->chan] == SINGLE_PRESS)
		if (w() < MIN_WIDTH)
			w(MIN_WIDTH);


	int color;
	if (selected)  /// && gActionChannel !disabled
		color = COLOR_BD_1;
	else
		color = COLOR_BG_2;

	if (type == ACTION_KILLCHAN)
		fl_rect(x(), y(), w(), h(), (Fl_Color) color);
	else {
		fl_rectf(x(), y(), w(), h(), (Fl_Color) color);
		if (G_Mixer.chanMode[parent->chan] != SINGLE_PRESS) { // don't do that for SINGLE PRESS
			if (type == ACTION_KEYPRESS)
				fl_rectf(x()+3, y()+h()-11, 2, 8, COLOR_BD_0);
			else
			if  (type == ACTION_KEYREL)
				fl_rectf(x()+3, y()+3, 2, 8, COLOR_BD_0);
		}
	}

}
Exemple #5
0
	void Box::draw_lines() const{
		if(fill_color().visibility()) {    // fill
			fl_color(fill_color().as_int());
			fl_rectf(point(0).x + r, point(0).y, w - r - r, h);								// 丸角四角形内の縦の長方形
			fl_rectf(point(0).x, point(0).y + r, w, h - r - r);								// 丸角四角形内の横の長方形
			fl_pie(point(0).x + w - r - r, point(0).y, r + r, r + r, 0, 90);				// 右上円
			fl_pie(point(0).x, point(0).y, r + r, r + r, 90, 180);							// 左上円
			fl_pie(point(0).x, point(0).y + h - r - r, r + r, r + r, 180, 270);				// 左下円
			fl_pie(point(0).x + w - r - r, point(0).y + h - r - r, r + r, r + r, 270, 360);	// 右下円
			fl_color(color().as_int());    // reset color
		}

		if(color().visibility()) {    // lines on top of fill
			fl_color(color().as_int());
			fl_line(point(0).x + r, point(0).y, point(0).x + w - r, point(0).y);			// 上線
			fl_line(point(0).x + r, point(0).y + h, point(0).x + w - r, point(0).y + h);	// 下線
			fl_line(point(0).x, point(0).y + r, point(0).x, point(0).y + h - r);			// 左線
			fl_line(point(0).x + w, point(0).y + r, point(0).x + w, point(0).y + h - r);	// 右線
			fl_arc(point(0).x + w - r - r, point(0).y, r + r, r + r, 0, 90);				// 右上角丸
			fl_arc(point(0).x, point(0).y, r + r, r + r, 90, 180);							// 左上角丸
			fl_arc(point(0).x, point(0).y + h - r - r, r + r, r + r, 180, 270);				// 左下角丸
			fl_arc(point(0).x + w - r - r, point(0).y + h - r - r, r + r, r + r, 270, 360);	// 右下角丸
		}

		int ofnt = fl_font();
		int osz = fl_size();
		fl_font(fnt.as_int(), fnt_sz);
		fl_draw(lab.c_str(), point(0).x + r, point(0).y + h - r);
		fl_font(ofnt, osz);
	}
Exemple #6
0
void gMuteChannel::draw() {

	baseDraw();

	/* print label */

	fl_color(COLOR_BG_1);
	fl_font(FL_HELVETICA, 12);
	fl_draw("mute", x()+4, y(), w(), h(), (Fl_Align) (FL_ALIGN_LEFT | FL_ALIGN_CENTER));

	/* draw "on" and "off" labels. Must stay in background */

	fl_color(COLOR_BG_1);
	fl_font(FL_HELVETICA, 9);
	fl_draw("on",  x()+4, y(),        w(), h(), (Fl_Align) (FL_ALIGN_LEFT | FL_ALIGN_TOP));
	fl_draw("off", x()+4, y()+h()-14, w(), h(), (Fl_Align) (FL_ALIGN_LEFT | FL_ALIGN_TOP));

	/* draw on-off points. On = higher rect, off = lower rect. It always
	 * starts with a note_off */

	fl_color(COLOR_BG_2);

	int pxOld = x()+1;
	int pxNew = 0;
	int py    = y()+h()-5;
	int pyDot = py-6;

	for (unsigned i=0; i<points.size; i++) {

		/* next px */

		pxNew = points.at(i).x+x();

		/* draw line from pxOld to pxNew.
		 * i % 2 == 0: first point, mute_on
		 * i % 2 != 0: second point, mute_off */

		fl_line(pxOld, py, pxNew, py);
		pxOld = pxNew;

		py = i % 2 == 0 ? y()+4 : y()+h()-5;

		/* draw dots (handles) */

		fl_line(pxNew, y()+h()-5, pxNew, y()+4);

		if (selectedPoint == (int) i) {
			fl_color(COLOR_BD_1);
			fl_rectf(pxNew-3, pyDot, 7, 7);
			fl_color(COLOR_BG_2);
		}
		else
			fl_rectf(pxNew-3, pyDot, 7, 7);
	}

	/* last section */

	py = y()+h()-5;
	fl_line(pxNew+3, py, pParent->coverX+x()-1, py);
}
Exemple #7
0
void Fl_MIDIKeyboard::draw(void) {                          // fltk draw() override
    Fl_Scroll::draw();

    fl_push_clip(x()+Fl::box_dx(box()), y()+Fl::box_dy(box()), w()-Fl::box_dw(box()), h()-Fl::box_dh(box()));
    int X = keyboard->x(), Y = keyboard->y();
    int press_diam = _b_width-2;
    int press_w_h_offs = _b_height + (_key_height - _b_height - press_diam) / 2;
    int press_w_w_offs = (int)((_key_width-press_diam) / 2);
    int press_b_h_offs = _b_height - press_diam - 2;
    uchar bk = is_black(_bottomkey) ? _bottomkey-1 : _bottomkey;    // need to begin with a white key

    fl_color(FL_BLACK);
    if (_type == MKB_HORIZONTAL) {
        int y_b_offs = Y + _b_height;
        for (int i = bk, cur_x = X + keyscoord[bk]; i <= _topkey; i++, cur_x = X + keyscoord[i]) {
            if (is_black(i)) {
                fl_rectf(cur_x, Y, _b_width, _b_height);
                if (pressed_keys[i]) {
                    fl_color(FL_RED);
                    fl_pie(cur_x, Y + press_b_h_offs, press_diam, press_diam, 0, 360);
                    fl_color(FL_BLACK);
                }
            }
            else {
                if (pressed_keys[i]) {
                    fl_color(FL_RED);
                    fl_pie(cur_x + press_w_w_offs, Y + press_w_h_offs, press_diam, press_diam, 0, 360);
                    fl_color(FL_BLACK);
                }
                isCF(i) ? fl_line(cur_x, Y, cur_x, Y + _key_height) :
                          fl_line(cur_x, y_b_offs, cur_x, Y + _key_height);

            }
        }
    }
    else {
        Y += keyboard->h();
        int x_b_offs = X + _b_height;
        for (int i = bk, cur_y = Y - keyscoord[bk]; i <= _topkey; i++, cur_y = Y - keyscoord[i]) {
            if (is_black(i)) {
                fl_rectf(X, cur_y - _b_width, _b_height, _b_width);
                if (pressed_keys[i]) {
                    fl_color(FL_RED);
                    fl_pie(X + press_b_h_offs, cur_y - press_diam,  press_diam, press_diam, 0, 360);
                    fl_color(FL_BLACK);
                }
            }
            else {
                if (pressed_keys[i]) {
                    fl_color(FL_RED);
                    fl_pie(X + press_w_h_offs, cur_y - press_w_w_offs - press_diam, press_diam, press_diam, 0, 360);
                    fl_color(FL_BLACK);
                }
                isCF(i) ? fl_line(X, cur_y, X + _key_height, cur_y) :
                          fl_line(x_b_offs, cur_y, X + _key_height, cur_y);
            }
        }
    }
    fl_pop_clip();
}
Exemple #8
0
void gBeatMeter::draw() {

	int cursorW = (w()/MAX_BEATS);

	fl_rect(x(), y(), w(), h(), COLOR_BD_0);													      // border
	fl_rectf(x()+1, y()+1, w()-2, h()-2, FL_BACKGROUND_COLOR);  						// bg
	fl_rectf(x()+(G_Mixer.actualBeat*cursorW)+3, y()+3, cursorW-5, h()-6, COLOR_BG_2); // cursor

	/* beat cells */

	fl_color(COLOR_BD_0);
	for (int i=1; i<=G_Mixer.beats; i++)
		fl_line(x()+cursorW*i, y()+1, x()+cursorW*i, y()+h()-2);

	/* bar line */

	fl_color(COLOR_BG_2);
	int delta = G_Mixer.beats / G_Mixer.bars;
	for (int i=1; i<G_Mixer.bars; i++)
		fl_line(x()+cursorW*(i*delta), y()+1, x()+cursorW*(i*delta), y()+h()-2);

	/* unused grey area */

	fl_rectf(x()+(G_Mixer.beats*cursorW)+1, y()+1, ((MAX_BEATS-G_Mixer.beats)*cursorW)-1, h()-2, COLOR_BG_1);
}
void IndicatorWindow::draw()
{
	fl_color(255, 255, 255);
	fl_rectf(0, 0, w(), h());


	// draw range
	if (m_bRangeMarkerEnabled) {
		fl_color(200,200,200);
		int min = toWindowX(m_fRangeMarkerMin);
		int max = toWindowX(m_fRangeMarkerMax);
		fl_rectf(min, 0, max - min, h());
	}

	// draw indicators
	fl_color(0, 0, 255);
	for (int i = 0; i < m_fvIndicators.size(); ++i) {
		int x = toWindowX(m_fvIndicators[i]);
		fl_line(x, 0, x, h());
	}

	// draw the floating indicator
	if (m_iSelectedIndicator < 0)
		fl_color(255, 0, 0);
	else
		fl_color(0, 255, 0);
	int x = toWindowX(m_fFloatingIndicator);
	fl_line(x, 0, x, h());

}
void RulerWindow::draw()
{
	char szText[256];

	if (m_dRangeMax != FLT_MAX && m_dRangeMin != FLT_MIN) {
		switch (m_flcColor) {
		case FL_CYAN:
		case FL_GREEN:
			fl_rectf(0, 0, w(), h(), 0, 0, 0);
			break;
		default:
			fl_rectf(0, 0, w(), h(), 255, 255, 255);
			break;
		}

		double dRange = m_dRangeMax - m_dRangeMin;
		int iWindowLen = m_byType == RW_HORIZONTAL ? w() : h();
		const int k_iAvgLongMarkLen = 15;

		int iLongMarkCount = iWindowLen / k_iAvgLongMarkLen;

		if (iLongMarkCount > 0 && iWindowLen > 0) {
			// Computer the long mark length so that it's 10^i where i is an integer
			double dLongMarkLength = dRange / (double)iLongMarkCount;
			double dLongMarkLengthPow = log10(dLongMarkLength);
			int iLongMarkLengthPow = (int)ceil(dLongMarkLengthPow);
			dLongMarkLength = pow(10.0, (double)iLongMarkLengthPow);

			int iStart = (int)ceil(m_dRangeMin / dLongMarkLength);
			int iMarkPos;

			fl_color(m_flcColor);
			fl_font(FL_HELVETICA, 10);
			do {
				iMarkPos = (int)(((double)iStart * dLongMarkLength - m_dRangeMin) / dRange * (double)iWindowLen + 0.5);

				snprintDecimal(szText, 256, iStart, iLongMarkLengthPow);
				if (m_byType == RW_HORIZONTAL) {
					fl_line(iMarkPos, 0, iMarkPos, h() / 2);
					fl_draw(szText, iMarkPos + 2, h() - 1);
				}
				else {
					fl_line(0, h() - iMarkPos, w() / 2, h() - iMarkPos);
					fl_draw(szText, 2, h() - iMarkPos - 2);
				}

				++iStart;
			} while (iMarkPos < iWindowLen);
		}
	}
	else {
		// disabled
		fl_rectf(0, 0, w(), h(), 128, 128, 128);
	}
}
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);
  }
}
Exemple #12
0
/*
=================================================================
draw_static:	This routine draws the static portions of the LCD,
				such as erasing the background, drawing function
				key labls, etc.
=================================================================
*/
void Fl_Usage_Box::draw()
{
	int c, i;
	int x_pos, y_pos;

	// Draw background
    fl_color(m_backgroundColor);
    fl_rectf(x()+1,y()+1,w()-2,h()-2);

	// Draw frame
	fl_color(FL_BLACK);
	fl_rect(x(),y(), w(), h());

	// Draw usage information
	for (c = 1; c < 256; c++)
	{
		// Test if index greater than max usage entry
		if (c > m_maxUsageEntry)
			break;

		// Selet Color for this usage entry
		fl_color(m_usageColors[c]);

		// "Walk" through the usage map and draw a pixel for each entry with this usage
		for (i = 0; i < m_usageMapSize; i++)
		{
			if (m_pUsageMap[i] == c)
			{
				x_pos = i / (h()-4) + 2;
				y_pos = i % (h()-4) + 2;
				fl_point(x() + x_pos, y() + y_pos);
			}
		}
	}
}
Exemple #13
0
   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();
        }
Exemple #14
0
void gChoice::draw() {
	fl_rectf(x(), y(), w(), h(), COLOR_BG_0);              // bg
	fl_rect(x(), y(), w(), h(), (Fl_Color) COLOR_BD_0);    // border
	if (angle)
		fl_polygon(x()+w()-8, y()+h()-1, x()+w()-1, y()+h()-8, x()+w()-1, y()+h()-1);

	/* pick up the text() from the selected item (value()) and print it in
	 * the box and avoid overflows */

	fl_color(!active() ? COLOR_BD_0 : COLOR_TEXT_0);
	if (value() != -1) {
		if (fl_width(text(value())) < w()-8) {
			fl_draw(text(value()), x(), y(), w(), h(), FL_ALIGN_CENTER);
		}
		else {
			std::string tmp = text(value());
			int size        = tmp.size();
			while (fl_width(tmp.c_str()) >= w()-16) {
				tmp.resize(size);
				size--;
			}
			tmp += "...";
			fl_draw(tmp.c_str(), x(), y(), w(), h(), FL_ALIGN_CENTER);
		}

	}
}
Exemple #15
0
void
Spatializer_Module::draw ( void )
{
    int W = 5;

    child(0)->size( w() - W, h() );
    Module::draw_box(x(),y(),w() - W,h());
    Module::draw_label(x() + 4,y(),w() - W,h());

    Module *m = this;

    fl_color( fl_darker( FL_FOREGROUND_COLOR ) );

    int spacing, offset;

    int ni = aux_audio_output.size();

    spacing = h() / ni;
    offset = spacing / 2;
    for ( int i = ni; i--; )
    {
        int xi = offset + ( spacing * i );
        fl_rectf( m->x() + m->w() - W, m->y() + xi, W, 2 );
    }
}
Exemple #16
0
void g_customBorderBox(int x, int y, int w, int h, Fl_Color c)
{
  fl_color(c);
  fl_rectf(x, y, w, h);
  fl_color(COLOR_BD_0);
  fl_rect(x, y, w, h);
}
Exemple #17
0
	void Binary_tree_rectangle::draw_lines() const{
		if(fill_color().visibility()) {	// fill
			fl_color(fill_color().as_int());

			for(int i = 0; i < number_of_points(); ++i)
				fl_rectf(point(i).x, point(i).y, radius * 2, radius * 2);	// ノード(正方形)を描画

			fl_color(color().as_int());	// reset color
		}

		if(color().visibility()) {
			fl_color(color().as_int());

			int parent = 0;	// point(i)に対する親ノードのインデックス
			for(int i = 0; i < number_of_points(); ++i){
				fl_rect(point(i).x, point(i).y, radius * 2, radius * 2);	// ノード(正方形)を描画

				// エッジ(線)を描画
				if(i != 0){
					fl_line(point(parent).x + radius, point(parent).y + radius * 2, point(i).x + radius, point(i).y);
					if(i % 2 == 0) parent++;
				}
			}
		}
	}
Exemple #18
0
void g_customDownBox(int x, int y, int w, int h, Fl_Color c)
{
  fl_color(c);
  fl_rectf(x, y, w, h);
  fl_color(COLOR_BG_0);
  fl_rect(x, y, w, h);
}
Exemple #19
0
void CCanvas::draw_sensor_beam()
{
    const int drawing_offset = 4; // Offset happens on y, don't know why??

    // Sensor hit mark
    if (m_drawing_mode == AZ_DRAW_SENSOR_STRIKE) {
        fl_color(FL_RED);
        for (int i = 0; i < m_cfg->LIDAR_RAYS; i = i + 1)
            fl_circle(m_sensor_data[i].get_hit_point().x(),
                      m_sensor_data[i].get_hit_point().y() + drawing_offset,
                      1.0); // Size of sensor hit mark
    }

    // Occupancy grid
    // Draw only grid with OCC != 127, OCC = 127 means unknown
    else if (m_drawing_mode == AZ_DRAW_GRID_MAP) {
        // Hide the real map
        fl_rectf(0, 25, w(), h() + 25, 127,127,127);

        // Scan m_gridmap and draw
        // We have offset of 25 pixels because of menu bar
        for (int y = 0; y < h() + 25; y = y + 1) {
            for (int x = 0; x < w(); x = x + 1) {
                if (m_grid_map[x + y * m_cfg->GRID_MAP_W] != 127) {
                    unsigned char c = 255 - m_grid_map[x + y * m_cfg->GRID_MAP_W];
                    fl_color(c, c, c);
                    fl_point(x, y + drawing_offset);
                } //end if
            } // end for x
        } // end for y
    } // end else if
}
Exemple #20
0
Fichier : draw.C Projet : imv/non
void
gui_clear_area ( int x, int y, int w, int h )
{
    fl_color( canvas_background_color );

    fl_rectf( x, y, w, h );
}
Exemple #21
0
	void draw(){
		int wt, wb, wc;
		wt = y() + 24;// wave top
		wb = y() + h() - 10;// wave bottom
		wc = (w() - 20) * sh / (sh + sl) + x() + 10;// wave change

		fl_color(FL_BLACK);
		fl_rectf(x(), y(), w(), h());
		if(sh == 0 && sl == 0){
			return;
		}
		fl_color(FL_GREEN);
		fl_xyline(x(), wb, x() + 10);
		fl_yxline(x() + 10, wt, wb);
		fl_xyline(x() + 10, wt, wc);
		fl_yxline(wc, wt, wb);
		fl_xyline(wc, wb, x() + w() - 10);
		fl_yxline(x() + w() - 10, wt, wb);
		fl_xyline(x() + w() - 10, wt, x() + w());
		
		fl_color(FL_WHITE);
		fl_font(FL_HELVETICA, 10);
		fl_draw(t, x(), y() + 10);
		sprintf(buf, "%dusec", sh);
		fl_draw(buf, x() + 12, wt - 2);
		sprintf(buf, "%dusec", sl);
		fl_draw(buf, wc + 2, wb - 2);
	}
Exemple #22
0
void Fl_Sparkline::drawCursor(void)
{
    int x = Fl::event_x() - Fl_Widget::x();
    int index;
    float value;

    hideCursor();

    x -= padding;

    index = num_values * x / width;
    index = snap(index);

    x = index * width / num_values;

    value = map(values[index], values[min_index], values[max_index],
        height, 0);

    fl_color(FL_BLUE);
    fl_rectf(Fl_Widget::x() + padding + x - 1, y() + value + padding - 1, 3, 3);


    fl_color(FL_RED);
    fl_line_style(FL_SOLID, 1);
    fl_line(Fl_Widget::x() + padding + x, y() + padding,
            Fl_Widget::x() + padding + x, y() + h() - padding);

    prev_x = x;
}
Exemple #23
0
void CairoBox::draw(void) 
  {
  // using fltk functions, set up white background with thin black frame
  fl_push_no_clip();            /* remove any clipping region set by the expose events... */
  fl_push_clip(x(), y(), w(), h());
  fl_color(FL_WHITE);
  fl_rectf(x(), y(), w(), h());
  fl_color(FL_BLACK);
  fl_rect(x(), y(), w(), h());

  // set up cairo structures
  surface = set_surface(w(), h());
  cr      = cairo_create(surface);
  /* All Cairo co-ordinates are shifted by 0.5 pixels to correct anti-aliasing */
  cairo_translate(cr, 0.5, 0.5);
  cairo_set_source_rgb(cr, 0.0, 0.0, 0.0); // set drawing color to black
  cairo_new_path(cr);

  // virtual function defined in driver program
  graphic(cr, x(), y(), w(), h());

  // release the cairo context
  cairo_destroy(cr);
  cairo_surface_destroy(surface);
//  cr = NULL;

  // remove clip regions
  fl_pop_clip();                          // local clip region
  fl_pop_clip();                          // "no_clip" region
  }
Exemple #24
0
void MapsWindow::MapArea::draw()
{
    fl_color(FL_BACKGROUND_COLOR);
    fl_rectf(0, 0, w(), h());

    int line = pos_/SIZE_;
    int first = line*mapsPerLine();

    int x = 0;
    int y = line*SIZE_ - pos_;
    for (int i=first; i<images_.size(); ++i)
    {
        auto im = images_[i];
        if (x > (w()-SIZE_) && x != 0)
        {
            x = 0;
            y += SIZE_;
        }

        if (y > h())
            break;

        if (im)
            im->draw(x + SIZE_/2 - im->w()/2, y + SIZE_/2 - im->h()/2);

        x += SIZE_;
    }
}
void DiagramWindow::DrawKey2(const int a, const int b)
{
    int yPosn = 55;

    fl_color(225, 225, 225);
    fl_rectf(m_menus[a]->x(), yPosn, m_menus[a]->w(), 3);
    fl_rectf(m_menus[b]->x(), yPosn, m_menus[b]->w(), 3);
    yPosn += 10;

    fl_color(FL_RED);
    fl_rectf(m_menus[a]->x(), yPosn, m_menus[a]->w(), 3);
    yPosn += 10;

    fl_color(FL_GREEN);
    fl_rectf(m_menus[b]->x(), yPosn, m_menus[b]->w(), 3);
}
Exemple #26
0
void Fl_Shadow_Box::draw(
    int x, int y, int w, int h, Fl_Color color, Fl_Flags f) const
{
    w-=BW;
    h-=BW;
    if (!(f & FL_INVISIBLE))
    {
        fl_color(color);
        fl_rectf(x+1,y+1,w-2,h-2);
    }
    fl_color(FL_DARK3);
    fl_rectf(x+BW, y+h,  w, BW);
    fl_rectf(x+w,  y+BW, BW,  h);
    fl_color(fl_inactive(FL_BLACK,f));
    fl_rect(x,y,w,h);
}
Exemple #27
0
void shape_window::draw() {
  fl_color(0);
  fl_rectf(0,0,w(),h());
  fl_font(0,20);
  fl_color(7);
  fl_draw("This requires GL",0,0,w(),h(),FL_ALIGN_CENTER);
}
Exemple #28
0
void Fl_ProgressBar::draw()
{
    int bdx, bdy;
    double pct;
    if(damage() & FL_DAMAGE_ALL) draw_box();

    int X = 0, Y = 0;
    bdx = box()->dx();
    bdy = box()->dy();

    fl_color(selection_color());
    if(mPresent > mMax)
        mPresent = mMax;
    if(mPresent < mMin)
        mPresent = mMin;
    pct = (mPresent - mMin) / mMax;
    fl_rectf(X + bdx, Y + bdy, (int)(((double)w() - 2*bdx) * pct), h() - (2*bdy + 1));
    if(mShowPct)
    {
        char buffer[30];
        sprintf(buffer, "%d%%", (int) (pct * 100));
        fl_color(textcolor());
        fl_font(this->label_font(), this->label_size());
        fl_draw(buffer, X + (w() - fl_width(buffer))/2, Y + fl_height() + (((h() - 2*bdy) - fl_height())/2));
    }
}
Exemple #29
0
void gActionWidget::baseDraw(bool clear) {

	/* clear the screen */

	if (clear)
		fl_rectf(x(), y(), w(), h(), COLOR_BG_MAIN);

	/* draw the container */

	fl_color(COLOR_BD_0);
	fl_rect(x(), y(), w(), h());

	/* grid drawing, if > 1 */

	if (pParent->gridTool->getValue() > 1) {

		fl_color(fl_rgb_color(54, 54, 54));
		fl_line_style(FL_DASH, 0, NULL);

		for (int i=0; i<(int) pParent->gridTool->points.size; i++) {
			int px = pParent->gridTool->points.at(i)+x()-1;
			fl_line(px, y()+1, px, y()+h()-2);
		}
		fl_line_style(0);
	}

	/* bars and beats drawing */

	fl_color(COLOR_BD_0);
	for (int i=0; i<(int) pParent->gridTool->beats.size; i++) {
		int px = pParent->gridTool->beats.at(i)+x()-1;
		fl_line(px, y()+1, px, y()+h()-2);
	}

	fl_color(COLOR_BG_2);
	for (int i=0; i<(int) pParent->gridTool->bars.size; i++) {
		int px = pParent->gridTool->bars.at(i)+x()-1;
		fl_line(px, y()+1, px, y()+h()-2);
	}

	/* cover unused area. Avoid drawing cover if width == 0 (i.e. beats
	 * are 32) */

	int coverWidth = pParent->totalWidth-pParent->coverX;
	if (coverWidth != 0)
		fl_rectf(pParent->coverX+x(), y()+1, coverWidth, h()-2, COLOR_BG_1);
}
void gActionWidget::baseDraw(bool clear) {

	

	if (clear)
		fl_rectf(x(), y(), w(), h(), COLOR_BG_MAIN);

	

	fl_color(COLOR_BD_0);
	fl_rect(x(), y(), w(), h());

	

	if (pParent->gridTool->getValue() > 1) {

		fl_color(fl_rgb_color(54, 54, 54));
		fl_line_style(FL_DASH, 0, NULL);

		for (int i=0; i<(int) pParent->gridTool->points.size(); i++) {
			int px = pParent->gridTool->points.at(i)+x()-1;
			fl_line(px, y()+1, px, y()+h()-2);
		}
		fl_line_style(0);
	}

	

	fl_color(COLOR_BD_0);
	for (int i=0; i<(int) pParent->gridTool->beats.size(); i++) {
		int px = pParent->gridTool->beats.at(i)+x()-1;
		fl_line(px, y()+1, px, y()+h()-2);
	}

	fl_color(COLOR_BG_2);
	for (int i=0; i<(int) pParent->gridTool->bars.size(); i++) {
		int px = pParent->gridTool->bars.at(i)+x()-1;
		fl_line(px, y()+1, px, y()+h()-2);
	}

	

	int coverWidth = pParent->totalWidth-pParent->coverX;
	if (coverWidth != 0)
		fl_rectf(pParent->coverX+x(), y()+1, coverWidth, h()-2, COLOR_BG_1);
}