コード例 #1
0
ファイル: bar.c プロジェクト: devanstroud/ratpoison
static void
marked_message_internal (char *msg, int mark_start, int mark_end)
{
  rp_screen *s = current_screen ();
  int num_lines;
  int width;
  int height;

  PRINT_DEBUG (("msg = %s\n", msg?msg:"NULL"));
  PRINT_DEBUG (("mark_start = %d, mark_end = %d\n", mark_start, mark_end));

  /* Calculate the width and height of the window. */
  num_lines = count_lines (msg, strlen(msg));
  width = defaults.bar_x_padding * 2 + max_line_length(msg);
  height = FONT_HEIGHT (s) * num_lines + defaults.bar_y_padding * 2;

  prepare_bar (s, width, height, num_lines > 1 ? 1 : 0);

  if (defaults.bar_sticky)
    /* Sticky bar is only showing the current window title, don't mark it */
    mark_start = mark_end = -1;
  else
    {
      /* Draw the mark over the designated part of the string. */
      correct_mark (strlen (msg), &mark_start, &mark_end);
      draw_mark (s, msg, mark_start, mark_end);
    }

  draw_string (s, msg, mark_start, mark_end);

  /* Keep a record of the message. */
  update_last_message (msg, mark_start, mark_end);
}
コード例 #2
0
ファイル: polygon.c プロジェクト: timburrow/ovj3
/************************************************************************
 *                                                                      *
 *  Draw part of polygon's segment.  That is, two lines between
 *  'vertex_selected' and the neighboring two vertices.
 *  It is called when a user needs to resize a polygon.			*
 *  									*/
