fix indenting ... again
[rrdtool.git] / src / rrd_graph.c
index 2aba6f9..191404e 100644 (file)
@@ -1575,7 +1575,8 @@ int leg_place(
         }
 
         if (im->extra_flags & FULL_SIZE_MODE)
-            leg_y = leg_y_prev = leg_y - (int) (im->text_prop[TEXT_PROP_LEGEND].size*1.8);
+            leg_y = leg_y_prev =
+                leg_y - (int) (im->text_prop[TEXT_PROP_LEGEND].size * 1.8);
 
         for (i = 0; i < im->gdes_c; i++) {
             fill_last = fill;
@@ -1702,14 +1703,14 @@ int leg_place(
                 if (im->extra_flags & FULL_SIZE_MODE) {
                     /* only add y space if there was text on the line */
                     if (leg_x > border || prt_fctn == 's')
-                       leg_y -= im->text_prop[TEXT_PROP_LEGEND].size * 1.8;
+                        leg_y -= im->text_prop[TEXT_PROP_LEGEND].size * 1.8;
                     if (prt_fctn == 's')
-                       leg_y += im->text_prop[TEXT_PROP_LEGEND].size;
+                        leg_y += im->text_prop[TEXT_PROP_LEGEND].size;
                 } else {
                     if (leg_x > border || prt_fctn == 's')
-                       leg_y += im->text_prop[TEXT_PROP_LEGEND].size * 1.8;
+                        leg_y += im->text_prop[TEXT_PROP_LEGEND].size * 1.8;
                     if (prt_fctn == 's')
-                       leg_y -= im->text_prop[TEXT_PROP_LEGEND].size;
+                        leg_y -= im->text_prop[TEXT_PROP_LEGEND].size;
                 }
                 fill = 0;
                 leg_c = 0;
@@ -1718,15 +1719,16 @@ int leg_place(
         }
 
         if (im->extra_flags & FULL_SIZE_MODE) {
-           if (leg_y != leg_y_prev) {
-              *gY = leg_y - im->text_prop[TEXT_PROP_LEGEND].size*1.8;
-              im->yorigin = leg_y - im->text_prop[TEXT_PROP_LEGEND].size*1.8;
-           }
+            if (leg_y != leg_y_prev) {
+                *gY = leg_y - im->text_prop[TEXT_PROP_LEGEND].size * 1.8;
+                im->yorigin =
+                    leg_y - im->text_prop[TEXT_PROP_LEGEND].size * 1.8;
+            }
         } else {
-           im->yimg = leg_y_prev;
-           /* if we did place some legends we have to add vertical space */
-           if (leg_y != im->yimg)
-              im->yimg += im->text_prop[TEXT_PROP_LEGEND].size * 1.8;
+            im->yimg = leg_y_prev;
+            /* if we did place some legends we have to add vertical space */
+            if (leg_y != im->yimg)
+                im->yimg += im->text_prop[TEXT_PROP_LEGEND].size * 1.8;
         }
         free(legspace);
     }
@@ -2625,52 +2627,52 @@ int graph_size_location(
      ** |                   watermark                    |
      ** +------------------------------------------------+
      */
-    
-    if (im->ylegend[0] != '\0' ) {
-         Xvertical = im->text_prop[TEXT_PROP_UNIT].size *2;
+
+    if (im->ylegend[0] != '\0') {
+        Xvertical = im->text_prop[TEXT_PROP_UNIT].size * 2;
     }
 
     if (im->title[0] != '\0') {
-         /* The title is placed "inbetween" two text lines so it
+        /* The title is placed "inbetween" two text lines so it
          ** automatically has some vertical spacing.  The horizontal
          ** spacing is added here, on each side.
          */
-         /* if necessary, reduce the font size of the title until it fits the image width */
-         Ytitle = im->text_prop[TEXT_PROP_TITLE].size*2.6+10;
+        /* if necessary, reduce the font size of the title until it fits the image width */
+        Ytitle = im->text_prop[TEXT_PROP_TITLE].size * 2.6 + 10;
     }
 
     if (elements) {
-         if (im->draw_x_grid) {
-               Yxlabel=im->text_prop[TEXT_PROP_AXIS].size *2.5;
-         }
-         if (im->draw_y_grid || im->forceleftspace ) {
-               Xylabel=gfx_get_text_width(im->canvas, 0,
-                            im->text_prop[TEXT_PROP_AXIS].font,
-                            im->text_prop[TEXT_PROP_AXIS].size,
-                            im->tabwidth,
-                            "0", 0) * im->unitslength;
-         }
+        if (im->draw_x_grid) {
+            Yxlabel = im->text_prop[TEXT_PROP_AXIS].size * 2.5;
+        }
+        if (im->draw_y_grid || im->forceleftspace) {
+            Xylabel = gfx_get_text_width(im->canvas, 0,
+                                         im->text_prop[TEXT_PROP_AXIS].font,
+                                         im->text_prop[TEXT_PROP_AXIS].size,
+                                         im->tabwidth,
+                                         "0", 0) * im->unitslength;
+        }
     }
 
     if (im->extra_flags & FULL_SIZE_MODE) {
         /* The actual size of the image to draw has been determined by the user.
-        ** The graph area is the space remaining after accounting for the legend,
-        ** the watermark, the pie chart, the axis labels, and the title.
-        */
-        im->xorigin =0;
+         ** The graph area is the space remaining after accounting for the legend,
+         ** the watermark, the pie chart, the axis labels, and the title.
+         */
+        im->xorigin = 0;
         im->ximg = im->xsize;
         im->yimg = im->ysize;
         im->yorigin = im->ysize;
-        Xmain=im->ximg;
-        Ymain=im->yimg;
+        Xmain = im->ximg;
+        Ymain = im->yimg;
 
         im->yorigin += Ytitle;
 
 #ifdef WITH_PIECHART
         if (piechart) {
-            im->piesize=im->xsize<im->ysize?im->xsize:im->ysize;
-            Xpie=im->piesize;
-            Ypie=im->piesize;
+            im->piesize = im->xsize < im->ysize ? im->xsize : im->ysize;
+            Xpie = im->piesize;
+            Ypie = im->piesize;
         }
 #endif
 
@@ -2682,11 +2684,13 @@ int graph_size_location(
 
         /* Initial size calculation for the main graph area */
         Xmain = im->ximg - (Xylabel + 2 * Xspacing);
-        if (Xmain) Xmain -= Xspacing; /* put space between main graph area and right edge */
+        if (Xmain)
+            Xmain -= Xspacing;  /* put space between main graph area and right edge */
 
 #ifdef WITH_PIECHART
-        Xmain -= Xpie; /* remove pie width from main graph area */
-        if (Xpie) Xmain -= Xspacing; /* put space between pie and main graph area */
+        Xmain -= Xpie;  /* remove pie width from main graph area */
+        if (Xpie)
+            Xmain -= Xspacing;  /* put space between pie and main graph area */
 #endif
 
         im->xorigin = Xspacing + Xylabel;
@@ -2694,22 +2698,22 @@ int graph_size_location(
         /* the length of the title should not influence with width of the graph
            if (Xtitle > im->ximg) im->ximg = Xtitle; */
 
-        if (Xvertical) { /* unit description */
+        if (Xvertical) {    /* unit description */
             Xmain -= Xvertical;
             im->xorigin += Xvertical;
         }
         im->xsize = Xmain;
-        xtr(im,0);
+        xtr(im, 0);
 
         /* The vertical size of the image is known in advance.  The main graph area
-        ** (Ymain) and im->yorigin must be set according to the space requirements
-        ** of the legend and the axis labels.
-        */
+         ** (Ymain) and im->yorigin must be set according to the space requirements
+         ** of the legend and the axis labels.
+         */
 
         /* Determine where to place the legends onto the image.
-        ** Set Ymain and adjust im->yorigin to match the space requirements.
-        */
-        if (leg_place(im,&Ymain)==-1)
+         ** Set Ymain and adjust im->yorigin to match the space requirements.
+         */
+        if (leg_place(im, &Ymain) == -1)
             return -1;
 
 #ifdef WITH_PIECHART
@@ -2720,7 +2724,7 @@ int graph_size_location(
         if (Ytitle) {
             Ymain -= Ytitle;
         } else {
-            Ymain -= 1.5*Yspacing;
+            Ymain -= 1.5 * Yspacing;
         }
 
         /* watermark doesn't seem to effect the vertical size of the main graph area, oh well! */
@@ -2730,43 +2734,42 @@ int graph_size_location(
 
         im->ysize = Ymain;
 
-    } else /* dimension options -width and -height refer to the dimensions of the main graph area */
-    {
+    } else {            /* dimension options -width and -height refer to the dimensions of the main graph area */
+
         /* The actual size of the image to draw is determined from
-        ** several sources.  The size given on the command line is
-        ** the graph area but we need more as we have to draw labels
-        ** and other things outside the graph area.
-        */
+         ** several sources.  The size given on the command line is
+         ** the graph area but we need more as we have to draw labels
+         ** and other things outside the graph area.
+         */
 
-        if (im->ylegend[0] != '\0' ) {
-               Xvertical = im->text_prop[TEXT_PROP_UNIT].size *2;
+        if (im->ylegend[0] != '\0') {
+            Xvertical = im->text_prop[TEXT_PROP_UNIT].size * 2;
         }
 
 
         if (im->title[0] != '\0') {
             /* The title is placed "inbetween" two text lines so it
-            ** automatically has some vertical spacing.  The horizontal
-            ** spacing is added here, on each side.
-            */
+             ** automatically has some vertical spacing.  The horizontal
+             ** spacing is added here, on each side.
+             */
             /* don't care for the with of the title
-                    Xtitle = gfx_get_text_width(im->canvas, 0,
-                    im->text_prop[TEXT_PROP_TITLE].font,
-                    im->text_prop[TEXT_PROP_TITLE].size,
-                    im->tabwidth,
-                    im->title, 0) + 2*Xspacing; */
-            Ytitle = im->text_prop[TEXT_PROP_TITLE].size*2.6+10;
+               Xtitle = gfx_get_text_width(im->canvas, 0,
+               im->text_prop[TEXT_PROP_TITLE].font,
+               im->text_prop[TEXT_PROP_TITLE].size,
+               im->tabwidth,
+               im->title, 0) + 2*Xspacing; */
+            Ytitle = im->text_prop[TEXT_PROP_TITLE].size * 2.6 + 10;
         }
 
         if (elements) {
-            Xmain=im->xsize;
-            Ymain=im->ysize;
+            Xmain = im->xsize;
+            Ymain = im->ysize;
         }
-
 #ifdef WITH_PIECHART
         if (piechart) {
-            im->piesize=im->xsize<im->ysize?im->xsize:im->ysize;
-            Xpie=im->piesize;
-            Ypie=im->piesize;
+            im->piesize = im->xsize < im->ysize ? im->xsize : im->ysize;
+            Xpie = im->piesize;
+            Ypie = im->piesize;
         }
 #endif
 
@@ -2777,19 +2780,21 @@ int graph_size_location(
            pie chart area. */
 
         /* The legend width cannot yet be determined, as a result we
-        ** have problems adjusting the image to it.  For now, we just
-        ** forget about it at all; the legend will have to fit in the
-        ** size already allocated.
-        */
+         ** have problems adjusting the image to it.  For now, we just
+         ** forget about it at all; the legend will have to fit in the
+         ** size already allocated.
+         */
         im->ximg = Xylabel + Xmain + 2 * Xspacing;
 
 #ifdef WITH_PIECHART
-        im->ximg  += Xpie;
+        im->ximg += Xpie;
 #endif
 
-        if (Xmain) im->ximg += Xspacing;
+        if (Xmain)
+            im->ximg += Xspacing;
 #ifdef WITH_PIECHART
-        if (Xpie) im->ximg += Xspacing;
+        if (Xpie)
+            im->ximg += Xspacing;
 #endif
 
         im->xorigin = Xspacing + Xylabel;
@@ -2797,28 +2802,29 @@ int graph_size_location(
         /* the length of the title should not influence with width of the graph
            if (Xtitle > im->ximg) im->ximg = Xtitle; */
 
-        if (Xvertical) { /* unit description */
+        if (Xvertical) {    /* unit description */
             im->ximg += Xvertical;
             im->xorigin += Xvertical;
         }
-        xtr(im,0);
+        xtr(im, 0);
 
         /* The vertical size is interesting... we need to compare
-        ** the sum of {Ytitle, Ymain, Yxlabel, Ylegend, Ywatermark} with 
-        ** Yvertical however we need to know {Ytitle+Ymain+Yxlabel}
-        ** in order to start even thinking about Ylegend or Ywatermark.
-        **
-        ** Do it in three portions: First calculate the inner part,
-        ** then do the legend, then adjust the total height of the img,
-        ** adding space for a watermark if one exists;
-        */
+         ** the sum of {Ytitle, Ymain, Yxlabel, Ylegend, Ywatermark} with 
+         ** Yvertical however we need to know {Ytitle+Ymain+Yxlabel}
+         ** in order to start even thinking about Ylegend or Ywatermark.
+         **
+         ** Do it in three portions: First calculate the inner part,
+         ** then do the legend, then adjust the total height of the img,
+         ** adding space for a watermark if one exists;
+         */
 
         /* reserve space for main and/or pie */
 
         im->yimg = Ymain + Yxlabel;
-    
+
 #ifdef WITH_PIECHART
-        if (im->yimg < Ypie) im->yimg = Ypie;
+        if (im->yimg < Ypie)
+            im->yimg = Ypie;
 #endif
 
         im->yorigin = im->yimg - Yxlabel;
@@ -2828,18 +2834,18 @@ int graph_size_location(
             im->yimg += Ytitle;
             im->yorigin += Ytitle;
         } else {
-            im->yimg += 1.5*Yspacing;
-            im->yorigin += 1.5*Yspacing;
+            im->yimg += 1.5 * Yspacing;
+            im->yorigin += 1.5 * Yspacing;
         }
         /* reserve space for padding below the graph */
         im->yimg += Yspacing;
-     
+
         /* Determine where to place the legends onto the image.
-        ** Adjust im->yimg to match the space requirements.
-        */
-        if(leg_place(im,0)==-1)
+         ** Adjust im->yimg to match the space requirements.
+         */
+        if (leg_place(im, 0) == -1)
             return -1;
-        
+
         if (im->watermark[0] != '\0') {
             im->yimg += Ywatermark;
         }
@@ -2854,19 +2860,19 @@ int graph_size_location(
 
 #ifdef WITH_PIECHART
     /* The pie is placed in the upper right hand corner,
-    ** just below the title (if any) and with sufficient
-    ** padding.
-    */
+     ** just below the title (if any) and with sufficient
+     ** padding.
+     */
     if (elements) {
-        im->pie_x = im->ximg - Xspacing - Xpie/2;
-        im->pie_y = im->yorigin-Ymain+Ypie/2;
+        im->pie_x = im->ximg - Xspacing - Xpie / 2;
+        im->pie_y = im->yorigin - Ymain + Ypie / 2;
     } else {
-        im->pie_x = im->ximg/2;
-        im->pie_y = im->yorigin-Ypie/2;
+        im->pie_x = im->ximg / 2;
+        im->pie_y = im->yorigin - Ypie / 2;
     }
 #endif
 
-    ytr(im,DNAN);
+    ytr(im, DNAN);
     return 0;
 }
 
@@ -3607,7 +3613,7 @@ void rrd_graph_options(
             {"vertical-label", required_argument, 0, 'v'},
             {"width", required_argument, 0, 'w'},
             {"height", required_argument, 0, 'h'},
-            {"full-size-mode",  no_argument, 0, 'D'},
+            {"full-size-mode", no_argument, 0, 'D'},
             {"interlaced", no_argument, 0, 'i'},
             {"upper-limit", required_argument, 0, 'u'},
             {"lower-limit", required_argument, 0, 'l'},