Skip to content

Commit

Permalink
fix inconsistent formatting issues: replace tabs with spaces in sourc…
Browse files Browse the repository at this point in the history
…e code
  • Loading branch information
danieljprice committed Dec 11, 2024
1 parent 83cc632 commit 2c7786a
Show file tree
Hide file tree
Showing 21 changed files with 683 additions and 683 deletions.
74 changes: 37 additions & 37 deletions src/giza-annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
*/
void
giza_annotate (const char *side, double displacment, double coord,
double justification, const char *string)
double justification, const char *string)
{
if (!_giza_check_device_ready ("giza_annotate"))
{
Expand All @@ -66,7 +66,7 @@ giza_annotate (const char *side, double displacment, double coord,
if (!side)
{
_giza_warning ("giza_annotate",
"No side argument passed, skipping annotate");
"No side argument passed, skipping annotate");
return;
}

Expand Down Expand Up @@ -104,58 +104,58 @@ giza_annotate (const char *side, double displacment, double coord,
else if (strchr (side, 'L') || strchr (side, 'l'))
{
if (strchr (side, 'V') || strchr (side, 'v'))
{
/* find the position on the y axis */
y = Win.ymin + (Win.ymax - Win.ymin) * coord - ych * 0.25;
{
/* find the position on the y axis */
y = Win.ymin + (Win.ymax - Win.ymin) * coord - ych * 0.25;

/* find the distance from the y axis */
x = Win.xmin - (xch * displacment);
/* find the distance from the y axis */
x = Win.xmin - (xch * displacment);

/* Set the angle */
angle = 0;
}
/* Set the angle */
angle = 0;
}
else
{
/* find the position on the y axis to place text */
y = Win.ymin + (Win.ymax - Win.ymin) * coord;
{
/* find the position on the y axis to place text */
y = Win.ymin + (Win.ymax - Win.ymin) * coord;

/* shift the position of the text away from the viewport by displacement */
x = Win.xmin - (xch * displacment);
/* shift the position of the text away from the viewport by displacement */
x = Win.xmin - (xch * displacment);

/* set the angle */
angle = 90;
}
/* set the angle */
angle = 90;
}
}
/* if drawing along the right */
else if (strchr (side, 'R') || strchr (side, 'r'))
{
if (strchr (side, 'V') || strchr (side, 'v'))
{
/* find the position on the y axis */
y = Win.ymin + (Win.ymax - Win.ymin) * coord - ych * 0.25;
{
/* find the position on the y axis */
y = Win.ymin + (Win.ymax - Win.ymin) * coord - ych * 0.25;

/* find the distance from the y axis */
x = Win.xmax + (xch * displacment);
/* find the distance from the y axis */
x = Win.xmax + (xch * displacment);

/* Set the angle */
angle = 0;
}
/* Set the angle */
angle = 0;
}
else
{
/* find the position on the y axis to place text */
y = Win.ymin + (Win.ymax - Win.ymin) * coord;
{
/* find the position on the y axis to place text */
y = Win.ymin + (Win.ymax - Win.ymin) * coord;

/* shift the position of the text away from the view port by displacement */
x = Win.xmax + (xch * displacment);
/* shift the position of the text away from the view port by displacement */
x = Win.xmax + (xch * displacment);

/* set the angle */
angle = 90;
}
/* set the angle */
angle = 90;
}
}
else
{
_giza_warning ("giza_annotate",
"invalid side string, skipping annotate.");
"invalid side string, skipping annotate.");
return;
}

Expand All @@ -174,8 +174,8 @@ giza_annotate (const char *side, double displacment, double coord,
*/
void
giza_annotate_float (const char *side, float displacment, float coord,
float justification, const char *string)
float justification, const char *string)
{
giza_annotate (side, (double) displacment, (double) coord,
(double) justification, string);
(double) justification, string);
}
142 changes: 71 additions & 71 deletions src/giza-arrow.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,48 +77,48 @@ giza_arrow (double x1, double y1, double x2, double y2)
if (chx > 0)
{
if (!(_giza_equal(dx,0.) && _giza_equal(dy,0.)))
{
/* find a unit vector in the direction of the arrow */
magnitude = sqrt (dx * dx + dy * dy);
dxUnit = dx / magnitude;
dyUnit = dy / magnitude;

/* find a perpendicular unit vector */
if (_giza_equal(dxUnit,0.))
{
dxPerp = 1.;
dyPerp = 0.;
}
else if (_giza_equal(dyUnit,0.))
{
dxPerp = 0.;
dyPerp = 1.;
}
else
{
dxPerp = 1.;
dyPerp = -dxUnit / dyUnit;
magnitude = sqrt(dxPerp * dxPerp + dyPerp * dyPerp);
dxPerp = dxPerp / magnitude;
dyPerp = dyPerp / magnitude;
}

if (magnitude > 0)
{
dx = dx/magnitude;
dy = dy/magnitude;
}
else
{
dx = 1.;
dy = 0.;
magnitude = 1.0;
}

/* Calculate where the vertices of the arrow head are */
/* The point */
xpts[0] = x2;
ypts[0] = y2;
{
/* find a unit vector in the direction of the arrow */
magnitude = sqrt (dx * dx + dy * dy);
dxUnit = dx / magnitude;
dyUnit = dy / magnitude;

/* find a perpendicular unit vector */
if (_giza_equal(dxUnit,0.))
{
dxPerp = 1.;
dyPerp = 0.;
}
else if (_giza_equal(dyUnit,0.))
{
dxPerp = 0.;
dyPerp = 1.;
}
else
{
dxPerp = 1.;
dyPerp = -dxUnit / dyUnit;
magnitude = sqrt(dxPerp * dxPerp + dyPerp * dyPerp);
dxPerp = dxPerp / magnitude;
dyPerp = dyPerp / magnitude;
}

if (magnitude > 0)
{
dx = dx/magnitude;
dy = dy/magnitude;
}
else
{
dx = 1.;
dy = 0.;
magnitude = 1.0;
}

/* Calculate where the vertices of the arrow head are */
/* The point */
xpts[0] = x2;
ypts[0] = y2;

/* 'above' the unit vector
* Note that we want the hypoteneuse of the arrow head
Expand All @@ -132,37 +132,37 @@ giza_arrow (double x1, double y1, double x2, double y2)
sinangle = sin (0.5 * Arrow.angle * GIZA_DEG_TO_RAD);
cosangle = cos (0.5 * Arrow.angle * GIZA_DEG_TO_RAD);
xpts[1] = x2 - (dxUnit* cosangle + dxPerp * sinangle) * chx;
ypts[1] = y2 - (dyUnit* cosangle + dyPerp * sinangle) * chy;
ypts[1] = y2 - (dyUnit* cosangle + dyPerp * sinangle) * chy;

/* on the unit vector, the cutback */
xpts[2] = x2 - (1. - Arrow.cutback) * chx * dxUnit * cosangle;
ypts[2] = y2 - (1. - Arrow.cutback) * chy * dyUnit * cosangle;

/* 'below' the unit vector */
xpts[3] = x2 - (dxUnit* cosangle - dxPerp * sinangle) * chx ;
ypts[3] = y2 - (dyUnit* cosangle - dyPerp * sinangle) * chy;

/* draw the head */
cairo_move_to (Dev[id].context, xpts[0], ypts[0]);
cairo_line_to (Dev[id].context, xpts[1], ypts[1]);
cairo_line_to (Dev[id].context, xpts[2], ypts[2]);
cairo_line_to (Dev[id].context, xpts[3], ypts[3]);
cairo_line_to (Dev[id].context, xpts[0], ypts[0]);

/* fill it in! */
double oldMiter = cairo_get_miter_limit (Dev[id].context);
cairo_set_miter_limit (Dev[id].context, 0.);
giza_set_fill (Arrow.fs);
cairo_stroke_preserve (Dev[id].context);
_giza_fill ();
cairo_set_miter_limit (Dev[id].context, oldMiter);

/* draw the tail */
cairo_move_to (Dev[id].context, x1, y1);
cairo_line_to (Dev[id].context, xpts[2], ypts[2]);

_giza_stroke ();
}
xpts[2] = x2 - (1. - Arrow.cutback) * chx * dxUnit * cosangle;
ypts[2] = y2 - (1. - Arrow.cutback) * chy * dyUnit * cosangle;

/* 'below' the unit vector */
xpts[3] = x2 - (dxUnit* cosangle - dxPerp * sinangle) * chx ;
ypts[3] = y2 - (dyUnit* cosangle - dyPerp * sinangle) * chy;

/* draw the head */
cairo_move_to (Dev[id].context, xpts[0], ypts[0]);
cairo_line_to (Dev[id].context, xpts[1], ypts[1]);
cairo_line_to (Dev[id].context, xpts[2], ypts[2]);
cairo_line_to (Dev[id].context, xpts[3], ypts[3]);
cairo_line_to (Dev[id].context, xpts[0], ypts[0]);

/* fill it in! */
double oldMiter = cairo_get_miter_limit (Dev[id].context);
cairo_set_miter_limit (Dev[id].context, 0.);
giza_set_fill (Arrow.fs);
cairo_stroke_preserve (Dev[id].context);
_giza_fill ();
cairo_set_miter_limit (Dev[id].context, oldMiter);

/* draw the tail */
cairo_move_to (Dev[id].context, x1, y1);
cairo_line_to (Dev[id].context, xpts[2], ypts[2]);

_giza_stroke ();
}
}
_giza_set_trans (oldTrans);

Expand Down
32 changes: 16 additions & 16 deletions src/giza-axis.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ giza_axis (const char *opt, double x1, double y1, double x2, double y2,
{
case ('h'):
case ('H'):
draw_axis = 0;
draw_axis = 0;
break;
case ('t'):
case ('T'):
Expand Down Expand Up @@ -206,9 +206,9 @@ giza_axis (const char *opt, double x1, double y1, double x2, double y2,
intervalMaj = 7. * Dev[id].fontExtents.max_x_advance /
((Dev[id].VP.xmax - Dev[id].VP.xmin)*Dev[id].width);
if (intervalMaj > 0.2)
intervalMaj = 0.2;
intervalMaj = 0.2;
if (intervalMaj < 0.05)
intervalMaj = 0.05;
intervalMaj = 0.05;
intervalMaj = intervalMaj * (v2 - v1);
intervalMaj = giza_round (intervalMaj, &nMinTicks);
}
Expand Down Expand Up @@ -269,11 +269,11 @@ giza_axis (const char *opt, double x1, double y1, double x2, double y2,
nv = _giza_nint (intervalMaj/pow (10., np));

for (i = i1; i <= i2; i++)
{
val = i * intervalMaj;
ratio = (val - v1) / (v2 - v1);
{
val = i * intervalMaj;
ratio = (val - v1) / (v2 - v1);
/* don't draw label if outside frame */
if (ratio < 0. || ratio > 1.)
if (ratio < 0. || ratio > 1.)
continue;
if (draw_log)
{
Expand All @@ -297,7 +297,7 @@ giza_axis (const char *opt, double x1, double y1, double x2, double y2,
cairo_matrix_transform_point (&mat,&x,&y);
giza_ptext (x, y, theta_deg + angle, 0.5, tmp);

}
}
_giza_stroke ();
}

Expand All @@ -306,15 +306,15 @@ giza_axis (const char *opt, double x1, double y1, double x2, double y2,
{
_giza_tick_intervals (v1, v2, intervalMin, &i1, &i2);
for (i = i1 - 1; i <= i2; i++)
{
for (j = 1; j <= 4; j += 3)
{
val = (i + logTab[j]) * intervalMin;
if (val <= v2 && val >= v1)
{
for (j = 1; j <= 4; j += 3)
{
val = (i + logTab[j]) * intervalMin;
if (val <= v2 && val >= v1)
{
ratio = (val - v1) / (v2 - v1);
val = pow (10, val);
giza_format_number (j+1, _giza_nint (i * intervalMin), number_format, tmp, sizeof(tmp));
ratio = (val - v1) / (v2 - v1);
val = pow (10, val);
giza_format_number (j+1, _giza_nint (i * intervalMin), number_format, tmp, sizeof(tmp));

/* write the label */
x = dr * ratio;
Expand Down
Loading

0 comments on commit 2c7786a

Please sign in to comment.