void
Polygon::draw_resize(void)
{
    set_clip_region(FRAME_CLIP_TO_IMAGE);

    if (bkg_pixmap){
	//
	// Redraw entire polygon
	//
	draw();
    }else{
	//
	// Redraw the two segments that moved
	//
	if (vertex_selected == 0){
	    if (closed){
		g_draw_line(gdev, pnt[npnts-1].x, pnt[npnts-1].y,
			    pnt[0].x, pnt[0].y, color);
	    }
	}else{
	    g_draw_line(gdev,
			pnt[vertex_selected-1].x, pnt[vertex_selected-1].y,
			pnt[vertex_selected].x, pnt[vertex_selected].y, color);
	}
	
	if (vertex_selected == (npnts-1)){
	    if (closed) {
		g_draw_line(gdev,
			    pnt[vertex_selected].x, pnt[vertex_selected].y,
			    pnt[0].x, pnt[0].y, color);
	    }
	}else{
	    g_draw_line(gdev,
			pnt[vertex_selected].x, pnt[vertex_selected].y,
			pnt[vertex_selected+1].x, pnt[vertex_selected+1].y,
			color);
	}
	
	g_draw_points(gdev, pnt+vertex_selected, 1, color);
	
	if (roi_state(ROI_STATE_MARK)){
	    draw_mark(pnt[vertex_selected].x, pnt[vertex_selected].y);
	}
    }
    set_clip_region(FRAME_NO_CLIP);
}
コード例 #3
0
ファイル: GRAPHS.C プロジェクト: rickytan/Snooker
void draw_ball(struct BALL ball)						/*********绘制球*********/
{
	int off_x,off_y;
	off_x=0.6*BALL_R*cos(1);
	off_y=0.6*BALL_R*sin(1);
	draw_mark();
	setcolor(BLACK);
	setfillstyle(SOLID_FILL,ball.color);

	circle(ball.posi.x,ball.posi.y,BALL_R);
	floodfill(ball.posi.x,ball.posi.y,BLACK);
	setcolor(ball.color);
	circle(ball.posi.x,ball.posi.y,BALL_R);
	setcolor(WHITE);
	line(ball.posi.x+off_x-1,ball.posi.y+off_y,ball.posi.x+off_x+1,ball.posi.y+off_y);
	line(ball.posi.x+off_x,ball.posi.y+off_y-1,ball.posi.x+off_x,ball.posi.y+off_y+1);
}
コード例 #4
0
ファイル: GRAPHS.C プロジェクト: rickytan/Snooker
void draw_table()								/********绘制球桌********/
{
	setlinestyle(0,0,3);
	setcolor(WHITE);
	setwritemode(COPY_PUT);
	rectangle(1,100,638,480);

	draw_boundary();
	draw_net();

	setfillstyle(SOLID_FILL,TABLECOLOR);
	floodfill(300,400,WHITE);
	setfillstyle(SOLID_FILL,6);
	floodfill(20,290,WHITE);
	floodfill(620,290,WHITE);

	draw_mark();
}
コード例 #5
0
ファイル: draw.c プロジェクト: zevlg/eukleides
void label_angle(void)
{
    double a, b, r, s, t,x1, y1, x2, y2;
    _point *A, *B, *C;

    check_color();
    C = POP(_point);
    B = POP(_point);
    A = POP(_point);
    a = argument(B, A);
    b = argument(B, C);
    r = SIZE(.5);
    s = .08/scale;
    fprintf(output_file, "\\pscustom");
    put_local();
    fprintf(output_file, "{\n");
    switch (local_angle) {
	case SIMPLE:
	    draw_mark("", B, r, a, b);
	    if (local_dec == DOTTED) {
		set_xy(A, B, C, SIZE(M_SQRT2/8), &x1, &y1, &x2, &y2);
		fprintf(output_file, "  \\Dot{%.4f}{%.4f}{%.4f}\n",
			B->x + x1 + x2, B->y + y1 + y2, SIZE(.05));
	    }
	    if (local_dec == DASHED) {
		fprintf(output_file, "  \\Dash{%.4f}{%.4f}{%.4f}{%.4f}{%.4f}\n",
			 B->x, B->y, (a + b)/2, r - s, r + s);
	    }
	    break;
	case DOUBLE:
	    if (local_dec == DASHED) {
		draw_mark("", B, r, a, b);
		t = 8/local_size;
		fprintf(output_file, "  \\DoubleDash"
			"{%.4f}{%.4f}{%.4f}{%.4f}{%.4f}{%.4f}\n",
			B->x, B->y, r - s, r + s, (a + b)/2 - t/2, t);
	    } else {
		fprintf(output_file, "  \\DoubleArc"
			"{%.4f}{%.4f}{%.4f}{%.4f}{%.4f}{%.4f}\n",
			B->x, B->y, r - s/2, r + s/2, a, b);
	    }
	    break;
	case TRIPLE:
	    if (local_dec == DASHED) {
		draw_mark("", B, r, a, b);
		t = 8/local_size;
		fprintf(output_file, "  \\TripleDash"
			"{%.4f}{%.4f}{%.4f}{%.4f}{%.4f}{%.4f}\n",
			B->x, B->y, r - s, r + s, (a + b)/2 - t, t);
	    } else {
		fprintf(output_file, "  \\TripleArc"
			"{%.4f}{%.4f}{%.4f}{%.4f}{%.4f}{%.4f}{%.4f}\n",
			B->x, B->y, r - s, r, r + s, a, b);
	    }
	    break;
	case RIGHT:
	    set_xy(A, B, C, SIZE(.35), &x1, &y1, &x2, &y2);
	    fprintf(output_file, "  \\Right{%.4f}{%.4f}{%.4f}{%.4f}{%.4f}{%.4f}\n",
		    B->x + x1, B->y + y1, x2, y2, -x1, -y1);
	    if (local_dec == DOTTED) {
		fprintf(output_file, "  \\Dot{%.4f}{%.4f}{%.4f}\n",
			B->x + (x1 + x2)/2, B->y + (y1 + y2)/2, SIZE(.05));
	    }
	    break;
	case FORTH:
	    draw_mark("{->}", B, r, a, b);
	    break;
	case BACK:
	    draw_mark("{<-}", B, r, a, b);
	    break;
    }
    fprintf(output_file, "}\n");
}
コード例 #6
0
ファイル: Graph.cpp プロジェクト: jake-leland/Logic-tron
void Marked_polyline::draw_lines() const
{
    Open_polyline::draw_lines();
    for (int i=0; i<number_of_points(); ++i) 
        draw_mark(point(i),mark[i%mark.size()]);
}
コード例 #7
0
ファイル: gpsapp.c プロジェクト: empeg/gpsapp
static void refresh_display(void)
{
    struct xy pos;
    int i;

    do_refresh = 0;

    draw_clear();

    draw_activity(1);

    switch (visual) {
    case VIEW_SATS:
	draw_sats(&gps_state);
	break;

    case VIEW_MAP:
	/* show map scale */
	if (show_scale)
	    draw_scale();

	/* show gps coordinates */
	if (show_gpscoords)
	    draw_gpscoords();

	vfdlib_setClipArea(0, 0, VFD_WIDTH - VFD_HEIGHT, VFD_HEIGHT);

	/* draw tracklog */
	if (show_track)
	    track_draw();

	/* draw route we're following */
	route_draw(&gps_coord.xy);

	/* highlight waypoints */
	i = 0;
	while (route_getwp(i, &pos, NULL, NULL)) {
	    draw_point(&pos, VFDSHADE_BRIGHT);
	    if (i++ != nextwp) continue;

	    /* add focus to next waypoint */
	    draw_mark(&pos, -1, VFDSHADE_MEDIUM);
	}

	/* draw our own location */
	draw_mark(&gps_coord.xy, gps_bearing, VFDSHADE_BRIGHT);

	vfdlib_setClipArea(0, 0, VFD_WIDTH, VFD_HEIGHT);
	draw_info();
	break;

    case VIEW_ROUTE:
	draw_wpstext();
	break;
    }

    if (load_route)
	routes_list();
    else if (menu) 
	draw_msg(menu_msg[menu_pos]);

    else if (lastmenu) {
	char *msg=NULL;
	lastmenu--;
	switch(menu_pos) {
	case 2: switch (show_popups) {
		case 0: msg = "No Popups"; break;
		case 1: msg = "Popups"; break;
		case 2: msg = "Permanent Popups"; break;
		}
		break;
	case 3: msg = (show_metric?"Meters":"Miles"); break;
	case 4: msg = (show_gpscoords?"Coordinates":"No Coordinates"); break;
	case 5: msg = (show_time?"Time":"Distance"); break;
	case 6: msg = (show_track?"Track":"No Track"); break;
	case 7: switch (coord_format) {
		case 0: msg = "DDD Coords"; break;
		case 1: msg = "DMM Coords"; break;
		case 2: msg = "DMS Coords"; break;
		}
		break;
	}
	if (msg)
	    draw_msg(msg);
    }

    draw_display();

#ifndef __arm__
    {
	extern int stats_toTM;
	extern int stats_distance;
	extern int stats_bearing;

	fprintf(stderr, "conv stats: GPS>TM %d DIST %d HDG %d\n",
		stats_toTM, stats_distance, stats_bearing);
	stats_toTM = stats_distance = stats_bearing = 0;
    }
#endif
}