diff options
author | Anders Broman <anders.broman@ericsson.com> | 2012-07-23 07:55:15 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2012-07-23 07:55:15 +0000 |
commit | 33f2e1cbb304e0a9bff6c87d10559625f82fcb86 (patch) | |
tree | 25cebb5523ab53cea111b5bf43f3e9ad652846d0 /ui/gtk/io_stat.c | |
parent | abc177f5d6c5a5621ecc2b1111ee2bd1bd4be0bb (diff) |
Align structs and code a bit, ultimatly code should be shared.
svn path=/trunk/; revision=43924
Diffstat (limited to 'ui/gtk/io_stat.c')
-rw-r--r-- | ui/gtk/io_stat.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/ui/gtk/io_stat.c b/ui/gtk/io_stat.c index 4b41fb2d1e..d409ab24f6 100644 --- a/ui/gtk/io_stat.c +++ b/ui/gtk/io_stat.c @@ -182,8 +182,8 @@ typedef struct _io_stat_t { GtkAdjustment *scrollbar_adjustment; GtkWidget *scrollbar; - int pixmap_width; - int pixmap_height; + int surface_width; + int surface_height; int pixels_per_tick; int max_y_units; int count_type; @@ -849,8 +849,8 @@ io_stat_draw(io_stat_t *io) /* * Calculate the size of the drawing area for the actual plot */ - draw_width = io->pixmap_width-io->right_x_border - io->left_x_border; - draw_height = io->pixmap_height-top_y_border - bottom_y_border; + draw_width = io->surface_width-io->right_x_border - io->left_x_border; + draw_height = io->surface_height-top_y_border - bottom_y_border; /* * Add a warning if too many entries @@ -864,7 +864,7 @@ io_stat_draw(io_stat_t *io) #else cr = gdk_cairo_create (io->pixmap); #endif - cairo_move_to (cr, 5, io->pixmap_height-bottom_y_border-draw_height-label_height/2); + cairo_move_to (cr, 5, io->surface_height-bottom_y_border-draw_height-label_height/2); pango_cairo_show_layout (cr, layout); cairo_destroy (cr); cr = NULL; @@ -879,8 +879,8 @@ io_stat_draw(io_stat_t *io) cr = gdk_cairo_create (io->pixmap); #endif cairo_set_line_width (cr, 1.0); - cairo_move_to(cr, io->pixmap_width-io->right_x_border+1.5, top_y_border + 0.5); - cairo_line_to(cr, io->pixmap_width-io->right_x_border+1.5, io->pixmap_height-bottom_y_border + 0.5); + cairo_move_to(cr, io->surface_width-io->right_x_border+1.5, top_y_border + 0.5); + cairo_line_to(cr, io->surface_width-io->right_x_border+1.5, io->surface_height-bottom_y_border + 0.5); cairo_stroke(cr); cairo_destroy(cr); if(io->max_y_units==LOGARITHMIC_YSCALE){ @@ -899,15 +899,15 @@ io_stat_draw(io_stat_t *io) if(io->max_y_units==LOGARITHMIC_YSCALE){ if (i==ys) { /* position for the 0 value */ - ypos=io->pixmap_height-bottom_y_border; + ypos=io->surface_height-bottom_y_border; } else if (i==tics) { /* position for the top value, do not draw logarithmic tics above graph */ - ypos=io->pixmap_height-bottom_y_border-draw_height; + ypos=io->surface_height-bottom_y_border-draw_height; } else { int j; /* draw the logarithmic tics */ for(j=2; j<10; j++) { - ypos=(int)(io->pixmap_height-bottom_y_border-(draw_height-ystart)*(i+log10((double)j))/tics-ystart); + ypos=(int)(io->surface_height-bottom_y_border-(draw_height-ystart)*(i+log10((double)j))/tics-ystart); /* draw the tick */ #if GTK_CHECK_VERSION(2,22,0) cr = cairo_create (io->surface); @@ -915,12 +915,12 @@ io_stat_draw(io_stat_t *io) cr = gdk_cairo_create (io->pixmap); #endif cairo_set_line_width (cr, 1.0); - cairo_move_to(cr, io->pixmap_width-io->right_x_border+1.5, ypos+0.5); - cairo_line_to(cr, io->pixmap_width-io->right_x_border+1.5+xwidth,ypos+0.5); + cairo_move_to(cr, io->surface_width-io->right_x_border+1.5, ypos+0.5); + cairo_line_to(cr, io->surface_width-io->right_x_border+1.5+xwidth,ypos+0.5); cairo_stroke(cr); cairo_destroy(cr); } - ypos=io->pixmap_height-bottom_y_border-(draw_height-ystart)*i/tics-ystart; + ypos=io->surface_height-bottom_y_border-(draw_height-ystart)*i/tics-ystart; } /* all "main" logarithmic lines are slightly longer */ xwidth=10; @@ -929,7 +929,7 @@ io_stat_draw(io_stat_t *io) /* first, middle and last tick are slightly longer */ xwidth = 10; } - ypos=io->pixmap_height-bottom_y_border-draw_height*i/10; + ypos=io->surface_height-bottom_y_border-draw_height*i/10; } /* draw the tick */ #if GTK_CHECK_VERSION(2,22,0) @@ -938,8 +938,8 @@ io_stat_draw(io_stat_t *io) cr = gdk_cairo_create (io->pixmap); #endif cairo_set_line_width (cr, 1.0); - cairo_move_to(cr, io->pixmap_width-io->right_x_border+1.5, ypos+0.5); - cairo_line_to(cr, io->pixmap_width-io->right_x_border+1.5+xwidth,ypos+0.5); + cairo_move_to(cr, io->surface_width-io->right_x_border+1.5, ypos+0.5); + cairo_line_to(cr, io->surface_width-io->right_x_border+1.5+xwidth,ypos+0.5); cairo_stroke(cr); cairo_destroy(cr); /* draw the labels */ @@ -969,7 +969,7 @@ io_stat_draw(io_stat_t *io) #else cr = gdk_cairo_create (io->pixmap); #endif - cairo_move_to (cr, io->pixmap_width-io->right_x_border+15+label_width-lwidth, ypos-label_height/2); + cairo_move_to (cr, io->surface_width-io->right_x_border+15+label_width-lwidth, ypos-label_height/2); pango_cairo_show_layout (cr, layout); cairo_destroy (cr); cr = NULL; @@ -994,8 +994,8 @@ io_stat_draw(io_stat_t *io) cr = gdk_cairo_create (io->pixmap); #endif cairo_set_line_width (cr, 1.0); - cairo_move_to(cr, io->left_x_border+0.5, io->pixmap_height-bottom_y_border+1.5); - cairo_line_to(cr, io->pixmap_width-io->right_x_border+1.5,io->pixmap_height-bottom_y_border+1.5); + cairo_move_to(cr, io->left_x_border+0.5, io->surface_height-bottom_y_border+1.5); + cairo_line_to(cr, io->surface_width-io->right_x_border+1.5,io->surface_height-bottom_y_border+1.5); cairo_stroke(cr); cairo_destroy(cr); if((last_interval/io->interval)>=draw_width/io->pixels_per_tick){ @@ -1030,8 +1030,8 @@ io_stat_draw(io_stat_t *io) cr = gdk_cairo_create (io->pixmap); #endif cairo_set_line_width (cr, 1.0); - cairo_move_to(cr, x-1-io->pixels_per_tick/2+0.5, io->pixmap_height-bottom_y_border+1.5); - cairo_line_to(cr, x-1-io->pixels_per_tick/2+0.5, io->pixmap_height-bottom_y_border+xlen+1.5); + cairo_move_to(cr, x-1-io->pixels_per_tick/2+0.5, io->surface_height-bottom_y_border+1.5); + cairo_line_to(cr, x-1-io->pixels_per_tick/2+0.5, io->surface_height-bottom_y_border+xlen+1.5); cairo_stroke(cr); cairo_destroy(cr); if(xlen==10){ @@ -1042,8 +1042,8 @@ io_stat_draw(io_stat_t *io) if ((x-1-io->pixels_per_tick/2-lwidth/2) < 5) { x_pos=5; - } else if ((x-1-io->pixels_per_tick/2+lwidth/2) > (io->pixmap_width-5)) { - x_pos=io->pixmap_width-lwidth-5; + } else if ((x-1-io->pixels_per_tick/2+lwidth/2) > (io->surface_width-5)) { + x_pos=io->surface_width-lwidth-5; } else { x_pos=x-1-io->pixels_per_tick/2-lwidth/2; } @@ -1052,7 +1052,7 @@ io_stat_draw(io_stat_t *io) #else cr = gdk_cairo_create (io->pixmap); #endif - cairo_move_to (cr, x_pos, io->pixmap_height-bottom_y_border+15); + cairo_move_to (cr, x_pos, io->surface_height-bottom_y_border+15); pango_cairo_show_layout (cr, layout); cairo_destroy (cr); cr = NULL; @@ -1265,7 +1265,7 @@ io_stat_draw(io_stat_t *io) #else gdk_cairo_set_source_pixmap (cr, io->pixmap, 0, 0); #endif - cairo_rectangle (cr, 0, 0, io->pixmap_width, io->pixmap_height); + cairo_rectangle (cr, 0, 0, io->surface_width, io->surface_height); cairo_fill (cr); cairo_destroy (cr); @@ -1408,8 +1408,8 @@ iostat_init(const char *optarg _U_, void* userdata _U_) #endif io->scrollbar=NULL; io->scrollbar_adjustment=NULL; - io->pixmap_width=500; - io->pixmap_height=200; + io->surface_width=500; + io->surface_height=200; io->pixels_per_tick=pixels_per_tick[DEFAULT_PIXELS_PER_TICK_INDEX]; io->max_y_units=AUTO_MAX_YSCALE; io->count_type=0; @@ -1510,7 +1510,7 @@ pixmap_clicked_event(GtkWidget *widget _U_, GdkEventButton *event, gpointer g) int i; gboolean load=FALSE, outstanding_call=FALSE; - draw_width = io->pixmap_width - io->right_x_border - io->left_x_border; + draw_width = io->surface_width - io->right_x_border - io->left_x_border; if ((event->x <= (draw_width+io->left_x_border+1-(draw_width/io->pixels_per_tick)*io->pixels_per_tick)) || (event->x >= (draw_width+io->left_x_border-io->pixels_per_tick/2))) { @@ -1618,8 +1618,8 @@ draw_area_configure_event(GtkWidget *widget, GdkEventConfigure *event _U_, gpoin widget_alloc.height, -1); #endif - io->pixmap_width=widget_alloc.width; - io->pixmap_height=widget_alloc.height; + io->surface_width=widget_alloc.width; + io->surface_height=widget_alloc.height; save_bt = g_object_get_data(G_OBJECT(io->window), "save_bt"); #if GTK_CHECK_VERSION(2,22,0) @@ -1702,7 +1702,7 @@ create_draw_area(io_stat_t *io, GtkWidget *box) io->draw_area=gtk_drawing_area_new(); g_signal_connect(io->draw_area, "destroy", G_CALLBACK(draw_area_destroy_cb), io); - gtk_widget_set_size_request(io->draw_area, io->pixmap_width, io->pixmap_height); + gtk_widget_set_size_request(io->draw_area, io->surface_width, io->surface_height); /* signals needed to handle backing pixmap */ #if GTK_CHECK_VERSION(3,0,0) |