Commit fadfcf5f authored by Maurits Rijk's avatar Maurits Rijk

Replaced underscores in filenames by hyphens.

parent 3dddb283
2003-10-24 Maurits Rijk <lpeek.mrijk@consunet.nl>
* plug-ins/gfig/gfig_*.[ch]: removed
* plug-ins/gfig/gfig-*.[ch]: added. Changed all underscores in
filenames to hyphens. More code-cleanup.
* plug-ins/gfig/Makefile.am: updated accordingly
2003-10-24 Sven Neumann <sven@gimp.org>
* app/errors.c (gimp_errors_init): fixed spelling of The GIMP.
......@@ -15,27 +15,27 @@ libexec_PROGRAMS = gfig
gfig_SOURCES = \
gfig.c \
gfig.h \
gfig_arc.c \
gfig_arc.h \
gfig_bezier.c \
gfig_bezier.h \
gfig_circle.c \
gfig_circle.h \
gfig_dobject.c \
gfig_dobject.h \
gfig_ellipse.c \
gfig_ellipse.h \
gfig_line.c \
gfig_line.h \
gfig_poly.c \
gfig_poly.h \
gfig_spiral.c \
gfig_spiral.h \
gfig_star.c \
gfig_star.h \
gfig-arc.c \
gfig-arc.h \
gfig-bezier.c \
gfig-bezier.h \
gfig-circle.c \
gfig-circle.h \
gfig-dobject.c \
gfig-dobject.h \
gfig-ellipse.c \
gfig-ellipse.h \
gfig-line.c \
gfig-line.h \
gfig-poly.c \
gfig-poly.h \
gfig-spiral.c \
gfig-spiral.h \
gfig-star.c \
gfig-star.h \
gfig-stock.c \
gfig-stock.h \
pix_data.h
pix-data.h
EXTRA_DIST = README
......
......@@ -23,6 +23,8 @@
*
*/
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
......@@ -32,11 +34,10 @@
#include <libgimp/gimp.h>
#include "config.h"
#include "libgimp/stdplugins-intl.h"
#include "gfig.h"
#include "gfig_line.h"
#include "gfig-line.h"
#include "libgimp/stdplugins-intl.h"
static Dobject *d_new_arc (gint x, gint y);
......@@ -288,8 +289,8 @@ arc_details (GdkPoint *vert_a,
if (!got_y)
inter_y = /*rint*/((line1_grad * inter_x + line1_const));
center_pnt->x = (gint16)inter_x;
center_pnt->y = (gint16)inter_y;
center_pnt->x = (gint) inter_x;
center_pnt->y = (gint) inter_y;
}
static gdouble
......@@ -458,36 +459,9 @@ d_draw_arc (Dobject * obj)
if (!obj)
return;
arc_drawing_details (obj, &minang, &center_pnt, &arcang, &radius, TRUE, FALSE);
if (drawing_pic)
{
gdk_draw_arc (pic_preview->window,
pic_preview->style->black_gc,
0,
adjust_pic_coords (center_pnt.x - (gint)radius,
preview_width),
adjust_pic_coords (center_pnt.y - (gint)radius,
preview_height),
adjust_pic_coords ((gint) (radius * 2),
preview_width),
adjust_pic_coords ((gint) (radius * 2),
preview_height),
(gint) (minang*64),
(gint) (arcang*64));
}
else
{
gdk_draw_arc (gfig_preview->window,
gfig_gc,
0,
gfig_scale_x (center_pnt.x - (gint)radius),
gfig_scale_y (center_pnt.y - (gint)radius),
gfig_scale_x ((gint) (radius * 2)),
gfig_scale_y ((gint) (radius * 2)),
(gint) (minang*64),
(gint) (arcang*64));
}
arc_drawing_details (obj, &minang, &center_pnt, &arcang, &radius, TRUE,
FALSE);
gfig_draw_arc (center_pnt.x, center_pnt.y, radius, radius, minang, arcang);
}
static void
......@@ -503,7 +477,7 @@ d_paint_arc (Dobject *obj)
gdouble radius;
gint loop;
GdkPoint first_pnt, last_pnt;
gint first = 1;
gboolean first = TRUE;
GdkPoint center_pnt;
gdouble minang, arcang;
......@@ -554,13 +528,14 @@ d_paint_arc (Dobject *obj)
}
}
last_pnt.x = line_pnts[i++] = calc_pnt.x;
last_pnt.y = line_pnts[i++] = calc_pnt.y;
line_pnts[i++] = calc_pnt.x;
line_pnts[i++] = calc_pnt.y;
last_pnt = calc_pnt;
if (first)
{
first_pnt = calc_pnt;
first = 0;
first = FALSE;
}
}
......@@ -600,13 +575,9 @@ d_copy_arc (Dobject * obj)
{
Dobject *nc;
if (!obj)
return NULL;
g_assert (obj->type == ARC);
nc = d_new_arc (obj->points->pnt.x, obj->points->pnt.y);
nc->points->next = d_copy_dobjpoints (obj->points->next);
return nc;
......
......@@ -23,6 +23,8 @@
*
*/
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <string.h>
......@@ -32,14 +34,13 @@
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
#include "config.h"
#include "libgimp/stdplugins-intl.h"
#include "gfig.h"
#include "libgimp/stdplugins-intl.h"
static gint bezier_closed = 0; /* Closed curve 0 = false 1 = true */
static gint bezier_line_frame = 0; /* Show frame = false 1 = true */
Dobject *tmp_bezier; /* Neeed when drawing bezier curves */
Dobject *tmp_bezier; /* Needed when drawing bezier curves */
static void d_paint_bezier (Dobject *obj);
static Dobject * d_copy_bezier (Dobject * obj);
......@@ -177,24 +178,7 @@ d_bz_line (void)
x1 = fp_pnt_pnts[i + 2];
y1 = fp_pnt_pnts[i + 3];
if (drawing_pic)
{
gdk_draw_line (pic_preview->window,
pic_preview->style->black_gc,
adjust_pic_coords (x0, preview_width),
adjust_pic_coords (y0, preview_height),
adjust_pic_coords (x1, preview_width),
adjust_pic_coords (y1, preview_height));
}
else
{
gdk_draw_line (gfig_preview->window,
gfig_gc,
gfig_scale_x (x0),
gfig_scale_y (y0),
gfig_scale_x (x1),
gfig_scale_y (y1));
}
gfig_draw_line (x0, y0, x1, y1);
}
}
......@@ -364,19 +348,14 @@ d_paint_bezier (Dobject *obj)
}
static Dobject *
d_copy_bezier (Dobject * obj)
d_copy_bezier (Dobject *obj)
{
Dobject *np;
if (!obj)
return (NULL);
g_assert (obj->type == BEZIER);
np = d_new_bezier (obj->points->pnt.x, obj->points->pnt.y);
np->points->next = d_copy_dobjpoints (obj->points->next);
np->type_data = obj->type_data;
return np;
......@@ -429,8 +408,7 @@ d_update_bezier (GdkPoint *pnt)
draw_circle (&l_pnt->pnt);
selvals.opts.showcontrol = 0;
d_draw_bezier (tmp_bezier);
l_pnt->pnt.x = pnt->x;
l_pnt->pnt.y = pnt->y;
l_pnt->pnt = *pnt;
}
else
{
......@@ -452,12 +430,10 @@ d_update_bezier (GdkPoint *pnt)
void
d_bezier_start (GdkPoint *pnt, gint shift_down)
{
gint16 x, y;
/* First is center point */
if (!tmp_bezier)
{
/* New curve */
tmp_bezier = obj_creating = d_new_bezier (x = pnt->x, y = pnt->y);
tmp_bezier = obj_creating = d_new_bezier (pnt->x, pnt->y);
}
}
......
......@@ -23,6 +23,8 @@
*
*/
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <string.h>
......@@ -32,13 +34,12 @@
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
#include "config.h"
#include "libgimp/stdplugins-intl.h"
#include "gfig.h"
#include "gfig_poly.h"
#include "gfig-poly.h"
#include "libgimp/stdplugins-intl.h"
static Dobject * d_new_circle (gint x, gint y);
static Dobject *d_new_circle (gint x, gint y);
static void
d_save_circle (Dobject *obj,
......@@ -83,12 +84,20 @@ d_load_circle (FILE *from)
return NULL;
}
static gint
calc_radius (GdkPoint *center, GdkPoint *edge)
{
gint dx = center->x - edge->x;
gint dy = center->y - edge->y;
return (gint) sqrt (dx * dx + dy * dy);
}
static void
d_draw_circle (Dobject * obj)
d_draw_circle (Dobject *obj)
{
DobjPoints *center_pnt;
DobjPoints *edge_pnt;
gdouble radius;
gint radius;
center_pnt = obj->points;
......@@ -102,42 +111,11 @@ d_draw_circle (Dobject * obj)
g_warning ("Internal error - circle no edge pnt");
}
radius = sqrt (((center_pnt->pnt.x - edge_pnt->pnt.x) *
(center_pnt->pnt.x - edge_pnt->pnt.x)) +
((center_pnt->pnt.y - edge_pnt->pnt.y) *
(center_pnt->pnt.y - edge_pnt->pnt.y)));
radius = calc_radius (&center_pnt->pnt, &edge_pnt->pnt);
draw_sqr (&center_pnt->pnt);
draw_sqr (&edge_pnt->pnt);
if (drawing_pic)
{
gdk_draw_arc (pic_preview->window,
pic_preview->style->black_gc,
0,
adjust_pic_coords (center_pnt->pnt.x - radius,
preview_width),
adjust_pic_coords (center_pnt->pnt.y - radius,
preview_height),
adjust_pic_coords (radius * 2,
preview_width),
adjust_pic_coords (radius * 2,
preview_height),
0,
360 * 64);
}
else
{
gdk_draw_arc (gfig_preview->window,
gfig_gc,
0,
gfig_scale_x (center_pnt->pnt.x - (gint) RINT (radius)),
gfig_scale_y (center_pnt->pnt.y - (gint) RINT (radius)),
gfig_scale_x ((gint) RINT (radius) * 2),
gfig_scale_y ((gint) RINT (radius) * 2),
0,
360 * 64);
}
gfig_draw_arc (center_pnt->pnt.x, center_pnt->pnt.y, radius, radius, 0, 360);
}
static void
......@@ -174,10 +152,7 @@ d_paint_circle (Dobject *obj)
g_error ("Internal error - circle no edge pnt");
}
radius = (gint) sqrt (((center_pnt->pnt.x - edge_pnt->pnt.x) *
(center_pnt->pnt.x - edge_pnt->pnt.x)) +
((center_pnt->pnt.y - edge_pnt->pnt.y) *
(center_pnt->pnt.y - edge_pnt->pnt.y)));
radius = calc_radius (&center_pnt->pnt, &edge_pnt->pnt);
dpnts[0] = (gdouble) center_pnt->pnt.x - radius;
dpnts[1] = (gdouble) center_pnt->pnt.y - radius;
......@@ -206,18 +181,14 @@ d_paint_circle (Dobject *obj)
gimp_selection_clear (gfig_image);
}
static Dobject *
static Dobject*
d_copy_circle (Dobject * obj)
{
Dobject *nc;
if (!obj)
return NULL;
g_assert (obj->type == CIRCLE);
nc = d_new_circle (obj->points->pnt.x, obj->points->pnt.y);
nc->points->next = d_copy_dobjpoints (obj->points->next);
return nc;
......@@ -246,7 +217,7 @@ void
d_update_circle (GdkPoint *pnt)
{
DobjPoints *center_pnt, *edge_pnt;
gdouble radius;
gint radius;
/* Undraw last one then draw new one */
center_pnt = obj_creating->points;
......@@ -258,10 +229,7 @@ d_update_circle (GdkPoint *pnt)
{
/* Undraw current */
draw_circle (&edge_pnt->pnt);
radius = sqrt (((center_pnt->pnt.x - edge_pnt->pnt.x) *
(center_pnt->pnt.x - edge_pnt->pnt.x)) +
((center_pnt->pnt.y - edge_pnt->pnt.y) *
(center_pnt->pnt.y - edge_pnt->pnt.y)));
radius = calc_radius (&center_pnt->pnt, &edge_pnt->pnt);
gdk_draw_arc (gfig_preview->window,
gfig_gc,
......@@ -277,11 +245,7 @@ d_update_circle (GdkPoint *pnt)
draw_circle (pnt);
edge_pnt = new_dobjpoint (pnt->x, pnt->y);
radius = sqrt (((center_pnt->pnt.x - edge_pnt->pnt.x) *
(center_pnt->pnt.x - edge_pnt->pnt.x)) +
((center_pnt->pnt.y - edge_pnt->pnt.y) *
(center_pnt->pnt.y - edge_pnt->pnt.y)));
radius = calc_radius (&center_pnt->pnt, &edge_pnt->pnt);
gdk_draw_arc (gfig_preview->window,
gfig_gc,
......
......@@ -22,31 +22,32 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include "config.h"
#include "libgimp/stdplugins-intl.h"
#include "gfig.h"
#include "gfig_arc.h"
#include "gfig_bezier.h"
#include "gfig_circle.h"
#include "gfig_dobject.h"
#include "gfig_ellipse.h"
#include "gfig_line.h"
#include "gfig_poly.h"
#include "gfig_spiral.h"
#include "gfig_star.h"
#include "gfig-arc.h"
#include "gfig-bezier.h"
#include "gfig-circle.h"
#include "gfig-dobject.h"
#include "gfig-ellipse.h"
#include "gfig-line.h"
#include "gfig-poly.h"
#include "gfig-spiral.h"
#include "gfig-star.h"
#include "libgimp/stdplugins-intl.h"
static Dobject *operation_obj;
static GdkPoint *move_all_pnt; /* Point moving all from */
static void draw_one_obj (Dobject * obj);
static void do_move_obj (Dobject *obj,
GdkPoint *to_pnt);
static void draw_one_obj (Dobject *obj);
static void do_move_obj (Dobject *obj,
GdkPoint *to_pnt);
static void do_move_all_obj (GdkPoint *to_pnt);
static void do_move_obj_pnt (Dobject *obj,
GdkPoint *to_pnt);
......@@ -82,27 +83,26 @@ new_dobjpoint (gint x, gint y)
}
DobjPoints *
d_copy_dobjpoints (DobjPoints * pnts)
d_copy_dobjpoints (DobjPoints *pnts)
{
DobjPoints *ret = NULL;
DobjPoints *head = NULL;
DobjPoints *newpnt;
DobjPoints *pnt2copy = pnts;
DobjPoints *pnt2copy;
while (pnt2copy)
for (pnt2copy = pnts; pnt2copy; pnt2copy = pnt2copy->next)
{
newpnt = g_new0 (DobjPoints, 1);
newpnt->pnt.x = pnt2copy->pnt.x;
newpnt->pnt.y = pnt2copy->pnt.y;
newpnt = new_dobjpoint (pnt2copy->pnt.x, pnt2copy->pnt.y);
if (!ret)
head = ret = newpnt;
{
head = ret = newpnt;
}
else
{
head->next = newpnt;
head = newpnt;
}
pnt2copy = pnt2copy->next;
}
return ret;
......@@ -110,8 +110,8 @@ d_copy_dobjpoints (DobjPoints * pnts)
static DobjPoints *
get_diffs (Dobject *obj,
gint16 *xdiff,
gint16 *ydiff,
gint *xdiff,
gint *ydiff,
GdkPoint *to_pnt)
{
DobjPoints *spnt;
......@@ -135,15 +135,15 @@ inside_sqr (GdkPoint *cpnt,
GdkPoint *testpnt)
{
/* Return TRUE if testpnt is near cpnt */
gint16 x = cpnt->x;
gint16 y = cpnt->y;
gint16 tx = testpnt->x;
gint16 ty = testpnt->y;
gint x = cpnt->x;
gint y = cpnt->y;
gint tx = testpnt->x;
gint ty = testpnt->y;
return (abs (x - tx) <= SQ_SIZE && abs (y - ty) < SQ_SIZE);
}
static gint
static gboolean
scan_obj_points (DobjPoints *opnt,
GdkPoint *pnt)
{
......@@ -172,9 +172,7 @@ get_nearest_objs (GFigObj *obj,
if (!obj)
return NULL;
all = obj->obj_list;
while (all)
for (all = obj->obj_list; all; all = all->next)
{
test_obj = all->obj;
......@@ -183,7 +181,6 @@ get_nearest_objs (GFigObj *obj,
{
return test_obj;
}
all = all->next;
count++;
}
return NULL;
......@@ -254,7 +251,7 @@ object_operation_start (GdkPoint *pnt,
/* Copy the "operation object" */
/* Then bung us into "copy/move" mode */
new_obj = (Dobject *) operation_obj->copyfunc (operation_obj);
new_obj = (Dobject*) operation_obj->copyfunc (operation_obj);
if (new_obj)
{
scan_obj_points (new_obj->points, pnt);
......@@ -369,8 +366,8 @@ object_operation (GdkPoint *to_pnt,
static void
update_pnts (Dobject *obj,
gint16 xdiff,
gint16 ydiff)
gint xdiff,
gint ydiff)
{
DobjPoints *spnt;
......@@ -401,10 +398,6 @@ remove_obj_from_list (GFigObj *obj,
if (all->obj == del_obj)
{
/* Found the one to delete */
#ifdef DEBUG
printf ("Found the one to delete\n");
#endif /* DEBUG */
if (prev_all)
prev_all->next = all->next;
else
......@@ -435,8 +428,8 @@ do_move_all_obj (GdkPoint *to_pnt)
{
/* Move all objects in one go */
/* Undraw/then draw in new pos */
gint16 xdiff = move_all_pnt->x - to_pnt->x;
gint16 ydiff = move_all_pnt->y - to_pnt->y;
gint xdiff = move_all_pnt->x - to_pnt->x;
gint ydiff = move_all_pnt->y - to_pnt->y;
if (xdiff || ydiff)
{
......@@ -476,8 +469,8 @@ do_move_obj (Dobject *obj,
{
/* Move the whole line - undraw the line to start with */
/* Then draw in new pos */
gint16 xdiff = 0;
gint16 ydiff = 0;
gint xdiff = 0;
gint ydiff = 0;
get_diffs (obj, &xdiff, &ydiff, to_pnt);
......@@ -500,8 +493,8 @@ do_move_obj_pnt (Dobject *obj,
/* Move the whole line - undraw the line to start with */
/* Then draw in new pos */
DobjPoints *spnt;
gint16 xdiff = 0;
gint16 ydiff = 0;
gint xdiff = 0;
gint ydiff = 0;
spnt = get_diffs (obj, &xdiff, &ydiff, to_pnt);
......
......@@ -23,6 +23,8 @@
*
*/
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
......@@ -33,13 +35,12 @@
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
#include "config.h"
#include "libgimp/stdplugins-intl.h"
#include "gfig.h"
#include "gfig_poly.h"
#include "gfig-poly.h"
static Dobject * d_new_ellipse (gint x, gint y);
#include "libgimp/stdplugins-intl.h"
static Dobject *d_new_ellipse (gint x, gint y);
static void
d_save_ellipse (Dobject *obj,
......@@ -122,34 +123,7 @@ d_draw_ellipse (Dobject * obj)
else
top_y = edge_pnt->pnt.y;
if (drawing_pic)
{
gdk_draw_arc (pic_preview->window,
pic_preview->style->black_gc,
0,
adjust_pic_coords (top_x,
preview_width),
adjust_pic_coords (top_y,
preview_height),
adjust_pic_coords (bound_wx,
preview_width),
adjust_pic_coords (bound_wy,
preview_height),
0,
360 * 64);
}
else
{
gdk_draw_arc (gfig_preview->window,
gfig_gc,
0,
gfig_scale_x (top_x),
gfig_scale_y (top_y),
gfig_scale_x (bound_wx),
gfig_scale_y (bound_wy),
0,
360 * 64);
}
gfig_draw_arc (top_x, top_y, bound_wx, bound_wy, 0, 360);
}
static void
......@@ -169,7 +143,7 @@ d_paint_approx_ellipse (Dobject *obj)
gdouble radius;
gint loop;
GdkPoint first_pnt, last_pnt;
gint first = 1;
gboolean first = TRUE;
g_assert (obj != NULL);
......@@ -220,13 +194,14 @@ d_paint_approx_ellipse (Dobject *obj)
}
}
last_pnt.x = line_pnts[i++] = calc_pnt.x;
last_pnt.y = line_pnts[i++] = calc_pnt.y;
line_pnts[i++] = calc_pnt.x;
line_pnts[i++] = calc_pnt.y;
last_pnt = calc_pnt;
if (first)
{
first_pnt = calc_pnt;
first = 0;
first = FALSE;
}
}
......@@ -285,10 +260,6 @@ d_paint_ellipse (Dobject *obj)
if (selvals.approxcircles)
{
#ifdef DEBUG
printf ("Painting ellipse as polygon\n");
#endif /* DEBUG */
d_paint_approx_ellipse (obj);
return;
}
......@@ -352,13 +323,9 @@ d_copy_ellipse (Dobject * obj)
{
Dobject *nc;
if (!obj)
return (NULL);
g_assert (obj->type == ELLIPSE);