Replaced underscores in filenames by hyphens.

This commit is contained in:
Maurits Rijk 2003-10-24 13:28:46 +00:00
parent 3dddb283fe
commit fadfcf5f11
23 changed files with 306 additions and 576 deletions

View File

@ -1,3 +1,10 @@
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.

View File

@ -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

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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 "gfig.h"
#include "gfig-poly.h"
#include "libgimp/stdplugins-intl.h"
#include "gfig.h"
#include "gfig_poly.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,

View File

@ -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);

View File

@ -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 "gfig.h"
#include "gfig-poly.h"
#include "libgimp/stdplugins-intl.h"
#include "gfig.h"
#include "gfig_poly.h"
static Dobject * d_new_ellipse (gint x, gint y);
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);
nc = d_new_ellipse (obj->points->pnt.x, obj->points->pnt.y);
nc->points->next = d_copy_dobjpoints (obj->points->next);
return nc;

View File

@ -23,6 +23,8 @@
*
*/
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <string.h>
@ -32,11 +34,10 @@
#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 Dobject * d_new_line (gint x, gint y);
void
@ -84,13 +85,9 @@ d_copy_line (Dobject *obj)
{
Dobject *nl;
if (!obj)
return NULL;
g_assert (obj->type == LINE);
nl = d_new_line (obj->points->pnt.x, obj->points->pnt.y);
nl = d_new_line (obj->points->pnt.x, obj->points->pnt.y);
nl->points->next = d_copy_dobjpoints (obj->points->next);
return nl;
@ -113,24 +110,7 @@ d_draw_line (Dobject *obj)
{
draw_sqr (&spnt->pnt);
/* Go around all the points drawing a line from one to the next */
if (drawing_pic)
{
gdk_draw_line (pic_preview->window,
pic_preview->style->black_gc,
adjust_pic_coords (spnt->pnt.x, preview_width),
adjust_pic_coords (spnt->pnt.y, preview_height),
adjust_pic_coords (epnt->pnt.x, preview_width),
adjust_pic_coords (epnt->pnt.y, preview_height));
}
else
{
gdk_draw_line (gfig_preview->window,
gfig_gc,
gfig_scale_x (spnt->pnt.x),
gfig_scale_y (spnt->pnt.y),
gfig_scale_x (epnt->pnt.x),
gfig_scale_y (epnt->pnt.y));
}
gfig_draw_line (spnt->pnt.x, spnt->pnt.y, epnt->pnt.x, epnt->pnt.y);
spnt = epnt;
epnt = epnt->next;
}

View File

@ -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 "gfig.h"
#include "gfig-line.h"
#include "libgimp/stdplugins-intl.h"
#include "gfig.h"
#include "gfig_line.h"
static gint poly_num_sides = 3; /* Default to three sided object */
static gint poly_num_sides = 3; /* Default to three sided object */
static void d_save_poly (Dobject * obj, FILE *to);
static void d_draw_poly (Dobject *obj);
@ -196,28 +197,7 @@ d_draw_poly (Dobject *obj)
if (calc_pnt.x == start_pnt.x && calc_pnt.y == start_pnt.y)
continue;
if (drawing_pic)
{
gdk_draw_line (pic_preview->window,
pic_preview->style->black_gc,
adjust_pic_coords (calc_pnt.x,
preview_width),
adjust_pic_coords (calc_pnt.y,
preview_height),
adjust_pic_coords (start_pnt.x,
preview_width),
adjust_pic_coords (start_pnt.y,
preview_height));
}
else
{
gdk_draw_line (gfig_preview->window,
gfig_gc,
gfig_scale_x (calc_pnt.x),
gfig_scale_y (calc_pnt.y),
gfig_scale_x (start_pnt.x),
gfig_scale_y (start_pnt.y));
}
gfig_draw_line (calc_pnt.x, calc_pnt.y, start_pnt.x, start_pnt.y);
}
else
{
@ -227,25 +207,7 @@ d_draw_poly (Dobject *obj)
start_pnt = calc_pnt;
}
/* Join up */
if (drawing_pic)
{
gdk_draw_line (pic_preview->window,
pic_preview->style->black_gc,
adjust_pic_coords (first_pnt.x, preview_width),
adjust_pic_coords (first_pnt.y, preview_width),
adjust_pic_coords (start_pnt.x, preview_width),
adjust_pic_coords (start_pnt.y, preview_width));
}
else
{
gdk_draw_line (gfig_preview->window,
gfig_gc,
gfig_scale_x (first_pnt.x),
gfig_scale_y (first_pnt.y),
gfig_scale_x (start_pnt.x),
gfig_scale_y (start_pnt.y));
}
gfig_draw_line (first_pnt.x, first_pnt.y, start_pnt.x, start_pnt.y);
}
void
@ -585,19 +547,14 @@ d_star2lines (Dobject *obj)
}
static Dobject *
d_copy_poly (Dobject * obj)
d_copy_poly (Dobject *obj)
{
Dobject *np;
if (!obj)
return (NULL);
g_assert (obj->type == POLY);
np = d_new_poly (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;
@ -652,8 +609,7 @@ d_update_poly (GdkPoint *pnt)
selvals.opts.showcontrol = 0;
d_draw_poly (obj_creating);
edge_pnt->pnt.x = pnt->x;
edge_pnt->pnt.y = pnt->y;
edge_pnt->pnt = *pnt;
}
else
{
@ -676,7 +632,7 @@ void
d_poly_start (GdkPoint *pnt,
gint shift_down)
{
obj_creating = d_new_poly ((gint16) pnt->x, (gint16) pnt->y);
obj_creating = d_new_poly (pnt->x, pnt->y);
obj_creating->type_data = poly_num_sides;
}

View File

@ -23,6 +23,8 @@
*
*/
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
@ -33,18 +35,17 @@
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
#include "config.h"
#include "libgimp/stdplugins-intl.h"
#include "gfig.h"
static void d_draw_spiral (Dobject *obj);
static void d_paint_spiral (Dobject *obj);
static Dobject * d_copy_spiral (Dobject * obj);
static Dobject * d_new_spiral (gint x, gint y);
#include "libgimp/stdplugins-intl.h"
static gint spiral_num_turns = 4; /* Default to 4 turns */
static gint spiral_toggle = 0; /* 0 = clockwise -1 = anti-clockwise */
static void d_draw_spiral (Dobject *obj);
static void d_paint_spiral (Dobject *obj);
static Dobject *d_copy_spiral (Dobject * obj);
static Dobject *d_new_spiral (gint x, gint y);
static gint spiral_num_turns = 4; /* Default to 4 turns */
static gint spiral_toggle = 0; /* 0 = clockwise -1 = anti-clockwise */
gint
spiral_button_press (GtkWidget *widget,
@ -144,7 +145,7 @@ d_draw_spiral (Dobject *obj)
gint loop;
GdkPoint start_pnt;
GdkPoint first_pnt;
gint do_line = 0;
gboolean do_line = FALSE;
gint clock_wise = 1;
center_pnt = obj->points;
@ -190,7 +191,8 @@ d_draw_spiral (Dobject *obj)
ang_grid = 2.0*G_PI/(gdouble)180;
for (loop = 0 ; loop <= abs (obj->type_data * 180) + clock_wise*(gint)RINT (offset_angle/ang_grid) ; loop++)
for (loop = 0 ; loop <= abs (obj->type_data * 180) +
clock_wise * (gint)RINT (offset_angle/ang_grid) ; loop++)
{
gdouble lx, ly;
GdkPoint calc_pnt;
@ -205,42 +207,18 @@ d_draw_spiral (Dobject *obj)
if (do_line)
{
/* Miss out points that come to the same location */
if (calc_pnt.x == start_pnt.x && calc_pnt.y == start_pnt.y)
continue;
if (drawing_pic)
{
gdk_draw_line (pic_preview->window,
pic_preview->style->black_gc,
adjust_pic_coords (calc_pnt.x,
preview_width),
adjust_pic_coords (calc_pnt.y,
preview_height),
adjust_pic_coords (start_pnt.x,
preview_width),
adjust_pic_coords (start_pnt.y,
preview_height));
}
else
{
gdk_draw_line (gfig_preview->window,
gfig_gc,
gfig_scale_x (calc_pnt.x),
gfig_scale_y (calc_pnt.y),
gfig_scale_x (start_pnt.x),
gfig_scale_y (start_pnt.y));
}
gfig_draw_line (calc_pnt.x, calc_pnt.y, start_pnt.x, start_pnt.y);
}
else
{
do_line = 1;
first_pnt.x = calc_pnt.x;
first_pnt.y = calc_pnt.y;
do_line = TRUE;
first_pnt = calc_pnt;
}
start_pnt.x = calc_pnt.x;
start_pnt.y = calc_pnt.y;
start_pnt = calc_pnt;
}
}
@ -321,8 +299,9 @@ d_paint_spiral (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;
}
/* Reverse line if approp */
@ -356,19 +335,14 @@ d_paint_spiral (Dobject *obj)
}
static Dobject *
d_copy_spiral (Dobject * obj)
d_copy_spiral (Dobject *obj)
{
Dobject *np;
if (!obj)
return NULL;
g_assert (obj->type == SPIRAL);
np = d_new_spiral (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;
@ -383,7 +357,7 @@ d_new_spiral (gint x,
nobj = g_new0 (Dobject, 1);
nobj->type = SPIRAL;
nobj->type_data = 4; /* Default to four turns */
nobj->type_data = 4; /* Default to for turns */
nobj->points = new_dobjpoint (x, y);
nobj->drawfunc = d_draw_spiral;
nobj->loadfunc = d_load_spiral;
@ -391,7 +365,7 @@ d_new_spiral (gint x,
nobj->paintfunc = d_paint_spiral;
nobj->copyfunc = d_copy_spiral;
return (nobj);
return nobj;
}
void
@ -423,8 +397,7 @@ d_update_spiral (GdkPoint *pnt)
selvals.opts.showcontrol = 0;
d_draw_spiral (obj_creating);
edge_pnt->pnt.x = pnt->x;
edge_pnt->pnt.y = pnt->y;
edge_pnt->pnt = *pnt;
}
else
{
@ -447,7 +420,7 @@ void
d_spiral_start (GdkPoint *pnt,
gint shift_down)
{
obj_creating = d_new_spiral ((gint16) pnt->x, (gint16) pnt->y);
obj_creating = d_new_spiral (pnt->x, pnt->y);
obj_creating->type_data = spiral_num_turns * ((spiral_toggle == 0) ? 1 : -1);
}

View File

@ -23,6 +23,8 @@
*
*/
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <string.h>
@ -32,20 +34,19 @@
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
#include "config.h"
#include "libgimp/stdplugins-intl.h"
#include "gfig.h"
static gint star_num_sides = 3; /* Default to three sided object */
#include "libgimp/stdplugins-intl.h"
static void d_save_star (Dobject * obj, FILE *to);
static void d_draw_star (Dobject *obj);
static void d_paint_star (Dobject *obj);
static Dobject * d_copy_star (Dobject * obj);
static Dobject * d_new_star (gint x, gint y);
static gint star_num_sides = 3; /* Default to three sided object */
gint
static void d_save_star (Dobject * obj, FILE *to);
static void d_draw_star (Dobject *obj);
static void d_paint_star (Dobject *obj);
static Dobject *d_copy_star (Dobject * obj);
static Dobject *d_new_star (gint x, gint y);
gboolean
star_button_press (GtkWidget *widget,
GdkEventButton *event,
gpointer data)
@ -142,7 +143,7 @@ d_draw_star (Dobject *obj)
gint loop;
GdkPoint start_pnt;
GdkPoint first_pnt;
gint do_line = 0;
gboolean do_line = FALSE;
center_pnt = obj->points;
@ -155,7 +156,7 @@ d_draw_star (Dobject *obj)
draw_sqr (&center_pnt->pnt);
/* Next point defines the radius */
outer_radius_pnt = center_pnt->next; /* this defines the vetices */
outer_radius_pnt = center_pnt->next; /* this defines the vertices */
if (!outer_radius_pnt)
{
@ -165,7 +166,7 @@ d_draw_star (Dobject *obj)
return;
}
inner_radius_pnt = outer_radius_pnt->next; /* this defines the vetices */
inner_radius_pnt = outer_radius_pnt->next; /* this defines the vertices */
if (!inner_radius_pnt)
{
@ -202,7 +203,7 @@ d_draw_star (Dobject *obj)
ang_loop = (gdouble)loop * ang_grid + offset_angle;
if (loop%2)
if (loop % 2)
{
lx = inner_radius * cos (ang_loop);
ly = inner_radius * sin (ang_loop);
@ -223,58 +224,17 @@ d_draw_star (Dobject *obj)
if (calc_pnt.x == start_pnt.x && calc_pnt.y == start_pnt.y)
continue;
if (drawing_pic)
{
gdk_draw_line (pic_preview->window,
pic_preview->style->black_gc,
adjust_pic_coords (calc_pnt.x,
preview_width),
adjust_pic_coords (calc_pnt.y,
preview_height),
adjust_pic_coords (start_pnt.x,
preview_width),
adjust_pic_coords (start_pnt.y,
preview_height));
}
else
{
gdk_draw_line (gfig_preview->window,
gfig_gc,
gfig_scale_x (calc_pnt.x),
gfig_scale_y (calc_pnt.y),
gfig_scale_x (start_pnt.x),
gfig_scale_y (start_pnt.y));
}
gfig_draw_line (calc_pnt.x, calc_pnt.y, start_pnt.x, start_pnt.y);
}
else
{
do_line = 1;
first_pnt.x = calc_pnt.x;
first_pnt.y = calc_pnt.y;
do_line = TRUE;
first_pnt = calc_pnt;
}
start_pnt.x = calc_pnt.x;
start_pnt.y = calc_pnt.y;
start_pnt = calc_pnt;
}
/* Join up */
if (drawing_pic)
{
gdk_draw_line (pic_preview->window,
pic_preview->style->black_gc,
adjust_pic_coords (first_pnt.x, preview_width),
adjust_pic_coords (first_pnt.y, preview_width),
adjust_pic_coords (start_pnt.x, preview_width),
adjust_pic_coords (start_pnt.y, preview_width));
}
else
{
gdk_draw_line (gfig_preview->window,
gfig_gc,
gfig_scale_x (first_pnt.x),
gfig_scale_y (first_pnt.y),
gfig_scale_x (start_pnt.x),
gfig_scale_y (start_pnt.y));
}
gfig_draw_line (first_pnt.x, first_pnt.y, start_pnt.x, start_pnt.y);
}
static void
@ -294,11 +254,10 @@ d_paint_star (Dobject *obj)
gdouble ang_loop;
gdouble outer_radius;
gdouble inner_radius;
gdouble offset_angle;
gint loop;
GdkPoint first_pnt, last_pnt;
gint first = 1;
gboolean first = TRUE;
g_assert (obj != NULL);
@ -355,7 +314,7 @@ d_paint_star (Dobject *obj)
ang_loop = (gdouble)loop * ang_grid + offset_angle;
if (loop%2)
if (loop % 2)
{
lx = inner_radius * cos (ang_loop);
ly = inner_radius * sin (ang_loop);
@ -385,7 +344,7 @@ d_paint_star (Dobject *obj)
if (first)
{
first_pnt = calc_pnt;
first = 0;
first = FALSE;
}
}
@ -423,19 +382,14 @@ d_paint_star (Dobject *obj)
}
static Dobject *
d_copy_star (Dobject * obj)
d_copy_star (Dobject *obj)
{
Dobject *np;
if (!obj)
return (NULL);
g_assert (obj->type == STAR);
np = d_new_star (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;
@ -492,8 +446,7 @@ d_update_star (GdkPoint *pnt)
draw_circle (&outer_pnt->pnt);
selvals.opts.showcontrol = 0;
d_draw_star (obj_creating);
outer_pnt->pnt.x = pnt->x;
outer_pnt->pnt.y = pnt->y;
outer_pnt->pnt = *pnt;
inner_pnt->pnt.x = pnt->x + (2*(center_pnt->pnt.x - pnt->x))/3;
inner_pnt->pnt.y = pnt->y + (2*(center_pnt->pnt.y - pnt->y))/3;
}
@ -525,7 +478,7 @@ void
d_star_start (GdkPoint *pnt,
gint shift_down)
{
obj_creating = d_new_star ((gint) pnt->x, (gint) pnt->y);
obj_creating = d_new_star (pnt->x, pnt->y);
obj_creating->type_data = star_num_sides;
}

View File

@ -26,9 +26,9 @@
#ifndef __GFIG_STAR_H__
#define __GFIG_STAR_H__
gint star_button_press (GtkWidget *widget,
GdkEventButton *event,
gpointer data);
gboolean star_button_press (GtkWidget *widget,
GdkEventButton *event,
gpointer data);
void d_update_star (GdkPoint *pnt);
void d_star_start (GdkPoint *pnt, gint shift_down);

View File

@ -54,18 +54,18 @@
#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 "gfig-stock.h"
#include "pix_data.h"
#include "pix-data.h"
/***** Magic numbers *****/
@ -105,7 +105,6 @@ gint32 gfig_drawable;
static GtkWidget *brush_page_pw;
static GtkWidget *brush_sel_button;
static gint tile_width, tile_height;
static gint img_width, img_height, img_bpp, real_img_bpp;
static void query (void);
@ -139,7 +138,8 @@ static void gfig_scale_update_scale (GtkAdjustment *adjustment,
static void gfig_scale2img_update (GtkWidget *widget,
gpointer data);
static gint gfig_scale_x (gint x);
static gint gfig_scale_y (gint y);
static gint gfig_invscale_x (gint x);
static gint gfig_invscale_y (gint y);
static GdkGC * gfig_get_grid_gc (GtkWidget *widget,
@ -319,7 +319,7 @@ static GtkWidget *select_page_widget; /* Widget for the selection part
* of notebook */
static gint undo_water_mark = -1; /* Last slot filled in -1 = no undo */
gint drawing_pic = FALSE; /* If true drawing to the small preview */
gboolean drawing_pic = FALSE; /* If true drawing to the small preview */
static GtkWidget *status_label_dname;
static GtkWidget *status_label_fname;
static GFigObj *gfig_obj_for_menu; /* More static data -
@ -407,8 +407,6 @@ run (const gchar *name,
gint pwidth, pheight;
/*kill (getpid (), 19);*/
INIT_I18N ();
run_mode = param[0].data.d_int32;
@ -423,9 +421,6 @@ run (const gchar *name,
gfig_select_drawable = drawable = gimp_drawable_get (param[2].data.d_drawable);
tile_width = gimp_tile_width ();
tile_height = gimp_tile_height ();
/* TMP Hack - clear any selections */
if (! gimp_selection_is_empty (gfig_image))
gimp_selection_clear (gfig_image);
@ -1674,7 +1669,7 @@ draw_buttons (GtkWidget *ww)
}
/* Brush preview stuff */
static gint
static gboolean
gfig_brush_preview_events (GtkWidget *widget,
GdkEvent *event)
{
@ -1774,7 +1769,6 @@ gfig_brush_menu_callback (GtkWidget *widget,
gfig_brush_update_preview (widget, data);
}
static GtkWidget *
gfig_brush_preview (GtkWidget **pv)
{
@ -1902,66 +1896,41 @@ gfig_brush_fill_preview (GtkWidget *pw,
}
static void
mygimp_brush_set (gchar *name)
mygimp_brush_set (const gchar *name)
{
GimpParam *return_vals;
int nreturn_vals;
return_vals = gimp_run_procedure ("gimp_brushes_set_brush",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_END);
if (return_vals[0].data.d_status != GIMP_PDB_SUCCESS)
if (!gimp_brushes_set_brush (name))
{
g_message ("Can't set brush...(1)");
}
gimp_destroy_params (return_vals, nreturn_vals);
}
static gchar *
mygimp_brush_get (void)
{
GimpParam *return_vals;
gint nreturn_vals;
gchar *name = NULL;
gint width, height, spacing;
return_vals = gimp_run_procedure ("gimp_brushes_get_brush",
&nreturn_vals,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
name = g_strdup (return_vals[1].data.d_string);
gimp_destroy_params (return_vals, nreturn_vals);
return name;
return gimp_brushes_get_brush (&width, &height, &spacing);
}
static void
mygimp_brush_info (gint32 *width,
gint32 *height)
mygimp_brush_info (gint *width,
gint *height)
{
GimpParam *return_vals;
gint nreturn_vals;
return_vals = gimp_run_procedure ("gimp_brushes_get_brush",
&nreturn_vals,
GIMP_PDB_END);
char *name;
gint spacing;
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
name = gimp_brushes_get_brush (width, height, &spacing);
if (name)
{
*width = MAX (return_vals[2].data.d_int32, 32);
*height = MAX (return_vals[3].data.d_int32, 32);
*width = MAX (*width, 32);
*height = MAX (*height, 32);
g_free (name);
}
else
{
g_message ("Failed to get brush info");
*width = *height = 48;
}
gimp_destroy_params (return_vals, nreturn_vals);
}
void
@ -3049,18 +3018,10 @@ static void
gfig_pos_update (gint x,
gint y)
{
gint update;
if (x_pos_val != x || y_pos_val != y)
update = 1;
else
update = 0;
x_pos_val = x;
y_pos_val = y;
if (update && pos_tag == -1 && selvals.showpos)
if ((x_pos_val !=x || y_pos_val != y) && pos_tag == -1 && selvals.showpos)
{
x_pos_val = x;
y_pos_val = y;
gfig_pos_update_labels (NULL);
}
}
@ -3312,7 +3273,6 @@ gfig_grid_colours (GtkWidget *widget,
GDK_GC_STIPPLE);
}
static gint
gfig_dialog (void)
{
@ -3527,7 +3487,7 @@ pic_preview_expose (GtkWidget *widget,
return FALSE;
}
gint
static gint
adjust_pic_coords (gint coord,
gint ratio)
{
@ -3928,10 +3888,6 @@ gfig_load_file_selection_ok (GtkWidget *widget,
filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs));
#ifdef DEBUG
printf ("Loading file '%s'\n", filename);
#endif /* DEBUG */
if (g_file_test (filename, G_FILE_TEST_IS_REGULAR))
{
/* Hack - current object MUST be NULL to prevent setup_undo ()
@ -4215,7 +4171,7 @@ about_button_callback (GtkWidget *widget,
gtk_misc_set_padding (GTK_MISC (label), 2, 2);
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
#ifdef _OLD_
label = gtk_label_new ("Email alt@picnic.demon.co.uk");
gtk_misc_set_padding (GTK_MISC (label), 2, 2);
gtk_widget_show (label);
@ -4225,7 +4181,7 @@ about_button_callback (GtkWidget *widget,
gtk_misc_set_padding (GTK_MISC (label), 2, 2);
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
#endif
label = gtk_label_new ("Isometric grid By Rob Saunders");
gtk_misc_set_padding (GTK_MISC (label), 2, 2);
gtk_widget_show (label);
@ -4305,10 +4261,6 @@ gfig_do_delete_gfig_callback (GtkWidget *widget,
return;
}
#ifdef DEBUG
printf ("Delete button pressed\n");
#endif /* DEBUG */
/* Must update which object we are editing */
/* Get the list and which item is selected */
/* Only allow single selections */
@ -4320,10 +4272,6 @@ gfig_do_delete_gfig_callback (GtkWidget *widget,
pos = gtk_list_child_position (GTK_LIST (gfig_gtk_list), sellist->data);
#ifdef DEBUG
printf ("delete pos = %d\n", pos);
#endif /* DEBUG */
/* Delete the current item + asssociated file */
gtk_list_clear_items (GTK_LIST (gfig_gtk_list), pos, pos + 1);
/* Shadow copy for ordering info */
@ -4539,10 +4487,6 @@ merge_button_callback (GtkWidget *widget,
DAllObjs *obj_copies;
GtkWidget *list = (GtkWidget *) data;
#ifdef DEBUG
printf ("Merge button pressed\n");
#endif /* DEBUG */
/* Must update which object we are editing */
/* Get the list and which item is selected */
/* Only allow single selections */
@ -4565,7 +4509,6 @@ merge_button_callback (GtkWidget *widget,
}
}
static void
gfig_save_menu_callback (GtkWidget *widget,
gpointer data)
@ -4632,7 +4575,8 @@ gfig_op_menu_create (GtkWidget *window)
gtk_window_add_accelerator_table (GTK_WINDOW (window), accelerator_table);
#endif /* 0 */
save_menu_item = menu_item = gtk_menu_item_new_with_label (_("Save"));
menu_item = gtk_image_menu_item_new_from_stock (GTK_STOCK_SAVE, NULL);
save_menu_item = menu_item;
gtk_menu_shell_append (GTK_MENU_SHELL (gfig_op_menu), menu_item);
gtk_widget_show (menu_item);
@ -4646,7 +4590,7 @@ gfig_op_menu_create (GtkWidget *window)
"activate", 'S', 0);
#endif /* 0 */
menu_item = gtk_menu_item_new_with_label (_("Save As..."));
menu_item = gtk_image_menu_item_new_from_stock (GTK_STOCK_SAVE_AS, NULL);
gtk_menu_shell_append (GTK_MENU_SHELL (gfig_op_menu), menu_item);
gtk_widget_show (menu_item);
g_signal_connect (menu_item, "activate",
@ -4659,7 +4603,7 @@ gfig_op_menu_create (GtkWidget *window)
"activate", 'A', 0);
#endif /* 0 */
menu_item = gtk_menu_item_new_with_label (_("Copy"));
menu_item = gtk_image_menu_item_new_from_stock (GTK_STOCK_COPY, NULL);
gtk_menu_shell_append (GTK_MENU_SHELL (gfig_op_menu), menu_item);
gtk_widget_show (menu_item);
g_signal_connect (menu_item, "activate",
@ -4672,7 +4616,7 @@ gfig_op_menu_create (GtkWidget *window)
"activate", 'C', 0);
#endif /* 0 */
menu_item = gtk_menu_item_new_with_label (_("Edit"));
menu_item = gtk_image_menu_item_new_from_stock (GIMP_STOCK_EDIT, NULL);
gtk_menu_shell_append (GTK_MENU_SHELL (gfig_op_menu), menu_item);
gtk_widget_show (menu_item);
g_signal_connect (menu_item, "activate",
@ -4708,8 +4652,7 @@ gfig_op_menu_popup (gint button,
button, activate_time);
}
static gint
static gboolean
list_button_press (GtkWidget *widget,
GdkEventButton *event,
gpointer data)
@ -4717,14 +4660,8 @@ list_button_press (GtkWidget *widget,
switch (event->type)
{
case GDK_BUTTON_PRESS:
#ifdef DEBUG
printf ("Single button press\n");
#endif /* DEBUG */
if (event->button == 3)
{
#ifdef DEBUG
printf ("Popup on '%s'\n", ((GFigObj *)data)->draw_name);
#endif /* DEBUG */
gfig_op_menu_popup (event->button, event->time, (GFigObj *) data);
return FALSE;
}
@ -4732,9 +4669,6 @@ list_button_press (GtkWidget *widget,
break;
case GDK_2BUTTON_PRESS:
#ifdef DEBUG
printf ("Two button press\n");
#endif /* DEBUG */
gfig_dialog_edit_list (widget, data, FALSE);
break;
@ -5110,7 +5044,6 @@ find_grid_pos (GdkPoint *p,
}
}
/* Given a point x, y draw a circle */
void
draw_circle (GdkPoint *p)
@ -5129,7 +5062,6 @@ draw_circle (GdkPoint *p)
360*64);
}
/* Given a point x, y draw a square around it */
void
draw_sqr (GdkPoint *p)
@ -5607,7 +5539,7 @@ scale_to_orginal_x (gdouble *list)
*list *= scale_x_factor;
}
gint
static gint
gfig_scale_x (gint x)
{
if (!selvals.scaletoimage)
@ -5631,7 +5563,7 @@ scale_to_orginal_y (gdouble *list)
*list *= scale_y_factor;
}
gint
static gint
gfig_scale_y (gint y)
{
if (!selvals.scaletoimage)
@ -5702,7 +5634,56 @@ reverse_pairs_list (gdouble *list,
}
}
void
gfig_draw_arc (gint x, gint y, gint width, gint height, gint angle1,
gint angle2)
{
if (drawing_pic)
{
gdk_draw_arc (pic_preview->window,
pic_preview->style->black_gc,
FALSE,
adjust_pic_coords (x - width, preview_width),
adjust_pic_coords (y - height, preview_height),
adjust_pic_coords (2 * width, preview_width),
adjust_pic_coords (2 * height, preview_height),
angle1 * 64,
angle2 * 64);
}
else
{
gdk_draw_arc (gfig_preview->window,
gfig_gc,
FALSE,
gfig_scale_x (x - width),
gfig_scale_y (y - height),
gfig_scale_x (2 * width),
gfig_scale_y (2 * height),
angle1 * 64,
angle2 * 64);
}
}
void
gfig_draw_line (gint x0, gint y0, gint x1, gint y1)
{
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));
}
}

View File

@ -26,14 +26,14 @@
#ifndef __GFIG_H__
#define __GFIG_H__
#include "gfig_dobject.h"
#include "gfig-dobject.h"
#define MAX_LOAD_LINE 256
#define SQ_SIZE 8
extern gint line_no;
extern gint preview_width, preview_height;
extern gint drawing_pic;
extern gboolean drawing_pic;
extern gint need_to_scale;
extern gint32 gfig_image;
extern gint32 gfig_drawable;
@ -180,14 +180,10 @@ gchar *get_line (gchar *buf,
FILE *from,
gint init);
gint gfig_scale_x (gint x);
gint gfig_scale_y (gint y);
void scale_to_xy (gdouble *list,
gint size);
void scale_to_original_xy (gdouble *list,
gint size);
gint adjust_pic_coords (gint coord,
gint ratio);
void reverse_pairs_list (gdouble *list,
gint size);
@ -205,8 +201,21 @@ void num_sides_dialog (gchar *d_title,
gint *which_way,
gint adj_min,
gint adj_max);
void setup_undo (void);
void draw_grid_clear (void);
void prepend_to_all_obj (GFigObj *fobj, DAllObjs *nobj);
void setup_undo (void);
void draw_grid_clear (void);
void prepend_to_all_obj (GFigObj *fobj,
DAllObjs *nobj);
void gfig_draw_arc (gint x,
gint y,
gint width,
gint height,
gint angle1,
gint angle2);
void gfig_draw_line (gint x0,
gint y0,
gint x1,
gint y1);
#endif /* __GFIG_H__ */