diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:30:19 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:30:19 +0000 |
commit | 5c1676dfe6d2f3c837a5e074117b45613fd29a72 (patch) | |
tree | cbffb45144febf451e54061db2b21395faf94bfe /plug-ins/gfig | |
parent | Initial commit. (diff) | |
download | gimp-5c1676dfe6d2f3c837a5e074117b45613fd29a72.tar.xz gimp-5c1676dfe6d2f3c837a5e074117b45613fd29a72.zip |
Adding upstream version 2.10.34.upstream/2.10.34upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
66 files changed, 14206 insertions, 0 deletions
diff --git a/plug-ins/gfig/Makefile.am b/plug-ins/gfig/Makefile.am new file mode 100644 index 0000000..283ad92 --- /dev/null +++ b/plug-ins/gfig/Makefile.am @@ -0,0 +1,85 @@ +## Process this file with automake to produce Makefile.in + +if OS_WIN32 +mwindows = -mwindows +else +libm = -lm +endif + +libgimpui = $(top_builddir)/libgimp/libgimpui-$(GIMP_API_VERSION).la +libgimpconfig = $(top_builddir)/libgimpconfig/libgimpconfig-$(GIMP_API_VERSION).la +libgimpwidgets = $(top_builddir)/libgimpwidgets/libgimpwidgets-$(GIMP_API_VERSION).la +libgimp = $(top_builddir)/libgimp/libgimp-$(GIMP_API_VERSION).la +libgimpcolor = $(top_builddir)/libgimpcolor/libgimpcolor-$(GIMP_API_VERSION).la +libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la +libgimpmath = $(top_builddir)/libgimpmath/libgimpmath-$(GIMP_API_VERSION).la + +if HAVE_WINDRES +include $(top_srcdir)/build/windows/gimprc-plug-ins.rule +gfig_RC = gfig.rc.o +endif + +AM_LDFLAGS = $(mwindows) + +SUBDIRS = gfig-examples images + +libexecdir = $(gimpplugindir)/plug-ins/gfig + +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-dialog.c \ + gfig-dialog.h \ + gfig-dobject.c \ + gfig-dobject.h \ + gfig-ellipse.c \ + gfig-ellipse.h \ + gfig-grid.c \ + gfig-grid.h \ + gfig-line.c \ + gfig-line.h \ + gfig-poly.c \ + gfig-poly.h \ + gfig-preview.c \ + gfig-preview.h \ + gfig-rectangle.c \ + gfig-rectangle.h \ + gfig-spiral.c \ + gfig-spiral.h \ + gfig-star.c \ + gfig-star.h \ + gfig-stock.c \ + gfig-stock.h \ + gfig-style.c \ + gfig-style.h \ + gfig-types.h + +EXTRA_DIST = README + +AM_CPPFLAGS = \ + -I$(top_srcdir) \ + $(GTK_CFLAGS) \ + $(GEGL_CFLAGS) \ + -I$(includedir) + +LDADD = \ + $(libm) \ + $(libgimpui) \ + $(libgimpwidgets) \ + $(libgimpconfig) \ + $(libgimp) \ + $(libgimpcolor) \ + $(libgimpmath) \ + $(libgimpbase) \ + $(GTK_LIBS) \ + $(RT_LIBS) \ + $(INTLLIBS) \ + $(gfig_RC) diff --git a/plug-ins/gfig/Makefile.in b/plug-ins/gfig/Makefile.in new file mode 100644 index 0000000..bd5d3d2 --- /dev/null +++ b/plug-ins/gfig/Makefile.in @@ -0,0 +1,1209 @@ +# Makefile.in generated by automake 1.16.3 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2020 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Version resources for Microsoft Windows + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +libexec_PROGRAMS = gfig$(EXEEXT) +subdir = plug-ins/gfig +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/m4macros/alsa.m4 \ + $(top_srcdir)/m4macros/ax_compare_version.m4 \ + $(top_srcdir)/m4macros/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4macros/ax_gcc_func_attribute.m4 \ + $(top_srcdir)/m4macros/ax_prog_cc_for_build.m4 \ + $(top_srcdir)/m4macros/ax_prog_perl_version.m4 \ + $(top_srcdir)/m4macros/detectcflags.m4 \ + $(top_srcdir)/m4macros/pythondev.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(libexecdir)" +PROGRAMS = $(libexec_PROGRAMS) +am_gfig_OBJECTS = gfig.$(OBJEXT) gfig-arc.$(OBJEXT) \ + gfig-bezier.$(OBJEXT) gfig-circle.$(OBJEXT) \ + gfig-dialog.$(OBJEXT) gfig-dobject.$(OBJEXT) \ + gfig-ellipse.$(OBJEXT) gfig-grid.$(OBJEXT) gfig-line.$(OBJEXT) \ + gfig-poly.$(OBJEXT) gfig-preview.$(OBJEXT) \ + gfig-rectangle.$(OBJEXT) gfig-spiral.$(OBJEXT) \ + gfig-star.$(OBJEXT) gfig-stock.$(OBJEXT) gfig-style.$(OBJEXT) +gfig_OBJECTS = $(am_gfig_OBJECTS) +gfig_LDADD = $(LDADD) +am__DEPENDENCIES_1 = +gfig_DEPENDENCIES = $(am__DEPENDENCIES_1) $(libgimpui) \ + $(libgimpwidgets) $(libgimpconfig) $(libgimp) $(libgimpcolor) \ + $(libgimpmath) $(libgimpbase) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(gfig_RC) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/gfig-arc.Po \ + ./$(DEPDIR)/gfig-bezier.Po ./$(DEPDIR)/gfig-circle.Po \ + ./$(DEPDIR)/gfig-dialog.Po ./$(DEPDIR)/gfig-dobject.Po \ + ./$(DEPDIR)/gfig-ellipse.Po ./$(DEPDIR)/gfig-grid.Po \ + ./$(DEPDIR)/gfig-line.Po ./$(DEPDIR)/gfig-poly.Po \ + ./$(DEPDIR)/gfig-preview.Po ./$(DEPDIR)/gfig-rectangle.Po \ + ./$(DEPDIR)/gfig-spiral.Po ./$(DEPDIR)/gfig-star.Po \ + ./$(DEPDIR)/gfig-stock.Po ./$(DEPDIR)/gfig-style.Po \ + ./$(DEPDIR)/gfig.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(gfig_SOURCES) +DIST_SOURCES = $(gfig_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir distdir-am +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in \ + $(top_srcdir)/build/windows/gimprc-plug-ins.rule \ + $(top_srcdir)/depcomp README +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +AA_LIBS = @AA_LIBS@ +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +ALL_LINGUAS = @ALL_LINGUAS@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALTIVEC_EXTRA_CFLAGS = @ALTIVEC_EXTRA_CFLAGS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APPSTREAM_UTIL = @APPSTREAM_UTIL@ +AR = @AR@ +AS = @AS@ +ATK_CFLAGS = @ATK_CFLAGS@ +ATK_LIBS = @ATK_LIBS@ +ATK_REQUIRED_VERSION = @ATK_REQUIRED_VERSION@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BABL_CFLAGS = @BABL_CFLAGS@ +BABL_LIBS = @BABL_LIBS@ +BABL_REQUIRED_VERSION = @BABL_REQUIRED_VERSION@ +BUG_REPORT_URL = @BUG_REPORT_URL@ +BUILD_EXEEXT = @BUILD_EXEEXT@ +BUILD_OBJEXT = @BUILD_OBJEXT@ +BZIP2_LIBS = @BZIP2_LIBS@ +CAIRO_CFLAGS = @CAIRO_CFLAGS@ +CAIRO_LIBS = @CAIRO_LIBS@ +CAIRO_PDF_CFLAGS = @CAIRO_PDF_CFLAGS@ +CAIRO_PDF_LIBS = @CAIRO_PDF_LIBS@ +CAIRO_PDF_REQUIRED_VERSION = @CAIRO_PDF_REQUIRED_VERSION@ +CAIRO_REQUIRED_VERSION = @CAIRO_REQUIRED_VERSION@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CC_FOR_BUILD = @CC_FOR_BUILD@ +CC_VERSION = @CC_VERSION@ +CFLAGS = @CFLAGS@ +CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@ +CPP_FOR_BUILD = @CPP_FOR_BUILD@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DESKTOP_DATADIR = @DESKTOP_DATADIR@ +DESKTOP_FILE_VALIDATE = @DESKTOP_FILE_VALIDATE@ +DLLTOOL = @DLLTOOL@ +DOC_SHOOTER = @DOC_SHOOTER@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILE_AA = @FILE_AA@ +FILE_EXR = @FILE_EXR@ +FILE_HEIF = @FILE_HEIF@ +FILE_JP2_LOAD = @FILE_JP2_LOAD@ +FILE_JPEGXL = @FILE_JPEGXL@ +FILE_MNG = @FILE_MNG@ +FILE_PDF_SAVE = @FILE_PDF_SAVE@ +FILE_PS = @FILE_PS@ +FILE_WMF = @FILE_WMF@ +FILE_XMC = @FILE_XMC@ +FILE_XPM = @FILE_XPM@ +FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@ +FONTCONFIG_LIBS = @FONTCONFIG_LIBS@ +FONTCONFIG_REQUIRED_VERSION = @FONTCONFIG_REQUIRED_VERSION@ +FREETYPE2_REQUIRED_VERSION = @FREETYPE2_REQUIRED_VERSION@ +FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ +FREETYPE_LIBS = @FREETYPE_LIBS@ +GDBUS_CODEGEN = @GDBUS_CODEGEN@ +GDK_PIXBUF_CFLAGS = @GDK_PIXBUF_CFLAGS@ +GDK_PIXBUF_CSOURCE = @GDK_PIXBUF_CSOURCE@ +GDK_PIXBUF_LIBS = @GDK_PIXBUF_LIBS@ +GDK_PIXBUF_REQUIRED_VERSION = @GDK_PIXBUF_REQUIRED_VERSION@ +GEGL = @GEGL@ +GEGL_CFLAGS = @GEGL_CFLAGS@ +GEGL_LIBS = @GEGL_LIBS@ +GEGL_MAJOR_MINOR_VERSION = @GEGL_MAJOR_MINOR_VERSION@ +GEGL_REQUIRED_VERSION = @GEGL_REQUIRED_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GEXIV2_CFLAGS = @GEXIV2_CFLAGS@ +GEXIV2_LIBS = @GEXIV2_LIBS@ +GEXIV2_REQUIRED_VERSION = @GEXIV2_REQUIRED_VERSION@ +GIMP_API_VERSION = @GIMP_API_VERSION@ +GIMP_APP_VERSION = @GIMP_APP_VERSION@ +GIMP_BINARY_AGE = @GIMP_BINARY_AGE@ +GIMP_COMMAND = @GIMP_COMMAND@ +GIMP_DATA_VERSION = @GIMP_DATA_VERSION@ +GIMP_FULL_NAME = @GIMP_FULL_NAME@ +GIMP_INTERFACE_AGE = @GIMP_INTERFACE_AGE@ +GIMP_MAJOR_VERSION = @GIMP_MAJOR_VERSION@ +GIMP_MICRO_VERSION = @GIMP_MICRO_VERSION@ +GIMP_MINOR_VERSION = @GIMP_MINOR_VERSION@ +GIMP_MKENUMS = @GIMP_MKENUMS@ +GIMP_MODULES = @GIMP_MODULES@ +GIMP_PACKAGE_REVISION = @GIMP_PACKAGE_REVISION@ +GIMP_PKGCONFIG_VERSION = @GIMP_PKGCONFIG_VERSION@ +GIMP_PLUGINS = @GIMP_PLUGINS@ +GIMP_PLUGIN_VERSION = @GIMP_PLUGIN_VERSION@ +GIMP_REAL_VERSION = @GIMP_REAL_VERSION@ +GIMP_RELEASE = @GIMP_RELEASE@ +GIMP_SYSCONF_VERSION = @GIMP_SYSCONF_VERSION@ +GIMP_TOOL_VERSION = @GIMP_TOOL_VERSION@ +GIMP_UNSTABLE = @GIMP_UNSTABLE@ +GIMP_USER_VERSION = @GIMP_USER_VERSION@ +GIMP_VERSION = @GIMP_VERSION@ +GIO_CFLAGS = @GIO_CFLAGS@ +GIO_LIBS = @GIO_LIBS@ +GIO_UNIX_CFLAGS = @GIO_UNIX_CFLAGS@ +GIO_UNIX_LIBS = @GIO_UNIX_LIBS@ +GIO_WINDOWS_CFLAGS = @GIO_WINDOWS_CFLAGS@ +GIO_WINDOWS_LIBS = @GIO_WINDOWS_LIBS@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_REQUIRED_VERSION = @GLIB_REQUIRED_VERSION@ +GMODULE_NO_EXPORT_CFLAGS = @GMODULE_NO_EXPORT_CFLAGS@ +GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GS_LIBS = @GS_LIBS@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +GTK_MAC_INTEGRATION_CFLAGS = @GTK_MAC_INTEGRATION_CFLAGS@ +GTK_MAC_INTEGRATION_LIBS = @GTK_MAC_INTEGRATION_LIBS@ +GTK_REQUIRED_VERSION = @GTK_REQUIRED_VERSION@ +GTK_UPDATE_ICON_CACHE = @GTK_UPDATE_ICON_CACHE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +HARFBUZZ_CFLAGS = @HARFBUZZ_CFLAGS@ +HARFBUZZ_LIBS = @HARFBUZZ_LIBS@ +HARFBUZZ_REQUIRED_VERSION = @HARFBUZZ_REQUIRED_VERSION@ +HAVE_CXX14 = @HAVE_CXX14@ +HAVE_FINITE = @HAVE_FINITE@ +HAVE_ISFINITE = @HAVE_ISFINITE@ +HAVE_VFORK = @HAVE_VFORK@ +HOST_GLIB_COMPILE_RESOURCES = @HOST_GLIB_COMPILE_RESOURCES@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_REQUIRED_VERSION = @INTLTOOL_REQUIRED_VERSION@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +ISO_CODES_LOCALEDIR = @ISO_CODES_LOCALEDIR@ +ISO_CODES_LOCATION = @ISO_CODES_LOCATION@ +JPEG_LIBS = @JPEG_LIBS@ +JSON_GLIB_CFLAGS = @JSON_GLIB_CFLAGS@ +JSON_GLIB_LIBS = @JSON_GLIB_LIBS@ +JXL_CFLAGS = @JXL_CFLAGS@ +JXL_LIBS = @JXL_LIBS@ +JXL_THREADS_CFLAGS = @JXL_THREADS_CFLAGS@ +JXL_THREADS_LIBS = @JXL_THREADS_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LCMS_REQUIRED_VERSION = @LCMS_REQUIRED_VERSION@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ +LIBBACKTRACE_LIBS = @LIBBACKTRACE_LIBS@ +LIBHEIF_CFLAGS = @LIBHEIF_CFLAGS@ +LIBHEIF_LIBS = @LIBHEIF_LIBS@ +LIBHEIF_REQUIRED_VERSION = @LIBHEIF_REQUIRED_VERSION@ +LIBJXL_REQUIRED_VERSION = @LIBJXL_REQUIRED_VERSION@ +LIBLZMA_REQUIRED_VERSION = @LIBLZMA_REQUIRED_VERSION@ +LIBMYPAINT_CFLAGS = @LIBMYPAINT_CFLAGS@ +LIBMYPAINT_LIBS = @LIBMYPAINT_LIBS@ +LIBMYPAINT_REQUIRED_VERSION = @LIBMYPAINT_REQUIRED_VERSION@ +LIBOBJS = @LIBOBJS@ +LIBPNG_REQUIRED_VERSION = @LIBPNG_REQUIRED_VERSION@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ +LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ +LIBUNWIND_REQUIRED_VERSION = @LIBUNWIND_REQUIRED_VERSION@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_CURRENT_MINUS_AGE = @LT_CURRENT_MINUS_AGE@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LT_VERSION_INFO = @LT_VERSION_INFO@ +LZMA_CFLAGS = @LZMA_CFLAGS@ +LZMA_LIBS = @LZMA_LIBS@ +MAIL = @MAIL@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MIME_INFO_CFLAGS = @MIME_INFO_CFLAGS@ +MIME_INFO_LIBS = @MIME_INFO_LIBS@ +MIME_TYPES = @MIME_TYPES@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MMX_EXTRA_CFLAGS = @MMX_EXTRA_CFLAGS@ +MNG_CFLAGS = @MNG_CFLAGS@ +MNG_LIBS = @MNG_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +MYPAINT_BRUSHES_CFLAGS = @MYPAINT_BRUSHES_CFLAGS@ +MYPAINT_BRUSHES_LIBS = @MYPAINT_BRUSHES_LIBS@ +NATIVE_GLIB_CFLAGS = @NATIVE_GLIB_CFLAGS@ +NATIVE_GLIB_LIBS = @NATIVE_GLIB_LIBS@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENEXR_CFLAGS = @OPENEXR_CFLAGS@ +OPENEXR_LIBS = @OPENEXR_LIBS@ +OPENEXR_REQUIRED_VERSION = @OPENEXR_REQUIRED_VERSION@ +OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@ +OPENJPEG_LIBS = @OPENJPEG_LIBS@ +OPENJPEG_REQUIRED_VERSION = @OPENJPEG_REQUIRED_VERSION@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOCAIRO_CFLAGS = @PANGOCAIRO_CFLAGS@ +PANGOCAIRO_LIBS = @PANGOCAIRO_LIBS@ +PANGOCAIRO_REQUIRED_VERSION = @PANGOCAIRO_REQUIRED_VERSION@ +PATHSEP = @PATHSEP@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_REQUIRED_VERSION = @PERL_REQUIRED_VERSION@ +PERL_VERSION = @PERL_VERSION@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PNG_CFLAGS = @PNG_CFLAGS@ +PNG_LIBS = @PNG_LIBS@ +POFILES = @POFILES@ +POPPLER_CFLAGS = @POPPLER_CFLAGS@ +POPPLER_DATA_CFLAGS = @POPPLER_DATA_CFLAGS@ +POPPLER_DATA_LIBS = @POPPLER_DATA_LIBS@ +POPPLER_DATA_REQUIRED_VERSION = @POPPLER_DATA_REQUIRED_VERSION@ +POPPLER_LIBS = @POPPLER_LIBS@ +POPPLER_REQUIRED_VERSION = @POPPLER_REQUIRED_VERSION@ +POSUB = @POSUB@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +PYBIN_PATH = @PYBIN_PATH@ +PYCAIRO_CFLAGS = @PYCAIRO_CFLAGS@ +PYCAIRO_LIBS = @PYCAIRO_LIBS@ +PYGIMP_EXTRA_CFLAGS = @PYGIMP_EXTRA_CFLAGS@ +PYGTK_CFLAGS = @PYGTK_CFLAGS@ +PYGTK_CODEGEN = @PYGTK_CODEGEN@ +PYGTK_DEFSDIR = @PYGTK_DEFSDIR@ +PYGTK_LIBS = @PYGTK_LIBS@ +PYLINK_LIBS = @PYLINK_LIBS@ +PYTHON = @PYTHON@ +PYTHON2_REQUIRED_VERSION = @PYTHON2_REQUIRED_VERSION@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_INCLUDES = @PYTHON_INCLUDES@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RSVG_REQUIRED_VERSION = @RSVG_REQUIRED_VERSION@ +RT_LIBS = @RT_LIBS@ +SCREENSHOT_LIBS = @SCREENSHOT_LIBS@ +SED = @SED@ +SENDMAIL = @SENDMAIL@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOCKET_LIBS = @SOCKET_LIBS@ +SSE2_EXTRA_CFLAGS = @SSE2_EXTRA_CFLAGS@ +SSE4_1_EXTRA_CFLAGS = @SSE4_1_EXTRA_CFLAGS@ +SSE_EXTRA_CFLAGS = @SSE_EXTRA_CFLAGS@ +STRIP = @STRIP@ +SVG_CFLAGS = @SVG_CFLAGS@ +SVG_LIBS = @SVG_LIBS@ +SYMPREFIX = @SYMPREFIX@ +TIFF_LIBS = @TIFF_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WEBKIT_CFLAGS = @WEBKIT_CFLAGS@ +WEBKIT_LIBS = @WEBKIT_LIBS@ +WEBKIT_REQUIRED_VERSION = @WEBKIT_REQUIRED_VERSION@ +WEBPDEMUX_CFLAGS = @WEBPDEMUX_CFLAGS@ +WEBPDEMUX_LIBS = @WEBPDEMUX_LIBS@ +WEBPMUX_CFLAGS = @WEBPMUX_CFLAGS@ +WEBPMUX_LIBS = @WEBPMUX_LIBS@ +WEBP_CFLAGS = @WEBP_CFLAGS@ +WEBP_LIBS = @WEBP_LIBS@ +WEBP_REQUIRED_VERSION = @WEBP_REQUIRED_VERSION@ +WEB_PAGE = @WEB_PAGE@ +WIN32_LARGE_ADDRESS_AWARE = @WIN32_LARGE_ADDRESS_AWARE@ +WINDRES = @WINDRES@ +WMF_CFLAGS = @WMF_CFLAGS@ +WMF_CONFIG = @WMF_CONFIG@ +WMF_LIBS = @WMF_LIBS@ +WMF_REQUIRED_VERSION = @WMF_REQUIRED_VERSION@ +XDG_EMAIL = @XDG_EMAIL@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_REQUIRED_VERSION = @XGETTEXT_REQUIRED_VERSION@ +XMC_CFLAGS = @XMC_CFLAGS@ +XMC_LIBS = @XMC_LIBS@ +XMKMF = @XMKMF@ +XMLLINT = @XMLLINT@ +XMU_LIBS = @XMU_LIBS@ +XPM_LIBS = @XPM_LIBS@ +XSLTPROC = @XSLTPROC@ +XVFB_RUN = @XVFB_RUN@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Z_LIBS = @Z_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CC_FOR_BUILD = @ac_ct_CC_FOR_BUILD@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gimpdatadir = @gimpdatadir@ +gimpdir = @gimpdir@ +gimplocaledir = @gimplocaledir@ +gimpplugindir = @gimpplugindir@ +gimpsysconfdir = @gimpsysconfdir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = $(gimpplugindir)/plug-ins/gfig +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +manpage_gimpdir = @manpage_gimpdir@ +mkdir_p = @mkdir_p@ +ms_librarian = @ms_librarian@ +mypaint_brushes_dir = @mypaint_brushes_dir@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +@OS_WIN32_TRUE@mwindows = -mwindows +@OS_WIN32_FALSE@libm = -lm +libgimpui = $(top_builddir)/libgimp/libgimpui-$(GIMP_API_VERSION).la +libgimpconfig = $(top_builddir)/libgimpconfig/libgimpconfig-$(GIMP_API_VERSION).la +libgimpwidgets = $(top_builddir)/libgimpwidgets/libgimpwidgets-$(GIMP_API_VERSION).la +libgimp = $(top_builddir)/libgimp/libgimp-$(GIMP_API_VERSION).la +libgimpcolor = $(top_builddir)/libgimpcolor/libgimpcolor-$(GIMP_API_VERSION).la +libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la +libgimpmath = $(top_builddir)/libgimpmath/libgimpmath-$(GIMP_API_VERSION).la +@HAVE_WINDRES_TRUE@GIMPPLUGINRC = $(top_builddir)/build/windows/gimp-plug-ins.rc +@HAVE_WINDRES_TRUE@gfig_RC = gfig.rc.o +AM_LDFLAGS = $(mwindows) +SUBDIRS = gfig-examples images +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-dialog.c \ + gfig-dialog.h \ + gfig-dobject.c \ + gfig-dobject.h \ + gfig-ellipse.c \ + gfig-ellipse.h \ + gfig-grid.c \ + gfig-grid.h \ + gfig-line.c \ + gfig-line.h \ + gfig-poly.c \ + gfig-poly.h \ + gfig-preview.c \ + gfig-preview.h \ + gfig-rectangle.c \ + gfig-rectangle.h \ + gfig-spiral.c \ + gfig-spiral.h \ + gfig-star.c \ + gfig-star.h \ + gfig-stock.c \ + gfig-stock.h \ + gfig-style.c \ + gfig-style.h \ + gfig-types.h + +EXTRA_DIST = README +AM_CPPFLAGS = \ + -I$(top_srcdir) \ + $(GTK_CFLAGS) \ + $(GEGL_CFLAGS) \ + -I$(includedir) + +LDADD = \ + $(libm) \ + $(libgimpui) \ + $(libgimpwidgets) \ + $(libgimpconfig) \ + $(libgimp) \ + $(libgimpcolor) \ + $(libgimpmath) \ + $(libgimpbase) \ + $(GTK_LIBS) \ + $(RT_LIBS) \ + $(INTLLIBS) \ + $(gfig_RC) + +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/build/windows/gimprc-plug-ins.rule $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plug-ins/gfig/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plug-ins/gfig/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/build/windows/gimprc-plug-ins.rule $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libexecPROGRAMS: $(libexec_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + || test -f $$p1 \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-libexecPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(libexecdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(libexecdir)" && rm -f $$files + +clean-libexecPROGRAMS: + @list='$(libexec_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +gfig$(EXEEXT): $(gfig_OBJECTS) $(gfig_DEPENDENCIES) $(EXTRA_gfig_DEPENDENCIES) + @rm -f gfig$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gfig_OBJECTS) $(gfig_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfig-arc.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfig-bezier.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfig-circle.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfig-dialog.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfig-dobject.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfig-ellipse.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfig-grid.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfig-line.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfig-poly.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfig-preview.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfig-rectangle.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfig-spiral.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfig-star.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfig-stock.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfig-style.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfig.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(PROGRAMS) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(libexecdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libexecPROGRAMS clean-libtool \ + mostlyclean-am + +distclean: distclean-recursive + -rm -f ./$(DEPDIR)/gfig-arc.Po + -rm -f ./$(DEPDIR)/gfig-bezier.Po + -rm -f ./$(DEPDIR)/gfig-circle.Po + -rm -f ./$(DEPDIR)/gfig-dialog.Po + -rm -f ./$(DEPDIR)/gfig-dobject.Po + -rm -f ./$(DEPDIR)/gfig-ellipse.Po + -rm -f ./$(DEPDIR)/gfig-grid.Po + -rm -f ./$(DEPDIR)/gfig-line.Po + -rm -f ./$(DEPDIR)/gfig-poly.Po + -rm -f ./$(DEPDIR)/gfig-preview.Po + -rm -f ./$(DEPDIR)/gfig-rectangle.Po + -rm -f ./$(DEPDIR)/gfig-spiral.Po + -rm -f ./$(DEPDIR)/gfig-star.Po + -rm -f ./$(DEPDIR)/gfig-stock.Po + -rm -f ./$(DEPDIR)/gfig-style.Po + -rm -f ./$(DEPDIR)/gfig.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: install-libexecPROGRAMS + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f ./$(DEPDIR)/gfig-arc.Po + -rm -f ./$(DEPDIR)/gfig-bezier.Po + -rm -f ./$(DEPDIR)/gfig-circle.Po + -rm -f ./$(DEPDIR)/gfig-dialog.Po + -rm -f ./$(DEPDIR)/gfig-dobject.Po + -rm -f ./$(DEPDIR)/gfig-ellipse.Po + -rm -f ./$(DEPDIR)/gfig-grid.Po + -rm -f ./$(DEPDIR)/gfig-line.Po + -rm -f ./$(DEPDIR)/gfig-poly.Po + -rm -f ./$(DEPDIR)/gfig-preview.Po + -rm -f ./$(DEPDIR)/gfig-rectangle.Po + -rm -f ./$(DEPDIR)/gfig-spiral.Po + -rm -f ./$(DEPDIR)/gfig-star.Po + -rm -f ./$(DEPDIR)/gfig-stock.Po + -rm -f ./$(DEPDIR)/gfig-style.Po + -rm -f ./$(DEPDIR)/gfig.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-libexecPROGRAMS + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--depfiles check check-am clean clean-generic \ + clean-libexecPROGRAMS clean-libtool cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-libexecPROGRAMS install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-libexecPROGRAMS + +.PRECIOUS: Makefile + + +# `windres` seems a very stupid tool and it breaks with double shlashes +# in parameter paths. Strengthen the rule a little. +@HAVE_WINDRES_TRUE@%.rc.o: +@HAVE_WINDRES_TRUE@ $(WINDRES) --define ORIGINALFILENAME_STR="$*$(EXEEXT)" \ +@HAVE_WINDRES_TRUE@ --define INTERNALNAME_STR="$*" \ +@HAVE_WINDRES_TRUE@ --define TOP_SRCDIR="`echo $(top_srcdir) | sed 's*//*/*'`" \ +@HAVE_WINDRES_TRUE@ -I"`echo $(top_srcdir)/app | sed 's%/\+%/%'`" \ +@HAVE_WINDRES_TRUE@ -I"`echo $(top_builddir)/app | sed 's%/\+%/%'`"\ +@HAVE_WINDRES_TRUE@ -I"`echo $(top_builddir) | sed 's%/\+%/%'`"\ +@HAVE_WINDRES_TRUE@ $(GIMPPLUGINRC) $@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/plug-ins/gfig/README b/plug-ins/gfig/README new file mode 100644 index 0000000..36076e8 --- /dev/null +++ b/plug-ins/gfig/README @@ -0,0 +1,313 @@ +Objects ++++++++ + +The plug-in allows you to draw the following shapes:- + +Lines +Circles +Ellipses +n sided regular polygons (n >=3) +Curves (arcs) +Spirals +N pointed stars +Simple Beizer curves + +An object is constructed as a number of control points and these are used +to select the object on the drawing area once it has been created. + +The drawing area preview is currently set to + + MIN(650 x 650,img_width x img_height). + +You can change this altering the PREVIEW_SIZE item in the source code. + +Operations +++++++++++ + +The following operations can be performed on objects:- + +The objects can either be moved independently around the drawing area or +all together. + +Each control point can be moved. + +Objects can be copied. + +Objects can be deleted. + +N sided Polygons can be split into N line segments. This also works for N +pointed stars. + +The drawing area can be scaled. + +Control points can be hidden. + +To aid alignment of objects a "grid" can be placed on the drawing area. +This can be either a normal rectangular grid or a polar type grid centered +in the drawing area. +The spacings of the grid can be changed as well as the colors used to draw the +grid lines. When "Snap to grid" is checked then all operations will be +constrained to fall on a grid intersection. (Fun when using the polar grid). +Additionally the third mouse button will constrain the point movement to be +on a horiz/vert (for rect grid) or radial/radius (for polar) only when +"Snap to grid" is set. + +The image that was selected when Gfig was started can also be shown (scaled) in +the drawing area. (Options tag). + +Painting tab +++++++++++++ + +There are three possible mode when painting. + +1) Brush +2) Selection +3) Selection+fill + +Brush +~~~~~ +When the paint button is pressed each object will be rendered/drawn onto +the image using the currently selected ink color. The objects can be drawn +onto the original layer or onto a new layer (either a single layer or +multiple layers - latter is good for animations). When new layers are +created the background can either be:- + +Transparent. +Background (the current BG color). +White. +Copy. + +The last option means that the layer is duplicated from the previous layer +before the draw operation is performed (re good for animations). + +Lines can be drawn in reverse order. This means that reg polygons/curves/lines +that are normally constructed of lines can be drawn starting at either "end". +This is only noticeable when the current brush has fading turned on. +The "Approx Circles/Ellipses" toggle allows the same effects when drawing these +types of objects. + +Note that in the current version any selections present in the image are first +de-selected when Gfig starts up. This is because selections are used to +draw circles and ellipses (unless the Approx. Circles & Ellipses toggle is set). + +Selection +~~~~~~~~~ +With this method closed selections are made of the objects. See selection +tab for more details. + +Selections can only be made on the current layer. + +Selection+Fill +~~~~~~~~~~~~~~ +This method first selects the objects and then fills the selection area. The +selection tab gives more details on how the selections are filled. + + +Brush Tab ++++++++++ + +This tab now contains a preview of the selected brush in black ink. If the +brush is too large to fit in the preview use the mouse button to "move" it +around (as with the brush dialog in the main GIMP - until that brush +patch went in!). + +Four types of brush can be used:- + +Normal brush +~~~~~~~~~~~~ +Simply paints with the current brush - honors fading if any +The Fade option allows the "brush fading" to be selected. I am sure that some +nifty anims can be created with this option. + +Pencil brush +~~~~~~~~~~~~ +Same as the GIMPS pencil. + +Airbrush +~~~~~~~~ +As GIMPS airbrush. The "pressure" can be specified and this is reflected in the +preview window. + +Pattern +~~~~~~~ +The lines are drawn with the currently selected pattern. The preview will +show this pattern. + +Note a patch to enable a couple of "hidden" paintbrush features was recently +posted to the GIMP developers list. The patch only allowed these features +to be called via the UI and not the PDB so they cannot be used by Gfig. If they were exported via the PDB then they would have probably broken a number of +scripts and Gfig itself (number of args changes on the PDB call). + +Select tab +++++++++++ + +This is enabled when using either Selection or Selection+fill types when +painting objects. + +The anti aliasing and feather toggles apply to the selection made when +"painting" the objects. The feather radius can be changed. + +The default selection mode is to add to the current selection so each object +add to the overall selection. The other selection modes are also possible +but you must bear in mind the following:- + +Subtraction/Intersection will not produce any selection if no selection is +elect the area in the target window (AFTER starting Gfig up) and then paint +using this method. + +Replace will leave only the last object selection. + +When the paint type is selection+fill then the objects will be selected +and then filled. The opacity of the fill can be chosen. By default a fill +is performed after each section. If filling onto a single layer +then the fill will accumulate on the first objects painted. This will be +noticeable when opacity != 100. To get around this then use replace mode +OR use a new layer for each selection/fill. (Paint tab). Additionally you can +set the fill to be performed after ALL objects have been selected (useful +for intersection type selections). + +Selection of non-closed objects +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +For objects that are not closed the first & last points will be joined +together to form the closed selection. For arcs you can either fill +as segments or sectors. Note straight lines will not cause any selection to be +made. This can be a little confusing when filling since the whole canvas will +be filled if any straight lines are present on it. + + +Scaling ++++++++ + +When Gfig first comes up the selected group of objects are automatically scaled +upwards to the image size. (If the source image is < 256*256 then no automatic +scaling is performed - change PREVIEW_SIZE in source to alter this values). +By toggling the scale button the objects can then be scaled in the drawing +area. This scaling will be reflected when the objects are drawn. +To reposition the objects on the drawing area use SHIFT + MOVE_OBJ operation. + + +Other ops ++++++++++ + +Double click on reg polygon object selection to get dialog with slider to +selected the number of sides to draw. + +Double click on star object selection to get dialog with slider to +selected the number of points the star will have. + +Double click on spiral object selection to get dialog with slider to +selected the number of turns the spiral will have and it direction. + +Double click on bezier object selection to get dialog which allows you to +control how the curve is displayed and if it is closed. + +SHIFT + MOVE_PNT will break a reg polygon or star into a number of +connected lines. + +When drawing lines if the SHIFT modifier is used then connected lines +can be drawn. + +SHIFT + MOVE_OBJ will move all objects. Note if "snap to grid" is selected then +the new point will be constrained to fall on a grid intersection. + +Mouse button 3 + "snap to grid" will constrain the point to fall on one of the +two gridlines it was originally on. + +The ">" and "<" buttons allow you to selective move through each of the +objects in the collection. The "==" returns the display to normal. If the +"paint" button is pressed then only the single object displayed will be +drawn into the target window. Also when in this mode pressing the shift button +will temporarily show all the objects in the collection. + +The the options tab there is now a toggle that allows you to turn the +position display on and off. + +Gfig objects +++++++++++++ + +The upper right part of gfig contains a scroll region when different +collection of objects can be found. When button 1 is pressed on an entry +the small preview window will be updated with the objects contained in +the selected figure. These objects can then be loaded into the main window +by using the "Edit" button or the "Merge" button. In the former case +the objects area will first be cleared before the new objects +are added. In the latter case the objects will be merged into the drawing area. + +When a collection of objects is altered to small image of a floppy disc +will be placed next to the entry signifying that this collection needs to be +saved. If a red cross appears here then the file associated with the +entry is read only and cannot be saved to (it can be copied however). + +Button 3 brings up a popup menu that allows collections to be saved away to +different files. (Accel. keys also exist for some functions). + +The buttons on the right of the list area allow the following operations:- + +Rescan:- +This popus up a window which allows you to add directories to the internal +gfig-path. A (re)scan of these directories can the performed. Note any +modification to the gfig-path will NOT be mirrored in your ~/.gimp/gimprc file. + +Load:- +Allows you to load a single collection of objects. + +New:- +Create a new collection. Note that until this is saved away to a file then no +filename will be associated with it. (See status area). + +Delete:- +Popups a dialog asking if you wish to delete the entry selected in the list +box as well as on disc. + +Additionally button 3 over the list area allows the following:- + +Save as...:- +Save collection to new filename. The collections filename is also +changed to this new name. The original name is NOT deleted from the disc +but it is effectively removed from the list selection area (actually it +is overwritten internally). + +Save:- +Save the currently selected entry to disc. + +Copy:- +Make a copy of the collection. + +Edit:- +Same as the "Edit button". + +Double click on entry with Button 1 popups up a dialog that allows you to +modify the nme of an entry (similar to other list areas in GIMP). + +Bezier +~~~~~~ + +OK my maths is a little rusty. The bezier stuff is only very simple. However... +I have tried to abstract as much as possible the bezier calculations from +the drawing of the control points / painting on the screen and in the target +window. + +The bezier function is defined as:- + +void +DrawBezier (gdouble (*points)[2], gint np, gdouble mid, gint depth) +{ +... +} + +Points an array of pairs of doubles that define the control points +np is the number of points. Mid is always starts as 0.5 - and depth +defines how deep the recursion should go when calculating the line points. + +The function should call fp_pnt_add() when a point on the curve has been +calculated. + +If anyone would like to produce a better/faster function then you +should be able to replace the DrawBezier function. (Only the first two args +are really needed). + +The algorithm the current code is based on was obtained by looking +at the many many examples out on the web. +(Bezier drawing seems to be topic of the year for computer degrees +and people learning java!!!) + diff --git a/plug-ins/gfig/gfig-arc.c b/plug-ins/gfig/gfig-arc.c new file mode 100644 index 0000000..5e8be02 --- /dev/null +++ b/plug-ins/gfig/gfig-arc.c @@ -0,0 +1,735 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + +#include "config.h" + +#include <math.h> +#include <stdlib.h> + +#include <gtk/gtk.h> + +#include <libgimp/gimp.h> + +#include "gfig.h" +#include "gfig-dobject.h" +#include "gfig-arc.h" + +#include "libgimp/stdplugins-intl.h" + +static gdouble dist (gdouble x1, + gdouble y1, + gdouble x2, + gdouble y2); + +static void mid_point (gdouble x1, + gdouble y1, + gdouble x2, + gdouble y2, + gdouble *mx, + gdouble *my); + +static gdouble line_grad (gdouble x1, + gdouble y1, + gdouble x2, + gdouble y2); + +static gdouble line_cons (gdouble x, + gdouble y, + gdouble lgrad); + +static void line_definition (gdouble x1, + gdouble y1, + gdouble x2, + gdouble y2, + gdouble *lgrad, + gdouble *lconst); + +static void arc_details (GdkPoint *vert_a, + GdkPoint *vert_b, + GdkPoint *vert_c, + GdkPoint *center_pnt, + gdouble *radius); + +static gdouble arc_angle (GdkPoint *pnt, + GdkPoint *center); + +static void arc_drawing_details (GfigObject *obj, + gdouble *minang, + GdkPoint *center_pnt, + gdouble *arcang, + gdouble *radius, + gboolean draw_cnts, + gboolean do_scale); + +static void d_draw_arc (GfigObject *obj, + cairo_t *cr); + +static void d_paint_arc (GfigObject *obj); + +static GfigObject *d_copy_arc (GfigObject *obj); + +static void d_update_arc_line (GdkPoint *pnt); +static void d_update_arc (GdkPoint *pnt); +static void d_arc_line_start (GdkPoint *pnt, + gboolean shift_down); +static void d_arc_line_end (GdkPoint *pnt, + gboolean shift_down); + +/* Distance between two points. */ +static gdouble +dist (gdouble x1, + gdouble y1, + gdouble x2, + gdouble y2) +{ + + double s1 = x1 - x2; + double s2 = y1 - y2; + + return sqrt (s1 * s1 + s2 * s2); +} + +/* Mid point of line returned */ +static void +mid_point (gdouble x1, + gdouble y1, + gdouble x2, + gdouble y2, + gdouble *mx, + gdouble *my) +{ + *mx = (x1 + x2) / 2.0; + *my = (y1 + y2) / 2.0; +} + +/* Careful about infinite grads */ +static gdouble +line_grad (gdouble x1, + gdouble y1, + gdouble x2, + gdouble y2) +{ + double dx, dy; + + dx = x1 - x2; + dy = y1 - y2; + + return (dx == 0.0) ? 0.0 : dy / dx; +} + +/* Constant of line that goes through x, y with grad lgrad */ +static gdouble +line_cons (gdouble x, + gdouble y, + gdouble lgrad) +{ + return y - lgrad * x; +} + +/* Get grad & const for perpend. line to given points */ +static void +line_definition (gdouble x1, + gdouble y1, + gdouble x2, + gdouble y2, + gdouble *lgrad, + gdouble *lconst) +{ + double grad1; + double midx, midy; + + grad1 = line_grad (x1, y1, x2, y2); + + if (grad1 == 0.0) + { +#ifdef DEBUG + printf ("Infinite grad....\n"); +#endif /* DEBUG */ + return; + } + + mid_point (x1, y1, x2, y2, &midx, &midy); + + /* Invert grad for perpen gradient */ + + *lgrad = -1.0 / grad1; + + *lconst = line_cons (midx, midy,*lgrad); +} + +/* Arch details + * Given three points get arc radius and the co-ords + * of center point. + */ + +static void +arc_details (GdkPoint *vert_a, + GdkPoint *vert_b, + GdkPoint *vert_c, + GdkPoint *center_pnt, + gdouble *radius) +{ + /* Only vertices are in whole numbers - everything else is in doubles */ + double ax, ay; + double bx, by; + double cx, cy; + + double len_a, len_b, len_c; + double sum_sides2; + double area; + double circumcircle_R; + double line1_grad = 0, line1_const = 0; + double line2_grad = 0, line2_const = 0; + double inter_x = 0.0, inter_y = 0.0; + int got_x = 0, got_y = 0; + + ax = (double) (vert_a->x); + ay = (double) (vert_a->y); + bx = (double) (vert_b->x); + by = (double) (vert_b->y); + cx = (double) (vert_c->x); + cy = (double) (vert_c->y); + + len_a = dist (ax, ay, bx, by); + len_b = dist (bx, by, cx, cy); + len_c = dist (cx, cy, ax, ay); + + sum_sides2 = (fabs (len_a) + fabs (len_b) + fabs (len_c))/2; + + /* Area */ + area = sqrt (sum_sides2 * (sum_sides2 - len_a) * + (sum_sides2 - len_b) * + (sum_sides2 - len_c)); + + /* Circumcircle */ + circumcircle_R = len_a * len_b * len_c / (4 * area); + *radius = circumcircle_R; + + /* Deal with exceptions - I hate exceptions */ + + if (ax == bx || ax == cx || cx == bx) + { + /* vert line -> mid point gives inter_x */ + if (ax == bx && bx == cx) + { + /* Straight line */ + double miny = ay; + double maxy = ay; + + if (by > maxy) + maxy = by; + + if (by < miny) + miny = by; + + if (cy > maxy) + maxy = cy; + + if (cy < miny) + miny = cy; + + inter_y = (maxy - miny) / 2 + miny; + } + else if (ax == bx) + { + inter_y = (ay - by) / 2 + by; + } + else if (bx == cx) + { + inter_y = (by - cy) / 2 + cy; + } + else + { + inter_y = (cy - ay) / 2 + ay; + } + got_y = 1; + } + + if (ay == by || by == cy || ay == cy) + { + /* Horz line -> midpoint gives inter_y */ + if (ax == bx && bx == cx) + { + /* Straight line */ + double minx = ax; + double maxx = ax; + + if (bx > maxx) + maxx = bx; + + if (bx < minx) + minx = bx; + + if (cx > maxx) + maxx = cx; + + if (cx < minx) + minx = cx; + + inter_x = (maxx - minx) / 2 + minx; + } + else if (ay == by) + { + inter_x = (ax - bx) / 2 + bx; + } + else if (by == cy) + { + inter_x = (bx - cx) / 2 + cx; + } + else + { + inter_x = (cx - ax) / 2 + ax; + } + got_x = 1; + } + + if (!got_x || !got_y) + { + /* At least two of the lines are not parallel to the axis */ + /*first line */ + if (ax != bx && ay != by) + line_definition (ax, ay, bx, by, &line1_grad, &line1_const); + else + line_definition (ax, ay, cx, cy, &line1_grad, &line1_const); + /* second line */ + if (bx != cx && by != cy) + line_definition (bx, by, cx, cy, &line2_grad, &line2_const); + else + line_definition (ax, ay, cx, cy, &line2_grad, &line2_const); + } + + /* Intersection point */ + + if (!got_x) + inter_x = (line2_const - line1_const) / (line1_grad - line2_grad); + if (!got_y) + inter_y = line1_grad * inter_x + line1_const; + + center_pnt->x = (gint) inter_x; + center_pnt->y = (gint) inter_y; +} + +static gdouble +arc_angle (GdkPoint *pnt, + GdkPoint *center) +{ + /* Get angle (in degrees) of point given origin of center */ + gint16 shift_x; + gint16 shift_y; + gdouble offset_angle; + + shift_x = pnt->x - center->x; + shift_y = -pnt->y + center->y; + offset_angle = atan2 (shift_y, shift_x); + + if (offset_angle < 0) + offset_angle += 2.0 * G_PI; + + return offset_angle * 360 / (2.0 * G_PI); +} + +static void +arc_drawing_details (GfigObject *obj, + gdouble *minang, + GdkPoint *center_pnt, + gdouble *arcang, + gdouble *radius, + gboolean draw_cnts, + gboolean do_scale) +{ + DobjPoints *pnt1 = NULL; + DobjPoints *pnt2 = NULL; + DobjPoints *pnt3 = NULL; + DobjPoints dpnts[3]; + gdouble ang1, ang2, ang3; + gdouble maxang; + + pnt1 = obj->points; + + if (!pnt1) + return; /* Not fully drawn */ + + pnt2 = pnt1->next; + + if (!pnt2) + return; /* Not fully drawn */ + + pnt3 = pnt2->next; + + if (!pnt3) + return; /* Still not fully drawn */ + + if (do_scale) + { + /* Adjust pnts for scaling */ + /* Warning struct copies here! and casting to double <-> int */ + /* Too complex fix me - to much hacking */ + gdouble xy[2]; + int j; + + dpnts[0] = *pnt1; + dpnts[1] = *pnt2; + dpnts[2] = *pnt3; + + pnt1 = &dpnts[0]; + pnt2 = &dpnts[1]; + pnt3 = &dpnts[2]; + + for (j = 0 ; j < 3; j++) + { + xy[0] = dpnts[j].pnt.x; + xy[1] = dpnts[j].pnt.y; + if (selvals.scaletoimage) + scale_to_original_xy (&xy[0], 1); + else + scale_to_xy (&xy[0], 1); + dpnts[j].pnt.x = xy[0]; + dpnts[j].pnt.y = xy[1]; + } + } + + arc_details (&pnt1->pnt, &pnt2->pnt, &pnt3->pnt, center_pnt, radius); + + ang1 = arc_angle (&pnt1->pnt, center_pnt); + ang2 = arc_angle (&pnt2->pnt, center_pnt); + ang3 = arc_angle (&pnt3->pnt, center_pnt); + + /* Find min/max angle */ + + maxang = ang1; + + if (ang3 > maxang) + maxang = ang3; + + *minang = ang1; + + if (ang3 < *minang) + *minang = ang3; + + if (ang2 > *minang && ang2 < maxang) + *arcang = maxang - *minang; + else + *arcang = maxang - *minang - 360; +} + +static void +d_draw_arc (GfigObject *obj, + cairo_t *cr) +{ + DobjPoints *pnt1, *pnt2, *pnt3; + GdkPoint center_pnt; + gdouble radius, minang, arcang; + + g_assert (obj != NULL); + + if (!obj) + return; + + pnt1 = obj->points; + pnt2 = pnt1 ? pnt1->next : NULL; + pnt3 = pnt2 ? pnt2->next : NULL; + + if (! pnt3) + return; + + draw_sqr (&pnt1->pnt, obj == gfig_context->selected_obj, cr); + draw_sqr (&pnt2->pnt, obj == gfig_context->selected_obj, cr); + draw_sqr (&pnt3->pnt, obj == gfig_context->selected_obj, cr); + + arc_drawing_details (obj, &minang, ¢er_pnt, &arcang, &radius, + TRUE, FALSE); + gfig_draw_arc (center_pnt.x, center_pnt.y, radius, radius, -minang, -(minang + arcang), cr); +} + +static void +d_paint_arc (GfigObject *obj) +{ + /* first point center */ + /* Next point is radius */ + gdouble *line_pnts; + gint seg_count = 0; + gint i = 0; + gdouble ang_grid; + gdouble ang_loop; + gdouble radius; + gint loop; + GdkPoint last_pnt = { 0, 0 }; + gboolean first = TRUE; + GdkPoint center_pnt; + gdouble minang, arcang; + + g_assert (obj != NULL); + + if (!obj) + return; + + /* No cnt pnts & must scale */ + arc_drawing_details (obj, &minang, ¢er_pnt, &arcang, &radius, + FALSE, TRUE); + + seg_count = 360; /* Should make a smoth-ish curve */ + + /* +3 because we MIGHT do pie selection */ + line_pnts = g_new0 (gdouble, 2 * seg_count + 3); + + /* Lines */ + ang_grid = 2.0 * G_PI / 360.0; + + if (arcang < 0.0) + { + /* Swap - since we always draw anti-clock wise */ + minang += arcang; + arcang = -arcang; + } + + minang = minang * (2.0 * G_PI / 360.0); /* min ang is in degrees - need in rads */ + + for (loop = 0 ; loop < abs ((gint)arcang) ; loop++) + { + gdouble lx, ly; + GdkPoint calc_pnt; + + ang_loop = (gdouble)loop * ang_grid + minang; + + lx = radius * cos (ang_loop); + ly = -radius * sin (ang_loop); /* y grows down screen and angs measured from x clockwise */ + + calc_pnt.x = RINT (lx + center_pnt.x); + calc_pnt.y = RINT (ly + center_pnt.y); + + /* Miss out duped pnts */ + if (!first) + { + if (calc_pnt.x == last_pnt.x && calc_pnt.y == last_pnt.y) + { + continue; + } + } + + line_pnts[i++] = calc_pnt.x; + line_pnts[i++] = calc_pnt.y; + last_pnt = calc_pnt; + + if (first) + { + first = FALSE; + } + } + + /* One go */ + if (obj->style.paint_type == PAINT_BRUSH_TYPE) + { + gfig_paint (selvals.brshtype, + gfig_context->drawable_id, + i, line_pnts); + } + + g_free (line_pnts); +} + +static GfigObject * +d_copy_arc (GfigObject *obj) +{ + GfigObject *nc; + + g_assert (obj->type == ARC); + + nc = d_new_object (ARC, obj->points->pnt.x, obj->points->pnt.y); + nc->points->next = d_copy_dobjpoints (obj->points->next); + + return nc; +} + +void +d_arc_object_class_init (void) +{ + GfigObjectClass *class = &dobj_class[ARC]; + + class->type = ARC; + class->name = "ARC"; + class->drawfunc = d_draw_arc; + class->paintfunc = d_paint_arc; + class->copyfunc = d_copy_arc; + class->update = d_update_arc; +} + +/* Update end point of line */ +static void +d_update_arc_line (GdkPoint *pnt) +{ + DobjPoints *spnt, *epnt; + /* Get last but one segment and undraw it - + * Then draw new segment in. + * always dealing with the static object. + */ + + /* Get start of segments */ + spnt = obj_creating->points; + + if (!spnt) + return; /* No points */ + + if ((epnt = spnt->next)) + { + g_free (epnt); + } + + epnt = new_dobjpoint (pnt->x, pnt->y); + spnt->next = epnt; +} + +static void +d_update_arc (GdkPoint *pnt) +{ + DobjPoints *pnt1 = NULL; + DobjPoints *pnt2 = NULL; + DobjPoints *pnt3 = NULL; + + /* First two points as line only become arch when third + * point is placed on canvas. + */ + + pnt1 = obj_creating->points; + + if (!pnt1 || + !(pnt2 = pnt1->next) || + !(pnt3 = pnt2->next)) + { + d_update_arc_line (pnt); + return; /* Not fully drawn */ + } + + /* Update a real curve */ + /* Nothing to be done ... */ +} + +static void +d_arc_line_start (GdkPoint *pnt, + gboolean shift_down) +{ + if (!obj_creating || !shift_down) + { + /* Must delete obj_creating if we have one */ + obj_creating = d_new_object (LINE, pnt->x, pnt->y); + } + else + { + /* Contniuation */ + d_update_arc_line (pnt); + } +} + +void +d_arc_start (GdkPoint *pnt, + gboolean shift_down) +{ + /* Draw lines to start with -- then convert to an arc */ + d_arc_line_start (pnt, TRUE); /* TRUE means multiple pointed line */ +} + +static void +d_arc_line_end (GdkPoint *pnt, + gboolean shift_down) +{ + if (shift_down) + { + if (tmp_line) + { + GdkPoint tmp_pnt = *pnt; + + if (need_to_scale) + { + tmp_pnt.x = pnt->x * scale_x_factor; + tmp_pnt.y = pnt->y * scale_y_factor; + } + + d_pnt_add_line (tmp_line, tmp_pnt.x, tmp_pnt.y, -1); + free_one_obj (obj_creating); + /* Must free obj_creating */ + } + else + { + tmp_line = obj_creating; + add_to_all_obj (gfig_context->current_obj, obj_creating); + } + + obj_creating = d_new_object (LINE, pnt->x, pnt->y); + } + else + { + if (tmp_line) + { + GdkPoint tmp_pnt = *pnt; + + if (need_to_scale) + { + tmp_pnt.x = pnt->x * scale_x_factor; + tmp_pnt.y = pnt->y * scale_y_factor; + } + + d_pnt_add_line (tmp_line, tmp_pnt.x, tmp_pnt.y, -1); + free_one_obj (obj_creating); + /* Must free obj_creating */ + } + else + { + add_to_all_obj (gfig_context->current_obj, obj_creating); + } + obj_creating = NULL; + tmp_line = NULL; + } + /*gtk_widget_queue_draw (gfig_context->preview);*/ +} + +void +d_arc_end (GdkPoint *pnt, + gboolean shift_down) +{ + /* Under control point */ + if (!tmp_line || + !tmp_line->points || + !tmp_line->points->next) + { + /* No arc created - yet. Must have three points */ + d_arc_line_end (pnt, TRUE); + } + else + { + /* Complete arc */ + /* Convert to an arc ... */ + tmp_line->type = ARC; + tmp_line->class = &dobj_class[ARC]; + d_arc_line_end (pnt, FALSE); + if (need_to_scale) + { + selvals.scaletoimage = 0; + } + gtk_widget_queue_draw (gfig_context->preview); + if (need_to_scale) + { + selvals.scaletoimage = 1; + } + } +} + diff --git a/plug-ins/gfig/gfig-arc.h b/plug-ins/gfig/gfig-arc.h new file mode 100644 index 0000000..70e599e --- /dev/null +++ b/plug-ins/gfig/gfig-arc.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + +#ifndef __GFIG_ARC_H__ +#define __GFIG_ARC_H__ + +void d_arc_object_class_init (void); + +void d_arc_start (GdkPoint *pnt, + gboolean shift_down); +void d_arc_end (GdkPoint *pnt, + gboolean shift_down); + + +#endif /* __GFIG_ARC_H__ */ diff --git a/plug-ins/gfig/gfig-bezier.c b/plug-ins/gfig/gfig-bezier.c new file mode 100644 index 0000000..9156d7c --- /dev/null +++ b/plug-ins/gfig/gfig-bezier.c @@ -0,0 +1,422 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + +#include "config.h" + +#include <libgimp/gimp.h> +#include <libgimp/gimpui.h> + +#include "gfig.h" +#include "gfig-line.h" +#include "gfig-dobject.h" +#include "gfig-dialog.h" +#include "gfig-bezier.h" + +#include "libgimp/stdplugins-intl.h" + +#define FP_PNT_MAX 10 + +typedef gdouble (*fp_pnt)[2]; + +static gboolean bezier_closed = FALSE; +static gboolean bezier_line_frame = FALSE; +static int fp_pnt_cnt = 0; +static int fp_pnt_chunk = 0; +static gdouble *fp_pnt_pnts = NULL; + +GfigObject *tmp_bezier; /* Needed when drawing bezier curves */ + +static void fp_pnt_start (void); +static void fp_pnt_add (gdouble p1, + gdouble p2, + gdouble p3, + gdouble p4); +static gdouble *d_bz_get_array (gint *sz); +static void d_bz_line (cairo_t *cr); +static void DrawBezier (fp_pnt points, + gint np, + gdouble mid, + gint depth); +static void d_paint_bezier (GfigObject *obj); +static GfigObject *d_copy_bezier (GfigObject *obj); +static void d_update_bezier (GdkPoint *pnt); + +static void +fp_pnt_start (void) +{ + fp_pnt_cnt = 0; +} + +/* Add a line segment to collection array */ +static void +fp_pnt_add (gdouble p1, + gdouble p2, + gdouble p3, + gdouble p4) +{ + if (!fp_pnt_pnts) + { + fp_pnt_pnts = g_new0 (gdouble, FP_PNT_MAX); + fp_pnt_chunk = 1; + } + + if (((fp_pnt_cnt + 4) / FP_PNT_MAX) >= fp_pnt_chunk) + { + /* more space pls */ + fp_pnt_chunk++; + fp_pnt_pnts = g_renew (gdouble, fp_pnt_pnts, fp_pnt_chunk * FP_PNT_MAX); + } + + fp_pnt_pnts[fp_pnt_cnt++] = p1; + fp_pnt_pnts[fp_pnt_cnt++] = p2; + fp_pnt_pnts[fp_pnt_cnt++] = p3; + fp_pnt_pnts[fp_pnt_cnt++] = p4; +} + +static gdouble * +d_bz_get_array (gint *sz) +{ + *sz = fp_pnt_cnt; + return fp_pnt_pnts; +} + +static void +d_bz_line (cairo_t *cr) +{ + gint i, x0, y0, x1, y1; + + g_assert ((fp_pnt_cnt % 4) == 0); + + for (i = 0 ; i < fp_pnt_cnt; i += 4) + { + x0 = fp_pnt_pnts[i]; + y0 = fp_pnt_pnts[i + 1]; + x1 = fp_pnt_pnts[i + 2]; + y1 = fp_pnt_pnts[i + 3]; + + gfig_draw_line (x0, y0, x1, y1, cr); + } +} + +/* Return points to plot */ +/* Terminate by point with DBL_MAX, DBL_MAX */ +static void +DrawBezier (fp_pnt points, + gint np, + gdouble mid, + gint depth) +{ + gint i, j, x0 = 0, y0 = 0, x1, y1; + fp_pnt left; + fp_pnt right; + + if (depth == 0) /* draw polyline */ + { + for (i = 0; i < np; i++) + { + x1 = (int) points[i][0]; + y1 = (int) points[i][1]; + if (i > 0 && (x1 != x0 || y1 != y0)) + { + /* Add pnts up */ + fp_pnt_add ((gdouble) x0, (gdouble) y0, + (gdouble) x1, (gdouble) y1); + } + x0 = x1; + y0 = y1; + } + } + else /* subdivide control points at mid */ + { + left = (fp_pnt)g_new (gdouble, np * 2); + right = (fp_pnt)g_new (gdouble, np * 2); + for (i = 0; i < np; i++) + { + right[i][0] = points[i][0]; + right[i][1] = points[i][1]; + } + left[0][0] = right[0][0]; + left[0][1] = right[0][1]; + for (j = np - 1; j >= 1; j--) + { + for (i = 0; i < j; i++) + { + right[i][0] = (1 - mid) * right[i][0] + mid * right[i + 1][0]; + right[i][1] = (1 - mid) * right[i][1] + mid * right[i + 1][1]; + } + left[np - j][0] = right[0][0]; + left[np - j][1] = right[0][1]; + } + if (depth > 0) + { + DrawBezier (left, np, mid, depth - 1); + DrawBezier (right, np, mid, depth - 1); + g_free (left); + g_free (right); + } + } +} + +void +d_draw_bezier (GfigObject *obj, + cairo_t *cr) +{ + DobjPoints *spnt; + gint seg_count = 0; + gint i = 0; + gdouble (*line_pnts)[2]; + + spnt = obj->points; + + /* First count the number of points */ + for (spnt = obj->points; spnt; spnt = spnt->next) + seg_count++; + + if (!seg_count) + return; /* no-line */ + + line_pnts = (fp_pnt) g_new0 (gdouble, 2 * seg_count + 1); + + /* Go around all the points drawing a line from one to the next */ + for (spnt = obj->points; spnt; spnt = spnt->next) + { + if (! spnt->next && obj == obj_creating) + draw_circle (&spnt->pnt, TRUE, cr); + else + draw_sqr (&spnt->pnt, obj == gfig_context->selected_obj, cr); + line_pnts[i][0] = spnt->pnt.x; + line_pnts[i][1] = spnt->pnt.y; + i++; + } + + /* Generate an array of doubles which are the control points */ + + if (bezier_line_frame && tmp_bezier) + { + fp_pnt_start (); + DrawBezier (line_pnts, seg_count, 0.5, 0); + d_bz_line (cr); + } + + fp_pnt_start (); + DrawBezier (line_pnts, seg_count, 0.5, 3); + d_bz_line (cr); + + g_free (line_pnts); +} + +static void +d_paint_bezier (GfigObject *obj) +{ + gdouble *line_pnts; + gdouble (*bz_line_pnts)[2]; + DobjPoints *spnt; + gint seg_count = 0; + gint i = 0; + + /* First count the number of points */ + for (spnt = obj->points; spnt; spnt = spnt->next) + seg_count++; + + if (!seg_count) + return; /* no-line */ + + bz_line_pnts = (fp_pnt) g_new0 (gdouble, 2 * seg_count + 1); + + /* Go around all the points drawing a line from one to the next */ + for (spnt = obj->points; spnt; spnt = spnt->next) + { + bz_line_pnts[i][0] = spnt->pnt.x; + bz_line_pnts[i][1] = spnt->pnt.y; + i++; + } + + fp_pnt_start (); + DrawBezier (bz_line_pnts, seg_count, 0.5, 5); + line_pnts = d_bz_get_array (&i); + + /* Scale before drawing */ + if (selvals.scaletoimage) + scale_to_original_xy (&line_pnts[0], i / 2); + else + scale_to_xy (&line_pnts[0], i / 2); + + /* One go */ + if (obj->style.paint_type == PAINT_BRUSH_TYPE) + { + gfig_paint (selvals.brshtype, + gfig_context->drawable_id, + i, line_pnts); + } + + g_free (bz_line_pnts); + /* Don't free line_pnts - may need again */ +} + +static GfigObject * +d_copy_bezier (GfigObject *obj) +{ + GfigObject *np; + + g_assert (obj->type == BEZIER); + + np = d_new_object (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; +} + +void +d_bezier_object_class_init (void) +{ + GfigObjectClass *class = &dobj_class[BEZIER]; + + class->type = BEZIER; + class->name = "BEZIER"; + class->drawfunc = d_draw_bezier; + class->paintfunc = d_paint_bezier; + class->copyfunc = d_copy_bezier; + class->update = d_update_bezier; +} + +static void +d_update_bezier (GdkPoint *pnt) +{ + DobjPoints *s_pnt, *l_pnt; + + g_assert (tmp_bezier != NULL); + + s_pnt = tmp_bezier->points; + + if (!s_pnt) + return; /* No points */ + + if ((l_pnt = s_pnt->next)) + { + while (l_pnt->next) + { + l_pnt = l_pnt->next; + } + + l_pnt->pnt = *pnt; + } + else + { + /* Radius is a few pixels away */ + /* First edge point */ + d_pnt_add_line (tmp_bezier, pnt->x, pnt->y,-1); + } +} + +void +d_bezier_start (GdkPoint *pnt, + gboolean shift_down) +{ + if (!tmp_bezier) + { + /* New curve */ + tmp_bezier = obj_creating = d_new_object (BEZIER, pnt->x, pnt->y); + } +} + +void +d_bezier_end (GdkPoint *pnt, + gboolean shift_down) +{ + DobjPoints *l_pnt; + + if (!tmp_bezier) + { + tmp_bezier = obj_creating; + } + + l_pnt = tmp_bezier->points->next; + + if (!l_pnt) + return; + + if (shift_down) + { + while (l_pnt->next) + { + l_pnt = l_pnt->next; + } + + if (l_pnt) + { + if (bezier_closed) + { + /* if closed then add first point */ + d_pnt_add_line (tmp_bezier, + tmp_bezier->points->pnt.x, + tmp_bezier->points->pnt.y, -1); + } + + add_to_all_obj (gfig_context->current_obj, obj_creating); + } + + /* small mem leak if !l_pnt ? */ + tmp_bezier = NULL; + obj_creating = NULL; + } + else + { + d_pnt_add_line (tmp_bezier, pnt->x, pnt->y,-1); + } +} + +void +tool_options_bezier (GtkWidget *notebook) +{ + GtkWidget *vbox; + GtkWidget *toggle; + + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + gtk_container_set_border_width (GTK_CONTAINER (vbox), 12); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, NULL); + gtk_widget_show (vbox); + + toggle = gtk_check_button_new_with_label (_("Closed")); + g_signal_connect (toggle, "toggled", + G_CALLBACK (gimp_toggle_button_update), + &bezier_closed); + gimp_help_set_help_data (toggle, + _("Close curve on completion"), NULL); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), bezier_closed); + gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0); + gtk_widget_show (toggle); + + toggle = gtk_check_button_new_with_label (_("Show Line Frame")); + g_signal_connect (toggle, "toggled", + G_CALLBACK (gimp_toggle_button_update), + &bezier_line_frame); + gimp_help_set_help_data (toggle, + _("Draws lines between the control points. " + "Only during curve creation"), NULL); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), bezier_line_frame); + gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0); + gtk_widget_show (toggle); +} + diff --git a/plug-ins/gfig/gfig-bezier.h b/plug-ins/gfig/gfig-bezier.h new file mode 100644 index 0000000..e030d0c --- /dev/null +++ b/plug-ins/gfig/gfig-bezier.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + +#ifndef __GFIG_BEZIER_H__ +#define __GFIG_BEZIER_H__ + +extern GfigObject *tmp_bezier; + +void d_draw_bezier (GfigObject *obj, + cairo_t *cr); + +void d_bezier_object_class_init (void); + +void d_bezier_start (GdkPoint *pnt, + gboolean shift_down); +void d_bezier_end (GdkPoint *pnt, + gboolean shift_down); + +void tool_options_bezier (GtkWidget *notebook); + +#endif /* __GFIG_BEZIER_H__ */ diff --git a/plug-ins/gfig/gfig-circle.c b/plug-ins/gfig/gfig-circle.c new file mode 100644 index 0000000..0839abf --- /dev/null +++ b/plug-ins/gfig/gfig-circle.c @@ -0,0 +1,234 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + +#include "config.h" + +#include <libgimp/gimp.h> +#include <libgimp/gimpui.h> + +#include "gfig.h" +#include "gfig-dobject.h" +#include "gfig-poly.h" +#include "gfig-circle.h" + +#include "libgimp/stdplugins-intl.h" + +static gint calc_radius (GdkPoint *center, + GdkPoint *edge); +static void d_draw_circle (GfigObject *obj, + cairo_t *cr); +static void d_paint_circle (GfigObject *obj); +static GfigObject *d_copy_circle (GfigObject *obj); + +static void d_update_circle (GdkPoint *pnt); + +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 (GfigObject *obj, + cairo_t *cr) +{ + DobjPoints *center_pnt; + DobjPoints *edge_pnt; + gint radius; + + center_pnt = obj->points; + + if (!center_pnt) + return; /* End-of-line */ + + draw_sqr (¢er_pnt->pnt, obj == gfig_context->selected_obj, cr); + + edge_pnt = center_pnt->next; + + if (!edge_pnt) + return; + + radius = calc_radius (¢er_pnt->pnt, &edge_pnt->pnt); + + if (obj_creating == obj) + draw_circle (&edge_pnt->pnt, TRUE, cr); + else + draw_sqr (&edge_pnt->pnt, obj == gfig_context->selected_obj, cr); + + gfig_draw_arc (center_pnt->pnt.x, center_pnt->pnt.y, + radius, radius, 0, 360, cr); +} + +static void +d_paint_circle (GfigObject *obj) +{ + DobjPoints *center_pnt; + DobjPoints *edge_pnt; + gint radius; + gdouble dpnts[4]; + + g_assert (obj != NULL); + + center_pnt = obj->points; + + if (!center_pnt) + return; /* End-of-line */ + + edge_pnt = center_pnt->next; + + if (!edge_pnt) + { + g_error ("Internal error - circle no edge pnt"); + } + + radius = calc_radius (¢er_pnt->pnt, &edge_pnt->pnt); + + dpnts[0] = (gdouble) center_pnt->pnt.x - radius; + dpnts[1] = (gdouble) center_pnt->pnt.y - radius; + dpnts[3] = dpnts[2] = (gdouble) radius * 2; + + /* Scale before drawing */ + if (selvals.scaletoimage) + scale_to_original_xy (&dpnts[0], 2); + else + scale_to_xy (&dpnts[0], 2); + + if (gfig_context_get_current_style ()->fill_type != FILL_NONE) + { + gimp_context_push (); + gimp_context_set_antialias (selopt.antia); + gimp_context_set_feather (selopt.feather); + gimp_context_set_feather_radius (selopt.feather_radius, selopt.feather_radius); + gimp_image_select_ellipse (gfig_context->image_id, + selopt.type, + dpnts[0], dpnts[1], + dpnts[2], dpnts[3]); + gimp_context_pop (); + + paint_layer_fill (center_pnt->pnt.x - radius, + center_pnt->pnt.y - radius, + center_pnt->pnt.x + radius, + center_pnt->pnt.y + radius); + gimp_selection_none (gfig_context->image_id); + } + + /* Drawing a circle may be harder than stroking a circular selection, + * but we have to do it or we will not be able to draw outside of the + * layer. */ + if (obj->style.paint_type == PAINT_BRUSH_TYPE) + { + const gdouble r = dpnts[2] / 2; + const gdouble cx = dpnts[0] + r, cy = dpnts[1] + r; + gdouble line_pnts[362]; + gdouble angle = 0; + gint i = 0; + + while (i < 361) + { + static const gdouble step = 2 * G_PI / 180; + + line_pnts[i++] = cx + r * cos (angle); + line_pnts[i++] = cy + r * sin (angle); + angle += step; + } + + gfig_paint (selvals.brshtype, gfig_context->drawable_id, i, line_pnts); + } +} + +static GfigObject * +d_copy_circle (GfigObject * obj) +{ + GfigObject *nc; + + g_assert (obj->type == CIRCLE); + + nc = d_new_object (CIRCLE, obj->points->pnt.x, obj->points->pnt.y); + nc->points->next = d_copy_dobjpoints (obj->points->next); + + return nc; +} + +void +d_circle_object_class_init (void) +{ + GfigObjectClass *class = &dobj_class[CIRCLE]; + + class->type = CIRCLE; + class->name = "CIRCLE"; + class->drawfunc = d_draw_circle; + class->paintfunc = d_paint_circle; + class->copyfunc = d_copy_circle; + class->update = d_update_circle; +} + +static void +d_update_circle (GdkPoint *pnt) +{ + DobjPoints *center_pnt, *edge_pnt; + + center_pnt = obj_creating->points; + + if (!center_pnt) + return; /* No points */ + + if ((edge_pnt = center_pnt->next)) + { + edge_pnt->pnt = *pnt; + } + else + { + edge_pnt = new_dobjpoint (pnt->x, pnt->y); + center_pnt->next = edge_pnt; + } +} + +void +d_circle_start (GdkPoint *pnt, + gboolean shift_down) +{ + obj_creating = d_new_object (CIRCLE, pnt->x, pnt->y); +} + +void +d_circle_end (GdkPoint *pnt, + gboolean shift_down) +{ + /* Under control point */ + if (!obj_creating->points->next) + { + /* No circle created */ + free_one_obj (obj_creating); + } + else + { + add_to_all_obj (gfig_context->current_obj, obj_creating); + } + + obj_creating = NULL; +} + diff --git a/plug-ins/gfig/gfig-circle.h b/plug-ins/gfig/gfig-circle.h new file mode 100644 index 0000000..910e3a3 --- /dev/null +++ b/plug-ins/gfig/gfig-circle.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + +#ifndef __GFIG_CIRCLE_H__ +#define __GFIG_CIRCLE_H__ + +void d_circle_object_class_init (void); + +void d_circle_start (GdkPoint *pnt, + gboolean shift_down); +void d_circle_end (GdkPoint *pnt, + gboolean shift_down); + +#endif /* __GFIG_CIRCLE_H__ */ diff --git a/plug-ins/gfig/gfig-dialog.c b/plug-ins/gfig/gfig-dialog.c new file mode 100644 index 0000000..9f72b97 --- /dev/null +++ b/plug-ins/gfig/gfig-dialog.c @@ -0,0 +1,2193 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +#include "config.h" + +#include <stdlib.h> +#include <string.h> +#include <errno.h> + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +#include <glib.h> + +#ifdef G_OS_WIN32 +#include <libgimpbase/gimpwin32-io.h> +#endif + +#include <libgimp/gimp.h> +#include <libgimp/gimpui.h> + +#include "libgimp/stdplugins-intl.h" + +#include "gfig.h" +#include "gfig-style.h" +#include "gfig-dialog.h" +#include "gfig-arc.h" +#include "gfig-bezier.h" +#include "gfig-circle.h" +#include "gfig-dobject.h" +#include "gfig-ellipse.h" +#include "gfig-grid.h" +#include "gfig-line.h" +#include "gfig-poly.h" +#include "gfig-preview.h" +#include "gfig-rectangle.h" +#include "gfig-spiral.h" +#include "gfig-star.h" +#include "gfig-stock.h" + +#define SEL_BUTTON_WIDTH 100 +#define SEL_BUTTON_HEIGHT 20 + +#define GRID_TYPE_MENU 1 +#define GRID_RENDER_MENU 2 + +#define PAINT_BGS_MENU 2 +#define PAINT_TYPE_MENU 3 + +#define OBJ_SELECT_GT 1 +#define OBJ_SELECT_LT 2 +#define OBJ_SELECT_EQ 4 + +#define UPDATE_DELAY 300 /* From GtkRange in GTK+ 2.22 */ + +/* Globals */ +gint undo_level; /* Last slot filled in -1 = no undo */ +GList *undo_table[MAX_UNDO]; + +/* Values when first invoked */ +SelectItVals selvals = +{ + { + MIN_GRID + (MAX_GRID - MIN_GRID)/2, /* Gridspacing */ + RECT_GRID, /* Default to rectangle type */ + FALSE, /* drawgrid */ + FALSE, /* snap2grid */ + FALSE, /* lockongrid */ + TRUE, /* show control points */ + 0.0, /* grid_radius_min */ + 10.0, /* grid_radius_interval */ + 0.0, /* grid_rotation */ + 5.0, /* grid_granularity */ + 120 /* grid_sectors_desired */ + }, + FALSE, /* show image */ + MIN_UNDO + (MAX_UNDO - MIN_UNDO)/2, /* Max level of undos */ + TRUE, /* Show pos updates */ + 0.0, /* Brush fade */ + 0.0, /* Brush gradient */ + 20.0, /* Air brush pressure */ + ORIGINAL_LAYER, /* Draw all objects on one layer */ + LAYER_TRANS_BG, /* New layers background */ + PAINT_BRUSH_TYPE, /* Default to use brushes */ + FALSE, /* reverse lines */ + TRUE, /* Scale to image when painting */ + 1.0, /* Scale to image fp */ + BRUSH_BRUSH_TYPE, /* Default to use a brush */ + LINE /* Initial object type */ +}; + +selection_option selopt = +{ + ADD, /* type */ + FALSE, /* Antia */ + FALSE, /* Feather */ + 10.0, /* feather radius */ + ARC_SEGMENT, /* Arc as a segment */ + FILL_PATTERN, /* Fill as pattern */ + 100.0, /* Max opacity */ +}; + +/* Should be kept in sync with GfigOpts */ +typedef struct +{ + GtkAdjustment *gridspacing; + GtkAdjustment *grid_sectors_desired; + GtkAdjustment *grid_radius_interval; + GtkWidget *gridtypemenu; + GtkWidget *drawgrid; + GtkWidget *snap2grid; + GtkWidget *lockongrid; + GtkWidget *showcontrol; +} GfigOptWidgets; + +static GfigOptWidgets gfig_opt_widget = { NULL, NULL, NULL, NULL, NULL, NULL }; +static gchar *gfig_path = NULL; +static GtkWidget *page_menu_bg; +static GtkWidget *tool_options_notebook; +static GtkWidget *fill_type_notebook; +static guint paint_timeout = 0; + +static GtkActionGroup *gfig_actions = NULL; + + +static void gfig_response (GtkWidget *widget, + gint response_id, + gpointer data); +static void gfig_load_action_callback (GtkAction *action, + gpointer data); +static void gfig_save_action_callback (GtkAction *action, + gpointer data); +static void gfig_list_load_all (const gchar *path); +static void gfig_list_free_all (void); +static void create_notebook_pages (GtkWidget *notebook); +static void select_filltype_callback (GtkWidget *widget); +static void gfig_grid_action_callback (GtkAction *action, + gpointer data); +static void gfig_prefs_action_callback (GtkAction *action, + gpointer data); +static void toggle_show_image (void); +static void gridtype_combo_callback (GtkWidget *widget, + gpointer data); + +static void load_file_chooser_response (GtkFileChooser *chooser, + gint response_id, + gpointer data); +static void save_file_chooser_response (GtkFileChooser *chooser, + gint response_id, + GFigObj *obj); +static void paint_combo_callback (GtkWidget *widget, + gpointer data); + +static void select_button_clicked (gint type); +static void select_button_clicked_lt (void); +static void select_button_clicked_gt (void); +static void select_button_clicked_eq (void); +static void raise_selected_obj_to_top (GtkWidget *widget, + gpointer data); +static void lower_selected_obj_to_bottom (GtkWidget *widget, + gpointer data); +static void raise_selected_obj (GtkWidget *widget, + gpointer data); +static void lower_selected_obj (GtkWidget *widget, + gpointer data); + +static void toggle_obj_type (GtkRadioAction *action, + GtkRadioAction *current, + gpointer data); + +static GtkUIManager *create_ui_manager (GtkWidget *window); + + +gboolean +gfig_dialog (void) +{ + GtkWidget *main_hbox; + GtkWidget *vbox; + GFigObj *gfig; + GimpParasite *parasite; + gint newlayer; + GtkWidget *menubar; + GtkWidget *toolbar; + GtkWidget *combo; + GtkWidget *frame; + gint img_width; + gint img_height; + GimpImageType img_type; + GtkWidget *toggle; + GtkWidget *right_vbox; + GtkWidget *hbox; + GtkUIManager *ui_manager; + GtkWidget *empty_label; + gchar *path; + + gimp_ui_init (PLUG_IN_BINARY, TRUE); + + img_width = gimp_drawable_width (gfig_context->drawable_id); + img_height = gimp_drawable_height (gfig_context->drawable_id); + img_type = gimp_drawable_type_with_alpha (gfig_context->drawable_id); + + /* + * See if there is a "gfig" parasite. If so, this is a gfig layer, + * and we start by clearing it to transparent. + * If not, we create a new transparent layer. + */ + gfig_list = NULL; + undo_level = -1; + parasite = gimp_item_get_parasite (gfig_context->drawable_id, "gfig"); + gfig_context->enable_repaint = FALSE; + + /* debug */ + gfig_context->debug_styles = FALSE; + + /* initial default style */ + gfig_read_gimp_style (&gfig_context->default_style, "Base"); + gfig_context->default_style.paint_type = selvals.painttype; + + if (parasite) + { + gimp_drawable_fill (gfig_context->drawable_id, GIMP_FILL_TRANSPARENT); + gfig_context->using_new_layer = FALSE; + gimp_parasite_free (parasite); + } + else + { + newlayer = gimp_layer_new (gfig_context->image_id, "GFig", + img_width, img_height, + img_type, + 100.0, + gimp_image_get_default_new_layer_mode (gfig_context->image_id)); + gimp_drawable_fill (newlayer, GIMP_FILL_TRANSPARENT); + gimp_image_insert_layer (gfig_context->image_id, newlayer, -1, -1); + gfig_context->drawable_id = newlayer; + gfig_context->using_new_layer = TRUE; + } + + gfig_stock_init (); + + path = gimp_gimprc_query ("gfig-path"); + + if (path) + { + gfig_path = g_filename_from_utf8 (path, -1, NULL, NULL, NULL); + g_free (path); + } + else + { + gchar *gimprc = gimp_personal_rc_file ("gimprc"); + gchar *full_path = gimp_config_build_data_path ("gfig"); + gchar *esc_path = g_strescape (full_path, NULL); + g_free (full_path); + + g_message (_("No %s in gimprc:\n" + "You need to add an entry like\n" + "(%s \"%s\")\n" + "to your %s file."), + "gfig-path", "gfig-path", esc_path, + gimp_filename_to_utf8 (gimprc)); + + g_free (gimprc); + g_free (esc_path); + } + + /* Start building the dialog up */ + top_level_dlg = gimp_dialog_new (_("Gfig"), PLUG_IN_ROLE, + NULL, 0, + gimp_standard_help_func, PLUG_IN_PROC, + + _("_Cancel"), GTK_RESPONSE_CANCEL, + _("_Close"), GTK_RESPONSE_OK, + + NULL); + + gtk_dialog_set_alternative_button_order (GTK_DIALOG (top_level_dlg), + GTK_RESPONSE_OK, + GTK_RESPONSE_CANCEL, + -1); + + g_signal_connect (top_level_dlg, "response", + G_CALLBACK (gfig_response), + top_level_dlg); + + /* build the menu */ + ui_manager = create_ui_manager (top_level_dlg); + menubar = gtk_ui_manager_get_widget (ui_manager, "/ui/gfig-menubar"); + gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (top_level_dlg))), + menubar, FALSE, FALSE, 0); + gtk_widget_show (menubar); + toolbar = gtk_ui_manager_get_widget (ui_manager, "/ui/gfig-toolbar"); + gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS); + gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (top_level_dlg))), + toolbar, FALSE, FALSE, 0); + gtk_widget_show (toolbar); + + gfig_dialog_action_set_sensitive ("undo", undo_level >= 0); + + /* Main box */ + main_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); + gtk_container_set_border_width (GTK_CONTAINER (main_hbox), 12); + gtk_box_pack_end (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (top_level_dlg))), + main_hbox, TRUE, TRUE, 0); + + /* Preview itself */ + gtk_box_pack_start (GTK_BOX (main_hbox), make_preview (), FALSE, FALSE, 0); + + gtk_widget_show (gfig_context->preview); + + right_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); + gtk_box_pack_start (GTK_BOX (main_hbox), right_vbox, FALSE, FALSE, 0); + gtk_widget_show (right_vbox); + + /* Tool options notebook */ + frame = gimp_frame_new ( _("Tool Options")); + gtk_box_pack_start (GTK_BOX (right_vbox), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + + tool_options_notebook = gtk_notebook_new (); + gtk_container_add (GTK_CONTAINER (frame), tool_options_notebook); + gtk_notebook_set_show_tabs (GTK_NOTEBOOK (tool_options_notebook), FALSE); + gtk_notebook_set_show_border (GTK_NOTEBOOK (tool_options_notebook), FALSE); + gtk_widget_show (tool_options_notebook); + create_notebook_pages (tool_options_notebook); + + /* Stroke frame on right side */ + frame = gimp_frame_new (NULL); + gtk_box_pack_start (GTK_BOX (right_vbox), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + + gfig_context->paint_type_toggle = + toggle = gtk_check_button_new_with_mnemonic (_("_Stroke")); + + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), selvals.painttype); + gtk_frame_set_label_widget (GTK_FRAME (frame), toggle); + gtk_widget_show (toggle); + + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); + gtk_container_add (GTK_CONTAINER (frame), hbox); + gtk_widget_show (hbox); + + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); + gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0); + gtk_widget_show (vbox); + + gtk_widget_set_sensitive (vbox, selvals.painttype); + g_signal_connect (toggle, "toggled", + G_CALLBACK (set_paint_type_callback), + vbox); + + /* foreground color button in Stroke frame*/ + gfig_context->fg_color = g_new0 (GimpRGB, 1); + gfig_context->fg_color_button = gimp_color_button_new ("Foreground", + SEL_BUTTON_WIDTH, + SEL_BUTTON_HEIGHT, + gfig_context->fg_color, + GIMP_COLOR_AREA_SMALL_CHECKS); + g_signal_connect (gfig_context->fg_color_button, "color-changed", + G_CALLBACK (set_foreground_callback), + gfig_context->fg_color); + gimp_color_button_set_color (GIMP_COLOR_BUTTON (gfig_context->fg_color_button), + &gfig_context->default_style.foreground); + gtk_box_pack_start (GTK_BOX (vbox), gfig_context->fg_color_button, + FALSE, FALSE, 0); + gtk_widget_show (gfig_context->fg_color_button); + + /* brush selector in Stroke frame */ + gfig_context->brush_select + = gimp_brush_select_button_new ("Brush", + gfig_context->default_style.brush_name, + -1.0, -1, -1); + g_signal_connect (gfig_context->brush_select, "brush-set", + G_CALLBACK (gfig_brush_changed_callback), NULL); + gtk_box_pack_start (GTK_BOX (vbox), gfig_context->brush_select, + FALSE, FALSE, 0); + gtk_widget_show (gfig_context->brush_select); + + /* Fill frame on right side */ + frame = gimp_frame_new (_("Fill")); + gtk_box_pack_start (GTK_BOX (right_vbox), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); + gtk_container_add (GTK_CONTAINER (frame), hbox); + gtk_widget_show (hbox); + + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); + gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0); + gtk_widget_show (vbox); + + /* fill style combo box in Style frame */ + gfig_context->fillstyle_combo = combo + = gimp_int_combo_box_new (_("No fill"), FILL_NONE, + _("Color fill"), FILL_COLOR, + _("Pattern fill"), FILL_PATTERN, + _("Shape gradient"), FILL_GRADIENT, + _("Vertical gradient"), FILL_VERTICAL, + _("Horizontal gradient"), FILL_HORIZONTAL, + NULL); + gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo), 0); + g_signal_connect (combo, "changed", + G_CALLBACK (select_filltype_callback), + NULL); + gtk_box_pack_start (GTK_BOX (vbox), combo, FALSE, FALSE, 0); + gtk_widget_show (combo); + + fill_type_notebook = gtk_notebook_new (); + gtk_box_pack_start (GTK_BOX (vbox), fill_type_notebook, FALSE, FALSE, 0); + gtk_notebook_set_show_tabs (GTK_NOTEBOOK (fill_type_notebook), FALSE); + gtk_notebook_set_show_border (GTK_NOTEBOOK (fill_type_notebook), FALSE); + gtk_widget_show (fill_type_notebook); + + /* An empty page for "No fill" */ + empty_label = gtk_label_new (""); + gtk_widget_show (empty_label); + gtk_notebook_append_page (GTK_NOTEBOOK (fill_type_notebook), + empty_label, NULL); + + /* A page for the fill color button */ + gfig_context->bg_color = g_new0 (GimpRGB, 1); + gfig_context->bg_color_button = gimp_color_button_new ("Background", + SEL_BUTTON_WIDTH, SEL_BUTTON_HEIGHT, + gfig_context->bg_color, + GIMP_COLOR_AREA_SMALL_CHECKS); + g_signal_connect (gfig_context->bg_color_button, "color-changed", + G_CALLBACK (set_background_callback), + gfig_context->bg_color); + gimp_color_button_set_color (GIMP_COLOR_BUTTON (gfig_context->bg_color_button), + &gfig_context->default_style.background); + gtk_widget_show (gfig_context->bg_color_button); + gtk_notebook_append_page (GTK_NOTEBOOK (fill_type_notebook), + gfig_context->bg_color_button, NULL); + + /* A page for the pattern selector */ + gfig_context->pattern_select + = gimp_pattern_select_button_new ("Pattern", gfig_context->default_style.pattern); + g_signal_connect (gfig_context->pattern_select, "pattern-set", + G_CALLBACK (gfig_pattern_changed_callback), NULL); + gtk_widget_show (gfig_context->pattern_select); + gtk_notebook_append_page (GTK_NOTEBOOK (fill_type_notebook), + gfig_context->pattern_select, NULL); + + /* A page for the gradient selector */ + gfig_context->gradient_select + = gimp_gradient_select_button_new ("Gradient", gfig_context->default_style.gradient); + g_signal_connect (gfig_context->gradient_select, "gradient-set", + G_CALLBACK (gfig_gradient_changed_callback), NULL); + gtk_widget_show (gfig_context->gradient_select); + gtk_notebook_append_page (GTK_NOTEBOOK (fill_type_notebook), + gfig_context->gradient_select, NULL); + + + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); + gtk_box_pack_start (GTK_BOX (right_vbox), vbox, FALSE, FALSE, 0); + gtk_widget_show (vbox); + + /* "show image" checkbutton at bottom of style frame */ + toggle = gtk_check_button_new_with_label (_("Show image")); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), + gfig_context->show_background); + gtk_box_pack_end (GTK_BOX (vbox), toggle, FALSE, FALSE, 0); + g_signal_connect (toggle, "toggled", + G_CALLBACK (gimp_toggle_button_update), + &gfig_context->show_background); + g_signal_connect_swapped (toggle, "toggled", + G_CALLBACK (gtk_widget_queue_draw), + gfig_context->preview); + gtk_widget_show (toggle); + + /* "snap to grid" checkbutton at bottom of style frame */ + toggle = gtk_check_button_new_with_label (C_("checkbutton", "Snap to grid")); + gtk_box_pack_end (GTK_BOX (vbox), toggle, FALSE, FALSE, 0); + g_signal_connect (toggle, "toggled", + G_CALLBACK (gimp_toggle_button_update), + &selvals.opts.snap2grid); + gtk_widget_show (toggle); + gfig_opt_widget.snap2grid = toggle; + + /* "show grid" checkbutton at bottom of style frame */ + toggle = gtk_check_button_new_with_label (_("Show grid")); + gtk_box_pack_end (GTK_BOX (vbox), toggle, FALSE, FALSE, 0); + g_signal_connect (toggle, "toggled", + G_CALLBACK (gimp_toggle_button_update), + &selvals.opts.drawgrid); + g_signal_connect (toggle, "toggled", + G_CALLBACK (draw_grid_clear), + NULL); + gtk_widget_show (toggle); + gfig_opt_widget.drawgrid = toggle; + + /* Load saved objects */ + gfig_list_load_all (gfig_path); + + /* Setup initial brush settings */ + gfig_context->bdesc.name = gimp_context_get_brush (); + mygimp_brush_info (&gfig_context->bdesc.width, &gfig_context->bdesc.height); + + gtk_widget_show (main_hbox); + + gtk_widget_show (top_level_dlg); + + gfig = gfig_load_from_parasite (); + if (gfig) + { + gfig_list_insert (gfig); + new_obj_2edit (gfig); + gfig_style_set_context_from_style (&gfig_context->default_style); + gfig_style_apply (&gfig_context->default_style); + } + + gfig_context->enable_repaint = TRUE; + gfig_paint_callback (); + + gtk_main (); + + /* FIXME */ + return TRUE; +} + +static void +gfig_response (GtkWidget *widget, + gint response_id, + gpointer data) +{ + GFigObj *gfig; + + switch (response_id) + { + case GTK_RESPONSE_DELETE_EVENT: + case GTK_RESPONSE_CANCEL: + /* if we created a new layer, delete it */ + if (gfig_context->using_new_layer) + { + gimp_image_remove_layer (gfig_context->image_id, + gfig_context->drawable_id); + } + else /* revert back to the original figure */ + { + free_all_objs (gfig_context->current_obj->obj_list); + gfig_context->current_obj->obj_list = NULL; + gfig = gfig_load_from_parasite (); + if (gfig) + { + gfig_list_insert (gfig); + new_obj_2edit (gfig); + } + gfig_context->enable_repaint = TRUE; + gfig_paint_callback (); + } + break; + + case GTK_RESPONSE_OK: /* Close button */ + gfig_save_as_parasite (); + break; + + default: + break; + } + + gtk_widget_destroy (widget); + gtk_main_quit (); +} + +void +gfig_dialog_action_set_sensitive (const gchar *name, + gboolean sensitive) +{ + g_return_if_fail (name != NULL); + + if (gfig_actions) + { + GtkAction *action = gtk_action_group_get_action (gfig_actions, name); + + if (! action) + { + g_warning ("%s: Unable to set sensitivity of action " + "which doesn't exist: %s", + G_STRFUNC, name); + return; + } + + g_object_set (action, "sensitive", sensitive ? TRUE : FALSE, NULL); + } +} + +static gchar * +gfig_get_user_writable_dir (void) +{ + if (gfig_path) + { + GList *list; + gchar *dir; + + list = gimp_path_parse (gfig_path, 256, FALSE, NULL); + dir = gimp_path_get_user_writable_dir (list); + gimp_path_free (list); + + return dir; + } + + return g_strdup (gimp_directory ()); +} + +static void +gfig_load_action_callback (GtkAction *action, + gpointer data) +{ + static GtkWidget *dialog = NULL; + + if (! dialog) + { + gchar *dir; + + dialog = + gtk_file_chooser_dialog_new (_("Load Gfig Object Collection"), + GTK_WINDOW (data), + GTK_FILE_CHOOSER_ACTION_OPEN, + + _("_Cancel"), GTK_RESPONSE_CANCEL, + _("_Open"), GTK_RESPONSE_OK, + + NULL); + + gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), + GTK_RESPONSE_OK, + GTK_RESPONSE_CANCEL, + -1); + + gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); + + g_object_add_weak_pointer (G_OBJECT (dialog), (gpointer) &dialog); + + g_signal_connect (dialog, "response", + G_CALLBACK (load_file_chooser_response), + NULL); + + dir = gfig_get_user_writable_dir (); + if (dir) + { + gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), + dir); + g_free (dir); + } + + gtk_widget_show (dialog); + } + else + { + gtk_window_present (GTK_WINDOW (dialog)); + } +} + +static void +gfig_save_action_callback (GtkAction *action, + gpointer data) +{ + static GtkWidget *dialog = NULL; + + if (!dialog) + { + gchar *dir; + + dialog = + gtk_file_chooser_dialog_new (_("Save Gfig Drawing"), + GTK_WINDOW (data), + GTK_FILE_CHOOSER_ACTION_SAVE, + + _("_Cancel"), GTK_RESPONSE_CANCEL, + _("_Save"), GTK_RESPONSE_OK, + + NULL); + + gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), + GTK_RESPONSE_OK, + GTK_RESPONSE_CANCEL, + -1); + gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); + + gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), + TRUE); + + g_object_add_weak_pointer (G_OBJECT (dialog), (gpointer) &dialog); + + /* FIXME: GFigObj should be a GObject and g_signal_connect_object() + * should be used here. + */ + g_signal_connect (dialog, "response", + G_CALLBACK (save_file_chooser_response), + gfig_context->current_obj); + + dir = gfig_get_user_writable_dir (); + if (dir) + { + gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), dir); + g_free (dir); + } + + gtk_widget_show (dialog); + } + else + { + gtk_window_present (GTK_WINDOW (dialog)); + } +} + +static void +gfig_close_action_callback (GtkAction *action, + gpointer data) +{ + gtk_dialog_response (GTK_DIALOG (data), GTK_RESPONSE_OK); +} + +static void +gfig_undo_action_callback (GtkAction *action, + gpointer data) +{ + if (undo_level >= 0) + { + /* Free current objects an reinstate previous */ + free_all_objs (gfig_context->current_obj->obj_list); + gfig_context->current_obj->obj_list = NULL; + tmp_bezier = tmp_line = obj_creating = NULL; + gfig_context->current_obj->obj_list = undo_table[undo_level]; + undo_level--; + /* Update the screen */ + gtk_widget_queue_draw (gfig_context->preview); + /* And preview */ + gfig_context->current_obj->obj_status |= GFIG_MODIFIED; + if (gfig_context->current_obj->obj_list) + gfig_context->selected_obj = gfig_context->current_obj->obj_list->data; + else + gfig_context->selected_obj = NULL; + } + + gfig_dialog_action_set_sensitive ("undo", undo_level >= 0); + gfig_paint_callback (); +} + +static void +gfig_clear_action_callback (GtkWidget *widget, + gpointer data) +{ + /* Make sure we can get back - if we have some objects to get back to */ + if (!gfig_context->current_obj->obj_list) + return; + + setup_undo (); + /* Free all objects */ + free_all_objs (gfig_context->current_obj->obj_list); + gfig_context->current_obj->obj_list = NULL; + gfig_context->selected_obj = NULL; + obj_creating = NULL; + tmp_line = NULL; + tmp_bezier = NULL; + gtk_widget_queue_draw (gfig_context->preview); + gfig_paint_callback (); +} + +void +draw_item (cairo_t *cr, gboolean fill) +{ + cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 1.0); + + if (fill) + { + cairo_fill_preserve (cr); + } + else + { + cairo_set_line_width (cr, 3.0); + cairo_stroke_preserve (cr); + } + + cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 1.0); + cairo_set_line_width (cr, 1.0); + cairo_stroke (cr); +} + +/* Given a point x, y draw a circle */ +void +draw_circle (GdkPoint *p, + gboolean selected, + cairo_t *cr) +{ + if (!selvals.opts.showcontrol) + return; + + cairo_arc (cr, + gfig_scale_x (p->x) + .5, + gfig_scale_y (p->y) + .5, + SQ_SIZE / 2, + 0, 2 * G_PI); + + draw_item (cr, selected); +} + +/* Given a point x, y draw a square around it */ +void +draw_sqr (GdkPoint *p, + gboolean selected, + cairo_t *cr) +{ + if (!selvals.opts.showcontrol) + return; + + cairo_rectangle (cr, + gfig_scale_x (p->x) + .5 - SQ_SIZE / 2, + gfig_scale_y (p->y) + .5 - SQ_SIZE / 2, + SQ_SIZE, + SQ_SIZE); + + draw_item (cr, selected); +} + +static void +gfig_list_load_all (const gchar *path) +{ + /* Make sure to clear any existing gfigs */ + gfig_context->current_obj = NULL; + gfig_list_free_all (); + + if (! gfig_list) + { + GFigObj *gfig; + + /* lets have at least one! */ + gfig = gfig_new (); + gfig->draw_name = g_strdup (_("First Gfig")); + gfig_list_insert (gfig); + } + + gfig_context->current_obj = gfig_list->data; /* set to first entry */ +} + +static void +gfig_list_free_all (void) +{ + g_list_free_full (gfig_list, (GDestroyNotify) gfig_free); + gfig_list = NULL; +} + +static GtkUIManager * +create_ui_manager (GtkWidget *window) +{ + static GtkActionEntry actions[] = + { + { "gfig-menubar", NULL, "GFig Menu" }, + + { "gfig-file-menu", NULL, "_File" }, + + { "open", GIMP_ICON_DOCUMENT_OPEN, + N_("_Open..."), "<control>O", NULL, + G_CALLBACK (gfig_load_action_callback) }, + + { "save", GIMP_ICON_DOCUMENT_SAVE, + N_("_Save..."), "<control>S", NULL, + G_CALLBACK (gfig_save_action_callback) }, + + { "close", GIMP_ICON_CLOSE, + N_("_Close"), "<control>C", NULL, + G_CALLBACK (gfig_close_action_callback) }, + + { "gfig-edit-menu", NULL, "_Edit" }, + + { "undo", GIMP_ICON_EDIT_UNDO, + N_("_Undo"), "<control>Z", NULL, + G_CALLBACK (gfig_undo_action_callback) }, + + { "clear", GIMP_ICON_EDIT_CLEAR, + N_("_Clear"), NULL, NULL, + G_CALLBACK (gfig_clear_action_callback) }, + + { "grid", GIMP_ICON_GRID, + N_("_Grid"), "<control>G", NULL, + G_CALLBACK (gfig_grid_action_callback) }, + + { "prefs", GIMP_ICON_PREFERENCES_SYSTEM, + N_("_Preferences..."), "<control>P", NULL, + G_CALLBACK (gfig_prefs_action_callback) }, + + { "raise", GIMP_ICON_GO_UP, + N_("_Raise"), "<control>U", N_("Raise selected object"), + G_CALLBACK (raise_selected_obj) }, + + { "lower", GIMP_ICON_GO_DOWN, + N_("_Lower"), "<control>D", N_("Lower selected object"), + G_CALLBACK (lower_selected_obj) }, + + { "top", GIMP_ICON_GO_TOP, + N_("Raise to _top"), "<control>T", N_("Raise selected object to top"), + G_CALLBACK (raise_selected_obj_to_top) }, + + { "bottom", GIMP_ICON_GO_BOTTOM, + N_("Lower to _bottom"), "<control>B", N_("Lower selected object to bottom"), + G_CALLBACK (lower_selected_obj_to_bottom) }, + + { "show_previous", GIMP_ICON_GO_PREVIOUS, + N_("_Previous"), "<control>H", N_("Show previous object"), + G_CALLBACK (select_button_clicked_lt) }, + + { "show_next", GIMP_ICON_GO_NEXT, + N_("_Next"), "<control>L", N_("Show next object"), + G_CALLBACK (select_button_clicked_gt) }, + + { "show_all", GFIG_STOCK_SHOW_ALL, + N_("Show _all"), "<control>A", N_("Show all objects"), + G_CALLBACK (select_button_clicked_eq) } + }; + static GtkRadioActionEntry radio_actions[] = + { + { "line", GFIG_STOCK_LINE, + NULL, "L", N_("Create line"), LINE }, + + { "rectangle", GFIG_STOCK_RECTANGLE, + NULL, "R", N_("Create rectangle"), RECTANGLE }, + + { "circle", GFIG_STOCK_CIRCLE, + NULL, "C", N_("Create circle"), CIRCLE }, + + { "ellipse", GFIG_STOCK_ELLIPSE, + NULL, "E", N_("Create ellipse"), ELLIPSE }, + + { "arc", GFIG_STOCK_CURVE, + NULL, "A", N_("Create arc"), ARC }, + + { "polygon", GFIG_STOCK_POLYGON, + NULL, "P", N_("Create reg polygon"), POLY }, + + { "star", GFIG_STOCK_STAR, + NULL, "S", N_("Create star"), STAR }, + + { "spiral", GFIG_STOCK_SPIRAL, + NULL, "I", N_("Create spiral"), SPIRAL }, + + { "bezier", GFIG_STOCK_BEZIER, + NULL, "B", N_("Create bezier curve. " + "Shift + Button ends object creation."), BEZIER }, + + { "move_obj", GFIG_STOCK_MOVE_OBJECT, + NULL, "M", N_("Move an object"), MOVE_OBJ }, + + { "move_point", GFIG_STOCK_MOVE_POINT, + NULL, "V", N_("Move a single point"), MOVE_POINT }, + + { "copy", GFIG_STOCK_COPY_OBJECT, + NULL, "Y", N_("Copy an object"), COPY_OBJ }, + + { "delete", GFIG_STOCK_DELETE_OBJECT, + NULL, "D", N_("Delete an object"), DEL_OBJ }, + + { "select", GFIG_STOCK_SELECT_OBJECT, + NULL, "A", N_("Select an object"), SELECT_OBJ } + }; + + GtkUIManager *ui_manager = gtk_ui_manager_new (); + + gfig_actions = gtk_action_group_new ("Actions"); + + gtk_action_group_set_translation_domain (gfig_actions, NULL); + + gtk_action_group_add_actions (gfig_actions, + actions, + G_N_ELEMENTS (actions), + window); + gtk_action_group_add_radio_actions (gfig_actions, + radio_actions, + G_N_ELEMENTS (radio_actions), + LINE, + G_CALLBACK (toggle_obj_type), + window); + + gtk_window_add_accel_group (GTK_WINDOW (window), + gtk_ui_manager_get_accel_group (ui_manager)); + gtk_accel_group_lock (gtk_ui_manager_get_accel_group (ui_manager)); + + gtk_ui_manager_insert_action_group (ui_manager, gfig_actions, -1); + g_object_unref (gfig_actions); + + gtk_ui_manager_add_ui_from_string (ui_manager, + "<ui>" + " <menubar name=\"gfig-menubar\">" + " <menu name=\"File\" action=\"gfig-file-menu\">" + " <menuitem action=\"open\" />" + " <menuitem action=\"save\" />" + " <menuitem action=\"close\" />" + " </menu>" + " <menu name=\"Edit\" action=\"gfig-edit-menu\">" + " <menuitem action=\"undo\" />" + " <menuitem action=\"clear\" />" + " <menuitem action=\"grid\" />" + " <menuitem action=\"prefs\" />" + " </menu>" + " </menubar>" + "</ui>", + -1, NULL); + gtk_ui_manager_add_ui_from_string (ui_manager, + "<ui>" + " <toolbar name=\"gfig-toolbar\">" + " <toolitem action=\"line\" />" + " <toolitem action=\"rectangle\" />" + " <toolitem action=\"circle\" />" + " <toolitem action=\"ellipse\" />" + " <toolitem action=\"arc\" />" + " <toolitem action=\"polygon\" />" + " <toolitem action=\"star\" />" + " <toolitem action=\"spiral\" />" + " <toolitem action=\"bezier\" />" + " <toolitem action=\"move_obj\" />" + " <toolitem action=\"move_point\" />" + " <toolitem action=\"copy\" />" + " <toolitem action=\"delete\" />" + " <toolitem action=\"select\" />" + " <separator />" + " <toolitem action=\"raise\" />" + " <toolitem action=\"lower\" />" + " <toolitem action=\"top\" />" + " <toolitem action=\"bottom\" />" + " <separator />" + " <toolitem action=\"show_previous\" />" + " <toolitem action=\"show_next\" />" + " <toolitem action=\"show_all\" />" + " </toolbar>" + "</ui>", + -1, NULL); + + return ui_manager; +} + +static void +tool_option_no_option (GtkWidget *notebook) +{ + GtkWidget *label; + + label = gtk_label_new (_("This tool has no options")); + gtk_widget_show (label); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), label, NULL); +} + +static void +create_notebook_pages (GtkWidget *notebook) +{ + tool_option_no_option (notebook); /* Line */ + tool_option_no_option (notebook); /* Rectangle */ + tool_option_no_option (notebook); /* Circle */ + tool_option_no_option (notebook); /* Ellipse */ + tool_option_no_option (notebook); /* Arc */ + tool_options_poly (notebook); /* Polygon */ + tool_options_star (notebook); /* Star */ + tool_options_spiral (notebook); /* Spiral */ + tool_options_bezier (notebook); /* Bezier */ + tool_option_no_option (notebook); /* Dummy */ + tool_option_no_option (notebook); /* Move Object */ + tool_option_no_option (notebook); /* Move Point */ + tool_option_no_option (notebook); /* Copy Object */ + tool_option_no_option (notebook); /* Delete Object */ +} + +static void +raise_selected_obj_to_top (GtkWidget *widget, + gpointer data) +{ + if (!gfig_context->selected_obj) + return; + + if (g_list_find (gfig_context->current_obj->obj_list, + gfig_context->selected_obj)) + { + gfig_context->current_obj->obj_list = + g_list_remove (gfig_context->current_obj->obj_list, + gfig_context->selected_obj); + gfig_context->current_obj->obj_list = + g_list_append (gfig_context->current_obj->obj_list, + gfig_context->selected_obj); + } + else + { + g_message ("Trying to raise object that does not exist."); + return; + } + + gfig_paint_callback (); +} + +static void +lower_selected_obj_to_bottom (GtkWidget *widget, + gpointer data) +{ + if (!gfig_context->selected_obj) + return; + + if (g_list_find (gfig_context->current_obj->obj_list, + gfig_context->selected_obj)) + { + gfig_context->current_obj->obj_list = + g_list_remove (gfig_context->current_obj->obj_list, + gfig_context->selected_obj); + gfig_context->current_obj->obj_list = + g_list_prepend (gfig_context->current_obj->obj_list, + gfig_context->selected_obj); + } + else + { + g_message ("Trying to lower object that does not exist."); + return; + } + + gfig_paint_callback (); +} + +static void +raise_selected_obj (GtkWidget *widget, + gpointer data) +{ + if (!gfig_context->selected_obj) + return; + + if (g_list_find (gfig_context->current_obj->obj_list, + gfig_context->selected_obj)) + { + int position; + + position = g_list_index (gfig_context->current_obj->obj_list, + gfig_context->selected_obj); + gfig_context->current_obj->obj_list = + g_list_remove (gfig_context->current_obj->obj_list, + gfig_context->selected_obj); + gfig_context->current_obj->obj_list = + g_list_insert (gfig_context->current_obj->obj_list, + gfig_context->selected_obj, + position + 1); + } + else + { + g_message ("Trying to raise object that does not exist."); + return; + } + + gfig_paint_callback (); +} + + +static void +lower_selected_obj (GtkWidget *widget, + gpointer data) +{ + if (!gfig_context->selected_obj) + return; + + if (g_list_find (gfig_context->current_obj->obj_list, + gfig_context->selected_obj)) + { + int position; + + position = g_list_index (gfig_context->current_obj->obj_list, + gfig_context->selected_obj); + gfig_context->current_obj->obj_list = + g_list_remove (gfig_context->current_obj->obj_list, + gfig_context->selected_obj); + gfig_context->current_obj->obj_list = + g_list_insert (gfig_context->current_obj->obj_list, + gfig_context->selected_obj, + MAX (0, position - 1)); + } + else + { + g_message ("Trying to lower object that does not exist."); + return; + } + + gfig_paint_callback (); +} + + +static void +select_filltype_callback (GtkWidget *widget) +{ + gint value; + + gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), &value); + gtk_notebook_set_current_page (GTK_NOTEBOOK (fill_type_notebook), + MIN (value, FILL_GRADIENT)); + + gfig_context_get_current_style ()->fill_type = (FillType) value; + + gfig_paint_callback (); +} + +static gboolean +gfig_paint_timeout (gpointer data) +{ + gfig_paint_callback (); + + paint_timeout = 0; + + return FALSE; +} + +static void +gfig_paint_delayed (void) +{ + if (paint_timeout) + g_source_remove (paint_timeout); + + paint_timeout = + g_timeout_add (UPDATE_DELAY, gfig_paint_timeout, NULL); +} + +static void +gfig_prefs_action_callback (GtkAction *widget, + gpointer data) +{ + static GtkWidget *dialog = NULL; + + if (!dialog) + { + GtkWidget *main_vbox; + GtkWidget *table; + GtkWidget *toggle; + GtkObject *size_data; + GtkWidget *scale; + GtkAdjustment *scale_data; + + dialog = gimp_dialog_new (_("Options"), "gimp-gfig-options", + GTK_WIDGET (data), 0, NULL, NULL, + + _("_Close"), GTK_RESPONSE_CLOSE, + + NULL); + + gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE); + + g_object_add_weak_pointer (G_OBJECT (dialog), (gpointer) &dialog); + + g_signal_connect (dialog, "response", + G_CALLBACK (gtk_widget_destroy), + NULL); + + main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12); + gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), + main_vbox, TRUE, TRUE, 0); + gtk_widget_show (main_vbox); + + /* Put buttons in */ + toggle = gtk_check_button_new_with_label (_("Show position")); + gtk_box_pack_start (GTK_BOX (main_vbox), toggle, FALSE, FALSE, 6); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), + selvals.showpos); + g_signal_connect (toggle, "toggled", + G_CALLBACK (gimp_toggle_button_update), + &selvals.showpos); + g_signal_connect_after (toggle, "toggled", + G_CALLBACK (gfig_pos_enable), + NULL); + gtk_widget_show (toggle); + + toggle = gtk_check_button_new_with_label (_("Show control points")); + gtk_box_pack_start (GTK_BOX (main_vbox), toggle, FALSE, FALSE, 6); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), + selvals.opts.showcontrol); + g_signal_connect (toggle, "toggled", + G_CALLBACK (gimp_toggle_button_update), + &selvals.opts.showcontrol); + g_signal_connect (toggle, "toggled", + G_CALLBACK (toggle_show_image), + NULL); + gtk_widget_show (toggle); + + gfig_opt_widget.showcontrol = toggle; + g_object_add_weak_pointer (G_OBJECT (gfig_opt_widget.showcontrol), + (gpointer) &gfig_opt_widget.showcontrol); + + toggle = gtk_check_button_new_with_label (_("Antialiasing")); + gtk_box_pack_start (GTK_BOX (main_vbox), toggle, FALSE, FALSE, 6); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), selopt.antia); + g_signal_connect (toggle, "toggled", + G_CALLBACK (gimp_toggle_button_update), + &selopt.antia); + g_signal_connect (toggle, "toggled", + G_CALLBACK (gfig_paint_callback), + NULL); + gtk_widget_show (toggle); + + table = gtk_table_new (4, 4, FALSE); + gtk_table_set_col_spacings (GTK_TABLE (table), 6); + gtk_table_set_row_spacings (GTK_TABLE (table), 6); + gtk_box_pack_start (GTK_BOX (main_vbox), table, FALSE, FALSE, 6); + gtk_widget_show (table); + + size_data = gimp_scale_entry_new (GTK_TABLE (table), 0, 0, + _("Max undo:"), 100, 50, + selvals.maxundo, + MIN_UNDO, MAX_UNDO, 1, 2, 0, + TRUE, 0, 0, + NULL, NULL); + g_signal_connect (size_data, "value-changed", + G_CALLBACK (gimp_int_adjustment_update), + &selvals.maxundo); + + page_menu_bg = gimp_int_combo_box_new (_("Transparent"), LAYER_TRANS_BG, + _("Background"), LAYER_BG_BG, + _("Foreground"), LAYER_FG_BG, + _("White"), LAYER_WHITE_BG, + _("Copy"), LAYER_COPY_BG, + NULL); + gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (page_menu_bg), selvals.onlayerbg); + + g_signal_connect (page_menu_bg, "changed", + G_CALLBACK (paint_combo_callback), + GINT_TO_POINTER (PAINT_BGS_MENU)); + + gimp_help_set_help_data (page_menu_bg, + _("Layer background type. Copy causes the " + "previous layer to be copied before the " + "draw is performed."), + NULL); + + gimp_table_attach_aligned (GTK_TABLE (table), 0, 1, + _("Background:"), 0.0, 0.5, + page_menu_bg, 2, FALSE); + + toggle = gtk_check_button_new_with_label (_("Feather")); + gtk_table_attach (GTK_TABLE (table), toggle, 2, 3, 2, 3, + GTK_FILL, GTK_FILL, 0, 0); + g_signal_connect (toggle, "toggled", + G_CALLBACK (gimp_toggle_button_update), + &selopt.feather); + g_signal_connect (toggle, "toggled", + G_CALLBACK (gfig_paint_callback), + NULL); + gtk_widget_show (toggle); + + scale_data = (GtkAdjustment *) + gtk_adjustment_new (selopt.feather_radius, 0.0, 100.0, 1.0, 1.0, 0.0); + scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, scale_data); + gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_TOP); + + g_signal_connect (scale_data, "value-changed", + G_CALLBACK (gimp_double_adjustment_update), + &selopt.feather_radius); + g_signal_connect (scale_data, "value-changed", + G_CALLBACK (gfig_paint_delayed), + NULL); + gimp_table_attach_aligned (GTK_TABLE (table), 0, 2, + _("Radius:"), 0.0, 1.0, scale, 1, FALSE); + + gtk_widget_show (dialog); + } + else + { + gtk_window_present (GTK_WINDOW (dialog)); + } +} + +static void +gfig_grid_action_callback (GtkAction *action, + gpointer data) +{ + static GtkWidget *dialog = NULL; + + if (!dialog) + { + GtkWidget *main_vbox; + GtkWidget *hbox; + GtkWidget *table; + GtkWidget *combo; + GtkObject *size_data; + GtkObject *sectors_data; + GtkObject *radius_data; + + dialog = gimp_dialog_new (_("Grid"), "gimp-gfig-grid", + GTK_WIDGET (data), 0, NULL, NULL, + + _("_Close"), GTK_RESPONSE_CLOSE, + + NULL); + + gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE); + + g_object_add_weak_pointer (G_OBJECT (dialog), (gpointer) &dialog); + + g_signal_connect (dialog, "response", + G_CALLBACK (gtk_widget_destroy), + NULL); + + main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12); + gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), + main_vbox, TRUE, TRUE, 0); + gtk_widget_show (main_vbox); + + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); + gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0); + gtk_widget_show (hbox); + + table = gtk_table_new (3, 3, FALSE); + gtk_table_set_col_spacings (GTK_TABLE (table), 6); + gtk_table_set_row_spacings (GTK_TABLE (table), 6); + gtk_box_pack_start (GTK_BOX (main_vbox), table, FALSE, FALSE, 0); + gtk_widget_show (table); + + size_data = gimp_scale_entry_new (GTK_TABLE (table), 0, 0, + _("Grid spacing:"), 100, 50, + selvals.opts.gridspacing, + MIN_GRID, MAX_GRID, 1, 10, 0, + TRUE, 0, 0, + NULL, NULL); + g_signal_connect (size_data, "value-changed", + G_CALLBACK (gimp_int_adjustment_update), + &selvals.opts.gridspacing); + g_signal_connect (size_data, "value-changed", + G_CALLBACK (draw_grid_clear), + NULL); + + gfig_opt_widget.gridspacing = GTK_ADJUSTMENT (size_data); + g_object_add_weak_pointer (G_OBJECT (gfig_opt_widget.gridspacing), + (gpointer) &gfig_opt_widget.gridspacing); + + sectors_data = gimp_scale_entry_new (GTK_TABLE (table), 0, 3, + _("Polar grid sectors desired:"), 1, 5, + selvals.opts.grid_sectors_desired, + 5, 360, 5, 1, 0, + TRUE, 0, 0, + NULL, NULL); + g_signal_connect (sectors_data, "value-changed", + G_CALLBACK (gimp_int_adjustment_update), + &selvals.opts.grid_sectors_desired); + g_signal_connect (sectors_data, "value-changed", + G_CALLBACK (draw_grid_clear), + NULL); + + gfig_opt_widget.grid_sectors_desired = GTK_ADJUSTMENT (sectors_data); + g_object_add_weak_pointer (G_OBJECT (gfig_opt_widget.grid_sectors_desired), + (gpointer) &gfig_opt_widget.grid_sectors_desired); + + + gfig_opt_widget.gridspacing = GTK_ADJUSTMENT (size_data); + g_object_add_weak_pointer (G_OBJECT (gfig_opt_widget.gridspacing), + (gpointer) &gfig_opt_widget.gridspacing); + + radius_data = gimp_scale_entry_new (GTK_TABLE (table), 0, 4, + _("Polar grid radius interval:"), 1, 5, + selvals.opts.grid_radius_interval, + 5, 50, 5, 1, 0, + TRUE, 0, 0, + NULL, NULL); + g_signal_connect (radius_data, "value-changed", + G_CALLBACK (gimp_double_adjustment_update), + &selvals.opts.grid_radius_interval); + g_signal_connect (radius_data, "value-changed", + G_CALLBACK (draw_grid_clear), + NULL); + + gfig_opt_widget.grid_radius_interval = GTK_ADJUSTMENT (radius_data); + g_object_add_weak_pointer (G_OBJECT (gfig_opt_widget.grid_radius_interval), + (gpointer) &gfig_opt_widget.grid_radius_interval); + + combo = gimp_int_combo_box_new (_("Rectangle"), RECT_GRID, + _("Polar"), POLAR_GRID, + _("Isometric"), ISO_GRID, + NULL); + gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo), selvals.opts.gridtype); + + g_signal_connect (combo, "changed", + G_CALLBACK (gridtype_combo_callback), + GINT_TO_POINTER (GRID_TYPE_MENU)); + + gimp_table_attach_aligned (GTK_TABLE (table), 0, 1, + _("Grid type:"), 0.0, 0.5, + combo, 2, FALSE); + + gfig_opt_widget.gridtypemenu = combo; + g_object_add_weak_pointer (G_OBJECT (gfig_opt_widget.gridtypemenu), + (gpointer) &gfig_opt_widget.gridtypemenu); + + combo = gimp_int_combo_box_new (_("Normal"), GFIG_NORMAL_GC, + _("Black"), GFIG_BLACK_GC, + _("White"), GFIG_WHITE_GC, + _("Grey"), GFIG_GREY_GC, + _("Darker"), GFIG_DARKER_GC, + _("Lighter"), GFIG_LIGHTER_GC, + _("Very dark"), GFIG_VERY_DARK_GC, + NULL); + gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo), grid_gc_type); + + g_signal_connect (combo, "changed", + G_CALLBACK (gridtype_combo_callback), + GINT_TO_POINTER (GRID_RENDER_MENU)); + + gimp_table_attach_aligned (GTK_TABLE (table), 0, 2, + _("Grid color:"), 0.0, 0.5, + combo, 2, FALSE); + + gtk_widget_show (dialog); + } + else + { + gtk_window_present (GTK_WINDOW (dialog)); + } +} + +void +options_update (GFigObj *old_obj) +{ + /* Save old vals */ + if (selvals.opts.gridspacing != old_obj->opts.gridspacing) + { + old_obj->opts.gridspacing = selvals.opts.gridspacing; + } + if (selvals.opts.grid_sectors_desired != old_obj->opts.grid_sectors_desired) + { + old_obj->opts.grid_sectors_desired = selvals.opts.grid_sectors_desired; + } + if (selvals.opts.grid_radius_interval != old_obj->opts.grid_radius_interval) + { + old_obj->opts.grid_radius_interval = selvals.opts.grid_radius_interval; + } + if (selvals.opts.gridtype != old_obj->opts.gridtype) + { + old_obj->opts.gridtype = selvals.opts.gridtype; + } + if (selvals.opts.drawgrid != old_obj->opts.drawgrid) + { + old_obj->opts.drawgrid = selvals.opts.drawgrid; + } + if (selvals.opts.snap2grid != old_obj->opts.snap2grid) + { + old_obj->opts.snap2grid = selvals.opts.snap2grid; + } + if (selvals.opts.lockongrid != old_obj->opts.lockongrid) + { + old_obj->opts.lockongrid = selvals.opts.lockongrid; + } + if (selvals.opts.showcontrol != old_obj->opts.showcontrol) + { + old_obj->opts.showcontrol = selvals.opts.showcontrol; + } + + /* New vals */ + if (selvals.opts.gridspacing != gfig_context->current_obj->opts.gridspacing) + { + if (gfig_opt_widget.gridspacing) + gtk_adjustment_set_value (gfig_opt_widget.gridspacing, + gfig_context->current_obj->opts.gridspacing); + } + if (selvals.opts.grid_sectors_desired != gfig_context->current_obj->opts.grid_sectors_desired) + { + if (gfig_opt_widget.grid_sectors_desired) + gtk_adjustment_set_value (gfig_opt_widget.grid_sectors_desired, + gfig_context->current_obj->opts.grid_sectors_desired); + } + if (selvals.opts.grid_radius_interval != gfig_context->current_obj->opts.grid_radius_interval) + { + if (gfig_opt_widget.grid_radius_interval) + gtk_adjustment_set_value (gfig_opt_widget.grid_radius_interval, + gfig_context->current_obj->opts.grid_radius_interval); + } + if (selvals.opts.gridtype != gfig_context->current_obj->opts.gridtype) + { + if (gfig_opt_widget.gridtypemenu) + gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (gfig_opt_widget.gridtypemenu), + gfig_context->current_obj->opts.gridtype); + } + if (selvals.opts.drawgrid != gfig_context->current_obj->opts.drawgrid) + { + if (gfig_opt_widget.drawgrid) + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gfig_opt_widget.drawgrid), + gfig_context->current_obj->opts.drawgrid); + } + if (selvals.opts.snap2grid != gfig_context->current_obj->opts.snap2grid) + { + if (gfig_opt_widget.snap2grid) + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gfig_opt_widget.snap2grid), + gfig_context->current_obj->opts.snap2grid); + } + if (selvals.opts.lockongrid != gfig_context->current_obj->opts.lockongrid) + { + if (gfig_opt_widget.lockongrid) + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gfig_opt_widget.lockongrid), + gfig_context->current_obj->opts.lockongrid); + } + if (selvals.opts.showcontrol != gfig_context->current_obj->opts.showcontrol) + { + if (gfig_opt_widget.showcontrol) + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gfig_opt_widget.showcontrol), + gfig_context->current_obj->opts.showcontrol); + } +} + +static void +save_file_chooser_response (GtkFileChooser *chooser, + gint response_id, + GFigObj *obj) +{ + if (response_id == GTK_RESPONSE_OK) + { + gchar *filename; + + filename = gtk_file_chooser_get_filename (chooser); + + obj->filename = filename; + + gfig_context->current_obj = obj; + gfig_save_callbk (); + } + + gtk_widget_destroy (GTK_WIDGET (chooser)); +} + +static GfigObject * +gfig_select_obj_by_number (gint count) +{ + GList *objs; + GfigObject *object = NULL; + gint k; + + gfig_context->selected_obj = NULL; + + for (objs = gfig_context->current_obj->obj_list, k = 0; + objs; + objs = g_list_next (objs), k++) + { + if (k == obj_show_single) + { + object = objs->data; + gfig_context->selected_obj = object; + gfig_style_set_context_from_style (&object->style); + break; + } + } + + return object; +} + +static void +select_button_clicked (gint type) +{ + gint count = 0; + + if (gfig_context->current_obj) + { + count = g_list_length (gfig_context->current_obj->obj_list); + } + + switch (type) + { + case OBJ_SELECT_LT: + obj_show_single--; + if (obj_show_single < 0) + obj_show_single = count - 1; + break; + + case OBJ_SELECT_GT: + obj_show_single++; + if (obj_show_single >= count) + obj_show_single = 0; + break; + + case OBJ_SELECT_EQ: + obj_show_single = -1; /* Reset to show all */ + break; + + default: + break; + } + + if (obj_show_single >= 0) + gfig_select_obj_by_number (obj_show_single); + + draw_grid_clear (); + gfig_paint_callback (); +} + +static void +select_button_clicked_lt (void) +{ + select_button_clicked (OBJ_SELECT_LT); +} + +static void +select_button_clicked_gt (void) +{ + select_button_clicked (OBJ_SELECT_GT); +} + +static void +select_button_clicked_eq (void) +{ + select_button_clicked (OBJ_SELECT_EQ); +} + +/* Special case for now - options on poly/star/spiral button */ + +GtkWidget * +num_sides_widget (const gchar *d_title, + gint *num_sides, + gint *which_way, + gint adj_min, + gint adj_max) +{ + GtkWidget *table; + GtkObject *size_data; + + table = gtk_table_new (which_way ? 2 : 1, 3, FALSE); + gtk_table_set_col_spacings (GTK_TABLE (table), 6); + gtk_table_set_row_spacings (GTK_TABLE (table), 6); + gtk_container_set_border_width (GTK_CONTAINER (table), 12); + gtk_widget_show (table); + + size_data = gimp_scale_entry_new (GTK_TABLE (table), 0, 0, + _("Sides:"), 0, 0, + *num_sides, adj_min, adj_max, 1, 10, 0, + TRUE, 0, 0, + NULL, NULL); + g_signal_connect (size_data, "value-changed", + G_CALLBACK (gimp_int_adjustment_update), + num_sides); + + if (which_way) + { + GtkWidget *combo = gimp_int_combo_box_new (_("Right"), 0, + _("Left"), 1, + NULL); + + gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo), *which_way); + + g_signal_connect (combo, "changed", + G_CALLBACK (gimp_int_combo_box_get_active), + which_way); + + gimp_table_attach_aligned (GTK_TABLE (table), 0, 1, + _("Orientation:"), 0.0, 0.5, + combo, 1, FALSE); + } + return table; +} + +void +gfig_paint (BrushType brush_type, + gint32 drawable_ID, + gint seg_count, + gdouble line_pnts[]) +{ + switch (brush_type) + { + case BRUSH_BRUSH_TYPE: + gimp_paintbrush (drawable_ID, + selvals.brushfade, + seg_count, line_pnts, + GIMP_PAINT_CONSTANT, + selvals.brushgradient); + break; + + case BRUSH_PENCIL_TYPE: + gimp_pencil (drawable_ID, + seg_count, line_pnts); + break; + + case BRUSH_AIRBRUSH_TYPE: + gimp_airbrush (drawable_ID, + selvals.airbrushpressure, + seg_count, line_pnts); + break; + + case BRUSH_PATTERN_TYPE: + gimp_clone (drawable_ID, + drawable_ID, + GIMP_CLONE_PATTERN, + 0.0, 0.0, + seg_count, line_pnts); + break; + } +} + + +static void +paint_combo_callback (GtkWidget *widget, + gpointer data) +{ + gint mtype = GPOINTER_TO_INT (data); + gint value; + + gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), &value); + + switch (mtype) + { + case PAINT_BGS_MENU: + selvals.onlayerbg = (LayersBGType) value; + break; + + default: + g_return_if_reached (); + break; + } + + gfig_paint_callback (); +} + + +static void +gridtype_combo_callback (GtkWidget *widget, + gpointer data) +{ + gint mtype = GPOINTER_TO_INT (data); + gint value; + + gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), &value); + + switch (mtype) + { + case GRID_TYPE_MENU: + selvals.opts.gridtype = value; + break; + + case GRID_RENDER_MENU: + grid_gc_type = value; + break; + + default: + g_return_if_reached (); + break; + } + + draw_grid_clear (); +} + +/* + * The edit gfig name attributes dialog + * Modified from Gimp source - layer edit. + */ + +typedef struct _GfigListOptions +{ + GtkWidget *query_box; + GtkWidget *name_entry; + GtkWidget *list_entry; + GFigObj *obj; + gboolean created; +} GfigListOptions; + +static void +load_file_chooser_response (GtkFileChooser *chooser, + gint response_id, + gpointer data) +{ + if (response_id == GTK_RESPONSE_OK) + { + gchar *filename; + GFigObj *gfig; + GFigObj *current_saved; + + filename = gtk_file_chooser_get_filename (chooser); + + if (g_file_test (filename, G_FILE_TEST_IS_REGULAR)) + { + /* Hack - current object MUST be NULL to prevent setup_undo () + * from kicking in. + */ + current_saved = gfig_context->current_obj; + gfig_context->current_obj = NULL; + gfig = gfig_load (filename, filename); + gfig_context->current_obj = current_saved; + + if (gfig) + { + /* Read only ?*/ + if (access (filename, W_OK)) + gfig->obj_status |= GFIG_READONLY; + + gfig_list_insert (gfig); + new_obj_2edit (gfig); + } + } + + g_free (filename); + } + + gtk_widget_destroy (GTK_WIDGET (chooser)); + gfig_paint_callback (); +} + +void +paint_layer_fill (gdouble x1, gdouble y1, gdouble x2, gdouble y2) +{ + GimpFillType fill_type = GIMP_FILL_FOREGROUND; + Style *current_style; + + current_style = gfig_context_get_current_style (); + + gimp_context_push (); + + gimp_context_set_paint_mode (GIMP_LAYER_MODE_NORMAL_LEGACY); + gimp_context_set_opacity (100.0); + gimp_context_set_gradient_repeat_mode (GIMP_REPEAT_NONE); + gimp_context_set_gradient_reverse (FALSE); + + switch (current_style->fill_type) + { + case FILL_NONE: + return; + + case FILL_COLOR: + fill_type = GIMP_FILL_BACKGROUND; + break; + + case FILL_PATTERN: + fill_type = GIMP_FILL_PATTERN; + break; + + case FILL_GRADIENT: + gimp_drawable_edit_gradient_fill (gfig_context->drawable_id, + GIMP_GRADIENT_SHAPEBURST_DIMPLED, + 0.0, /* offset */ + FALSE, /* supersampling */ + 0, /* max_depth */ + 0.0, /* threshold */ + FALSE, /* dither */ + 0.0, 0.0, /* (x1, y1) - ignored */ + 0.0, 0.0); /* (x2, y2) - ignored */ + return; + case FILL_VERTICAL: + gimp_drawable_edit_gradient_fill (gfig_context->drawable_id, + GIMP_GRADIENT_LINEAR, + 0.0, + FALSE, + 0, + 0.0, + FALSE, + x1, y1, + x1, y2); + return; + case FILL_HORIZONTAL: + gimp_drawable_edit_gradient_fill (gfig_context->drawable_id, + GIMP_GRADIENT_LINEAR, + 0.0, + FALSE, + 0, + 0.0, + FALSE, + x1, y1, + x2, y1); + return; + } + + gimp_context_set_opacity (current_style->fill_opacity); + + gimp_drawable_edit_fill (gfig_context->drawable_id, + fill_type); + + gimp_context_pop (); +} + +void +gfig_paint_callback (void) +{ + GList *objs; + gint ccount = 0; + GfigObject *object; + + if (!gfig_context->enable_repaint || !gfig_context->current_obj) + return; + + objs = gfig_context->current_obj->obj_list; + + gimp_drawable_fill (gfig_context->drawable_id, GIMP_FILL_TRANSPARENT); + + while (objs) + { + if (ccount == obj_show_single || obj_show_single == -1) + { + FillType saved_filltype; + + object = objs->data; + + gfig_style_apply (&object->style); + + saved_filltype = gfig_context_get_current_style ()->fill_type; + gfig_context_get_current_style ()->fill_type = object->style.fill_type; + object->class->paintfunc (object); + gfig_context_get_current_style ()->fill_type = saved_filltype; + } + + objs = g_list_next (objs); + + ccount++; + } + + gimp_displays_flush (); + + if (back_pixbuf) + { + g_object_unref (back_pixbuf); + back_pixbuf = NULL; + } + + gtk_widget_queue_draw (gfig_context->preview); +} + +/* Draw the grid on the screen + */ + +void +draw_grid_clear (void) +{ + /* wipe slate and start again */ + gtk_widget_queue_draw (gfig_context->preview); +} + +static void +toggle_show_image (void) +{ + /* wipe slate and start again */ + draw_grid_clear (); +} + +static void +toggle_obj_type (GtkRadioAction *action, + GtkRadioAction *current, + gpointer data) +{ + static GdkCursor *p_cursors[DEL_OBJ + 1]; + GdkCursorType ctype = GDK_LAST_CURSOR; + DobjType new_type; + + new_type = gtk_radio_action_get_current_value (action); + if (selvals.otype != new_type) + { + /* Mem leak */ + obj_creating = NULL; + tmp_line = NULL; + tmp_bezier = NULL; + + if (new_type < MOVE_OBJ) /* Eeeeek */ + { + obj_show_single = -1; /* Cancel select preview */ + } + /* Update draw areas */ + gtk_widget_queue_draw (gfig_context->preview); + } + + selvals.otype = new_type; + gtk_notebook_set_current_page (GTK_NOTEBOOK (tool_options_notebook), + new_type - 1); + + switch (selvals.otype) + { + case LINE: + case RECTANGLE: + case CIRCLE: + case ELLIPSE: + case ARC: + case POLY: + case STAR: + case SPIRAL: + case BEZIER: + default: + ctype = GDK_CROSSHAIR; + break; + case MOVE_OBJ: + case MOVE_POINT: + case COPY_OBJ: + case MOVE_COPY_OBJ: + ctype = GDK_DIAMOND_CROSS; + break; + case DEL_OBJ: + ctype = GDK_PIRATE; + break; + } + + if (!p_cursors[selvals.otype]) + { + GdkDisplay *display = gtk_widget_get_display (gfig_context->preview); + + p_cursors[selvals.otype] = gdk_cursor_new_for_display (display, ctype); + } + + gdk_window_set_cursor (gtk_widget_get_window (gfig_context->preview), + p_cursors[selvals.otype]); +} + +/* This could belong in a separate file ... but makes it easier to lump into + * one when compiling the plugin. + */ + +/* Given a number of float co-ords adjust for scaling back to org size */ +/* Size is number of PAIRS of points */ +/* FP + int variants */ + +static void +scale_to_orginal_x (gdouble *list) +{ + *list *= scale_x_factor; +} + +gint +gfig_scale_x (gint x) +{ + if (!selvals.scaletoimage) + return (gint) (x * (1 / scale_x_factor)); + else + return x; +} + +static void +scale_to_orginal_y (gdouble *list) +{ + *list *= scale_y_factor; +} + +gint +gfig_scale_y (gint y) +{ + if (!selvals.scaletoimage) + return (gint) (y * (1 / scale_y_factor)); + else + return y; +} + +/* Pairs x followed by y */ +void +scale_to_original_xy (gdouble *list, + gint size) +{ + gint i; + + for (i = 0; i < size * 2; i += 2) + { + scale_to_orginal_x (&list[i]); + scale_to_orginal_y (&list[i + 1]); + } +} + +/* Pairs x followed by y */ +void +scale_to_xy (gdouble *list, + gint size) +{ + gint i; + + for (i = 0; i < size * 2; i += 2) + { + list[i] *= (org_scale_x_factor / scale_x_factor); + list[i + 1] *= (org_scale_y_factor / scale_y_factor); + } +} + +void +gfig_draw_arc (gint x, gint y, gint width, gint height, gint angle1, + gint angle2, cairo_t *cr) +{ + cairo_save (cr); + + cairo_translate (cr, gfig_scale_x (x), gfig_scale_y (y)); + cairo_scale (cr, gfig_scale_x (width), gfig_scale_y (height)); + + if (angle1 < angle2) + cairo_arc (cr, 0., 0., 1., angle1 * G_PI / 180, angle2 * G_PI / 180); + else + cairo_arc_negative (cr, 0., 0., 1., angle1 * G_PI / 180, angle2 * G_PI / 180); + + cairo_restore (cr); + + draw_item (cr, FALSE); +} + +void +gfig_draw_line (gint x0, gint y0, gint x1, gint y1, cairo_t *cr) +{ + cairo_move_to (cr, gfig_scale_x (x0) + .5, gfig_scale_y (y0) + .5); + cairo_line_to (cr, gfig_scale_x (x1) + .5, gfig_scale_y (y1) + .5); + + draw_item (cr, FALSE); +} diff --git a/plug-ins/gfig/gfig-dialog.h b/plug-ins/gfig/gfig-dialog.h new file mode 100644 index 0000000..1b4eced --- /dev/null +++ b/plug-ins/gfig/gfig-dialog.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + +#ifndef __GFIG_DIALOG_H__ +#define __GFIG_DIALOG_H__ + +extern gint undo_level; /* Last slot filled in -1 = no undo */ +extern GList *undo_table[MAX_UNDO]; + +gboolean gfig_dialog (void); +void gfig_dialog_action_set_sensitive (const gchar *name, + gboolean sensitive); + +void options_update (GFigObj *old_obj); +void tool_option_page_update (GtkWidget *button, + GtkWidget *notebook); + +#endif /* __GFIG_DIALOG_H__ */ diff --git a/plug-ins/gfig/gfig-dobject.c b/plug-ins/gfig/gfig-dobject.c new file mode 100644 index 0000000..1340cec --- /dev/null +++ b/plug-ins/gfig/gfig-dobject.c @@ -0,0 +1,1063 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +#include "config.h" + +#include <stdlib.h> +#include <string.h> + +#include <libgimp/gimp.h> +#include <libgimp/gimpui.h> + +#include "gfig.h" +#include "gfig-dialog.h" +#include "gfig-style.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-rectangle.h" +#include "gfig-spiral.h" +#include "gfig-star.h" + +#include "libgimp/stdplugins-intl.h" + +static GfigObject *operation_obj = NULL; +static GdkPoint *move_all_pnt; /* Point moving all from */ + + +static void draw_one_obj (GfigObject *obj, + cairo_t *cr); +static void do_move_obj (GfigObject *obj, + GdkPoint *to_pnt); +static void do_move_all_obj (GdkPoint *to_pnt); +static void do_move_obj_pnt (GfigObject *obj, + GdkPoint *to_pnt); +static void remove_obj_from_list (GFigObj *obj, + GfigObject *del_obj); +static gint scan_obj_points (DobjPoints *opnt, + GdkPoint *pnt); + +void +d_save_object (GfigObject *obj, + GString *string) +{ + do_save_obj (obj, string); + + switch (obj->type) + { + case BEZIER: + case POLY: + case SPIRAL: + case STAR: + g_string_append_printf (string, "<EXTRA>\n"); + g_string_append_printf (string, "%d\n</EXTRA>\n", obj->type_data); + break; + default: + break; + } +} + +static DobjType +gfig_read_object_type (gchar *desc) +{ + gchar *ptr = desc; + DobjType type; + + if (*ptr != '<') + return OBJ_TYPE_NONE; + + ptr++; + + for (type = LINE; type < NUM_OBJ_TYPES; type++) + { + if (ptr == strstr (ptr, dobj_class[type].name)) + return type; + } + + return OBJ_TYPE_NONE; +} + +GfigObject * +d_load_object (gchar *desc, + FILE *fp) +{ + GfigObject *new_obj = NULL; + gint xpnt; + gint ypnt; + gchar buf[MAX_LOAD_LINE]; + DobjType type; + + type = gfig_read_object_type (desc); + if (type == OBJ_TYPE_NONE) + { + g_message ("Error loading object: type not recognized."); + return NULL; + } + + while (get_line (buf, MAX_LOAD_LINE, fp, 0)) + { + if (sscanf (buf, "%d %d", &xpnt, &ypnt) != 2) + { + /* Read <EXTRA> block if there is one */ + if (!strcmp ("<EXTRA>", buf)) + { + if ( !new_obj) + { + g_message ("Error while loading object (no points)"); + return NULL; + } + + get_line (buf, MAX_LOAD_LINE, fp, 0); + + if (sscanf (buf, "%d", &new_obj->type_data) != 1) + { + g_message ("Error while loading object (no type data)"); + g_free (new_obj); + return NULL; + } + + get_line (buf, MAX_LOAD_LINE, fp, 0); + if (strcmp ("</EXTRA>", buf)) + { + g_message ("Syntax error while loading object"); + g_free (new_obj); + return NULL; + } + /* Go around and read the last line */ + continue; + } + else + return new_obj; + } + + if (!new_obj) + new_obj = d_new_object (type, xpnt, ypnt); + else + d_pnt_add_line (new_obj, xpnt, ypnt, -1); + } + + return new_obj; +} + +GfigObject * +d_new_object (DobjType type, + gint x, + gint y) +{ + GfigObject *nobj = g_new0 (GfigObject, 1); + + nobj->type = type; + nobj->class = &dobj_class[type]; + nobj->points = new_dobjpoint (x, y); + + nobj->type_data = 0; + + if (type == BEZIER) + { + nobj->type_data = 4; + } + else if (type == POLY) + { + nobj->type_data = 3; /* default to 3 sides */ + } + else if (type == SPIRAL) + { + nobj->type_data = 4; /* default to 4 turns */ + } + else if (type == STAR) + { + nobj->type_data = 3; /* default to 3 sides 6 points */ + } + + return nobj; +} + +void +gfig_init_object_classes (void) +{ + d_arc_object_class_init (); + d_line_object_class_init (); + d_rectangle_object_class_init (); + d_circle_object_class_init (); + d_ellipse_object_class_init (); + d_poly_object_class_init (); + d_spiral_object_class_init (); + d_star_object_class_init (); + d_bezier_object_class_init (); +} + +/* Delete a list of points */ +void +d_delete_dobjpoints (DobjPoints * pnts) +{ + DobjPoints *next; + DobjPoints *pnt2del = pnts; + + while (pnt2del) + { + next = pnt2del->next; + g_free (pnt2del); + pnt2del = next; + } +} + +DobjPoints * +new_dobjpoint (gint x, gint y) +{ + DobjPoints *npnt = g_new0 (DobjPoints, 1); + + npnt->pnt.x = x; + npnt->pnt.y = y; + + return npnt; +} + +DobjPoints * +d_copy_dobjpoints (DobjPoints *pnts) +{ + DobjPoints *ret = NULL; + DobjPoints *head = NULL; + DobjPoints *newpnt; + DobjPoints *pnt2copy; + + for (pnt2copy = pnts; pnt2copy; pnt2copy = pnt2copy->next) + { + newpnt = new_dobjpoint (pnt2copy->pnt.x, pnt2copy->pnt.y); + + if (!ret) + { + head = ret = newpnt; + } + else + { + head->next = newpnt; + head = newpnt; + } + } + + return ret; +} + +static DobjPoints * +get_diffs (GfigObject *obj, + gint *xdiff, + gint *ydiff, + GdkPoint *to_pnt) +{ + DobjPoints *spnt; + + g_assert (obj != NULL); + + for (spnt = obj->points; spnt; spnt = spnt->next) + { + if (spnt->found_me) + { + *xdiff = spnt->pnt.x - to_pnt->x; + *ydiff = spnt->pnt.y - to_pnt->y; + return spnt; + } + } + return NULL; +} + +static gboolean +inside_sqr (GdkPoint *cpnt, + GdkPoint *testpnt) +{ + /* Return TRUE if testpnt is near cpnt */ + 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 gboolean +scan_obj_points (DobjPoints *opnt, + GdkPoint *pnt) +{ + while (opnt) + { + if (inside_sqr (&opnt->pnt, pnt)) + { + opnt->found_me = TRUE; + return TRUE; + } + opnt->found_me = FALSE; + opnt = opnt->next; + } + return FALSE; +} + +static GfigObject * +get_nearest_objs (GFigObj *obj, + GdkPoint *pnt) +{ + /* Nearest object to given point or NULL */ + GList *all; + GfigObject *test_obj; + gint count = 0; + + if (!obj) + return NULL; + + for (all = obj->obj_list; all; all = g_list_next (all)) + { + test_obj = all->data; + + if (count == obj_show_single || obj_show_single == -1) + if (scan_obj_points (test_obj->points, pnt)) + { + return test_obj; + } + count++; + } + return NULL; +} + +void +object_operation_start (GdkPoint *pnt, + gboolean shift_down) +{ + GfigObject *new_obj; + + /* Find point in given object list */ + operation_obj = get_nearest_objs (gfig_context->current_obj, pnt); + + /* Special case if shift down && move obj then moving all objs */ + + if (shift_down && selvals.otype == MOVE_OBJ) + { + move_all_pnt = g_new (GdkPoint, 1); + *move_all_pnt = *pnt; /* Structure copy */ + setup_undo (); + return; + } + + if (!operation_obj) + return;/* None to work on */ + + gfig_context->selected_obj = operation_obj; + + setup_undo (); + + switch (selvals.otype) + { + case MOVE_OBJ: + if (operation_obj->type == BEZIER) + { + tmp_bezier = operation_obj; + } + break; + + case MOVE_POINT: + if (operation_obj->type == BEZIER) + { + tmp_bezier = operation_obj; + } + /* If shift is down the break into sep lines */ + if ((operation_obj->type == POLY + || operation_obj->type == STAR) + && shift_down) + { + switch (operation_obj->type) + { + case POLY: + d_poly2lines (operation_obj); + break; + case STAR: + d_star2lines (operation_obj); + break; + default: + break; + } + /* Re calc which object point we are looking at */ + scan_obj_points (operation_obj->points, pnt); + gtk_widget_queue_draw (gfig_context->preview); + } + break; + + case COPY_OBJ: + /* Copy the "operation object" */ + /* Then bung us into "copy/move" mode */ + + new_obj = (GfigObject*) operation_obj->class->copyfunc (operation_obj); + if (new_obj) + { + gfig_style_copy (&new_obj->style, &operation_obj->style, "Object"); + scan_obj_points (new_obj->points, pnt); + add_to_all_obj (gfig_context->current_obj, new_obj); + operation_obj = new_obj; + selvals.otype = MOVE_COPY_OBJ; + gtk_widget_queue_draw (gfig_context->preview); + } + break; + + case DEL_OBJ: + remove_obj_from_list (gfig_context->current_obj, operation_obj); + break; + + case SELECT_OBJ: + /* don't need to do anything */ + break; + + case MOVE_COPY_OBJ: /* Never when button down */ + default: + g_warning ("Internal error selvals.otype object operation start"); + break; + } + +} + +void +object_operation_end (GdkPoint *pnt, + gboolean shift_down) +{ + if (selvals.otype != DEL_OBJ && operation_obj && + operation_obj->type == BEZIER) + { + tmp_bezier = NULL; /* use as switch */ + } + + if (operation_obj && selvals.otype != DEL_OBJ) + gfig_style_set_context_from_style (&operation_obj->style); + + operation_obj = NULL; + + if (move_all_pnt) + { + g_free (move_all_pnt); + move_all_pnt = NULL; + } + + /* Special case - if copying mode MUST be copy when button up received */ + if (selvals.otype == MOVE_COPY_OBJ) + selvals.otype = COPY_OBJ; +} + +/* Move object around */ +void +object_operation (GdkPoint *to_pnt, + gboolean shift_down) +{ + /* Must do different things depending on object type */ + /* but must have object to operate on! */ + + /* Special case - if shift own and move_obj then move ALL objects */ + if (move_all_pnt && shift_down && selvals.otype == MOVE_OBJ) + { + do_move_all_obj (to_pnt); + return; + } + + if (!operation_obj) + return; + + switch (selvals.otype) + { + case MOVE_OBJ: + case MOVE_COPY_OBJ: + switch (operation_obj->type) + { + case LINE: + case RECTANGLE: + case CIRCLE: + case ELLIPSE: + case POLY: + case ARC: + case STAR: + case SPIRAL: + case BEZIER: + do_move_obj (operation_obj, to_pnt); + break; + default: + /* Internal error */ + g_warning ("Internal error in operation_obj->type"); + break; + } + break; + case MOVE_POINT: + switch (operation_obj->type) + { + case LINE: + case RECTANGLE: + case CIRCLE: + case ELLIPSE: + case POLY: + case ARC: + case STAR: + case SPIRAL: + case BEZIER: + do_move_obj_pnt (operation_obj, to_pnt); + break; + default: + /* Internal error */ + g_warning ("Internal error in operation_obj->type"); + break; + } + break; + case DEL_OBJ: + case SELECT_OBJ: + break; + case COPY_OBJ: /* Should have been changed to MOVE_COPY_OBJ */ + default: + g_warning ("Internal error selvals.otype"); + break; + } +} + +static void +update_pnts (GfigObject *obj, + gint xdiff, + gint ydiff) +{ + DobjPoints *spnt; + + g_assert (obj != NULL); + + /* Update all pnts */ + for (spnt = obj->points; spnt; spnt = spnt->next) + { + spnt->pnt.x -= xdiff; + spnt->pnt.y -= ydiff; + } +} + +static void +remove_obj_from_list (GFigObj *obj, + GfigObject *del_obj) +{ + /* Nearest object to given point or NULL */ + + g_assert (del_obj != NULL); + + if (g_list_find (obj->obj_list, del_obj)) + { + obj->obj_list = g_list_remove (obj->obj_list, del_obj); + + free_one_obj (del_obj); + + if (obj->obj_list) + gfig_context->selected_obj = obj->obj_list->data; + else + gfig_context->selected_obj = NULL; + + if (obj_show_single != -1) + { + /* We've just deleted the only visible one */ + draw_grid_clear (); + obj_show_single = -1; /* Show entry again */ + } + + gtk_widget_queue_draw (gfig_context->preview); + } + else + g_warning (_("Hey, where has the object gone?")); +} + +static void +do_move_all_obj (GdkPoint *to_pnt) +{ + /* Move all objects in one go */ + /* Undraw/then draw in new pos */ + gint xdiff = move_all_pnt->x - to_pnt->x; + gint ydiff = move_all_pnt->y - to_pnt->y; + + if (xdiff || ydiff) + { + GList *all; + + for (all = gfig_context->current_obj->obj_list; all; all = all->next) + { + GfigObject *obj = all->data; + + update_pnts (obj, xdiff, ydiff); + } + + *move_all_pnt = *to_pnt; + + gtk_widget_queue_draw (gfig_context->preview); + } +} + +void +do_save_obj (GfigObject *obj, + GString *string) +{ + DobjPoints *spnt; + + for (spnt = obj->points; spnt; spnt = spnt->next) + { + g_string_append_printf (string, "%d %d\n", spnt->pnt.x, spnt->pnt.y); + } +} + +static void +do_move_obj (GfigObject *obj, + GdkPoint *to_pnt) +{ + /* Move the whole line - undraw the line to start with */ + /* Then draw in new pos */ + gint xdiff = 0; + gint ydiff = 0; + + get_diffs (obj, &xdiff, &ydiff, to_pnt); + + if (xdiff || ydiff) + { + update_pnts (obj, xdiff, ydiff); + + gtk_widget_queue_draw (gfig_context->preview); + } +} + +static void +do_move_obj_pnt (GfigObject *obj, + GdkPoint *to_pnt) +{ + /* Move the whole line - undraw the line to start with */ + /* Then draw in new pos */ + DobjPoints *spnt; + gint xdiff = 0; + gint ydiff = 0; + + spnt = get_diffs (obj, &xdiff, &ydiff, to_pnt); + + if ((!xdiff && !ydiff) || !spnt) + return; + + spnt->pnt.x = spnt->pnt.x - xdiff; + spnt->pnt.y = spnt->pnt.y - ydiff; + + /* Draw in new pos */ + gtk_widget_queue_draw (gfig_context->preview); +} + +/* copy objs */ +GList * +copy_all_objs (GList *objs) +{ + GList *new_all_objs = NULL; + + while (objs) + { + GfigObject *object = objs->data; + GfigObject *new_object = (GfigObject *) object->class->copyfunc (object); + gfig_style_copy (&new_object->style, &object->style, "Object"); + + new_all_objs = g_list_prepend (new_all_objs, new_object); + + objs = objs->next; + } + + new_all_objs = g_list_reverse (new_all_objs); + + return new_all_objs; +} + +/* Screen refresh */ +static void +draw_one_obj (GfigObject *obj, + cairo_t *cr) +{ + obj->class->drawfunc (obj, cr); +} + +void +draw_objects (GList *objs, + gboolean show_single, + cairo_t *cr) +{ + /* Show_single - only one object to draw Unless shift + * is down in which case show all. + */ + + gint count = 0; + + while (objs) + { + if (!show_single || count == obj_show_single || obj_show_single == -1) + draw_one_obj (objs->data, cr); + + objs = g_list_next (objs); + count++; + } +} + +void +prepend_to_all_obj (GFigObj *fobj, + GList *nobj) +{ + setup_undo (); /* Remember ME */ + + fobj->obj_list = g_list_concat (fobj->obj_list, nobj); +} + +static void +scale_obj_points (DobjPoints *opnt, + gdouble scale_x, + gdouble scale_y) +{ + while (opnt) + { + opnt->pnt.x = (gint) (opnt->pnt.x * scale_x); + opnt->pnt.y = (gint) (opnt->pnt.y * scale_y); + opnt = opnt->next; + } +} + +void +add_to_all_obj (GFigObj *fobj, + GfigObject *obj) +{ + GList *nobj = NULL; + + nobj = g_list_append (nobj, obj); + + if (need_to_scale) + scale_obj_points (obj->points, scale_x_factor, scale_y_factor); + + prepend_to_all_obj (fobj, nobj); + + /* initialize style when we add the object */ + gfig_context->selected_obj = obj; +} + +/* First button press -- start drawing object */ +/* + * object_start() creates a new object of the type specified in the + * button panel. It is activated by a button press, and causes + * a small square to be drawn at the initial point. The style of + * the new object is set to values taken from the style control + * widgets. + */ +void +object_start (GdkPoint *pnt, + gboolean shift_down) +{ + /* start for the current object */ + if (!selvals.scaletoimage) + { + need_to_scale = 1; + selvals.scaletoimage = 1; + } + else + { + need_to_scale = 0; + } + + switch (selvals.otype) + { + case LINE: + /* Shift means we are still drawing */ + d_line_start (pnt, shift_down); + break; + case RECTANGLE: + d_rectangle_start (pnt, shift_down); + break; + case CIRCLE: + d_circle_start (pnt, shift_down); + break; + case ELLIPSE: + d_ellipse_start (pnt, shift_down); + break; + case POLY: + d_poly_start (pnt, shift_down); + break; + case ARC: + d_arc_start (pnt, shift_down); + break; + case STAR: + d_star_start (pnt, shift_down); + break; + case SPIRAL: + d_spiral_start (pnt, shift_down); + break; + case BEZIER: + d_bezier_start (pnt, shift_down); + break; + default: + /* Internal error */ + break; + } + + if (obj_creating) + { + if (gfig_context->debug_styles) + g_printerr ("Creating object, setting style from context\n"); + gfig_style_set_style_from_context (&obj_creating->style); + } + +} + +void +object_end (GdkPoint *pnt, + gboolean shift_down) +{ + /* end for the current object */ + /* Add onto global object list */ + + /* If shift is down may carry on drawing */ + switch (selvals.otype) + { + case LINE: + d_line_end (pnt, shift_down); + break; + case RECTANGLE: + d_rectangle_end (pnt, shift_down); + break; + case CIRCLE: + d_circle_end (pnt, shift_down); + break; + case ELLIPSE: + d_ellipse_end (pnt, shift_down); + break; + case POLY: + d_poly_end (pnt, shift_down); + break; + case STAR: + d_star_end (pnt, shift_down); + break; + case ARC: + d_arc_end (pnt, shift_down); + break; + case SPIRAL: + d_spiral_end (pnt, shift_down); + break; + case BEZIER: + d_bezier_end (pnt, shift_down); + break; + default: + /* Internal error */ + break; + } + + if (need_to_scale) + { + need_to_scale = 0; + selvals.scaletoimage = 0; + } +} + +/* Stuff for the generation/deletion of objects. */ + +/* Objects are easy one they are created - you just go down the object + * list calling the draw function for each object but... when they + * are been created we have to be a little more careful. When + * the first point is placed on the canvas we create the object, + * the mouse position then defines the next point that can move around. + * careful how we draw this position. + */ + +void +free_one_obj (GfigObject *obj) +{ + d_delete_dobjpoints (obj->points); + g_free (obj); +} + +void +free_all_objs (GList *objs) +{ + g_list_free_full (objs, (GDestroyNotify) free_one_obj); +} + +gchar * +get_line (gchar *buf, + gint s, + FILE *from, + gint init) +{ + gint slen; + char *ret; + + if (init) + line_no = 1; + else + line_no++; + + do + { + ret = fgets (buf, s, from); + } + while (!ferror (from) && buf[0] == '#'); + + slen = strlen (buf); + + /* The last newline is a pain */ + if (slen > 0) + buf[slen - 1] = '\0'; + + /* Check and remove an '\r' too from Windows */ + if ((slen > 1) && (buf[slen - 2] == '\r')) + buf[slen - 2] = '\0'; + + if (ferror (from)) + { + g_warning (_("Error reading file")); + return NULL; + } + +#ifdef DEBUG + printf ("Processing line '%s'\n", buf); +#endif /* DEBUG */ + + return ret; +} + +void +clear_undo (void) +{ + int lv; + + for (lv = undo_level; lv >= 0; lv--) + { + free_all_objs (undo_table[lv]); + undo_table[lv] = NULL; + } + + undo_level = -1; + + gfig_dialog_action_set_sensitive ("undo", FALSE); +} + +void +setup_undo (void) +{ + /* Copy object list to undo buffer */ +#if DEBUG + printf ("setup undo level [%d]\n", undo_level); +#endif /*DEBUG*/ + + if (!gfig_context->current_obj) + { + /* If no current_obj must be loading -> no undo */ + return; + } + + if (undo_level >= selvals.maxundo - 1) + { + int loop; + /* the little one in the bed said "roll over".. */ + if (undo_table[0]) + free_one_obj (undo_table[0]->data); + for (loop = 0; loop < undo_level; loop++) + { + undo_table[loop] = undo_table[loop + 1]; + } + } + else + { + undo_level++; + } + undo_table[undo_level] = + copy_all_objs (gfig_context->current_obj->obj_list); + + gfig_dialog_action_set_sensitive ("undo", TRUE); + + gfig_context->current_obj->obj_status |= GFIG_MODIFIED; +} + +void +new_obj_2edit (GFigObj *obj) +{ + GFigObj *old_current = gfig_context->current_obj; + + /* Clear undo levels */ + /* redraw the preview */ + /* Set up options as define in the selected object */ + + clear_undo (); + + /* Point at this one */ + gfig_context->current_obj = obj; + + /* Show all objects to start with */ + obj_show_single = -1; + + /* Change options */ + options_update (old_current); + + /* redraw with new */ + gtk_widget_queue_draw (gfig_context->preview); + + if (obj->obj_status & GFIG_READONLY) + { + g_message (_("Editing read-only object - " + "you will not be able to save it")); + + gfig_dialog_action_set_sensitive ("save", FALSE); + } + else + { + gfig_dialog_action_set_sensitive ("save", TRUE); + } +} + +/* Add a point to a line (given x, y) + * pos = 0 = head + * pos = -1 = tail + * 0 < pos = nth position + */ + +void +d_pnt_add_line (GfigObject *obj, + gint x, + gint y, + gint pos) +{ + DobjPoints *npnts = new_dobjpoint (x, y); + + g_assert (obj != NULL); + + if (!pos) + { + /* Add to head */ + npnts->next = obj->points; + obj->points = npnts; + } + else + { + DobjPoints *pnt = obj->points; + + /* Go down chain until the end if pos */ + while (pos < 0 || pos-- > 0) + { + if (!(pnt->next) || !pos) + { + npnts->next = pnt->next; + pnt->next = npnts; + break; + } + else + { + pnt = pnt->next; + } + } + } +} diff --git a/plug-ins/gfig/gfig-dobject.h b/plug-ins/gfig/gfig-dobject.h new file mode 100644 index 0000000..19be4dd --- /dev/null +++ b/plug-ins/gfig/gfig-dobject.h @@ -0,0 +1,114 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +#ifndef __GFIG_DOBJECT_H__ +#define __GFIG_DOBJECT_H__ + +#include "gfig-types.h" +#include "gfig-style.h" + +typedef void (*DobjDrawFunc) (GfigObject *, cairo_t *); +typedef void (*DobjFunc) (GfigObject *); +typedef GfigObject *(*DobjGenFunc) (GfigObject *); + +typedef struct DobjPoints +{ + struct DobjPoints *next; + GdkPoint pnt; + gboolean found_me; +} DobjPoints; + +typedef struct +{ + DobjType type; /* the object type for this class */ + const gchar *name; + + /* virtuals */ + DobjDrawFunc drawfunc; /* How do I draw myself */ + DobjFunc paintfunc; /* Draw me on canvas */ + DobjGenFunc copyfunc; /* copy */ + void (*update) (GdkPoint *pnt); +} GfigObjectClass; + +extern GfigObjectClass dobj_class[10]; + +/* The object itself */ +struct _GfigObject +{ + DobjType type; /* What is the type? */ + GfigObjectClass *class; /* What class does it belong to? */ + gint type_data; /* Extra data needed by the object */ + DobjPoints *points; /* List of points */ + Style style; /* this object's individual style settings */ + gint style_no; /* style index of this specific object */ +}; + +/* States of the object */ +#define GFIG_OK 0x0 +#define GFIG_MODIFIED 0x1 +#define GFIG_READONLY 0x2 + +extern GfigObject *obj_creating; +extern GfigObject *tmp_line; + + +DobjPoints *new_dobjpoint (gint x, + gint y); +void do_save_obj (GfigObject *obj, + GString *to); + +DobjPoints *d_copy_dobjpoints (DobjPoints *pnts); +void free_one_obj (GfigObject *obj); +void d_delete_dobjpoints (DobjPoints *pnts); +void object_update (GdkPoint *pnt); +GList *copy_all_objs (GList *objs); +void draw_objects (GList *objs, + gboolean show_single, + cairo_t *cr); + +GfigObject *d_load_object (gchar *desc, + FILE *fp); + +GfigObject *d_new_object (DobjType type, + gint x, + gint y); + +void d_save_object (GfigObject *obj, + GString *string); + +void free_all_objs (GList *objs); + +void clear_undo (void); + +void new_obj_2edit (GFigObj *obj); + +void gfig_init_object_classes (void); + +void d_pnt_add_line (GfigObject *obj, + gint x, + gint y, + gint pos); + +#endif /* __GFIG_DOBJECT_H__ */ + + diff --git a/plug-ins/gfig/gfig-ellipse.c b/plug-ins/gfig/gfig-ellipse.c new file mode 100644 index 0000000..e6fd430 --- /dev/null +++ b/plug-ins/gfig/gfig-ellipse.c @@ -0,0 +1,235 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + +#include "config.h" + +#include <stdlib.h> + +#include <libgimp/gimp.h> +#include <libgimp/gimpui.h> + +#include "gfig.h" +#include "gfig-dobject.h" +#include "gfig-ellipse.h" + +#include "libgimp/stdplugins-intl.h" + + +static void d_draw_ellipse (GfigObject *obj, + cairo_t *cr); +static void d_paint_ellipse (GfigObject *obj); +static GfigObject *d_copy_ellipse (GfigObject *obj); + +static void d_update_ellipse (GdkPoint *pnt); + +static void +d_draw_ellipse (GfigObject *obj, + cairo_t *cr) +{ + DobjPoints *center_pnt; + DobjPoints *edge_pnt; + gint bound_wx; + gint bound_wy; + + center_pnt = obj->points; + + if (!center_pnt) + return; /* End-of-line */ + + draw_sqr (¢er_pnt->pnt, obj == gfig_context->selected_obj, cr); + + edge_pnt = center_pnt->next; + + if (!edge_pnt) + return; + + if (obj == obj_creating) + draw_circle (&edge_pnt->pnt, TRUE, cr); + else + draw_sqr (&edge_pnt->pnt, obj == gfig_context->selected_obj, cr); + + bound_wx = abs (center_pnt->pnt.x - edge_pnt->pnt.x); + bound_wy = abs (center_pnt->pnt.y - edge_pnt->pnt.y); + + gfig_draw_arc (center_pnt->pnt.x, center_pnt->pnt.y, bound_wx, bound_wy, 0, 360, cr); +} + +static void +d_paint_ellipse (GfigObject *obj) +{ + DobjPoints *center_pnt; + DobjPoints *edge_pnt; + gint bound_wx; + gint bound_wy; + gint top_x; + gint top_y; + gdouble dpnts[4]; + + g_assert (obj != NULL); + + center_pnt = obj->points; + + if (!center_pnt) + return; /* End-of-line */ + + edge_pnt = center_pnt->next; + + if (!edge_pnt) + { + g_error ("Internal error - ellipse no edge pnt"); + } + + bound_wx = abs (center_pnt->pnt.x - edge_pnt->pnt.x)*2; + bound_wy = abs (center_pnt->pnt.y - edge_pnt->pnt.y)*2; + + if (edge_pnt->pnt.x > center_pnt->pnt.x) + top_x = 2*center_pnt->pnt.x - edge_pnt->pnt.x; + else + top_x = edge_pnt->pnt.x; + + if (edge_pnt->pnt.y > center_pnt->pnt.y) + top_y = 2*center_pnt->pnt.y - edge_pnt->pnt.y; + else + top_y = edge_pnt->pnt.y; + + dpnts[0] = (gdouble)top_x; + dpnts[1] = (gdouble)top_y; + dpnts[2] = (gdouble)bound_wx; + dpnts[3] = (gdouble)bound_wy; + + /* Scale before drawing */ + if (selvals.scaletoimage) + scale_to_original_xy (&dpnts[0], 2); + else + scale_to_xy (&dpnts[0], 2); + + if (gfig_context_get_current_style ()->fill_type != FILL_NONE) + { + gimp_context_push (); + gimp_context_set_antialias (selopt.antia); + gimp_context_set_feather (selopt.feather); + gimp_context_set_feather_radius (selopt.feather_radius, selopt.feather_radius); + gimp_image_select_ellipse (gfig_context->image_id, + selopt.type, + dpnts[0], dpnts[1], + dpnts[2], dpnts[3]); + gimp_context_pop (); + + paint_layer_fill (top_x, top_y, top_x + bound_wx, top_y + bound_wy); + gimp_selection_none (gfig_context->image_id); + } + + if (obj->style.paint_type == PAINT_BRUSH_TYPE) + { + const gdouble rx = dpnts[2] / 2, ry = dpnts[3] / 2; + const gdouble cx = dpnts[0] + rx, cy = dpnts[1] + ry; + gdouble line_pnts[362]; + gdouble angle = 0; + gint i = 0; + + while (i < 361) + { + static const gdouble step = 2 * G_PI / 180; + + line_pnts[i++] = cx + rx * cos (angle); + line_pnts[i++] = cy + ry * sin (angle); + angle += step; + } + + gfig_paint (selvals.brshtype, gfig_context->drawable_id, i, line_pnts); + } +} + +static GfigObject * +d_copy_ellipse (GfigObject * obj) +{ + GfigObject *nc; + + g_assert (obj->type == ELLIPSE); + + nc = d_new_object (ELLIPSE, obj->points->pnt.x, obj->points->pnt.y); + nc->points->next = d_copy_dobjpoints (obj->points->next); + + return nc; +} + +void +d_ellipse_object_class_init (void) +{ + GfigObjectClass *class = &dobj_class[ELLIPSE]; + + class->type = ELLIPSE; + class->name = "ELLIPSE"; + class->drawfunc = d_draw_ellipse; + class->paintfunc = d_paint_ellipse; + class->copyfunc = d_copy_ellipse; + class->update = d_update_ellipse; +} + +static void +d_update_ellipse (GdkPoint *pnt) +{ + DobjPoints *center_pnt, *edge_pnt; + + center_pnt = obj_creating->points; + + if (!center_pnt) + return; /* No points */ + + if ((edge_pnt = center_pnt->next)) + { + edge_pnt->pnt = *pnt; + } + else + { + edge_pnt = new_dobjpoint (pnt->x, pnt->y); + center_pnt->next = edge_pnt; + } +} + +void +d_ellipse_start (GdkPoint *pnt, + gboolean shift_down) +{ + obj_creating = d_new_object (ELLIPSE, pnt->x, pnt->y); +} + +void +d_ellipse_end (GdkPoint *pnt, + gboolean shift_down) +{ + /* Under control point */ + if (!obj_creating->points->next) + { + /* No circle created */ + free_one_obj (obj_creating); + } + else + { + add_to_all_obj (gfig_context->current_obj, obj_creating); + } + + obj_creating = NULL; +} + diff --git a/plug-ins/gfig/gfig-ellipse.h b/plug-ins/gfig/gfig-ellipse.h new file mode 100644 index 0000000..e770311 --- /dev/null +++ b/plug-ins/gfig/gfig-ellipse.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + +#ifndef __GFIG_ELLIPSE_H__ +#define __GFIG_ELLIPSE_H__ + +void d_ellipse_object_class_init (void); + +void d_ellipse_start (GdkPoint *pnt, + gboolean shift_down); +void d_ellipse_end (GdkPoint *pnt, + gboolean shift_down); + +#endif /* __GFIG_ELLIPSE_H__ */ diff --git a/plug-ins/gfig/gfig-examples/A_star b/plug-ins/gfig/gfig-examples/A_star new file mode 100644 index 0000000..6d5e981 --- /dev/null +++ b/plug-ins/gfig/gfig-examples/A_star @@ -0,0 +1,84 @@ +GFIG Version 0.1 +Name: A\040star +Version: 0.000000 +ObjCount: 18 +<OPTIONS> +GridSpacing: 30 +GridType: POLAR_GRID +DrawGrid: TRUE +Snap2Grid: TRUE +LockOnGrid: FALSE +ShowControl: TRUE +</OPTIONS> +<LINE> +127 67 +44 44 +</LINE> +<LINE> +44 44 +68 128 +</LINE> +<LINE> +68 128 +44 212 +</LINE> +<LINE> +44 212 +128 188 +</LINE> +<LINE> +128 188 +212 212 +</LINE> +<LINE> +212 212 +188 128 +</LINE> +<LINE> +188 128 +212 44 +</LINE> +<LINE> +212 44 +128 68 +</LINE> +<CIRCLE> +128 128 +139 186 +</CIRCLE> +<CIRCLE> +128 128 +151 245 +</CIRCLE> +<LINE> +128 8 +86 86 +</LINE> +<LINE> +86 86 +8 128 +</LINE> +<LINE> +8 128 +86 170 +</LINE> +<LINE> +86 170 +128 248 +</LINE> +<LINE> +128 248 +170 170 +</LINE> +<LINE> +170 170 +248 128 +</LINE> +<LINE> +248 128 +170 86 +</LINE> +<LINE> +170 86 +128 8 +</LINE> diff --git a/plug-ins/gfig/gfig-examples/Makefile.am b/plug-ins/gfig/gfig-examples/Makefile.am new file mode 100644 index 0000000..f41deea --- /dev/null +++ b/plug-ins/gfig/gfig-examples/Makefile.am @@ -0,0 +1,17 @@ +## Process this file with automake to produce Makefile.in + +gfigdatadir = $(gimpdatadir)/gfig + +gfigdata_DATA = \ + A_star \ + curves \ + polys \ + ring \ + ring+star \ + simily \ + spirals_and_stars \ + sprial \ + star2 \ + stars + +EXTRA_DIST = $(gfigdata_DATA) diff --git a/plug-ins/gfig/gfig-examples/Makefile.in b/plug-ins/gfig/gfig-examples/Makefile.in new file mode 100644 index 0000000..f343359 --- /dev/null +++ b/plug-ins/gfig/gfig-examples/Makefile.in @@ -0,0 +1,815 @@ +# Makefile.in generated by automake 1.16.3 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2020 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = plug-ins/gfig/gfig-examples +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/m4macros/alsa.m4 \ + $(top_srcdir)/m4macros/ax_compare_version.m4 \ + $(top_srcdir)/m4macros/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4macros/ax_gcc_func_attribute.m4 \ + $(top_srcdir)/m4macros/ax_prog_cc_for_build.m4 \ + $(top_srcdir)/m4macros/ax_prog_perl_version.m4 \ + $(top_srcdir)/m4macros/detectcflags.m4 \ + $(top_srcdir)/m4macros/pythondev.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(gfigdatadir)" +DATA = $(gfigdata_DATA) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +AA_LIBS = @AA_LIBS@ +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +ALL_LINGUAS = @ALL_LINGUAS@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALTIVEC_EXTRA_CFLAGS = @ALTIVEC_EXTRA_CFLAGS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APPSTREAM_UTIL = @APPSTREAM_UTIL@ +AR = @AR@ +AS = @AS@ +ATK_CFLAGS = @ATK_CFLAGS@ +ATK_LIBS = @ATK_LIBS@ +ATK_REQUIRED_VERSION = @ATK_REQUIRED_VERSION@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BABL_CFLAGS = @BABL_CFLAGS@ +BABL_LIBS = @BABL_LIBS@ +BABL_REQUIRED_VERSION = @BABL_REQUIRED_VERSION@ +BUG_REPORT_URL = @BUG_REPORT_URL@ +BUILD_EXEEXT = @BUILD_EXEEXT@ +BUILD_OBJEXT = @BUILD_OBJEXT@ +BZIP2_LIBS = @BZIP2_LIBS@ +CAIRO_CFLAGS = @CAIRO_CFLAGS@ +CAIRO_LIBS = @CAIRO_LIBS@ +CAIRO_PDF_CFLAGS = @CAIRO_PDF_CFLAGS@ +CAIRO_PDF_LIBS = @CAIRO_PDF_LIBS@ +CAIRO_PDF_REQUIRED_VERSION = @CAIRO_PDF_REQUIRED_VERSION@ +CAIRO_REQUIRED_VERSION = @CAIRO_REQUIRED_VERSION@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CC_FOR_BUILD = @CC_FOR_BUILD@ +CC_VERSION = @CC_VERSION@ +CFLAGS = @CFLAGS@ +CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@ +CPP_FOR_BUILD = @CPP_FOR_BUILD@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DESKTOP_DATADIR = @DESKTOP_DATADIR@ +DESKTOP_FILE_VALIDATE = @DESKTOP_FILE_VALIDATE@ +DLLTOOL = @DLLTOOL@ +DOC_SHOOTER = @DOC_SHOOTER@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILE_AA = @FILE_AA@ +FILE_EXR = @FILE_EXR@ +FILE_HEIF = @FILE_HEIF@ +FILE_JP2_LOAD = @FILE_JP2_LOAD@ +FILE_JPEGXL = @FILE_JPEGXL@ +FILE_MNG = @FILE_MNG@ +FILE_PDF_SAVE = @FILE_PDF_SAVE@ +FILE_PS = @FILE_PS@ +FILE_WMF = @FILE_WMF@ +FILE_XMC = @FILE_XMC@ +FILE_XPM = @FILE_XPM@ +FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@ +FONTCONFIG_LIBS = @FONTCONFIG_LIBS@ +FONTCONFIG_REQUIRED_VERSION = @FONTCONFIG_REQUIRED_VERSION@ +FREETYPE2_REQUIRED_VERSION = @FREETYPE2_REQUIRED_VERSION@ +FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ +FREETYPE_LIBS = @FREETYPE_LIBS@ +GDBUS_CODEGEN = @GDBUS_CODEGEN@ +GDK_PIXBUF_CFLAGS = @GDK_PIXBUF_CFLAGS@ +GDK_PIXBUF_CSOURCE = @GDK_PIXBUF_CSOURCE@ +GDK_PIXBUF_LIBS = @GDK_PIXBUF_LIBS@ +GDK_PIXBUF_REQUIRED_VERSION = @GDK_PIXBUF_REQUIRED_VERSION@ +GEGL = @GEGL@ +GEGL_CFLAGS = @GEGL_CFLAGS@ +GEGL_LIBS = @GEGL_LIBS@ +GEGL_MAJOR_MINOR_VERSION = @GEGL_MAJOR_MINOR_VERSION@ +GEGL_REQUIRED_VERSION = @GEGL_REQUIRED_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GEXIV2_CFLAGS = @GEXIV2_CFLAGS@ +GEXIV2_LIBS = @GEXIV2_LIBS@ +GEXIV2_REQUIRED_VERSION = @GEXIV2_REQUIRED_VERSION@ +GIMP_API_VERSION = @GIMP_API_VERSION@ +GIMP_APP_VERSION = @GIMP_APP_VERSION@ +GIMP_BINARY_AGE = @GIMP_BINARY_AGE@ +GIMP_COMMAND = @GIMP_COMMAND@ +GIMP_DATA_VERSION = @GIMP_DATA_VERSION@ +GIMP_FULL_NAME = @GIMP_FULL_NAME@ +GIMP_INTERFACE_AGE = @GIMP_INTERFACE_AGE@ +GIMP_MAJOR_VERSION = @GIMP_MAJOR_VERSION@ +GIMP_MICRO_VERSION = @GIMP_MICRO_VERSION@ +GIMP_MINOR_VERSION = @GIMP_MINOR_VERSION@ +GIMP_MKENUMS = @GIMP_MKENUMS@ +GIMP_MODULES = @GIMP_MODULES@ +GIMP_PACKAGE_REVISION = @GIMP_PACKAGE_REVISION@ +GIMP_PKGCONFIG_VERSION = @GIMP_PKGCONFIG_VERSION@ +GIMP_PLUGINS = @GIMP_PLUGINS@ +GIMP_PLUGIN_VERSION = @GIMP_PLUGIN_VERSION@ +GIMP_REAL_VERSION = @GIMP_REAL_VERSION@ +GIMP_RELEASE = @GIMP_RELEASE@ +GIMP_SYSCONF_VERSION = @GIMP_SYSCONF_VERSION@ +GIMP_TOOL_VERSION = @GIMP_TOOL_VERSION@ +GIMP_UNSTABLE = @GIMP_UNSTABLE@ +GIMP_USER_VERSION = @GIMP_USER_VERSION@ +GIMP_VERSION = @GIMP_VERSION@ +GIO_CFLAGS = @GIO_CFLAGS@ +GIO_LIBS = @GIO_LIBS@ +GIO_UNIX_CFLAGS = @GIO_UNIX_CFLAGS@ +GIO_UNIX_LIBS = @GIO_UNIX_LIBS@ +GIO_WINDOWS_CFLAGS = @GIO_WINDOWS_CFLAGS@ +GIO_WINDOWS_LIBS = @GIO_WINDOWS_LIBS@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_REQUIRED_VERSION = @GLIB_REQUIRED_VERSION@ +GMODULE_NO_EXPORT_CFLAGS = @GMODULE_NO_EXPORT_CFLAGS@ +GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GS_LIBS = @GS_LIBS@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +GTK_MAC_INTEGRATION_CFLAGS = @GTK_MAC_INTEGRATION_CFLAGS@ +GTK_MAC_INTEGRATION_LIBS = @GTK_MAC_INTEGRATION_LIBS@ +GTK_REQUIRED_VERSION = @GTK_REQUIRED_VERSION@ +GTK_UPDATE_ICON_CACHE = @GTK_UPDATE_ICON_CACHE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +HARFBUZZ_CFLAGS = @HARFBUZZ_CFLAGS@ +HARFBUZZ_LIBS = @HARFBUZZ_LIBS@ +HARFBUZZ_REQUIRED_VERSION = @HARFBUZZ_REQUIRED_VERSION@ +HAVE_CXX14 = @HAVE_CXX14@ +HAVE_FINITE = @HAVE_FINITE@ +HAVE_ISFINITE = @HAVE_ISFINITE@ +HAVE_VFORK = @HAVE_VFORK@ +HOST_GLIB_COMPILE_RESOURCES = @HOST_GLIB_COMPILE_RESOURCES@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_REQUIRED_VERSION = @INTLTOOL_REQUIRED_VERSION@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +ISO_CODES_LOCALEDIR = @ISO_CODES_LOCALEDIR@ +ISO_CODES_LOCATION = @ISO_CODES_LOCATION@ +JPEG_LIBS = @JPEG_LIBS@ +JSON_GLIB_CFLAGS = @JSON_GLIB_CFLAGS@ +JSON_GLIB_LIBS = @JSON_GLIB_LIBS@ +JXL_CFLAGS = @JXL_CFLAGS@ +JXL_LIBS = @JXL_LIBS@ +JXL_THREADS_CFLAGS = @JXL_THREADS_CFLAGS@ +JXL_THREADS_LIBS = @JXL_THREADS_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LCMS_REQUIRED_VERSION = @LCMS_REQUIRED_VERSION@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ +LIBBACKTRACE_LIBS = @LIBBACKTRACE_LIBS@ +LIBHEIF_CFLAGS = @LIBHEIF_CFLAGS@ +LIBHEIF_LIBS = @LIBHEIF_LIBS@ +LIBHEIF_REQUIRED_VERSION = @LIBHEIF_REQUIRED_VERSION@ +LIBJXL_REQUIRED_VERSION = @LIBJXL_REQUIRED_VERSION@ +LIBLZMA_REQUIRED_VERSION = @LIBLZMA_REQUIRED_VERSION@ +LIBMYPAINT_CFLAGS = @LIBMYPAINT_CFLAGS@ +LIBMYPAINT_LIBS = @LIBMYPAINT_LIBS@ +LIBMYPAINT_REQUIRED_VERSION = @LIBMYPAINT_REQUIRED_VERSION@ +LIBOBJS = @LIBOBJS@ +LIBPNG_REQUIRED_VERSION = @LIBPNG_REQUIRED_VERSION@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ +LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ +LIBUNWIND_REQUIRED_VERSION = @LIBUNWIND_REQUIRED_VERSION@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_CURRENT_MINUS_AGE = @LT_CURRENT_MINUS_AGE@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LT_VERSION_INFO = @LT_VERSION_INFO@ +LZMA_CFLAGS = @LZMA_CFLAGS@ +LZMA_LIBS = @LZMA_LIBS@ +MAIL = @MAIL@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MIME_INFO_CFLAGS = @MIME_INFO_CFLAGS@ +MIME_INFO_LIBS = @MIME_INFO_LIBS@ +MIME_TYPES = @MIME_TYPES@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MMX_EXTRA_CFLAGS = @MMX_EXTRA_CFLAGS@ +MNG_CFLAGS = @MNG_CFLAGS@ +MNG_LIBS = @MNG_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +MYPAINT_BRUSHES_CFLAGS = @MYPAINT_BRUSHES_CFLAGS@ +MYPAINT_BRUSHES_LIBS = @MYPAINT_BRUSHES_LIBS@ +NATIVE_GLIB_CFLAGS = @NATIVE_GLIB_CFLAGS@ +NATIVE_GLIB_LIBS = @NATIVE_GLIB_LIBS@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENEXR_CFLAGS = @OPENEXR_CFLAGS@ +OPENEXR_LIBS = @OPENEXR_LIBS@ +OPENEXR_REQUIRED_VERSION = @OPENEXR_REQUIRED_VERSION@ +OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@ +OPENJPEG_LIBS = @OPENJPEG_LIBS@ +OPENJPEG_REQUIRED_VERSION = @OPENJPEG_REQUIRED_VERSION@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOCAIRO_CFLAGS = @PANGOCAIRO_CFLAGS@ +PANGOCAIRO_LIBS = @PANGOCAIRO_LIBS@ +PANGOCAIRO_REQUIRED_VERSION = @PANGOCAIRO_REQUIRED_VERSION@ +PATHSEP = @PATHSEP@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_REQUIRED_VERSION = @PERL_REQUIRED_VERSION@ +PERL_VERSION = @PERL_VERSION@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PNG_CFLAGS = @PNG_CFLAGS@ +PNG_LIBS = @PNG_LIBS@ +POFILES = @POFILES@ +POPPLER_CFLAGS = @POPPLER_CFLAGS@ +POPPLER_DATA_CFLAGS = @POPPLER_DATA_CFLAGS@ +POPPLER_DATA_LIBS = @POPPLER_DATA_LIBS@ +POPPLER_DATA_REQUIRED_VERSION = @POPPLER_DATA_REQUIRED_VERSION@ +POPPLER_LIBS = @POPPLER_LIBS@ +POPPLER_REQUIRED_VERSION = @POPPLER_REQUIRED_VERSION@ +POSUB = @POSUB@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +PYBIN_PATH = @PYBIN_PATH@ +PYCAIRO_CFLAGS = @PYCAIRO_CFLAGS@ +PYCAIRO_LIBS = @PYCAIRO_LIBS@ +PYGIMP_EXTRA_CFLAGS = @PYGIMP_EXTRA_CFLAGS@ +PYGTK_CFLAGS = @PYGTK_CFLAGS@ +PYGTK_CODEGEN = @PYGTK_CODEGEN@ +PYGTK_DEFSDIR = @PYGTK_DEFSDIR@ +PYGTK_LIBS = @PYGTK_LIBS@ +PYLINK_LIBS = @PYLINK_LIBS@ +PYTHON = @PYTHON@ +PYTHON2_REQUIRED_VERSION = @PYTHON2_REQUIRED_VERSION@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_INCLUDES = @PYTHON_INCLUDES@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RSVG_REQUIRED_VERSION = @RSVG_REQUIRED_VERSION@ +RT_LIBS = @RT_LIBS@ +SCREENSHOT_LIBS = @SCREENSHOT_LIBS@ +SED = @SED@ +SENDMAIL = @SENDMAIL@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOCKET_LIBS = @SOCKET_LIBS@ +SSE2_EXTRA_CFLAGS = @SSE2_EXTRA_CFLAGS@ +SSE4_1_EXTRA_CFLAGS = @SSE4_1_EXTRA_CFLAGS@ +SSE_EXTRA_CFLAGS = @SSE_EXTRA_CFLAGS@ +STRIP = @STRIP@ +SVG_CFLAGS = @SVG_CFLAGS@ +SVG_LIBS = @SVG_LIBS@ +SYMPREFIX = @SYMPREFIX@ +TIFF_LIBS = @TIFF_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WEBKIT_CFLAGS = @WEBKIT_CFLAGS@ +WEBKIT_LIBS = @WEBKIT_LIBS@ +WEBKIT_REQUIRED_VERSION = @WEBKIT_REQUIRED_VERSION@ +WEBPDEMUX_CFLAGS = @WEBPDEMUX_CFLAGS@ +WEBPDEMUX_LIBS = @WEBPDEMUX_LIBS@ +WEBPMUX_CFLAGS = @WEBPMUX_CFLAGS@ +WEBPMUX_LIBS = @WEBPMUX_LIBS@ +WEBP_CFLAGS = @WEBP_CFLAGS@ +WEBP_LIBS = @WEBP_LIBS@ +WEBP_REQUIRED_VERSION = @WEBP_REQUIRED_VERSION@ +WEB_PAGE = @WEB_PAGE@ +WIN32_LARGE_ADDRESS_AWARE = @WIN32_LARGE_ADDRESS_AWARE@ +WINDRES = @WINDRES@ +WMF_CFLAGS = @WMF_CFLAGS@ +WMF_CONFIG = @WMF_CONFIG@ +WMF_LIBS = @WMF_LIBS@ +WMF_REQUIRED_VERSION = @WMF_REQUIRED_VERSION@ +XDG_EMAIL = @XDG_EMAIL@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_REQUIRED_VERSION = @XGETTEXT_REQUIRED_VERSION@ +XMC_CFLAGS = @XMC_CFLAGS@ +XMC_LIBS = @XMC_LIBS@ +XMKMF = @XMKMF@ +XMLLINT = @XMLLINT@ +XMU_LIBS = @XMU_LIBS@ +XPM_LIBS = @XPM_LIBS@ +XSLTPROC = @XSLTPROC@ +XVFB_RUN = @XVFB_RUN@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Z_LIBS = @Z_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CC_FOR_BUILD = @ac_ct_CC_FOR_BUILD@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gimpdatadir = @gimpdatadir@ +gimpdir = @gimpdir@ +gimplocaledir = @gimplocaledir@ +gimpplugindir = @gimpplugindir@ +gimpsysconfdir = @gimpsysconfdir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +manpage_gimpdir = @manpage_gimpdir@ +mkdir_p = @mkdir_p@ +ms_librarian = @ms_librarian@ +mypaint_brushes_dir = @mypaint_brushes_dir@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +gfigdatadir = $(gimpdatadir)/gfig +gfigdata_DATA = \ + A_star \ + curves \ + polys \ + ring \ + ring+star \ + simily \ + spirals_and_stars \ + sprial \ + star2 \ + stars + +EXTRA_DIST = $(gfigdata_DATA) +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plug-ins/gfig/gfig-examples/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plug-ins/gfig/gfig-examples/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-gfigdataDATA: $(gfigdata_DATA) + @$(NORMAL_INSTALL) + @list='$(gfigdata_DATA)'; test -n "$(gfigdatadir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(gfigdatadir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(gfigdatadir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(gfigdatadir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(gfigdatadir)" || exit $$?; \ + done + +uninstall-gfigdataDATA: + @$(NORMAL_UNINSTALL) + @list='$(gfigdata_DATA)'; test -n "$(gfigdatadir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(gfigdatadir)'; $(am__uninstall_files_from_dir) +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(DATA) +installdirs: + for dir in "$(DESTDIR)$(gfigdatadir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-gfigdataDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-gfigdataDATA + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am \ + install-gfigdataDATA install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ + uninstall-am uninstall-gfigdataDATA + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/plug-ins/gfig/gfig-examples/curves b/plug-ins/gfig/gfig-examples/curves new file mode 100644 index 0000000..3c48165 --- /dev/null +++ b/plug-ins/gfig/gfig-examples/curves @@ -0,0 +1,57 @@ +GFIG Version 0.1 +Name: curves +Version: 0.000000 +ObjCount: 9 +<OPTIONS> +GridSpacing: 13 +GridType: POLAR_GRID +DrawGrid: TRUE +Snap2Grid: TRUE +LockOnGrid: FALSE +ShowControl: TRUE +</OPTIONS> +<ARC> +53 39 +109 13 +170 19 +</ARC> +<ARC> +177 37 +217 75 +231 115 +</ARC> +<ARC> +219 128 +199 184 +160 212 +</ARC> +<ARC> +146 203 +105 202 +71 180 +</ARC> +<ARC> +75 164 +64 132 +70 99 +</ARC> +<ARC> +95 89 +128 77 +158 87 +</ARC> +<ARC> +158 104 +166 128 +155 156 +</ARC> +<ARC> +143 148 +121 152 +105 139 +</ARC> +<ARC> +116 130 +125 116 +139 123 +</ARC> diff --git a/plug-ins/gfig/gfig-examples/polys b/plug-ins/gfig/gfig-examples/polys new file mode 100644 index 0000000..3bdd0ab --- /dev/null +++ b/plug-ins/gfig/gfig-examples/polys @@ -0,0 +1,40 @@ +GFIG Version 0.1 +Name: polys +Version: 0.000000 +ObjCount: 4 +<OPTIONS> +GridSpacing: 10 +GridType: RECT_GRID +DrawGrid: TRUE +Snap2Grid: TRUE +LockOnGrid: FALSE +ShowControl: TRUE +</OPTIONS> +<POLY> +60 40 +60 100 +<EXTRA> +3 +</EXTRA> +</POLY> +<POLY> +170 60 +200 110 +<EXTRA> +4 +</EXTRA> +</POLY> +<POLY> +50 170 +70 210 +<EXTRA> +5 +</EXTRA> +</POLY> +<POLY> +170 170 +110 160 +<EXTRA> +6 +</EXTRA> +</POLY> diff --git a/plug-ins/gfig/gfig-examples/ring b/plug-ins/gfig/gfig-examples/ring new file mode 100644 index 0000000..8c0bffe --- /dev/null +++ b/plug-ins/gfig/gfig-examples/ring @@ -0,0 +1,44 @@ +GFIG Version 0.1 +Name: a\040ring +Version: 0.000000 +ObjCount: 8 +<OPTIONS> +GridSpacing: 50 +GridType: RECT_GRID +DrawGrid: TRUE +Snap2Grid: TRUE +LockOnGrid: FALSE +ShowControl: TRUE +</OPTIONS> +<CIRCLE> +163 163 +147 174 +</CIRCLE> +<CIRCLE> +178 128 +174 147 +</CIRCLE> +<CIRCLE> +163 93 +174 109 +</CIRCLE> +<CIRCLE> +128 78 +109 82 +</CIRCLE> +<CIRCLE> +93 93 +82 109 +</CIRCLE> +<CIRCLE> +78 128 +82 147 +</CIRCLE> +<CIRCLE> +93 163 +109 174 +</CIRCLE> +<CIRCLE> +128 178 +147 174 +</CIRCLE> diff --git a/plug-ins/gfig/gfig-examples/ring+star b/plug-ins/gfig/gfig-examples/ring+star new file mode 100644 index 0000000..8b48129 --- /dev/null +++ b/plug-ins/gfig/gfig-examples/ring+star @@ -0,0 +1,123 @@ +GFIG Version 0.1 +Name: a\040ring\040merged +Version: 0.000000 +ObjCount: 27 +<OPTIONS> +GridSpacing: 47 +GridType: RECT_GRID +DrawGrid: TRUE +Snap2Grid: TRUE +LockOnGrid: FALSE +ShowControl: TRUE +</OPTIONS> +<CIRCLE> +163 163 +147 174 +</CIRCLE> +<CIRCLE> +178 128 +174 147 +</CIRCLE> +<CIRCLE> +163 93 +174 109 +</CIRCLE> +<CIRCLE> +128 78 +109 82 +</CIRCLE> +<CIRCLE> +93 93 +82 109 +</CIRCLE> +<CIRCLE> +78 128 +82 147 +</CIRCLE> +<CIRCLE> +93 163 +109 174 +</CIRCLE> +<CIRCLE> +128 178 +147 174 +</CIRCLE> +<LINE> +127 67 +44 44 +</LINE> +<LINE> +44 44 +68 128 +</LINE> +<LINE> +68 128 +44 212 +</LINE> +<LINE> +44 212 +128 188 +</LINE> +<LINE> +128 188 +212 212 +</LINE> +<LINE> +212 212 +188 128 +</LINE> +<LINE> +188 128 +212 44 +</LINE> +<LINE> +212 44 +128 68 +</LINE> +<CIRCLE> +128 128 +139 186 +</CIRCLE> +<CIRCLE> +128 128 +151 245 +</CIRCLE> +<LINE> +128 8 +86 86 +</LINE> +<LINE> +86 86 +8 128 +</LINE> +<LINE> +8 128 +86 170 +</LINE> +<LINE> +86 170 +128 248 +</LINE> +<LINE> +128 248 +170 170 +</LINE> +<LINE> +170 170 +248 128 +</LINE> +<LINE> +248 128 +170 86 +</LINE> +<LINE> +170 86 +128 8 +</LINE> +<POLY> +338 132 +256 256 +<EXTRA> +3 +</EXTRA> +</POLY> diff --git a/plug-ins/gfig/gfig-examples/simily b/plug-ins/gfig/gfig-examples/simily new file mode 100644 index 0000000..d2e9d44 --- /dev/null +++ b/plug-ins/gfig/gfig-examples/simily @@ -0,0 +1,47 @@ +GFIG Version 0.1 +Name: Simly\040face +Version: 0.000000 +ObjCount: 5 +<OPTIONS> +GridSpacing: 30 +GridType: RECT_GRID +DrawGrid: FALSE +Snap2Grid: FALSE +LockOnGrid: FALSE +ShowControl: TRUE +</OPTIONS> +<CIRCLE> +128 128 +142 235 +</CIRCLE> +<CIRCLE> +72 90 +72 108 +</CIRCLE> +<CIRCLE> +180 90 +180 108 +</CIRCLE> +<LINE> +66 163 +71 171 +78 178 +85 185 +92 190 +101 194 +110 197 +119 199 +128 200 +137 199 +146 197 +155 194 +163 190 +171 185 +178 178 +185 171 +190 164 +</LINE> +<CIRCLE> +128 145 +128 164 +</CIRCLE> diff --git a/plug-ins/gfig/gfig-examples/spirals_and_stars b/plug-ins/gfig/gfig-examples/spirals_and_stars new file mode 100644 index 0000000..fae6052 --- /dev/null +++ b/plug-ins/gfig/gfig-examples/spirals_and_stars @@ -0,0 +1,55 @@ +GFIG Version 0.1 +Name: First\040gfig +Version: 0.000000 +ObjCount: 6 +<OPTIONS> +GridSpacing: 30 +GridType: RECT_GRID +DrawGrid: FALSE +Snap2Grid: FALSE +LockOnGrid: FALSE +ShowControl: TRUE +</OPTIONS> +<SPIRAL> +71 81 +96 103 +<EXTRA> +4 +</EXTRA> +</SPIRAL> +<SPIRAL> +152 79 +179 91 +<EXTRA> +-4 +</EXTRA> +</SPIRAL> +<BEZIER> +116 94 +105 147 +73 161 +<EXTRA> +4 +</EXTRA> +</BEZIER> +<STAR> +206 106 +228 123 +214 112 +<EXTRA> +3 +</EXTRA> +</STAR> +<STAR> +26 115 +10 133 +20 121 +<EXTRA> +3 +</EXTRA> +</STAR> +<ARC> +38 169 +92 218 +182 182 +</ARC> diff --git a/plug-ins/gfig/gfig-examples/sprial b/plug-ins/gfig/gfig-examples/sprial new file mode 100644 index 0000000..0223c45 --- /dev/null +++ b/plug-ins/gfig/gfig-examples/sprial @@ -0,0 +1,38 @@ +GFIG Version 0.1 +Name: square\040sprial +Version: 0.000000 +ObjCount: 2 +<OPTIONS> +GridSpacing: 30 +GridType: RECT_GRID +DrawGrid: FALSE +Snap2Grid: FALSE +LockOnGrid: FALSE +ShowControl: TRUE +</OPTIONS> +<LINE> +30 20 +230 20 +230 230 +50 230 +50 40 +210 40 +210 210 +70 210 +70 60 +190 60 +190 190 +90 190 +90 80 +170 80 +170 170 +110 170 +110 100 +150 100 +150 150 +130 150 +</LINE> +<LINE> +130 150 +130 120 +</LINE> diff --git a/plug-ins/gfig/gfig-examples/star2 b/plug-ins/gfig/gfig-examples/star2 new file mode 100644 index 0000000..568859d --- /dev/null +++ b/plug-ins/gfig/gfig-examples/star2 @@ -0,0 +1,61 @@ +GFIG Version 0.1 +Name: Another\040star +Version: 0.000000 +ObjCount: 7 +<OPTIONS> +GridSpacing: 30 +GridType: RECT_GRID +DrawGrid: FALSE +Snap2Grid: FALSE +LockOnGrid: FALSE +ShowControl: TRUE +</OPTIONS> +<POLY> +128 128 +164 190 +<EXTRA> +6 +</EXTRA> +</POLY> +<POLY> +128 43 +163 63 +<EXTRA> +3 +</EXTRA> +</POLY> +<POLY> +203 170 +238 190 +<EXTRA> +3 +</EXTRA> +</POLY> +<POLY> +54 170 +89 190 +<EXTRA> +3 +</EXTRA> +</POLY> +<POLY> +202 85 +237 65 +<EXTRA> +3 +</EXTRA> +</POLY> +<POLY> +54 85 +89 65 +<EXTRA> +3 +</EXTRA> +</POLY> +<POLY> +128 213 +163 193 +<EXTRA> +3 +</EXTRA> +</POLY> diff --git a/plug-ins/gfig/gfig-examples/stars b/plug-ins/gfig/gfig-examples/stars new file mode 100644 index 0000000..29a784f --- /dev/null +++ b/plug-ins/gfig/gfig-examples/stars @@ -0,0 +1,44 @@ +GFIG Version 0.1 +Name: First\040gfig +Version: 0.000000 +ObjCount: 4 +<OPTIONS> +GridSpacing: 30 +GridType: RECT_GRID +DrawGrid: FALSE +Snap2Grid: FALSE +LockOnGrid: FALSE +ShowControl: TRUE +</OPTIONS> +<STAR> +80 70 +80 130 +80 90 +<EXTRA> +6 +</EXTRA> +</STAR> +<STAR> +200 70 +200 130 +200 90 +<EXTRA> +6 +</EXTRA> +</STAR> +<STAR> +200 190 +200 250 +200 210 +<EXTRA> +6 +</EXTRA> +</STAR> +<STAR> +80 190 +80 250 +80 210 +<EXTRA> +6 +</EXTRA> +</STAR> diff --git a/plug-ins/gfig/gfig-grid.c b/plug-ins/gfig/gfig-grid.c new file mode 100644 index 0000000..ac81859 --- /dev/null +++ b/plug-ins/gfig/gfig-grid.c @@ -0,0 +1,540 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +#include "config.h" + +#include <math.h> +#include <stdlib.h> + +#include <libgimp/gimp.h> +#include <libgimp/gimpui.h> + +#include "gfig.h" +#include "gfig-grid.h" + +#include "libgimp/stdplugins-intl.h" + + +/* For the isometric grid */ +#define SQRT3 1.73205080756887729353 /* Square root of 3 */ +#define SIN_1o6PI_RAD 0.5 /* Sine 1/6 Pi Radians */ +#define COS_1o6PI_RAD SQRT3 / 2 /* Cosine 1/6 Pi Radians */ +#define TAN_1o6PI_RAD 1 / SQRT3 /* Tangent 1/6 Pi Radians == SIN / COS */ +#define RECIP_TAN_1o6PI_RAD SQRT3 /* Reciprocal of Tangent 1/6 Pi Radians */ + +gint grid_gc_type = GFIG_NORMAL_GC; + +static void draw_grid_polar (cairo_t *drawgc); +static void draw_grid_sq (cairo_t *drawgc); +static void draw_grid_iso (cairo_t *drawgc); + +static cairo_t * gfig_get_grid_gc (cairo_t *cr, + GtkWidget *widget, + gint gctype); + +static void find_grid_pos_polar (GdkPoint *p, + GdkPoint *gp); + + +/********** PrimeFactors for Shaneyfelt-style Polar Grid ********** + * Quickly factor any number up to 17160 + * Correctly factors numbers up to 131 * 131 - 1 + */ +typedef struct +{ + gint product; + gint remaining; + gint current; + gint next; + gint index; +} PrimeFactors; + +static gchar primes[] = { 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53, + 59,61,67,71,73,79,83,89,97,101,103,107,109,113,127 }; + +#define PRIMES_MAX_INDEX 30 + + +static gint +prime_factors_get (PrimeFactors *this) +{ + this->current = this->next; + while (this->index <= PRIMES_MAX_INDEX) + { + if (this->remaining % primes[this->index] == 0) /* divisible */ + { + this->remaining /= primes[this->index]; + this->next = primes[this->index]; + return this->current; + } + this->index++; + } + this->next = this->remaining; + this->remaining = 1; + + return this->current; +} + +static gint +prime_factors_lookahead (PrimeFactors *this) +{ + return this->next; +} + +static void +prime_factors_reset (PrimeFactors *this) +{ + this->remaining = this->product; + this->index = 0; + prime_factors_get (this); +} + +static PrimeFactors * +prime_factors_new (gint n) +{ + PrimeFactors *this = g_new (PrimeFactors, 1); + + this->product = n; + prime_factors_reset (this); + + return this; +} + +static void +prime_factors_delete (PrimeFactors* this) +{ + g_free (this); +} + +/********** ********** **********/ + +static gdouble +sector_size_at_radius (gdouble inner_radius) +{ + PrimeFactors *factors = prime_factors_new (selvals.opts.grid_sectors_desired); + gint current_sectors = 1; + gdouble sector_size = 2 * G_PI / current_sectors; + + while ((current_sectors < selvals.opts.grid_sectors_desired) + && (inner_radius*sector_size + > (prime_factors_lookahead (factors) * + selvals.opts.grid_granularity))) + { + current_sectors *= prime_factors_get (factors); + sector_size = 2 * G_PI / current_sectors; + } + + prime_factors_delete(factors); + + return sector_size; +} + +static void +find_grid_pos_polar (GdkPoint *p, + GdkPoint *gp) +{ + gdouble cx = preview_width / 2.0; + gdouble cy = preview_height / 2.0; + gdouble px = p->x - cx; + gdouble py = p->y - cy; + gdouble x = 0; + gdouble y = 0; + gdouble r = sqrt (SQR (px) + SQR (py)); + + if (r >= selvals.opts.grid_radius_min * 0.5) + { + gdouble t; + gdouble sectorSize; + + r = selvals.opts.grid_radius_interval + * (gint) (0.5 + ((r - selvals.opts.grid_radius_min) / + selvals.opts.grid_radius_interval)) + + selvals.opts.grid_radius_min; + + t = atan2 (py, px) + 2 * G_PI; + sectorSize = sector_size_at_radius (r); + t = selvals.opts.grid_rotation + + (gint) (0.5 + ((t - selvals.opts.grid_rotation) / sectorSize)) + * sectorSize; + x = r * cos (t); + y = r * sin (t); + } + + gp->x = x + cx; + gp->y = y + cy; +} + +/* find_grid_pos - Given an x, y point return the grid position of it */ +/* return the new position in the passed point */ + +void +gfig_grid_colors (GtkWidget *widget) +{ +} + +void +find_grid_pos (GdkPoint *p, + GdkPoint *gp, + guint is_butt3) +{ + gint16 x = p->x; + gint16 y = p->y; + static GdkPoint cons_pnt; + + if (selvals.opts.gridtype == RECT_GRID) + { + if (p->x % selvals.opts.gridspacing > selvals.opts.gridspacing/2) + x += selvals.opts.gridspacing; + + if (p->y % selvals.opts.gridspacing > selvals.opts.gridspacing/2) + y += selvals.opts.gridspacing; + + gp->x = (x/selvals.opts.gridspacing)*selvals.opts.gridspacing; + gp->y = (y/selvals.opts.gridspacing)*selvals.opts.gridspacing; + + if (is_butt3) + { + if (abs (gp->x - cons_pnt.x) < abs (gp->y - cons_pnt.y)) + gp->x = cons_pnt.x; + else + gp->y = cons_pnt.y; + } + else + { + /* Store the point since might be used later */ + cons_pnt = *gp; /* Structure copy */ + } + } + else if (selvals.opts.gridtype == POLAR_GRID) + { + find_grid_pos_polar (p,gp); + } + else if (selvals.opts.gridtype == ISO_GRID) + { + /* + * This really needs a picture to show the math... + * + * Consider an isometric grid with one of the sets of lines + * parallel to the y axis (vertical alignment). Further define + * that the origin of a Cartesian grid is at a isometric vertex. + * For simplicity consider the first quadrant only. + * + * - Let one line segment between vertices be r + * - Define the value of r as the grid spacing + * - Assign an integer n identifier to each vertical grid line + * along the x axis. with n=0 being the y axis. n can be any + * integer + * - Let m to be any integer + + * - Let h be the spacing between vertical grid lines measured + * along the x axis. It follows from the isometric grid that + * h has a value of r * COS(1/6 Pi Rad) + * + * Consider a Vertex V at the Cartesian location [Xv, Yv] + * + * It follows that vertices belong to the set... + * V[Xv, Yv] = [ [ n * h ] , + * [ m * r + ( 0.5 * r (n % 2) ) ] ] + * for all integers n and m + * + * Who cares? Me. It's useful in solving this problem: + * Consider an arbitrary point P[Xp,Yp], find the closest vertex + * in the set V. + * + * Restated this problem is "find values for m and n that are + * drive V closest to P" + * + * A Solution method (there may be a better one?): + * + * Step 1) bound n to the two closest values for Xp + * n_lo = (int) (Xp / h) + * n_hi = n_lo + 1 + * + * Step 2) Consider the two closes vertices for each n_lo and + * n_hi. The further of the vertices in each pair can + * readily be discarded. + * + * m_lo_n_lo = (int) ( (Yp / r) - 0.5 (n_lo % 2) ) + * m_hi_n_lo = m_lo_n_lo + 1 + * + * m_lo_n_hi = (int) ( (Yp / r) - 0.5 (n_hi % 2) ) + * m_hi_n_hi = m_hi_n_hi + * + * Step 3) compute the distance from P to V1 and V2. Snap to the + * closer point. + */ + + gint n_lo; + gint n_hi; + gint m_lo_n_lo; + gint m_hi_n_lo; + gint m_lo_n_hi; + gint m_hi_n_hi; + gint m_n_lo; + gint m_n_hi; + gdouble r; + gdouble h; + gint x1; + gint x2; + gint y1; + gint y2; + + r = selvals.opts.gridspacing; + h = COS_1o6PI_RAD * r; + + n_lo = (gint) x / h; + n_hi = n_lo + 1; + + /* evaluate m candidates for n_lo */ + m_lo_n_lo = (gint) ((y / r) - 0.5 * (n_lo % 2)); + m_hi_n_lo = m_lo_n_lo + 1; + + /* figure out which is the better candidate */ + if (fabs ((m_lo_n_lo * r + (0.5 * r * (n_lo % 2))) - y) < + fabs ((m_hi_n_lo * r + (0.5 * r * (n_lo % 2))) - y)) + { + m_n_lo = m_lo_n_lo; + } + else + { + m_n_lo = m_hi_n_lo; + } + + /* evaluate m candidates for n_hi */ + m_lo_n_hi = (gint) ( (y / r) - 0.5 * (n_hi % 2) ); + m_hi_n_hi = m_lo_n_hi + 1; + + /* figure out which is the better candidate */ + if (fabs((m_lo_n_hi * r + (0.5 * r * (n_hi % 2))) - y) < + fabs((m_hi_n_hi * r + (0.5 * r * (n_hi % 2))) - y)) + { + m_n_hi = m_lo_n_hi; + } + else + { + m_n_hi = m_hi_n_hi; + } + + /* Now, which is closer to [x,y]? we can use a somewhat + * abbreviated form of the distance formula since we only care + * about relative values. + */ + + x1 = (gint) (n_lo * h); + y1 = (gint) (m_n_lo * r + (0.5 * r * (n_lo % 2))); + x2 = (gint) (n_hi * h); + y2 = (gint) (m_n_hi * r + (0.5 * r * (n_hi % 2))); + + if (((x - x1) * (x - x1) + (y - y1) * (y - y1)) < + ((x - x2) * (x - x2) + (y - y2) * (y - y2))) + { + gp->x = x1; + gp->y = y1; + } + else + { + gp->x = x2; + gp->y = y2; + } + } +} + +static void +draw_grid_polar (cairo_t *cr) +{ + gdouble inner_radius; + gdouble outer_radius; + gdouble max_radius = sqrt (SQR (preview_width) + SQR (preview_height)); + gint current_sectors = 1; + PrimeFactors *factors = prime_factors_new (selvals.opts.grid_sectors_desired); + for (inner_radius = 0, outer_radius = selvals.opts.grid_radius_min; + outer_radius <= max_radius; + inner_radius = outer_radius, outer_radius += selvals.opts.grid_radius_interval) + { + gdouble t; + gdouble sector_size = 2 * G_PI / current_sectors; + cairo_arc (cr, + 0.5 + preview_width / 2.0, + 0.5 + preview_height / 2.0, + outer_radius, 0, 2 * G_PI); + cairo_stroke (cr); + + while ((current_sectors < selvals.opts.grid_sectors_desired) + && (inner_radius * sector_size + > prime_factors_lookahead (factors) * selvals.opts.grid_granularity )) + { + current_sectors *= prime_factors_get (factors); + sector_size = 2 * G_PI / current_sectors; + } + + for (t = 0 ; t < 2 * G_PI ; t += sector_size) + { + gdouble normal_x = cos (selvals.opts.grid_rotation+t); + gdouble normal_y = sin (selvals.opts.grid_rotation+t); + cairo_move_to (cr, + 0.5 + (preview_width / 2.0 + inner_radius * normal_x), + 0.5 + (preview_height / 2.0 - inner_radius * normal_y)); + cairo_line_to (cr, + 0.5 + (preview_width / 2.0 + outer_radius * normal_x), + 0.5 + (preview_height / 2.0 - outer_radius * normal_y)); + cairo_stroke (cr); + } + } + + prime_factors_delete (factors); +} + + +static void +draw_grid_sq (cairo_t *cr) +{ + gint step; + gint loop; + + /* Draw the horizontal lines */ + step = selvals.opts.gridspacing; + + for (loop = 0 ; loop < preview_height ; loop += step) + { + cairo_move_to (cr, 0 + .5, loop + .5); + cairo_line_to (cr, preview_width + .5, loop + .5); + } + + /* Draw the vertical lines */ + + for (loop = 0 ; loop < preview_width ; loop += step) + { + cairo_move_to (cr, loop + .5, 0 + .5); + cairo_line_to (cr, loop + .5, preview_height + .5); + } + cairo_stroke (cr); +} + +static void +draw_grid_iso (cairo_t *cr) +{ + /* vstep is an int since it's defined from grid size */ + gint vstep; + gdouble loop; + gdouble hstep; + + gdouble diagonal_start; + gdouble diagonal_end; + gdouble diagonal_width; + gdouble diagonal_height; + + vstep = selvals.opts.gridspacing; + hstep = selvals.opts.gridspacing * COS_1o6PI_RAD; + + /* Draw the vertical lines - These are easy */ + for (loop = 0 ; loop < preview_width ; loop += hstep) + { + cairo_move_to (cr, loop, 0); + cairo_line_to (cr, loop, preview_height); + } + cairo_stroke (cr); + + /* draw diag lines at a Theta of +/- 1/6 Pi Rad */ + + diagonal_start = -(((int)preview_width * TAN_1o6PI_RAD) - (((int)(preview_width * TAN_1o6PI_RAD)) % vstep)); + + diagonal_end = preview_height + (preview_width * TAN_1o6PI_RAD); + diagonal_end -= ((int)diagonal_end) % vstep; + + diagonal_width = preview_width; + diagonal_height = preview_width * TAN_1o6PI_RAD; + + /* Draw diag lines */ + for (loop = diagonal_start ; loop < diagonal_end ; loop += vstep) + { + cairo_move_to (cr, 0, loop); + cairo_line_to (cr, diagonal_width, loop + diagonal_height); + + cairo_move_to (cr, 0, loop); + cairo_line_to (cr, diagonal_width, loop - diagonal_height); + } + cairo_stroke (cr); +} + +static cairo_t * +gfig_get_grid_gc (cairo_t *cr, GtkWidget *w, gint gctype) +{ + switch (gctype) + { + default: + case GFIG_NORMAL_GC: + cairo_set_source_rgb (cr, .92, .92, .92); + break; + case GFIG_BLACK_GC: + cairo_set_source_rgb (cr, 0., 0., 0.); + break; + case GFIG_WHITE_GC: + cairo_set_source_rgb (cr, 1., 1., 1.); + break; + case GFIG_GREY_GC: + cairo_set_source_rgb (cr, .5, .5, .5); + break; + case GFIG_DARKER_GC: + cairo_set_source_rgb (cr, .25, .25, .25); + break; + case GFIG_LIGHTER_GC: + cairo_set_source_rgb (cr, .75, .75, .75); + break; + case GFIG_VERY_DARK_GC: + cairo_set_source_rgb (cr, .125, .125, .125); + break; + } + + return cr; +} + +void +draw_grid (cairo_t *cr) +{ + /* Get the size of the preview and calc where the lines go */ + /* Draw in prelight to start with... */ + /* Always start in the upper left corner for rect. + */ + + if ((preview_width < selvals.opts.gridspacing && + preview_height < selvals.opts.gridspacing)) + { + /* Don't draw if they don't fit */ + return; + } + + if (selvals.opts.drawgrid) + gfig_get_grid_gc (cr, gfig_context->preview, grid_gc_type); + else + return; + + cairo_set_line_width (cr, 1.); + if (selvals.opts.gridtype == RECT_GRID) + draw_grid_sq (cr); + else if (selvals.opts.gridtype == POLAR_GRID) + draw_grid_polar (cr); + else if (selvals.opts.gridtype == ISO_GRID) + draw_grid_iso (cr); +} + + diff --git a/plug-ins/gfig/gfig-grid.h b/plug-ins/gfig/gfig-grid.h new file mode 100644 index 0000000..20e2e90 --- /dev/null +++ b/plug-ins/gfig/gfig-grid.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + +#ifndef __GFIG_GRID_H__ +#define __GFIG_GRID_H__ + +#define GFIG_NORMAL_GC -1 +#define GFIG_BLACK_GC -2 +#define GFIG_WHITE_GC -3 +#define GFIG_GREY_GC -4 +#define GFIG_DARKER_GC -5 +#define GFIG_LIGHTER_GC -6 +#define GFIG_VERY_DARK_GC -7 + +#define MIN_GRID 10 +#define MAX_GRID 50 + +extern gint grid_gc_type; + +void gfig_grid_colors (GtkWidget *widget); +void find_grid_pos (GdkPoint *p, + GdkPoint *gp, + guint state); +void draw_grid (cairo_t *cr); + +#endif /* __GFIG_GRID_H__ */ diff --git a/plug-ins/gfig/gfig-line.c b/plug-ins/gfig/gfig-line.c new file mode 100644 index 0000000..f842d7b --- /dev/null +++ b/plug-ins/gfig/gfig-line.c @@ -0,0 +1,225 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + +#include "config.h" + +#include <libgimp/gimp.h> +#include <libgimp/gimpui.h> + +#include "gfig.h" +#include "gfig-dobject.h" +#include "gfig-line.h" + +#include "libgimp/stdplugins-intl.h" + + +static GfigObject *d_copy_line (GfigObject *obj); +static void d_draw_line (GfigObject *obj, + cairo_t *cr); +static void d_paint_line (GfigObject *obj); + +static void d_update_line (GdkPoint *pnt); + +static GfigObject * +d_copy_line (GfigObject *obj) +{ + GfigObject *nl; + + g_assert (obj->type == LINE); + + nl = d_new_object (LINE, obj->points->pnt.x, obj->points->pnt.y); + nl->points->next = d_copy_dobjpoints (obj->points->next); + + return nl; +} + +static void +d_draw_line (GfigObject *obj, + cairo_t *cr) +{ + DobjPoints *spnt; + DobjPoints *epnt; + + spnt = obj->points; + + if (!spnt) + return; /* End-of-line */ + + epnt = spnt->next; + + while (spnt && epnt) + { + draw_sqr (&spnt->pnt, obj == gfig_context->selected_obj, cr); + /* Go around all the points drawing a line from one to the next */ + gfig_draw_line (spnt->pnt.x, spnt->pnt.y, epnt->pnt.x, epnt->pnt.y, cr); + spnt = epnt; + epnt = epnt->next; + } + if (obj_creating == obj) + draw_circle (&spnt->pnt, TRUE, cr); + else + draw_sqr (&spnt->pnt, obj == gfig_context->selected_obj, cr); +} + +static void +d_paint_line (GfigObject *obj) +{ + DobjPoints *spnt; + gdouble *line_pnts; + gint seg_count = 0; + gint i = 0; + + for (spnt = obj->points; spnt; spnt = spnt->next) + seg_count++; + + if (!seg_count) + return; /* no-line */ + + line_pnts = g_new0 (gdouble, 2 * seg_count + 1); + + /* Go around all the points drawing a line from one to the next */ + for (spnt = obj->points; spnt; spnt = spnt->next) + { + line_pnts[i++] = spnt->pnt.x; + line_pnts[i++] = spnt->pnt.y; + } + + /* Scale before drawing */ + if (selvals.scaletoimage) + scale_to_original_xy (&line_pnts[0], i/2); + else + scale_to_xy (&line_pnts[0], i/2); + + /* One go */ + if (obj->style.paint_type == PAINT_BRUSH_TYPE) + { + gfig_paint (selvals.brshtype, + gfig_context->drawable_id, + seg_count * 2, line_pnts); + } + + g_free (line_pnts); +} + +void +d_line_object_class_init (void) +{ + GfigObjectClass *class = &dobj_class[LINE]; + + class->type = LINE; + class->name = "LINE"; + class->drawfunc = d_draw_line; + class->paintfunc = d_paint_line; + class->copyfunc = d_copy_line; + class->update = d_update_line; +} + +static void +d_update_line (GdkPoint *pnt) +{ + DobjPoints *spnt, *epnt; + + /* Get start of segments */ + spnt = obj_creating->points; + + if (!spnt) + return; /* No points */ + + if ((epnt = spnt->next)) + { + g_free (epnt); + } + + epnt = new_dobjpoint (pnt->x, pnt->y); + spnt->next = epnt; +} + +void +d_line_start (GdkPoint *pnt, + gboolean shift_down) +{ + if (!obj_creating || !shift_down) + { + /* Must delete obj_creating if we have one */ + obj_creating = d_new_object (LINE, pnt->x, pnt->y); + } + else + { + /* Contniuation */ + d_update_line (pnt); + } +} + +void +d_line_end (GdkPoint *pnt, + gboolean shift_down) +{ + if (shift_down) + { + if (tmp_line) + { + GdkPoint tmp_pnt = *pnt; + + if (need_to_scale) + { + tmp_pnt.x = pnt->x * scale_x_factor; + tmp_pnt.y = pnt->y * scale_y_factor; + } + + d_pnt_add_line (tmp_line, tmp_pnt.x, tmp_pnt.y, -1); + free_one_obj (obj_creating); + /* Must free obj_creating */ + } + else + { + tmp_line = obj_creating; + add_to_all_obj (gfig_context->current_obj, obj_creating); + } + + obj_creating = d_new_object (LINE, pnt->x, pnt->y); + } + else + { + if (tmp_line) + { + GdkPoint tmp_pnt = *pnt; + + if (need_to_scale) + { + tmp_pnt.x = pnt->x * scale_x_factor; + tmp_pnt.y = pnt->y * scale_y_factor; + } + + d_pnt_add_line (tmp_line, tmp_pnt.x, tmp_pnt.y, -1); + free_one_obj (obj_creating); + /* Must free obj_creating */ + } + else + { + add_to_all_obj (gfig_context->current_obj, obj_creating); + } + obj_creating = NULL; + tmp_line = NULL; + } +} diff --git a/plug-ins/gfig/gfig-line.h b/plug-ins/gfig/gfig-line.h new file mode 100644 index 0000000..f15c9d6 --- /dev/null +++ b/plug-ins/gfig/gfig-line.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + +#ifndef __GFIG_LINE_H__ +#define __GFIG_LINE_H__ + +void d_line_object_class_init (void); + +void d_line_start (GdkPoint *pnt, + gboolean shift_down); +void d_line_end (GdkPoint *pnt, + gboolean shift_down); + +#endif /* __GFIG_LINE_H__ */ diff --git a/plug-ins/gfig/gfig-poly.c b/plug-ins/gfig/gfig-poly.c new file mode 100644 index 0000000..2fe9e5d --- /dev/null +++ b/plug-ins/gfig/gfig-poly.c @@ -0,0 +1,533 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + +#include "config.h" + +#include <libgimp/gimp.h> +#include <libgimp/gimpui.h> + +#include "gfig.h" +#include "gfig-dobject.h" +#include "gfig-line.h" +#include "gfig-dialog.h" +#include "gfig-poly.h" + +#include "libgimp/stdplugins-intl.h" + +static gint poly_num_sides = 3; /* Default to three sided object */ + +static void d_draw_poly (GfigObject *obj, + cairo_t *cr); +static GfigObject *d_copy_poly (GfigObject *obj); + +static void d_update_poly (GdkPoint *pnt); + +void +tool_options_poly (GtkWidget *notebook) +{ + GtkWidget *sides; + + sides = num_sides_widget (_("Regular Polygon Number of Sides"), + &poly_num_sides, NULL, 3, 200); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sides, NULL); +} + +static void +d_draw_poly (GfigObject *obj, + cairo_t *cr) +{ + DobjPoints *center_pnt; + DobjPoints *radius_pnt; + gint16 shift_x; + gint16 shift_y; + gdouble ang_grid; + gdouble ang_loop; + gdouble radius; + gdouble offset_angle; + gint loop; + GdkPoint start_pnt = { 0, 0 }; + GdkPoint first_pnt = { 0, 0 }; + gboolean do_line = FALSE; + + center_pnt = obj->points; + + if (!center_pnt) + return; /* End-of-line */ + + /* First point is the center */ + /* Just draw a control point around it */ + + draw_sqr (¢er_pnt->pnt, obj == gfig_context->selected_obj, cr); + + /* Next point defines the radius */ + radius_pnt = center_pnt->next; /* this defines the vertices */ + + if (!radius_pnt) + { +#ifdef DEBUG + g_warning ("Internal error in polygon - no vertice point \n"); +#endif /* DEBUG */ + return; + } + + /* Other control point */ + if (obj == obj_creating) + draw_circle (&radius_pnt->pnt, TRUE, cr); + else + draw_sqr (&radius_pnt->pnt, obj == gfig_context->selected_obj, cr); + + /* Have center and radius - draw polygon */ + + shift_x = radius_pnt->pnt.x - center_pnt->pnt.x; + shift_y = radius_pnt->pnt.y - center_pnt->pnt.y; + + radius = sqrt ((shift_x*shift_x) + (shift_y*shift_y)); + + /* Lines */ + ang_grid = 2 * G_PI / (gdouble) obj->type_data; + offset_angle = atan2 (shift_y, shift_x); + + for (loop = 0 ; loop < obj->type_data ; loop++) + { + gdouble lx, ly; + GdkPoint calc_pnt; + + ang_loop = (gdouble)loop * ang_grid + offset_angle; + + lx = radius * cos (ang_loop); + ly = radius * sin (ang_loop); + + calc_pnt.x = RINT (lx + center_pnt->pnt.x); + calc_pnt.y = RINT (ly + center_pnt->pnt.y); + + 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; + + gfig_draw_line (calc_pnt.x, calc_pnt.y, start_pnt.x, start_pnt.y, cr); + } + else + { + do_line = TRUE; + first_pnt = calc_pnt; + } + start_pnt = calc_pnt; + } + + gfig_draw_line (first_pnt.x, first_pnt.y, start_pnt.x, start_pnt.y, cr); +} + +void +d_paint_poly (GfigObject *obj) +{ + /* first point center */ + /* Next point is radius */ + gdouble *line_pnts; + gint seg_count; + gint i = 0; + DobjPoints *center_pnt; + DobjPoints *radius_pnt; + gint16 shift_x; + gint16 shift_y; + gdouble ang_grid; + gdouble ang_loop; + gdouble radius; + gdouble offset_angle; + gint loop; + GdkPoint first_pnt = { 0, 0 }; + GdkPoint last_pnt = { 0, 0 }; + gboolean first = TRUE; + gdouble *min_max; + + g_assert (obj != NULL); + + /* count - add one to close polygon */ + seg_count = obj->type_data + 1; + + center_pnt = obj->points; + + if (!center_pnt || !seg_count || !center_pnt->next) + return; /* no-line */ + + line_pnts = g_new0 (gdouble, 2 * seg_count + 1); + min_max = g_new (gdouble, 4); + + /* Go around all the points drawing a line from one to the next */ + + radius_pnt = center_pnt->next; /* this defines the vetices */ + + /* Have center and radius - get lines */ + shift_x = radius_pnt->pnt.x - center_pnt->pnt.x; + shift_y = radius_pnt->pnt.y - center_pnt->pnt.y; + + radius = sqrt ((shift_x*shift_x) + (shift_y*shift_y)); + + /* Lines */ + ang_grid = 2.0 * G_PI/(gdouble) obj->type_data; + offset_angle = atan2 (shift_y, shift_x); + + for (loop = 0 ; loop < obj->type_data ; loop++) + { + gdouble lx, ly; + GdkPoint calc_pnt; + + ang_loop = (gdouble)loop * ang_grid + offset_angle; + + lx = radius * cos (ang_loop); + ly = radius * sin (ang_loop); + + calc_pnt.x = RINT (lx + center_pnt->pnt.x); + calc_pnt.y = RINT (ly + center_pnt->pnt.y); + + /* Miss out duped pnts */ + if (!first) + { + if (calc_pnt.x == last_pnt.x && calc_pnt.y == last_pnt.y) + { + continue; + } + } + + line_pnts[i++] = calc_pnt.x; + line_pnts[i++] = calc_pnt.y; + last_pnt = calc_pnt; + + if (first) + { + first_pnt = calc_pnt; + first = FALSE; + min_max[0] = min_max[2] = calc_pnt.x; + min_max[1] = min_max[3] = calc_pnt.y; + } + else + { + min_max[0] = MIN (min_max[0], calc_pnt.x); + min_max[1] = MIN (min_max[1], calc_pnt.y); + min_max[2] = MAX (min_max[2], calc_pnt.x); + min_max[3] = MAX (min_max[3], calc_pnt.y); + } + } + + line_pnts[i++] = first_pnt.x; + line_pnts[i++] = first_pnt.y; + + /* Scale before drawing */ + if (selvals.scaletoimage) + {/* FIXME scale xmax and al. */ + scale_to_original_xy (&line_pnts[0], i/2); + scale_to_original_xy (min_max, 2); + } + else + { + scale_to_xy (&line_pnts[0], i/2); + scale_to_xy (min_max, 2); + } + + + if (gfig_context_get_current_style ()->fill_type != FILL_NONE) + { + gimp_context_push (); + gimp_context_set_antialias (selopt.antia); + gimp_context_set_feather (selopt.feather); + gimp_context_set_feather_radius (selopt.feather_radius, selopt.feather_radius); + gimp_image_select_polygon (gfig_context->image_id, + selopt.type, + i, line_pnts); + gimp_context_pop (); + + paint_layer_fill (min_max[0], min_max[1], min_max[2], min_max[3]); + gimp_selection_none (gfig_context->image_id); + } + + if (obj->style.paint_type == PAINT_BRUSH_TYPE) + gfig_paint (selvals.brshtype, gfig_context->drawable_id, i, line_pnts); + + g_free (line_pnts); + g_free (min_max); +} + +void +d_poly2lines (GfigObject *obj) +{ + /* first point center */ + /* Next point is radius */ + DobjPoints *center_pnt; + DobjPoints *radius_pnt; + gint16 shift_x; + gint16 shift_y; + gdouble ang_grid; + gdouble ang_loop; + gdouble radius; + gdouble offset_angle; + gint loop; + GdkPoint first_pnt = { 0, 0 }; + GdkPoint last_pnt = { 0, 0 }; + gboolean first = TRUE; + + g_assert (obj != NULL); + + center_pnt = obj->points; + + if (!center_pnt) + return; /* no-line */ + + /* NULL out these points free later */ + obj->points = NULL; + + /* Go around all the points creating line points */ + + radius_pnt = center_pnt->next; /* this defines the vertices */ + + /* Have center and radius - get lines */ + shift_x = radius_pnt->pnt.x - center_pnt->pnt.x; + shift_y = radius_pnt->pnt.y - center_pnt->pnt.y; + + radius = sqrt ((shift_x*shift_x) + (shift_y*shift_y)); + + /* Lines */ + ang_grid = 2.0 * G_PI / (gdouble) obj->type_data; + offset_angle = atan2 (shift_y, shift_x); + + for (loop = 0 ; loop < obj->type_data ; loop++) + { + gdouble lx, ly; + GdkPoint calc_pnt; + + ang_loop = (gdouble)loop * ang_grid + offset_angle; + + lx = radius * cos (ang_loop); + ly = radius * sin (ang_loop); + + calc_pnt.x = RINT (lx + center_pnt->pnt.x); + calc_pnt.y = RINT (ly + center_pnt->pnt.y); + + if (!first) + { + if (calc_pnt.x == last_pnt.x && calc_pnt.y == last_pnt.y) + { + continue; + } + } + + d_pnt_add_line (obj, calc_pnt.x, calc_pnt.y, 0); + + last_pnt = calc_pnt; + + if (first) + { + first_pnt = calc_pnt; + first = FALSE; + } + } + + d_pnt_add_line (obj, first_pnt.x, first_pnt.y, 0); + /* Free old pnts */ + d_delete_dobjpoints (center_pnt); + + /* hey we're a line now */ + obj->type = LINE; + obj->class = &dobj_class[LINE]; +} + +void +d_star2lines (GfigObject *obj) +{ + /* first point center */ + /* Next point is radius */ + DobjPoints *center_pnt; + DobjPoints *outer_radius_pnt; + DobjPoints *inner_radius_pnt; + gint16 shift_x; + gint16 shift_y; + gdouble ang_grid; + gdouble ang_loop; + gdouble outer_radius; + gdouble inner_radius; + gdouble offset_angle; + gint loop; + GdkPoint first_pnt = { 0, 0 }; + GdkPoint last_pnt = { 0, 0 }; + gboolean first = TRUE; + + g_assert (obj != NULL); + + center_pnt = obj->points; + + if (!center_pnt) + return; /* no-line */ + + /* NULL out these points free later */ + obj->points = NULL; + + /* Go around all the points creating line points */ + /* Next point defines the radius */ + outer_radius_pnt = center_pnt->next; /* this defines the vetices */ + + if (!outer_radius_pnt) + { +#ifdef DEBUG + g_warning ("Internal error in star - no outer vertice point \n"); +#endif /* DEBUG */ + return; + } + + inner_radius_pnt = outer_radius_pnt->next; /* this defines the vetices */ + + if (!inner_radius_pnt) + { +#ifdef DEBUG + g_warning ("Internal error in star - no inner vertice point \n"); +#endif /* DEBUG */ + return; + } + + shift_x = outer_radius_pnt->pnt.x - center_pnt->pnt.x; + shift_y = outer_radius_pnt->pnt.y - center_pnt->pnt.y; + + outer_radius = sqrt ((shift_x*shift_x) + (shift_y*shift_y)); + + /* Lines */ + ang_grid = 2.0 * G_PI / (2.0 * (gdouble) obj->type_data); + offset_angle = atan2 (shift_y, shift_x); + + shift_x = inner_radius_pnt->pnt.x - center_pnt->pnt.x; + shift_y = inner_radius_pnt->pnt.y - center_pnt->pnt.y; + + inner_radius = sqrt ((shift_x * shift_x) + (shift_y * shift_y)); + + for (loop = 0 ; loop < 2 * obj->type_data ; loop++) + { + gdouble lx, ly; + GdkPoint calc_pnt; + + ang_loop = (gdouble)loop * ang_grid + offset_angle; + + if (loop % 2) + { + lx = inner_radius * cos (ang_loop); + ly = inner_radius * sin (ang_loop); + } + else + { + lx = outer_radius * cos (ang_loop); + ly = outer_radius * sin (ang_loop); + } + + calc_pnt.x = RINT (lx + center_pnt->pnt.x); + calc_pnt.y = RINT (ly + center_pnt->pnt.y); + + if (!first) + { + if (calc_pnt.x == last_pnt.x && calc_pnt.y == last_pnt.y) + { + continue; + } + } + + d_pnt_add_line (obj, calc_pnt.x, calc_pnt.y, 0); + + last_pnt = calc_pnt; + + if (first) + { + first_pnt = calc_pnt; + first = FALSE; + } + } + + d_pnt_add_line (obj, first_pnt.x, first_pnt.y, 0); + /* Free old pnts */ + d_delete_dobjpoints (center_pnt); + + /* hey we're a line now */ + obj->type = LINE; + obj->class = &dobj_class[LINE]; +} + +static GfigObject * +d_copy_poly (GfigObject *obj) +{ + GfigObject *np; + + g_assert (obj->type == POLY); + + np = d_new_object (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; +} + +void +d_poly_object_class_init (void) +{ + GfigObjectClass *class = &dobj_class[POLY]; + + class->type = POLY; + class->name = "POLY"; + class->drawfunc = d_draw_poly; + class->paintfunc = d_paint_poly; + class->copyfunc = d_copy_poly; + class->update = d_update_poly; +} + +static void +d_update_poly (GdkPoint *pnt) +{ + DobjPoints *center_pnt; + DobjPoints *edge_pnt; + + center_pnt = obj_creating->points; + + if (!center_pnt) + return; /* No points */ + + if ((edge_pnt = center_pnt->next)) + { + edge_pnt->pnt = *pnt; + } + else + { + d_pnt_add_line (obj_creating, pnt->x, pnt->y, -1); + } +} + +void +d_poly_start (GdkPoint *pnt, + gboolean shift_down) +{ + obj_creating = d_new_object (POLY, pnt->x, pnt->y); + obj_creating->type_data = poly_num_sides; +} + +void +d_poly_end (GdkPoint *pnt, + gboolean shift_down) +{ + add_to_all_obj (gfig_context->current_obj, obj_creating); + obj_creating = NULL; +} diff --git a/plug-ins/gfig/gfig-poly.h b/plug-ins/gfig/gfig-poly.h new file mode 100644 index 0000000..9cadcce --- /dev/null +++ b/plug-ins/gfig/gfig-poly.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + +#ifndef __GFIG_POLY_H__ +#define __GFIG_POLY_H__ + +void tool_options_poly (GtkWidget *notebook); + +void d_paint_poly (GfigObject *obj); + +void d_poly2lines (GfigObject *obj); +void d_star2lines (GfigObject *obj); + +void d_poly_object_class_init (void); + +void d_poly_start (GdkPoint *pnt, + gboolean shift_down); +void d_poly_end (GdkPoint *pnt, + gboolean shift_down); + +#endif /* __GFIG_POLY_H__ */ diff --git a/plug-ins/gfig/gfig-preview.c b/plug-ins/gfig/gfig-preview.c new file mode 100644 index 0000000..c9f0009 --- /dev/null +++ b/plug-ins/gfig/gfig-preview.c @@ -0,0 +1,423 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +#include "config.h" + +#include <libgimp/gimp.h> +#include <libgimp/gimpui.h> + +#include "gfig.h" +#include "gfig-grid.h" +#include "gfig-dobject.h" +#include "gfig-preview.h" + +#include "libgimp/stdplugins-intl.h" + +#define PREVIEW_MASK (GDK_EXPOSURE_MASK | \ + GDK_POINTER_MOTION_MASK | \ + GDK_BUTTON_PRESS_MASK | \ + GDK_BUTTON_RELEASE_MASK | \ + GDK_BUTTON_MOTION_MASK | \ + GDK_KEY_PRESS_MASK | \ + GDK_KEY_RELEASE_MASK) + +static gint x_pos_val; +static gint y_pos_val; +static gint pos_tag = -1; +GtkWidget *status_label_dname; +GtkWidget *status_label_fname; +static GtkWidget *pos_label; /* XY pos marker */ + + +static void gfig_preview_realize (GtkWidget *widget); +static gboolean gfig_preview_events (GtkWidget *widget, + GdkEvent *event); +static gboolean gfig_preview_expose (GtkWidget *widget, + GdkEvent *event); + +static gint gfig_invscale_x (gint x); +static gint gfig_invscale_y (gint y); +static GtkWidget *gfig_pos_labels (void); +static GtkWidget *make_pos_info (void); + +static void gfig_pos_update (gint x, + gint y); +static void gfig_pos_update_labels (gpointer data); + +GtkWidget * +make_preview (void) +{ + GtkWidget *frame; + GtkWidget *vbox; + GtkWidget *hbox; + GtkWidget *table; + GtkWidget *ruler; + + gfig_context->preview = gtk_drawing_area_new (); + gtk_widget_set_events (GTK_WIDGET (gfig_context->preview), PREVIEW_MASK); + + g_signal_connect (gfig_context->preview , "realize", + G_CALLBACK (gfig_preview_realize), + NULL); + + g_signal_connect (gfig_context->preview , "event", + G_CALLBACK (gfig_preview_events), + NULL); + + g_signal_connect_after (gfig_context->preview , "expose-event", + G_CALLBACK (gfig_preview_expose), + NULL); + + gtk_widget_set_size_request (gfig_context->preview, + preview_width, preview_height); + + frame = gtk_frame_new (NULL); + + gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); + + table = gtk_table_new (3, 3, FALSE); + gtk_table_attach (GTK_TABLE (table), gfig_context->preview, 1, 2, 1, 2, + GTK_FILL , GTK_FILL , 0, 0); + gtk_container_add (GTK_CONTAINER (frame), table); + + ruler = gimp_ruler_new (GTK_ORIENTATION_HORIZONTAL); + gimp_ruler_set_range (GIMP_RULER (ruler), 0, preview_width, PREVIEW_SIZE); + g_signal_connect_swapped (gfig_context->preview, "motion-notify-event", + G_CALLBACK (GTK_WIDGET_CLASS (G_OBJECT_GET_CLASS (ruler))->motion_notify_event), + ruler); + gtk_table_attach (GTK_TABLE (table), ruler, 1, 2, 0, 1, + GTK_FILL, GTK_FILL, 0, 0); + gtk_widget_show (ruler); + + ruler = gimp_ruler_new (GTK_ORIENTATION_VERTICAL); + gimp_ruler_set_range (GIMP_RULER (ruler), 0, preview_height, PREVIEW_SIZE); + g_signal_connect_swapped (gfig_context->preview, "motion-notify-event", + G_CALLBACK (GTK_WIDGET_CLASS (G_OBJECT_GET_CLASS (ruler))->motion_notify_event), + ruler); + gtk_table_attach (GTK_TABLE (table), ruler, 0, 1, 1, 2, + GTK_FILL, GTK_FILL, 0, 0); + gtk_widget_show (ruler); + + gtk_widget_show (frame); + gtk_widget_show (table); + + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); + gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); + + frame = make_pos_info (); + gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0); + + gtk_widget_show (vbox); + gtk_widget_show (hbox); + + return vbox; +} + +static void +gfig_preview_realize (GtkWidget *widget) +{ + GdkDisplay *display = gtk_widget_get_display (widget); + + gdk_window_set_cursor (gtk_widget_get_window (gfig_context->preview), + gdk_cursor_new_for_display (display, GDK_CROSSHAIR)); + gfig_grid_colors (widget); +} + +static void +draw_background (cairo_t *cr) +{ + if (! back_pixbuf) + back_pixbuf = gimp_image_get_thumbnail (gfig_context->image_id, + preview_width, preview_height, + GIMP_PIXBUF_LARGE_CHECKS); + + if (back_pixbuf) + { + gdk_cairo_set_source_pixbuf (cr, back_pixbuf, 0, 0); + cairo_paint (cr); + } +} + +static gboolean +gfig_preview_expose (GtkWidget *widget, + GdkEvent *event) +{ + cairo_t *cr = gdk_cairo_create (event->expose.window); + + if (gfig_context->show_background) + draw_background (cr); + + draw_grid (cr); + draw_objects (gfig_context->current_obj->obj_list, TRUE, cr); + + if (obj_creating) + { + GList *single = g_list_prepend (NULL, obj_creating); + draw_objects (single, TRUE, cr); + g_list_free (single); + } + + cairo_destroy (cr); + return FALSE; +} + +static gboolean +gfig_preview_events (GtkWidget *widget, + GdkEvent *event) +{ + GdkEventButton *bevent; + GdkEventMotion *mevent; + GdkPoint point; + static gint tmp_show_single = 0; + + switch (event->type) + { + case GDK_EXPOSE: + break; + + case GDK_BUTTON_PRESS: + bevent = (GdkEventButton *) event; + point.x = bevent->x; + point.y = bevent->y; + + g_assert (need_to_scale == 0); /* If not out of step some how */ + + /* Start drawing of object */ + if (selvals.otype >= MOVE_OBJ) + { + if (!selvals.scaletoimage) + { + point.x = gfig_invscale_x (point.x); + point.y = gfig_invscale_y (point.y); + } + object_operation_start (&point, bevent->state & GDK_SHIFT_MASK); + + /* If constraining save start pnt */ + if (selvals.opts.snap2grid) + { + /* Save point to constrained point ... if button 3 down */ + if (bevent->button == 3) + { + find_grid_pos (&point, &point, FALSE); + } + } + } + else + { + if (selvals.opts.snap2grid) + find_grid_pos (&point, &point, FALSE); + object_start (&point, bevent->state & GDK_SHIFT_MASK); + + gtk_widget_queue_draw (widget); + } + + break; + + case GDK_BUTTON_RELEASE: + bevent = (GdkEventButton *) event; + point.x = bevent->x; + point.y = bevent->y; + + if (selvals.opts.snap2grid) + find_grid_pos (&point, &point, bevent->button == 3); + + /* Still got shift down ?*/ + if (selvals.otype >= MOVE_OBJ) + { + if (!selvals.scaletoimage) + { + point.x = gfig_invscale_x (point.x); + point.y = gfig_invscale_y (point.y); + } + object_operation_end (&point, bevent->state & GDK_SHIFT_MASK); + } + else + { + if (obj_creating) + { + object_end (&point, bevent->state & GDK_SHIFT_MASK); + } + else + break; + } + + gfig_paint_callback (); + break; + + case GDK_MOTION_NOTIFY: + mevent = (GdkEventMotion *) event; + point.x = mevent->x; + point.y = mevent->y; + + if (selvals.opts.snap2grid) + find_grid_pos (&point, &point, mevent->state & GDK_BUTTON3_MASK); + + if (selvals.otype >= MOVE_OBJ) + { + /* Moving objects around */ + if (!selvals.scaletoimage) + { + point.x = gfig_invscale_x (point.x); + point.y = gfig_invscale_y (point.y); + } + object_operation (&point, mevent->state & GDK_SHIFT_MASK); + gfig_pos_update (point.x, point.y); + return FALSE; + } + + if (obj_creating) + { + obj_creating->class->update (&point); + gtk_widget_queue_draw (widget); + } + gfig_pos_update (point.x, point.y); + break; + + case GDK_KEY_PRESS: + if ((tmp_show_single = obj_show_single) != -1) + { + obj_show_single = -1; + draw_grid_clear (); + } + break; + + case GDK_KEY_RELEASE: + if (tmp_show_single != -1) + { + obj_show_single = tmp_show_single; + draw_grid_clear (); + } + break; + + default: + break; + } + + return FALSE; +} + +static GtkWidget * +make_pos_info (void) +{ + GtkWidget *frame; + GtkWidget *hbox; + GtkWidget *label; + + frame = gimp_frame_new (_("Object Details")); + + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); + gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE); + gtk_container_add (GTK_CONTAINER (frame), hbox); + + /* Add labels */ + label = gfig_pos_labels (); + gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0); + gfig_pos_enable (NULL, NULL); + +#if 0 + label = gfig_obj_size_label (); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); +#endif /* 0 */ + + gtk_widget_show (hbox); + gtk_widget_show (frame); + + return frame; +} + +static gint +gfig_invscale_x (gint x) +{ + if (!selvals.scaletoimage) + return (gint) (x * scale_x_factor); + else + return x; +} + +static gint +gfig_invscale_y (gint y) +{ + if (!selvals.scaletoimage) + return (gint) (y * scale_y_factor); + else + return y; +} + +static GtkWidget * +gfig_pos_labels (void) +{ + GtkWidget *label; + GtkWidget *hbox; + gchar buf[256]; + + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); + gtk_widget_show (hbox); + + /* Position labels */ + label = gtk_label_new (_("XY position:")); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); + gtk_widget_show (label); + + pos_label = gtk_label_new (""); + gtk_box_pack_start (GTK_BOX (hbox), pos_label, FALSE, FALSE, 0); + gtk_widget_show (pos_label); + + g_snprintf (buf, sizeof (buf), "%d, %d", 0, 0); + gtk_label_set_text (GTK_LABEL (pos_label), buf); + + return hbox; +} + +void +gfig_pos_enable (GtkWidget *widget, + gpointer data) +{ + gboolean enable = selvals.showpos; + + gtk_widget_set_sensitive (GTK_WIDGET (pos_label), enable); +} + +static void +gfig_pos_update_labels (gpointer data) +{ + static gchar buf[256]; + + pos_tag = -1; + + g_snprintf (buf, sizeof (buf), "%d, %d", x_pos_val, y_pos_val); + gtk_label_set_text (GTK_LABEL (pos_label), buf); +} + +static void +gfig_pos_update (gint x, + gint y) +{ + 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); + } +} diff --git a/plug-ins/gfig/gfig-preview.h b/plug-ins/gfig/gfig-preview.h new file mode 100644 index 0000000..49804e8 --- /dev/null +++ b/plug-ins/gfig/gfig-preview.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + +#ifndef __GFIG_PREVIEW_H__ +#define __GFIG_PREVIEW_H__ + +#define PREVIEW_SIZE 400 + +GtkWidget *make_preview (void); + +void gfig_pos_enable (GtkWidget *widget, + gpointer data); + +#endif /* __GFIG_PREVIEW_H__ */ diff --git a/plug-ins/gfig/gfig-rectangle.c b/plug-ins/gfig/gfig-rectangle.c new file mode 100644 index 0000000..d3688f1 --- /dev/null +++ b/plug-ins/gfig/gfig-rectangle.c @@ -0,0 +1,218 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + +#include "config.h" + +#include <libgimp/gimp.h> +#include <libgimp/gimpui.h> + +#include "gfig.h" +#include "gfig-dobject.h" +#include "gfig-rectangle.h" + +#include "libgimp/stdplugins-intl.h" + +static void d_draw_rectangle (GfigObject *obj, + cairo_t *cr); +static void d_paint_rectangle (GfigObject *obj); +static GfigObject *d_copy_rectangle (GfigObject *obj); + +static void d_update_rectangle (GdkPoint *pnt); + +static void +d_draw_rectangle (GfigObject *obj, + cairo_t *cr) +{ + DobjPoints *first_pnt; + DobjPoints *second_pnt; + gint xmin, ymin; + gint xmax, ymax; + + first_pnt = obj->points; + + if (!first_pnt) + return; /* End-of-line */ + + draw_sqr (&first_pnt->pnt, obj == gfig_context->selected_obj, cr); + + second_pnt = first_pnt->next; + + if (!second_pnt) + return; + + if (obj == obj_creating) + draw_circle (&second_pnt->pnt, TRUE, cr); + else + draw_sqr (&second_pnt->pnt, obj == gfig_context->selected_obj, cr); + + xmin = MIN (gfig_scale_x (first_pnt->pnt.x), + gfig_scale_x (second_pnt->pnt.x)); + ymin = MIN (gfig_scale_y (first_pnt->pnt.y), + gfig_scale_y (second_pnt->pnt.y)); + xmax = MAX (gfig_scale_x (first_pnt->pnt.x), + gfig_scale_x (second_pnt->pnt.x)); + ymax = MAX (gfig_scale_y (first_pnt->pnt.y), + gfig_scale_y (second_pnt->pnt.y)); + + cairo_rectangle (cr, xmin + .5, ymin + .5, xmax - xmin, ymax - ymin); + draw_item (cr, FALSE); +} + +static void +d_paint_rectangle (GfigObject *obj) +{ + DobjPoints *first_pnt; + DobjPoints *second_pnt; + gdouble dpnts[4]; + + g_assert (obj != NULL); + + /* Drawing rectangles is hard . + * 1) select rectangle + * 2) stroke it + */ + first_pnt = obj->points; + + if (!first_pnt) + return; /* End-of-line */ + + second_pnt = first_pnt->next; + + if (!second_pnt) + { + g_error ("Internal error - rectangle no second pnt"); + } + + dpnts[0] = (gdouble) MIN (first_pnt->pnt.x, second_pnt->pnt.x); + dpnts[1] = (gdouble) MIN (first_pnt->pnt.y, second_pnt->pnt.y); + dpnts[2] = (gdouble) MAX (first_pnt->pnt.x, second_pnt->pnt.x); + dpnts[3] = (gdouble) MAX (first_pnt->pnt.y, second_pnt->pnt.y); + + /* Scale before drawing */ + if (selvals.scaletoimage) + scale_to_original_xy (&dpnts[0], 2); + else + scale_to_xy (&dpnts[0], 2); + + if (gfig_context_get_current_style ()->fill_type != FILL_NONE) + { + gimp_context_push (); + gimp_context_set_feather (selopt.feather); + gimp_context_set_feather_radius (selopt.feather_radius, selopt.feather_radius); + gimp_image_select_rectangle (gfig_context->image_id, + selopt.type, + dpnts[0], dpnts[1], + dpnts[2] - dpnts[0], + dpnts[3] - dpnts[1]); + gimp_context_pop (); + + paint_layer_fill (dpnts[0], dpnts[1], dpnts[2], dpnts[3]); + gimp_selection_none (gfig_context->image_id); + } + + if (obj->style.paint_type == PAINT_BRUSH_TYPE) + { + gdouble line_pnts[] = { dpnts[0], dpnts[1], dpnts[2], dpnts[1], + dpnts[2], dpnts[3], dpnts[0], dpnts[3], + dpnts[0], dpnts[1] }; + + gfig_paint (selvals.brshtype, gfig_context->drawable_id, 10, line_pnts); + } +} + +static GfigObject * +d_copy_rectangle (GfigObject * obj) +{ + GfigObject *new_rectangle; + + g_assert (obj->type == RECTANGLE); + + new_rectangle = d_new_object (RECTANGLE, + obj->points->pnt.x, obj->points->pnt.y); + new_rectangle->points->next = d_copy_dobjpoints (obj->points->next); + + return new_rectangle; +} + +void +d_rectangle_object_class_init (void) +{ + GfigObjectClass *class = &dobj_class[RECTANGLE]; + + class->type = RECTANGLE; + class->name = "RECTANGLE"; + class->drawfunc = d_draw_rectangle; + class->paintfunc = d_paint_rectangle; + class->copyfunc = d_copy_rectangle; + class->update = d_update_rectangle; +} + +static void +d_update_rectangle (GdkPoint *pnt) +{ + DobjPoints *first_pnt; + DobjPoints *second_pnt; + + first_pnt = obj_creating->points; + + if (!first_pnt) + return; /* No points */ + + if ((second_pnt = first_pnt->next)) + { + second_pnt->pnt.x = pnt->x; + second_pnt->pnt.y = pnt->y; + } + else + { + second_pnt = new_dobjpoint (pnt->x, pnt->y); + first_pnt->next = second_pnt; + } +} + +void +d_rectangle_start (GdkPoint *pnt, + gboolean shift_down) +{ + obj_creating = d_new_object (RECTANGLE, pnt->x, pnt->y); +} + +void +d_rectangle_end (GdkPoint *pnt, + gboolean shift_down) +{ + /* Under control point */ + if (!obj_creating->points->next) + { + /* No circle created */ + free_one_obj (obj_creating); + } + else + { + add_to_all_obj (gfig_context->current_obj, obj_creating); + } + + obj_creating = NULL; +} + diff --git a/plug-ins/gfig/gfig-rectangle.h b/plug-ins/gfig/gfig-rectangle.h new file mode 100644 index 0000000..72ebe74 --- /dev/null +++ b/plug-ins/gfig/gfig-rectangle.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + +#ifndef __GFIG_RECTANGLE_H__ +#define __GFIG_RECTANGLE_H__ + +void d_rectangle_object_class_init (void); + +void d_rectangle_start (GdkPoint *pnt, + gboolean shift_down); +void d_rectangle_end (GdkPoint *pnt, + gboolean shift_down); + +#endif /* __GFIG_RECTANGLE_H__ */ diff --git a/plug-ins/gfig/gfig-spiral.c b/plug-ins/gfig/gfig-spiral.c new file mode 100644 index 0000000..fbb56cf --- /dev/null +++ b/plug-ins/gfig/gfig-spiral.c @@ -0,0 +1,316 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + +#include "config.h" + +#include <stdlib.h> + +#include <libgimp/gimp.h> +#include <libgimp/gimpui.h> + +#include "gfig.h" +#include "gfig-dobject.h" +#include "gfig-line.h" +#include "gfig-spiral.h" +#include "gfig-dialog.h" + +#include "libgimp/stdplugins-intl.h" + +static void d_draw_spiral (GfigObject *obj, + cairo_t *cr); +static void d_paint_spiral (GfigObject *obj); +static GfigObject *d_copy_spiral (GfigObject *obj); + +static void d_update_spiral (GdkPoint *pnt); + +static gint spiral_num_turns = 4; /* Default to 4 turns */ +static gint spiral_toggle = 0; /* 0 = clockwise -1 = anti-clockwise */ + +void +tool_options_spiral (GtkWidget *notebook) +{ + GtkWidget *sides; + + sides = num_sides_widget (_("Spiral Number of Turns"), + &spiral_num_turns, &spiral_toggle, 1, 20); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sides, NULL); +} + +static void +d_draw_spiral (GfigObject *obj, + cairo_t *cr) +{ + DobjPoints *center_pnt; + DobjPoints *radius_pnt; + gint16 shift_x; + gint16 shift_y; + gdouble ang_grid; + gdouble ang_loop; + gdouble radius; + gdouble offset_angle; + gdouble sp_cons; + gint loop; + GdkPoint start_pnt = { 0, 0 }; + gboolean do_line = FALSE; + gint clock_wise = 1; + + center_pnt = obj->points; + + if (!center_pnt) + return; /* End-of-line */ + + /* First point is the center */ + /* Just draw a control point around it */ + + draw_sqr (¢er_pnt->pnt, obj == gfig_context->selected_obj, cr); + + /* Next point defines the radius */ + radius_pnt = center_pnt->next; /* this defines the vetices */ + + if (!radius_pnt) + { +#ifdef DEBUG + g_warning ("Internal error in spiral - no vertice point \n"); +#endif /* DEBUG */ + return; + } + + /* Other control point */ + if (obj_creating == obj) + draw_circle (&radius_pnt->pnt, TRUE, cr); + else + draw_sqr (&radius_pnt->pnt, obj == gfig_context->selected_obj, cr); + + /* Have center and radius - draw spiral */ + + shift_x = radius_pnt->pnt.x - center_pnt->pnt.x; + shift_y = radius_pnt->pnt.y - center_pnt->pnt.y; + + radius = sqrt ((shift_x * shift_x) + (shift_y * shift_y)); + + offset_angle = atan2 (shift_y, shift_x); + + clock_wise = obj->type_data / abs (obj->type_data); + + if (offset_angle < 0) + offset_angle += 2.0 * G_PI; + + sp_cons = radius/(obj->type_data * 2 * G_PI + offset_angle); + /* Lines */ + ang_grid = 2.0 * G_PI / 180.0; + + + for (loop = 0 ; loop <= abs (obj->type_data * 180) + + clock_wise * (gint)RINT (offset_angle/ang_grid) ; loop++) + { + gdouble lx, ly; + GdkPoint calc_pnt; + + ang_loop = (gdouble)loop * ang_grid; + + lx = sp_cons * ang_loop * cos (ang_loop)*clock_wise; + ly = sp_cons * ang_loop * sin (ang_loop); + + calc_pnt.x = RINT (lx + center_pnt->pnt.x); + calc_pnt.y = RINT (ly + center_pnt->pnt.y); + + 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; + + gfig_draw_line (calc_pnt.x, calc_pnt.y, start_pnt.x, start_pnt.y, cr); + } + else + { + do_line = TRUE; + } + start_pnt = calc_pnt; + } +} + +static void +d_paint_spiral (GfigObject *obj) +{ + /* first point center */ + /* Next point is radius */ + gdouble *line_pnts; + gint seg_count = 0; + gint i = 0; + DobjPoints *center_pnt; + DobjPoints *radius_pnt; + gint16 shift_x; + gint16 shift_y; + gdouble ang_grid; + gdouble ang_loop; + gdouble radius; + gdouble offset_angle; + gdouble sp_cons; + gint loop; + GdkPoint last_pnt = { 0, 0 }; + gint clock_wise = 1; + + g_assert (obj != NULL); + + center_pnt = obj->points; + + if (!center_pnt || !center_pnt->next) + return; /* no-line */ + + /* Go around all the points drawing a line from one to the next */ + + radius_pnt = center_pnt->next; /* this defines the vetices */ + + /* Have center and radius - get lines */ + shift_x = radius_pnt->pnt.x - center_pnt->pnt.x; + shift_y = radius_pnt->pnt.y - center_pnt->pnt.y; + + radius = sqrt ((shift_x * shift_x) + (shift_y * shift_y)); + + clock_wise = obj->type_data / abs (obj->type_data); + + offset_angle = atan2 (shift_y, shift_x); + + if (offset_angle < 0) + offset_angle += 2.0 * G_PI; + + sp_cons = radius/(obj->type_data * 2.0 * G_PI + offset_angle); + /* Lines */ + ang_grid = 2.0 * G_PI / 180.0; + + /* count - */ + seg_count = abs (obj->type_data * 180) + clock_wise * (gint)RINT (offset_angle/ang_grid); + + line_pnts = g_new0 (gdouble, 2 * seg_count + 3); + + for (loop = 0 ; loop <= seg_count; loop++) + { + gdouble lx, ly; + GdkPoint calc_pnt; + + ang_loop = (gdouble)loop * ang_grid; + + lx = sp_cons * ang_loop * cos (ang_loop)*clock_wise; + ly = sp_cons * ang_loop * sin (ang_loop); + + calc_pnt.x = RINT (lx + center_pnt->pnt.x); + calc_pnt.y = RINT (ly + center_pnt->pnt.y); + + /* Miss out duped pnts */ + if (!loop) + { + if (calc_pnt.x == last_pnt.x && calc_pnt.y == last_pnt.y) + { + continue; + } + } + + line_pnts[i++] = calc_pnt.x; + line_pnts[i++] = calc_pnt.y; + last_pnt = calc_pnt; + } + + /* Scale before drawing */ + if (selvals.scaletoimage) + scale_to_original_xy (&line_pnts[0], i / 2); + else + scale_to_xy (&line_pnts[0], i / 2); + + /* One go */ + if (obj->style.paint_type == PAINT_BRUSH_TYPE) + { + gfig_paint (selvals.brshtype, + gfig_context->drawable_id, + i, line_pnts); + } + + g_free (line_pnts); +} + +static GfigObject * +d_copy_spiral (GfigObject *obj) +{ + GfigObject *np; + + g_assert (obj->type == SPIRAL); + + np = d_new_object (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; +} + +void +d_spiral_object_class_init (void) +{ + GfigObjectClass *class = &dobj_class[SPIRAL]; + + class->type = SPIRAL; + class->name = "SPIRAL"; + class->drawfunc = d_draw_spiral; + class->paintfunc = d_paint_spiral; + class->copyfunc = d_copy_spiral; + class->update = d_update_spiral; +} + +static void +d_update_spiral (GdkPoint *pnt) +{ + DobjPoints *center_pnt; + DobjPoints *edge_pnt; + + center_pnt = obj_creating->points; + + if (!center_pnt) + return; /* No points */ + + if ((edge_pnt = center_pnt->next)) + { + edge_pnt->pnt = *pnt; + } + else + { + /* Radius is a few pixels away */ + /* First edge point */ + d_pnt_add_line (obj_creating, pnt->x, pnt->y, -1); + } +} + +void +d_spiral_start (GdkPoint *pnt, + gboolean shift_down) +{ + obj_creating = d_new_object (SPIRAL, pnt->x, pnt->y); + obj_creating->type_data = spiral_num_turns * ((spiral_toggle == 0) ? 1 : -1); +} + +void +d_spiral_end (GdkPoint *pnt, + gboolean shift_down) +{ + add_to_all_obj (gfig_context->current_obj, obj_creating); + obj_creating = NULL; +} diff --git a/plug-ins/gfig/gfig-spiral.h b/plug-ins/gfig/gfig-spiral.h new file mode 100644 index 0000000..37a1007 --- /dev/null +++ b/plug-ins/gfig/gfig-spiral.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + +#ifndef __GFIG_SPIRAL_H__ +#define __GFIG_SPIRAL_H__ + +void tool_options_spiral (GtkWidget *notebook); + +void d_spiral_object_class_init (void); + +void d_spiral_start (GdkPoint *pnt, + gboolean shift_down); +void d_spiral_end (GdkPoint *pnt, + gboolean shift_down); + +#endif /* __GFIG_SPIRAL_H__ */ diff --git a/plug-ins/gfig/gfig-star.c b/plug-ins/gfig/gfig-star.c new file mode 100644 index 0000000..6ef6848 --- /dev/null +++ b/plug-ins/gfig/gfig-star.c @@ -0,0 +1,406 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + +#include "config.h" + +#include <libgimp/gimp.h> +#include <libgimp/gimpui.h> + +#include "gfig.h" +#include "gfig-line.h" +#include "gfig-dobject.h" +#include "gfig-star.h" +#include "gfig-dialog.h" + +#include "libgimp/stdplugins-intl.h" + +static gint star_num_sides = 3; /* Default to three sided object */ + +static void d_draw_star (GfigObject *obj, + cairo_t *cr); +static void d_paint_star (GfigObject *obj); +static GfigObject *d_copy_star (GfigObject *obj); + +static void d_update_star (GdkPoint *pnt); + +void +tool_options_star (GtkWidget *notebook) +{ + GtkWidget *sides; + + sides = num_sides_widget (_("Star Number of Points"), + &star_num_sides, NULL, 3, 200); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sides, NULL); +} + +static void +d_draw_star (GfigObject *obj, + cairo_t *cr) +{ + DobjPoints *center_pnt; + DobjPoints *outer_radius_pnt; + DobjPoints *inner_radius_pnt; + gint16 shift_x; + gint16 shift_y; + gdouble ang_grid; + gdouble ang_loop; + gdouble outer_radius; + gdouble inner_radius; + gdouble offset_angle; + gint loop; + GdkPoint start_pnt = { 0, 0 }; + GdkPoint first_pnt = { 0, 0 }; + gboolean do_line = FALSE; + + center_pnt = obj->points; + + if (!center_pnt) + return; /* End-of-line */ + + /* First point is the center */ + /* Just draw a control point around it */ + + draw_sqr (¢er_pnt->pnt, obj == gfig_context->selected_obj, cr); + + /* Next point defines the radius */ + outer_radius_pnt = center_pnt->next; /* this defines the vertices */ + + if (!outer_radius_pnt) + { + return; + } + + inner_radius_pnt = outer_radius_pnt->next; /* this defines the vertices */ + + if (!inner_radius_pnt) + { + return; + } + + /* Other control points */ + if (obj == obj_creating) + { + draw_circle (&outer_radius_pnt->pnt, TRUE, cr); + draw_circle (&inner_radius_pnt->pnt, TRUE, cr); + } + else + { + draw_sqr (&outer_radius_pnt->pnt, obj == gfig_context->selected_obj, cr); + draw_sqr (&inner_radius_pnt->pnt, obj == gfig_context->selected_obj, cr); + } + + /* Have center and radius - draw star */ + + shift_x = outer_radius_pnt->pnt.x - center_pnt->pnt.x; + shift_y = outer_radius_pnt->pnt.y - center_pnt->pnt.y; + + outer_radius = sqrt ((shift_x*shift_x) + (shift_y*shift_y)); + + /* Lines */ + ang_grid = 2.0 * G_PI / (2.0 * (gdouble) obj->type_data); + offset_angle = atan2 (shift_y, shift_x); + + shift_x = inner_radius_pnt->pnt.x - center_pnt->pnt.x; + shift_y = inner_radius_pnt->pnt.y - center_pnt->pnt.y; + + inner_radius = sqrt ((shift_x*shift_x) + (shift_y*shift_y)); + + for (loop = 0 ; loop < 2 * obj->type_data ; loop++) + { + gdouble lx, ly; + GdkPoint calc_pnt; + + ang_loop = (gdouble)loop * ang_grid + offset_angle; + + if (loop % 2) + { + lx = inner_radius * cos (ang_loop); + ly = inner_radius * sin (ang_loop); + } + else + { + lx = outer_radius * cos (ang_loop); + ly = outer_radius * sin (ang_loop); + } + + calc_pnt.x = RINT (lx + center_pnt->pnt.x); + calc_pnt.y = RINT (ly + center_pnt->pnt.y); + + 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; + + gfig_draw_line (calc_pnt.x, calc_pnt.y, start_pnt.x, start_pnt.y, cr); + } + else + { + do_line = TRUE; + first_pnt = calc_pnt; + } + start_pnt = calc_pnt; + } + + gfig_draw_line (first_pnt.x, first_pnt.y, start_pnt.x, start_pnt.y, cr); +} + +static void +d_paint_star (GfigObject *obj) +{ + /* first point center */ + /* Next point is radius */ + gdouble *line_pnts; + gint seg_count = 0; + gint i = 0; + DobjPoints *center_pnt; + DobjPoints *outer_radius_pnt; + DobjPoints *inner_radius_pnt; + gint16 shift_x; + gint16 shift_y; + gdouble ang_grid; + gdouble ang_loop; + gdouble outer_radius; + gdouble inner_radius; + gdouble offset_angle; + gint loop; + GdkPoint first_pnt = { 0, 0 }; + GdkPoint last_pnt = { 0, 0 }; + gboolean first = TRUE; + gdouble *min_max; + + g_assert (obj != NULL); + + /* count - add one to close polygon */ + seg_count = 2 * obj->type_data + 1; + + center_pnt = obj->points; + + if (!center_pnt || !seg_count) + return; /* no-line */ + + line_pnts = g_new0 (gdouble, 2 * seg_count + 1); + min_max = g_new (gdouble, 4); + + /* Go around all the points drawing a line from one to the next */ + /* Next point defines the radius */ + outer_radius_pnt = center_pnt->next; /* this defines the vetices */ + + if (!outer_radius_pnt) + { +#ifdef DEBUG + g_warning ("Internal error in star - no outer vertice point \n"); +#endif /* DEBUG */ + g_free (line_pnts); + g_free (min_max); + return; + } + + inner_radius_pnt = outer_radius_pnt->next; /* this defines the vetices */ + + if (!inner_radius_pnt) + { +#ifdef DEBUG + g_warning ("Internal error in star - no inner vertice point \n"); +#endif /* DEBUG */ + g_free (line_pnts); + g_free (min_max); + return; + } + + shift_x = outer_radius_pnt->pnt.x - center_pnt->pnt.x; + shift_y = outer_radius_pnt->pnt.y - center_pnt->pnt.y; + + outer_radius = sqrt ((shift_x*shift_x) + (shift_y*shift_y)); + + /* Lines */ + ang_grid = 2.0 * G_PI / (2.0 * (gdouble) obj->type_data); + offset_angle = atan2 (shift_y, shift_x); + + shift_x = inner_radius_pnt->pnt.x - center_pnt->pnt.x; + shift_y = inner_radius_pnt->pnt.y - center_pnt->pnt.y; + + inner_radius = sqrt ((shift_x*shift_x) + (shift_y*shift_y)); + + for (loop = 0 ; loop < 2 * obj->type_data ; loop++) + { + gdouble lx, ly; + GdkPoint calc_pnt; + + ang_loop = (gdouble)loop * ang_grid + offset_angle; + + if (loop % 2) + { + lx = inner_radius * cos (ang_loop); + ly = inner_radius * sin (ang_loop); + } + else + { + lx = outer_radius * cos (ang_loop); + ly = outer_radius * sin (ang_loop); + } + + calc_pnt.x = RINT (lx + center_pnt->pnt.x); + calc_pnt.y = RINT (ly + center_pnt->pnt.y); + + /* Miss out duped pnts */ + if (!first) + { + if (calc_pnt.x == last_pnt.x && calc_pnt.y == last_pnt.y) + { + continue; + } + } + + line_pnts[i++] = calc_pnt.x; + line_pnts[i++] = calc_pnt.y; + last_pnt = calc_pnt; + + if (first) + { + first_pnt = calc_pnt; + first = FALSE; + min_max[0] = min_max[2] = calc_pnt.x; + min_max[1] = min_max[3] = calc_pnt.y; + } + else + { + min_max[0] = MIN (min_max[0], calc_pnt.x); + min_max[1] = MIN (min_max[1], calc_pnt.y); + min_max[2] = MAX (min_max[2], calc_pnt.x); + min_max[3] = MAX (min_max[3], calc_pnt.y); + } + } + + line_pnts[i++] = first_pnt.x; + line_pnts[i++] = first_pnt.y; + + /* Scale before drawing */ + if (selvals.scaletoimage) + { + scale_to_original_xy (&line_pnts[0], i / 2); + scale_to_original_xy (min_max, 2); + } + else + { + scale_to_xy (&line_pnts[0], i / 2); + scale_to_xy (min_max, 2); + } + + if (gfig_context_get_current_style ()->fill_type != FILL_NONE) + { + gimp_context_push (); + gimp_context_set_antialias (selopt.antia); + gimp_context_set_feather (selopt.feather); + gimp_context_set_feather_radius (selopt.feather_radius, selopt.feather_radius); + gimp_image_select_polygon (gfig_context->image_id, + selopt.type, + i, line_pnts); + gimp_context_pop (); + + paint_layer_fill (min_max[0], min_max[1], min_max[2], min_max[3]); + gimp_selection_none (gfig_context->image_id); + } + + if (obj->style.paint_type == PAINT_BRUSH_TYPE) + gfig_paint (selvals.brshtype, gfig_context->drawable_id, i, line_pnts); + + g_free (line_pnts); + g_free (min_max); +} + +static GfigObject * +d_copy_star (GfigObject *obj) +{ + GfigObject *np; + + g_assert (obj->type == STAR); + + np = d_new_object (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; +} + +void +d_star_object_class_init (void) +{ + GfigObjectClass *class = &dobj_class[STAR]; + + class->type = STAR; + class->name = "STAR"; + class->drawfunc = d_draw_star; + class->paintfunc = d_paint_star; + class->copyfunc = d_copy_star; + class->update = d_update_star; +} + +static void +d_update_star (GdkPoint *pnt) +{ + DobjPoints *center_pnt, *inner_pnt, *outer_pnt; + + center_pnt = obj_creating->points; + + if (!center_pnt) + return; /* No points */ + + if ((outer_pnt = center_pnt->next)) + { + inner_pnt = outer_pnt->next; + 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; + } + else + { + /* Radius is a few pixels away */ + /* First edge point */ + d_pnt_add_line (obj_creating, pnt->x, pnt->y,-1); + /* Inner radius */ + d_pnt_add_line (obj_creating, + pnt->x + (2 * (center_pnt->pnt.x - pnt->x)) / 3, + pnt->y + (2 * (center_pnt->pnt.y - pnt->y)) / 3, + -1); + } +} + +void +d_star_start (GdkPoint *pnt, + gboolean shift_down) +{ + obj_creating = d_new_object (STAR, pnt->x, pnt->y); + obj_creating->type_data = star_num_sides; +} + +void +d_star_end (GdkPoint *pnt, + gboolean shift_down) +{ + add_to_all_obj (gfig_context->current_obj, obj_creating); + obj_creating = NULL; +} + diff --git a/plug-ins/gfig/gfig-star.h b/plug-ins/gfig/gfig-star.h new file mode 100644 index 0000000..193e03a --- /dev/null +++ b/plug-ins/gfig/gfig-star.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + +#ifndef __GFIG_STAR_H__ +#define __GFIG_STAR_H__ + +void tool_options_star (GtkWidget *notebook); + +void d_star_object_class_init (void); + +void d_star_start (GdkPoint *pnt, + gboolean shift_down); +void d_star_end (GdkPoint *pnt, + gboolean shift_down); + + +#endif /* __GFIG_STAR_H__ */ diff --git a/plug-ins/gfig/gfig-stock.c b/plug-ins/gfig/gfig-stock.c new file mode 100644 index 0000000..19e791d --- /dev/null +++ b/plug-ins/gfig/gfig-stock.c @@ -0,0 +1,117 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas <alt@picnic.demon.co.uk> + * 2003 Sven Neumann <sven@gimp.org> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +#include "config.h" + +#include <gtk/gtk.h> + +#include "gfig-stock.h" + +#include "images/gfig-stock-pixbufs.h" + +#include "libgimp/stdplugins-intl.h" + + +static GtkIconFactory *gfig_icon_factory = NULL; + +static GtkStockItem gfig_stock_items[] = +{ + { GFIG_STOCK_BEZIER, N_("Create bezier curve"), 0, 0, NULL }, + { GFIG_STOCK_CIRCLE, N_("Create circle"), 0, 0, NULL }, + { GFIG_STOCK_COPY_OBJECT, N_("Copy an object"), 0, 0, NULL }, + { GFIG_STOCK_CURVE, N_("Create arc"), 0, 0, NULL }, + { GFIG_STOCK_DELETE_OBJECT, N_("Delete an object"), 0, 0, NULL }, + { GFIG_STOCK_ELLIPSE, N_("Create ellipse"), 0, 0, NULL }, + { GFIG_STOCK_LINE, N_("Create line"), 0, 0, NULL }, + { GFIG_STOCK_MOVE_OBJECT, N_("Move an object"), 0, 0, NULL }, + { GFIG_STOCK_MOVE_POINT, N_("Move a single point"), 0, 0, NULL }, + { GFIG_STOCK_POLYGON, N_("Create reg polygon"), 0, 0, NULL }, + { GFIG_STOCK_RECTANGLE, N_("Create rectangle"), 0, 0, NULL }, + { GFIG_STOCK_SELECT_OBJECT, N_("Select an object"), 0, 0, NULL }, + { GFIG_STOCK_SHOW_ALL, N_("Show all objects"), 0, 0, NULL }, + { GFIG_STOCK_SPIRAL, N_("Create spiral"), 0, 0, NULL }, + { GFIG_STOCK_STAR, N_("Create star"), 0, 0, NULL } +}; + +static void +add_stock_icon (const gchar *stock_id, + GtkIconSize size, + const guint8 *inline_data) +{ + GtkIconSource *source; + GtkIconSet *set; + GdkPixbuf *pixbuf; + + source = gtk_icon_source_new (); + + gtk_icon_source_set_size (source, size); + gtk_icon_source_set_size_wildcarded (source, TRUE); + + pixbuf = gdk_pixbuf_new_from_inline (-1, inline_data, FALSE, NULL); + + gtk_icon_source_set_pixbuf (source, pixbuf); + g_object_unref (pixbuf); + + set = gtk_icon_set_new (); + + gtk_icon_set_add_source (set, source); + gtk_icon_source_free (source); + + gtk_icon_factory_add (gfig_icon_factory, stock_id, set); + + gtk_icon_set_unref (set); +} + +void +gfig_stock_init (void) +{ + static gboolean initialized = FALSE; + + if (initialized) + return; + + gfig_icon_factory = gtk_icon_factory_new (); + + add_stock_icon (GFIG_STOCK_BEZIER, GTK_ICON_SIZE_BUTTON, stock_bezier); + add_stock_icon (GFIG_STOCK_CIRCLE, GTK_ICON_SIZE_BUTTON, stock_circle); + add_stock_icon (GFIG_STOCK_COPY_OBJECT, GTK_ICON_SIZE_BUTTON, stock_copy_object); + add_stock_icon (GFIG_STOCK_CURVE, GTK_ICON_SIZE_BUTTON, stock_curve); + add_stock_icon (GFIG_STOCK_DELETE_OBJECT, GTK_ICON_SIZE_BUTTON, stock_delete_object); + add_stock_icon (GFIG_STOCK_ELLIPSE, GTK_ICON_SIZE_BUTTON, stock_ellipse); + add_stock_icon (GFIG_STOCK_LINE, GTK_ICON_SIZE_BUTTON, stock_line); + add_stock_icon (GFIG_STOCK_MOVE_OBJECT, GTK_ICON_SIZE_BUTTON, stock_move_object); + add_stock_icon (GFIG_STOCK_MOVE_POINT, GTK_ICON_SIZE_BUTTON, stock_move_point); + add_stock_icon (GFIG_STOCK_POLYGON, GTK_ICON_SIZE_BUTTON, stock_polygon); + add_stock_icon (GFIG_STOCK_RECTANGLE, GTK_ICON_SIZE_BUTTON, stock_rectangle); + add_stock_icon (GFIG_STOCK_SELECT_OBJECT, GTK_ICON_SIZE_BUTTON, stock_select_object); + add_stock_icon (GFIG_STOCK_SHOW_ALL, GTK_ICON_SIZE_BUTTON, stock_show_all); + add_stock_icon (GFIG_STOCK_SPIRAL, GTK_ICON_SIZE_BUTTON, stock_spiral); + add_stock_icon (GFIG_STOCK_STAR, GTK_ICON_SIZE_BUTTON, stock_star); + + gtk_icon_factory_add_default (gfig_icon_factory); + + gtk_stock_add_static (gfig_stock_items, G_N_ELEMENTS (gfig_stock_items)); + + initialized = TRUE; +} diff --git a/plug-ins/gfig/gfig-stock.h b/plug-ins/gfig/gfig-stock.h new file mode 100644 index 0000000..ee459c8 --- /dev/null +++ b/plug-ins/gfig/gfig-stock.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas <alt@picnic.demon.co.uk> + * 2003 Sven Neumann <sven@gimp.org> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +#ifndef __GFIG_STOCK_H__ +#define __GFIG_STOCK_H__ + +#define GFIG_STOCK_BEZIER "gfig-bezier" +#define GFIG_STOCK_CIRCLE "gfig-circle" +#define GFIG_STOCK_COPY_OBJECT "gfig-copy-object" +#define GFIG_STOCK_CURVE "gfig-curve" +#define GFIG_STOCK_DELETE_OBJECT "gfig-delete" +#define GFIG_STOCK_ELLIPSE "gfig-ellipse" +#define GFIG_STOCK_LINE "gfig-line" +#define GFIG_STOCK_MOVE_OBJECT "gfig-move-object" +#define GFIG_STOCK_MOVE_POINT "gfig-move-point" +#define GFIG_STOCK_POLYGON "gfig-polygon" +#define GFIG_STOCK_RECTANGLE "gfig-rectangle" +#define GFIG_STOCK_SELECT_OBJECT "gfig-select-object" +#define GFIG_STOCK_SHOW_ALL "gfig-show-all" +#define GFIG_STOCK_SPIRAL "gfig-spiral" +#define GFIG_STOCK_STAR "gfig-star" + +void gfig_stock_init (void); + +#endif /* __GFIG_STOCK_H__ */ diff --git a/plug-ins/gfig/gfig-style.c b/plug-ins/gfig/gfig-style.c new file mode 100644 index 0000000..69776e9 --- /dev/null +++ b/plug-ins/gfig/gfig-style.c @@ -0,0 +1,787 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + +#include "config.h" + +#include <stdlib.h> +#include <string.h> + +#include <libgimp/gimp.h> +#include <libgimp/gimpui.h> + +#include "libgimp/stdplugins-intl.h" + +#include "gfig.h" +#include "gfig-dobject.h" +#include "gfig-style.h" + + +static void gfig_read_parameter_string (gchar **text, + gint nitems, + const gchar *name, + gchar **style_entry); + +static void gfig_read_parameter_int (gchar **text, + gint nitems, + const gchar *name, + gint *style_entry); + +static void gfig_read_parameter_double (gchar **text, + gint nitems, + const gchar *name, + gdouble *style_entry); + +static void gfig_read_parameter_gimp_rgb (gchar **text, + gint nitems, + const gchar *name, + GimpRGB *style_entry); + +static void +gfig_read_parameter_string (gchar **text, + gint nitems, + const gchar *name, + gchar **style_entry) +{ + gint n = 0; + gchar *ptr; + gchar *tmpstr; + + *style_entry = NULL; + + while (n < nitems) + { + ptr = strchr (text[n], ':'); + if (ptr) + { + tmpstr = g_strndup (text[n], ptr - text[n]); + ptr++; + if (!strcmp (tmpstr, name)) + { + *style_entry = g_strdup (g_strchug (ptr)); + g_free (tmpstr); + return; + } + g_free (tmpstr); + } + ++n; + } + + g_message ("Parameter '%s' not found", name); +} + + +static void +gfig_read_parameter_int (gchar **text, + gint nitems, + const gchar *name, + gint *style_entry) +{ + gint n = 0; + gchar *ptr; + gchar *tmpstr; + + *style_entry = 0; + + while (n < nitems) + { + ptr = strchr (text[n], ':'); + if (ptr) + { + tmpstr = g_strndup (text[n], ptr - text[n]); + ptr++; + if (!strcmp (tmpstr, name)) + { + *style_entry = atoi (g_strchug (ptr)); + g_free (tmpstr); + return; + } + g_free (tmpstr); + } + ++n; + } +} + +static void +gfig_read_parameter_double (gchar **text, + gint nitems, + const gchar *name, + gdouble *style_entry) +{ + gint n = 0; + gchar *ptr; + gchar *endptr; + gchar *tmpstr; + + *style_entry = 0.; + + while (n < nitems) + { + ptr = strchr (text[n], ':'); + if (ptr) + { + tmpstr = g_strndup (text[n], ptr - text[n]); + ptr++; + if (!strcmp (tmpstr, name)) + { + *style_entry = g_ascii_strtod (g_strchug (ptr), &endptr); + g_free (tmpstr); + return; + } + g_free (tmpstr); + } + ++n; + } +} + +static void +gfig_read_parameter_gimp_rgb (gchar **text, + gint nitems, + const gchar *name, + GimpRGB *style_entry) +{ + gint n = 0; + gchar *ptr; + gchar *tmpstr; + gchar *endptr; + gchar fmt_str[32]; + gchar colorstr_r[G_ASCII_DTOSTR_BUF_SIZE]; + gchar colorstr_g[G_ASCII_DTOSTR_BUF_SIZE]; + gchar colorstr_b[G_ASCII_DTOSTR_BUF_SIZE]; + gchar colorstr_a[G_ASCII_DTOSTR_BUF_SIZE]; + + style_entry->r = style_entry->g = style_entry->b = style_entry->a = 0.; + + snprintf (fmt_str, sizeof (fmt_str), + "%%%" G_GSIZE_FORMAT "s" + " %%%" G_GSIZE_FORMAT "s" + " %%%" G_GSIZE_FORMAT "s" + " %%%" G_GSIZE_FORMAT "s", + sizeof (colorstr_r) - 1, sizeof (colorstr_g) - 1, + sizeof (colorstr_b) - 1, sizeof (colorstr_a) - 1); + + while (n < nitems) + { + ptr = strchr (text[n], ':'); + if (ptr) + { + tmpstr = g_strndup (text[n], ptr - text[n]); + ptr++; + if (!strcmp (tmpstr, name)) + { + sscanf (ptr, fmt_str, + colorstr_r, colorstr_g, colorstr_b, colorstr_a); + style_entry->r = g_ascii_strtod (colorstr_r, &endptr); + style_entry->g = g_ascii_strtod (colorstr_g, &endptr); + style_entry->b = g_ascii_strtod (colorstr_b, &endptr); + style_entry->a = g_ascii_strtod (colorstr_a, &endptr); + g_free (tmpstr); + return; + } + g_free (tmpstr); + } + ++n; + } +} + +#define MAX_STYLE_TEXT_ENTRIES 100 + +gboolean +gfig_load_style (Style *style, + FILE *fp) +{ + gulong offset; + gchar load_buf2[MAX_LOAD_LINE]; + gchar *style_text[MAX_STYLE_TEXT_ENTRIES]; + gint nitems = 0; + gint value; + gint k; + gchar name[100]; + + offset = ftell (fp); + + get_line (load_buf2, MAX_LOAD_LINE, fp, 0); + /* nuke final > and preserve spaces in name */ + if (1 != sscanf (load_buf2, "<Style %99[^>]>", name)) + { + /* no style data, copy default style and fail silently */ + gfig_style_copy (style, &gfig_context->default_style, "default style"); + fseek (fp, offset, SEEK_SET); + return TRUE; + } + + if (gfig_context->debug_styles) + g_printerr ("Loading style '%s' -- ", name); + + style->name = g_strdup (name); + + while (TRUE) + { + get_line (load_buf2, MAX_LOAD_LINE, fp, 0); + if (!strcmp (load_buf2, "</Style>") || feof (fp)) + break; + + style_text[nitems] = g_strdup (load_buf2); + nitems++; + + if (nitems >= MAX_STYLE_TEXT_ENTRIES) + break; + } + + if (feof (fp) || (nitems >= MAX_STYLE_TEXT_ENTRIES)) + { + g_message ("Error reading style data"); + return TRUE; + } + + gfig_read_parameter_string (style_text, nitems, "BrushName", + &style->brush_name); + + if (style->brush_name == NULL) + g_message ("Error loading style: got NULL for brush name."); + + gfig_read_parameter_string (style_text, nitems, "Pattern", &style->pattern); + gfig_read_parameter_string (style_text, nitems, "Gradient", &style->gradient); + + gfig_read_parameter_gimp_rgb (style_text, nitems, "Foreground", + &style->foreground); + gfig_read_parameter_gimp_rgb (style_text, nitems, "Background", + &style->background); + + gfig_read_parameter_int (style_text, nitems, "FillType", &value); + style->fill_type = value; + + gfig_read_parameter_int (style_text, nitems, "PaintType", &value); + style->paint_type = value; + + gfig_read_parameter_double (style_text, nitems, "FillOpacity", + &style->fill_opacity); + + for (k = 0; k < nitems; k++) + { + g_free (style_text[k]); + } + + if (gfig_context->debug_styles) + g_printerr ("done\n"); + + return FALSE; +} + + +gboolean +gfig_skip_style (Style *style, + FILE *fp) +{ + gulong offset; + gchar load_buf2[MAX_LOAD_LINE]; + + offset = ftell (fp); + + get_line (load_buf2, MAX_LOAD_LINE, fp, 0); + if (strncmp (load_buf2, "<Style ", 7)) + { + /* no style data */ + fseek (fp, offset, SEEK_SET); + return TRUE; + } + + while (TRUE) + { + get_line (load_buf2, MAX_LOAD_LINE, fp, 0); + if (!strcmp (load_buf2, "</Style>") || feof (fp)) + break; + } + + if (feof (fp)) + { + g_message ("Error trying to skip style data"); + return TRUE; + } + + return FALSE; +} + +/* + * FIXME: need to make this load a list of styles if there are more than one. + */ +gboolean +gfig_load_styles (GFigObj *gfig, + FILE *fp) +{ + if (gfig_context->debug_styles) + g_printerr ("Loading global styles -- "); + + /* currently we only have the default style */ + gfig_load_style (&gfig_context->default_style, fp); + + if (gfig_context->debug_styles) + g_printerr ("done\n"); + + return FALSE; +} + +void +gfig_save_style (Style *style, + GString *string) +{ + gchar buffer[G_ASCII_DTOSTR_BUF_SIZE]; + gchar buffer_r[G_ASCII_DTOSTR_BUF_SIZE]; + gchar buffer_g[G_ASCII_DTOSTR_BUF_SIZE]; + gchar buffer_b[G_ASCII_DTOSTR_BUF_SIZE]; + gchar buffer_a[G_ASCII_DTOSTR_BUF_SIZE]; + gint blen = G_ASCII_DTOSTR_BUF_SIZE; + + if (gfig_context->debug_styles) + g_printerr ("Saving style %s, brush name '%s'\n", style->name, style->brush_name); + + g_string_append_printf (string, "<Style %s>\n", style->name); + g_string_append_printf (string, "BrushName: %s\n", style->brush_name); + if (!style->brush_name) + g_message ("Error saving style %s: saving NULL for brush name", style->name); + + g_string_append_printf (string, "PaintType: %d\n", style->paint_type); + + g_string_append_printf (string, "FillType: %d\n", style->fill_type); + + g_string_append_printf (string, "FillOpacity: %s\n", + g_ascii_dtostr (buffer, blen, style->fill_opacity)); + + g_string_append_printf (string, "Pattern: %s\n", style->pattern); + + g_string_append_printf (string, "Gradient: %s\n", style->gradient); + + g_string_append_printf (string, "Foreground: %s %s %s %s\n", + g_ascii_dtostr (buffer_r, blen, style->foreground.r), + g_ascii_dtostr (buffer_g, blen, style->foreground.g), + g_ascii_dtostr (buffer_b, blen, style->foreground.b), + g_ascii_dtostr (buffer_a, blen, style->foreground.a)); + + g_string_append_printf (string, "Background: %s %s %s %s\n", + g_ascii_dtostr (buffer_r, blen, style->background.r), + g_ascii_dtostr (buffer_g, blen, style->background.g), + g_ascii_dtostr (buffer_b, blen, style->background.b), + g_ascii_dtostr (buffer_a, blen, style->background.a)); + + g_string_append_printf (string, "</Style>\n"); +} + +void +gfig_style_save_as_attributes (Style *style, + GString *string) +{ + gchar buffer[G_ASCII_DTOSTR_BUF_SIZE]; + gchar buffer_r[G_ASCII_DTOSTR_BUF_SIZE]; + gchar buffer_g[G_ASCII_DTOSTR_BUF_SIZE]; + gchar buffer_b[G_ASCII_DTOSTR_BUF_SIZE]; + gchar buffer_a[G_ASCII_DTOSTR_BUF_SIZE]; + gint blen = G_ASCII_DTOSTR_BUF_SIZE; + + if (gfig_context->debug_styles) + g_printerr ("Saving style %s as attributes\n", style->name); + g_string_append_printf (string, "BrushName=\"%s\" ", style->brush_name); + + g_string_append_printf (string, "Foreground=\"%s %s %s %s\" ", + g_ascii_dtostr (buffer_r, blen, style->foreground.r), + g_ascii_dtostr (buffer_g, blen, style->foreground.g), + g_ascii_dtostr (buffer_b, blen, style->foreground.b), + g_ascii_dtostr (buffer_a, blen, style->foreground.a)); + + g_string_append_printf (string, "Background=\"%s %s %s %s\" ", + g_ascii_dtostr (buffer_r, blen, style->background.r), + g_ascii_dtostr (buffer_g, blen, style->background.g), + g_ascii_dtostr (buffer_b, blen, style->background.b), + g_ascii_dtostr (buffer_a, blen, style->background.a)); + + g_string_append_printf (string, "FillType=%d ", style->fill_type); + + g_string_append_printf (string, "PaintType=%d ", style->paint_type); + + g_string_append_printf (string, "FillOpacity=%s ", + g_ascii_dtostr (buffer, blen, style->fill_opacity)); + + +} + +void +gfig_save_styles (GString *string) +{ + if (gfig_context->debug_styles) + g_printerr ("Saving global styles.\n"); + + gfig_save_style (&gfig_context->default_style, string); +} + +/* + * set_foreground_callback() is the callback for the Foreground color select + * widget. It reads the color from the widget, and applies this color to the + * current style. It then produces a repaint (which will be suppressed if + * gfig_context->enable_repaint is FALSE). + */ +void +set_foreground_callback (GimpColorButton *button, + gpointer data) +{ + GimpRGB color2; + Style *current_style; + + if (gfig_context->debug_styles) + g_printerr ("Setting foreground color from color selector\n"); + + current_style = gfig_context_get_current_style (); + + gimp_color_button_get_color (button, &color2); + + gimp_rgba_set (¤t_style->foreground, + color2.r, color2.g, color2.b, color2.a); + + gfig_paint_callback (); +} + +void +set_background_callback (GimpColorButton *button, + gpointer data) +{ + GimpRGB color2; + Style *current_style; + + if (gfig_context->debug_styles) + g_printerr ("Setting background color from color selector\n"); + + current_style = gfig_context_get_current_style (); + + gimp_color_button_get_color (button, &color2); + gimp_rgba_set (¤t_style->background, + color2.r, color2.g, color2.b, color2.a); + + gfig_paint_callback (); +} + +void +set_paint_type_callback (GtkToggleButton *toggle, + gpointer data) +{ + gboolean paint_type; + Style *current_style; + + current_style = gfig_context_get_current_style (); + paint_type = gtk_toggle_button_get_active (toggle); + current_style->paint_type = paint_type; + gfig_paint_callback (); + + gtk_widget_set_sensitive (GTK_WIDGET (data), paint_type); +} + +/* + * gfig_brush_changed_callback() is the callback for the brush + * selector widget. It reads the brush name from the widget, and + * applies this to the current style, as well as the gfig_context->bdesc + * values. It then produces a repaint (which will be suppressed if + * gfig_context->enable_repaint is FALSE). + */ +void +gfig_brush_changed_callback (GimpBrushSelectButton *button, + const gchar *brush_name, + gdouble opacity, + gint spacing, + GimpLayerMode paint_mode, + gint width, + gint height, + const guchar *mask_data, + gboolean dialog_closing, + gpointer user_data) +{ + Style *current_style; + + current_style = gfig_context_get_current_style (); + current_style->brush_name = g_strdup (brush_name); + + /* this will soon be unneeded. How soon? */ + gfig_context->bdesc.name = g_strdup (brush_name); + gfig_context->bdesc.width = width; + gfig_context->bdesc.height = height; + gimp_context_set_brush (brush_name); + gimp_context_set_brush_default_size (); + + gfig_paint_callback (); +} + +void +gfig_pattern_changed_callback (GimpPatternSelectButton *button, + const gchar *pattern_name, + gint width, + gint height, + gint bpp, + const guchar *mask_data, + gboolean dialog_closing, + gpointer user_data) +{ + Style *current_style; + + current_style = gfig_context_get_current_style (); + current_style->pattern = g_strdup (pattern_name); + + gfig_paint_callback (); +} + +void +gfig_gradient_changed_callback (GimpGradientSelectButton *button, + const gchar *gradient_name, + gint width, + const gdouble *grad_data, + gboolean dialog_closing, + gpointer user_data) +{ + Style *current_style; + + current_style = gfig_context_get_current_style (); + current_style->gradient = g_strdup (gradient_name); + + gfig_paint_callback (); +} + +void +gfig_rgba_copy (GimpRGB *color1, + GimpRGB *color2) +{ + color1->r = color2->r; + color1->g = color2->g; + color1->b = color2->b; + color1->a = color2->a; +} + +void +gfig_style_copy (Style *style1, + Style *style0, + const gchar *name) +{ + if (name) + style1->name = g_strdup (name); + else + g_message ("Error: name is NULL in gfig_style_copy."); + + if (gfig_context->debug_styles) + g_printerr ("Copying style %s as style %s\n", style0->name, name); + + gfig_rgba_copy (&style1->foreground, &style0->foreground); + gfig_rgba_copy (&style1->background, &style0->background); + + if (!style0->brush_name) + g_message ("Error copying style %s: brush name is NULL.", style0->name); + + style1->brush_name = g_strdup (style0->brush_name); + style1->gradient = g_strdup (style0->gradient); + style1->pattern = g_strdup (style0->pattern); + style1->fill_type = style0->fill_type; + style1->fill_opacity = style0->fill_opacity; + style1->paint_type = style0->paint_type; +} + +/* + * gfig_style_apply() applies the settings from the specified style to + * the GIMP core. It does not change any widgets, and does not cause + * a repaint. + */ +void +gfig_style_apply (Style *style) +{ + if (gfig_context->debug_styles) + g_printerr ("Applying style '%s' -- ", style->name); + + gimp_context_set_foreground (&style->foreground); + + gimp_context_set_background (&style->background); + + if (! gimp_context_set_brush (style->brush_name)) + g_message ("Style apply: Failed to set brush to '%s' in style '%s'", + style->brush_name, style->name); + + gimp_context_set_brush_default_size (); + + gimp_context_set_pattern (style->pattern); + + gimp_context_set_gradient (style->gradient); + + if (gfig_context->debug_styles) + g_printerr ("done.\n"); +} + +/* + * gfig_read_gimp_style() reads the style settings from the Gimp core, + * and applies them to the specified style, giving that style the + * specified name. This is mainly useful as a way of initializing + * a style. The function does not cause a repaint. + */ +void +gfig_read_gimp_style (Style *style, + const gchar *name) +{ + gint dummy; + + if (!name) + g_message ("Error: name is NULL in gfig_read_gimp_style."); + + if (gfig_context->debug_styles) + g_printerr ("Reading Gimp settings as style %s\n", name); + style->name = g_strdup (name); + + gimp_context_get_foreground (&style->foreground); + gimp_context_get_background (&style->background); + + style->brush_name = gimp_context_get_brush (); + gimp_brush_get_info (style->brush_name, + &style->brush_width, &style->brush_height, + &dummy, &dummy); + gimp_brush_get_spacing (style->brush_name, &style->brush_spacing); + + style->gradient = gimp_context_get_gradient (); + style->pattern = gimp_context_get_pattern (); + + style->fill_opacity = 100.; + + gfig_context->bdesc.name = style->brush_name; + gfig_context->bdesc.width = style->brush_width; + gfig_context->bdesc.height = style->brush_height; +} + +/* + * gfig_style_set_content_from_style() sets all of the style control widgets + * to values from the specified style. This in turn sets the Gimp core's + * values to the same things. Repainting is suppressed while this happens, + * so calling this function will not produce a repaint. + * + */ +void +gfig_style_set_context_from_style (Style *style) +{ + gboolean enable_repaint; + + if (gfig_context->debug_styles) + g_printerr ("Setting context from style '%s' -- ", style->name); + + enable_repaint = gfig_context->enable_repaint; + gfig_context->enable_repaint = FALSE; + + gimp_color_button_set_color (GIMP_COLOR_BUTTON (gfig_context->fg_color_button), + &style->foreground); + gimp_color_button_set_color (GIMP_COLOR_BUTTON (gfig_context->bg_color_button), + &style->background); + if (! gimp_context_set_brush (style->brush_name)) + g_message ("Style from context: Failed to set brush to '%s'", + style->brush_name); + + gimp_context_set_brush_default_size (); + + gimp_brush_select_button_set_brush (GIMP_BRUSH_SELECT_BUTTON (gfig_context->brush_select), + style->brush_name, -1.0, -1, -1); /* FIXME */ + + gimp_pattern_select_button_set_pattern (GIMP_PATTERN_SELECT_BUTTON (gfig_context->pattern_select), + style->pattern); + + gimp_gradient_select_button_set_gradient (GIMP_GRADIENT_SELECT_BUTTON (gfig_context->gradient_select), + style->gradient); + + gfig_context->bdesc.name = style->brush_name; + if (gfig_context->debug_styles) + g_printerr ("done.\n"); + + gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (gfig_context->fillstyle_combo), + (gint) style->fill_type); + + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gfig_context->paint_type_toggle), + style->paint_type); + gfig_context->enable_repaint = enable_repaint; +} + +/* + * gfig_style_set_style_from_context() sets the values in the specified + * style to those that appear in the style control widgets f + */ +void +gfig_style_set_style_from_context (Style *style) +{ + Style *current_style; + GimpRGB color; + gint value; + + style->name = "object"; + current_style = gfig_context_get_current_style (); + + gimp_color_button_get_color (GIMP_COLOR_BUTTON (gfig_context->fg_color_button), + &color); + if (gfig_context->debug_styles) + g_printerr ("Setting foreground color to %lg %lg %lg\n", + color.r, color.g, color.b); + + gfig_rgba_copy (&style->foreground, &color); + gimp_color_button_get_color (GIMP_COLOR_BUTTON (gfig_context->bg_color_button), + &color); + gfig_rgba_copy (&style->background, &color); + + style->brush_name = current_style->brush_name; + + if (!style->pattern || strcmp (style->pattern, current_style->pattern)) + { + style->pattern = g_strdup (current_style->pattern); /* why strduping? */ + } + + style->gradient = current_style->gradient; + + if (gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (gfig_context->fillstyle_combo), &value)) + style->fill_type = value; + + /* FIXME when there is an opacity control widget to read */ + style->fill_opacity = 100.; + + style->paint_type = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gfig_context->paint_type_toggle)); +} + +void +mygimp_brush_info (gint *width, + gint *height) +{ + gchar *name = gimp_context_get_brush (); + gint dummy; + + if (name && gimp_brush_get_info (name, width, height, &dummy, &dummy)) + { + *width = MAX (*width, 32); + *height = MAX (*height, 32); + } + else + { + g_message ("Failed to get brush info"); + *width = *height = 48; + } + + g_free (name); +} + +Style * +gfig_context_get_current_style (void) +{ + if (gfig_context->selected_obj) + return &gfig_context->selected_obj->style; + else + return &gfig_context->default_style; +} diff --git a/plug-ins/gfig/gfig-style.h b/plug-ins/gfig/gfig-style.h new file mode 100644 index 0000000..3d18c05 --- /dev/null +++ b/plug-ins/gfig/gfig-style.h @@ -0,0 +1,126 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + +#ifndef __GFIG_STYLE_H__ +#define __GFIG_STYLE_H__ + +#include <libgimp/gimpui.h> + +struct _Style +{ + gchar *name; + gchar *brush_name; + gint brush_width; + gint brush_height; + gint brush_spacing; + BrushType brush_type; + gdouble brushfade; + gdouble brushgradient; + gdouble airbrushpressure; + FillType fill_type; + gdouble fill_opacity; + gchar *pattern; + gchar *gradient; + PaintType paint_type; + GimpRGB foreground; + GimpRGB background; + gboolean reverselines; + gint ref_count; +}; + +gboolean gfig_load_style (Style *style, + FILE *fp); + +gboolean gfig_skip_style (Style *style, + FILE *fp); + +gboolean gfig_load_styles (GFigObj *gfig, + FILE *fp); + +void gfig_save_style (Style *style, + GString *string); + +void gfig_style_save_as_attributes (Style *style, + GString *string); + +void gfig_save_styles (GString *string); + +void set_foreground_callback (GimpColorButton *button, + gpointer data); + +void set_background_callback (GimpColorButton *button, + gpointer data); + +void set_paint_type_callback (GtkToggleButton *toggle, + gpointer data); + +void gfig_brush_changed_callback (GimpBrushSelectButton *button, + const gchar *brush_name, + gdouble opacity, + gint spacing, + GimpLayerMode paint_mode, + gint width, + gint height, + const guchar *mask_data, + gboolean dialog_closing, + gpointer user_data); + +void gfig_pattern_changed_callback (GimpPatternSelectButton *button, + const gchar *pattern_name, + gint width, + gint height, + gint bpp, + const guchar *mask_data, + gboolean dialog_closing, + gpointer user_data); + +void gfig_gradient_changed_callback (GimpGradientSelectButton *button, + const gchar *gradient_name, + gint width, + const gdouble *grad_data, + gboolean dialog_closing, + gpointer user_data); + +void gfig_rgba_copy (GimpRGB *color1, + GimpRGB *color2); + +void gfig_style_copy (Style *style1, + Style *style0, + const gchar *name); + +void gfig_style_apply (Style *style); + +void gfig_read_gimp_style (Style *style, + const gchar *name); + +void gfig_style_set_context_from_style (Style *style); + +void gfig_style_set_style_from_context (Style *style); + +void mygimp_brush_info (gint *width, + gint *height); + +Style *gfig_context_get_current_style (void); + +#endif /* __GFIG_STYLE_H__ */ diff --git a/plug-ins/gfig/gfig-types.h b/plug-ins/gfig/gfig-types.h new file mode 100644 index 0000000..5cb3168 --- /dev/null +++ b/plug-ins/gfig/gfig-types.h @@ -0,0 +1,115 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + +#ifndef __GFIG_TYPES_H__ +#define __GFIG_TYPES_H__ + +typedef enum +{ + RECT_GRID = 0, + POLAR_GRID, + ISO_GRID +} GridType; + +typedef enum +{ + ADD = 0, + SUBTRACT, + REPLACE, + INTERSECT +} SelectionType; + +typedef enum +{ + ARC_SEGMENT = 0, + ARC_SECTOR +} ArcType; + +typedef enum +{ + FILL_NONE = 0, + FILL_COLOR, + FILL_PATTERN, + FILL_GRADIENT, + FILL_VERTICAL, + FILL_HORIZONTAL +} FillType; + +typedef enum +{ + ORIGINAL_LAYER = 0, + SINGLE_LAYER, + MULTI_LAYER +} DrawonLayers; + +typedef enum +{ + LAYER_TRANS_BG = 0, + LAYER_BG_BG, + LAYER_FG_BG, + LAYER_WHITE_BG, + LAYER_COPY_BG +} LayersBGType; + +typedef enum +{ + PAINT_NONE = 0, + PAINT_BRUSH_TYPE = 1 +} PaintType; + +typedef enum +{ + BRUSH_BRUSH_TYPE = 0, + BRUSH_PENCIL_TYPE, + BRUSH_AIRBRUSH_TYPE, + BRUSH_PATTERN_TYPE +} BrushType; + +typedef enum +{ + OBJ_TYPE_NONE = 0, + LINE, + RECTANGLE, + CIRCLE, + ELLIPSE, + ARC, + POLY, + STAR, + SPIRAL, + BEZIER, + NUM_OBJ_TYPES, + MOVE_OBJ, + MOVE_POINT, + COPY_OBJ, + MOVE_COPY_OBJ, + DEL_OBJ, + SELECT_OBJ, + NULL_OPER +} DobjType; + +typedef struct _GFigObj GFigObj; +typedef struct _GfigObject GfigObject; +typedef struct _Style Style; + +#endif /* __GFIG_TYPES_H__ */ diff --git a/plug-ins/gfig/gfig.c b/plug-ins/gfig/gfig.c new file mode 100644 index 0000000..118930f --- /dev/null +++ b/plug-ins/gfig/gfig.c @@ -0,0 +1,809 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +#include "config.h" + +#include <string.h> +#include <stdlib.h> +#include <errno.h> + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +#include <glib/gstdio.h> + +#include <libgimp/gimp.h> +#include <libgimp/gimpui.h> + +#include "gfig.h" +#include "gfig-style.h" +#include "gfig-dialog.h" +#include "gfig-arc.h" +#include "gfig-bezier.h" +#include "gfig-circle.h" +#include "gfig-dobject.h" +#include "gfig-ellipse.h" +#include "gfig-grid.h" +#include "gfig-line.h" +#include "gfig-poly.h" +#include "gfig-preview.h" +#include "gfig-spiral.h" +#include "gfig-star.h" +#include "gfig-stock.h" + +#include "libgimp/stdplugins-intl.h" + + +#define GFIG_HEADER "GFIG Version 0.2\n" + +static void query (void); +static void run (const gchar *name, + gint nparams, + const GimpParam *param, + gint *nreturn_vals, + GimpParam **return_vals); + + +const GimpPlugInInfo PLUG_IN_INFO = +{ + NULL, /* init_proc */ + NULL, /* quit_proc */ + query, /* query_proc */ + run, /* run_proc */ +}; + + +gint line_no; + +gint obj_show_single = -1; /* -1 all >= 0 object number */ + +/* Structures etc for the objects */ +/* Points used to draw the object */ + +GfigObject *obj_creating; /* Object we are creating */ +GfigObject *tmp_line; /* Needed when drawing lines */ + +gboolean need_to_scale; + +static gint load_options (GFigObj *gfig, + FILE *fp); +/* globals */ + +GfigObjectClass dobj_class[10]; +GFigContext *gfig_context; +GtkWidget *top_level_dlg; +GList *gfig_list; +gdouble org_scale_x_factor, org_scale_y_factor; + + +/* Stuff for the preview bit */ +static gint sel_x, sel_y; +static gint sel_width, sel_height; +gint preview_width, preview_height; +gdouble scale_x_factor, scale_y_factor; +GdkPixbuf *back_pixbuf = NULL; + +MAIN () + +static void +query (void) +{ + static const GimpParamDef args[] = + { + { GIMP_PDB_INT32, "run-mode", "The run mode { RUN-INTERACTIVE (0), RUN-NONINTERACTIVE (1) }" }, + { GIMP_PDB_IMAGE, "image", "Input image (unused)" }, + { GIMP_PDB_DRAWABLE, "drawable", "Input drawable" }, + { GIMP_PDB_INT32, "dummy", "dummy" } + }; + + gimp_install_procedure (PLUG_IN_PROC, + N_("Create geometric shapes"), + "Draw Vector Graphics and paint them onto your images. " + "Gfig allows you to draw many types of objects " + "including Lines, Circles, Ellipses, Curves, Polygons, " + "pointed stars, Bezier curves, and Spirals. " + "Objects can be painted using Brushes or other tools" + "or filled using colors or patterns. " + "Gfig objects can also be used to create selections. ", + "Andy Thomas", + "Andy Thomas", + "1997", + N_("_Gfig..."), + "RGB*, GRAY*", + GIMP_PLUGIN, + G_N_ELEMENTS (args), 0, + args, NULL); + + gimp_plugin_menu_register (PLUG_IN_PROC, "<Image>/Filters/Render"); +} + +static void +run (const gchar *name, + gint nparams, + const GimpParam *param, + gint *nreturn_vals, + GimpParam **return_vals) +{ + static GimpParam values[1]; + gint32 drawable_id; + GimpRunMode run_mode; + GimpPDBStatusType status = GIMP_PDB_SUCCESS; + gint pwidth, pheight; + + INIT_I18N (); + + gfig_context = g_new0 (GFigContext, 1); + gfig_context->show_background = TRUE; + gfig_context->selected_obj = NULL; + + drawable_id = param[2].data.d_drawable; + + run_mode = param[0].data.d_int32; + + gfig_context->image_id = param[1].data.d_image; + gfig_context->drawable_id = drawable_id; + + *nreturn_vals = 1; + *return_vals = values; + + values[0].type = GIMP_PDB_STATUS; + values[0].data.d_status = status; + + gimp_image_undo_group_start (gfig_context->image_id); + + gimp_context_push (); + + /* TMP Hack - clear any selections */ + if (! gimp_selection_is_empty (gfig_context->image_id)) + gimp_selection_none (gfig_context->image_id); + + if (! gimp_drawable_mask_intersect (drawable_id, &sel_x, &sel_y, + &sel_width, &sel_height)) + { + gimp_context_pop (); + + gimp_image_undo_group_end (gfig_context->image_id); + return; + } + + /* Calculate preview size */ + + if (sel_width > sel_height) + { + pwidth = MIN (sel_width, PREVIEW_SIZE); + pheight = sel_height * pwidth / sel_width; + } + else + { + pheight = MIN (sel_height, PREVIEW_SIZE); + pwidth = sel_width * pheight / sel_height; + } + + + preview_width = MAX (pwidth, 2); /* Min size is 2 */ + preview_height = MAX (pheight, 2); + + org_scale_x_factor = scale_x_factor = + (gdouble) sel_width / (gdouble) preview_width; + org_scale_y_factor = scale_y_factor = + (gdouble) sel_height / (gdouble) preview_height; + + /* initialize */ + gfig_init_object_classes (); + + switch (run_mode) + { + case GIMP_RUN_INTERACTIVE: + case GIMP_RUN_WITH_LAST_VALS: + /*gimp_get_data (PLUG_IN_PROC, &selvals);*/ + if (! gfig_dialog ()) + { + gimp_image_undo_group_end (gfig_context->image_id); + + return; + } + break; + + case GIMP_RUN_NONINTERACTIVE: + status = GIMP_PDB_CALLING_ERROR; + break; + + default: + break; + } + + gimp_context_pop (); + + gimp_image_undo_group_end (gfig_context->image_id); + + if (run_mode != GIMP_RUN_NONINTERACTIVE) + gimp_displays_flush (); + else +#if 0 + if (run_mode == GIMP_RUN_INTERACTIVE) + gimp_set_data (PLUG_IN_PROC, &selvals, sizeof (SelectItVals)); + else +#endif /* 0 */ + { + status = GIMP_PDB_EXECUTION_ERROR; + } + + values[0].data.d_status = status; +} + +/* + Translate SPACE to "\\040", etc. + Taken from gflare plugin + */ +void +gfig_name_encode (gchar *dest, + gchar *src) +{ + gint cnt = MAX_LOAD_LINE - 1; + + while (*src && cnt--) + { + if (g_ascii_iscntrl (*src) || g_ascii_isspace (*src) || *src == '\\') + { + sprintf (dest, "\\%03o", *src++); + dest += 4; + } + else + *dest++ = *src++; + } + *dest = '\0'; +} + +/* + Translate "\\040" to SPACE, etc. + */ +void +gfig_name_decode (gchar *dest, + const gchar *src) +{ + gint cnt = MAX_LOAD_LINE - 1; + guint tmp; + + while (*src && cnt--) + { + if (*src == '\\' && *(src+1) && *(src+2) && *(src+3)) + { + sscanf (src+1, "%3o", &tmp); + *dest++ = tmp; + src += 4; + } + else + *dest++ = *src++; + } + *dest = '\0'; +} + + +/* + * Load all gfig, which are founded in gfig-path-list, into gfig_list. + * gfig-path-list must be initialized first. (plug_in_parse_gfig_path ()) + * based on code from Gflare. + */ + +gint +gfig_list_pos (GFigObj *gfig) +{ + GFigObj *g; + gint n; + GList *tmp; + + n = 0; + + for (tmp = gfig_list; tmp; tmp = g_list_next (tmp)) + { + g = tmp->data; + + if (strcmp (gfig->draw_name, g->draw_name) <= 0) + break; + + n++; + } + return n; +} + +/* + * Insert gfigs in alphabetical order + */ + +gint +gfig_list_insert (GFigObj *gfig) +{ + gint n; + + n = gfig_list_pos (gfig); + + gfig_list = g_list_insert (gfig_list, gfig, n); + + return n; +} + +void +gfig_free (GFigObj *gfig) +{ + g_assert (gfig != NULL); + + free_all_objs (gfig->obj_list); + + g_free (gfig->name); + g_free (gfig->filename); + g_free (gfig->draw_name); + + g_free (gfig); +} + +GFigObj * +gfig_new (void) +{ + return g_new0 (GFigObj, 1); +} + +static void +gfig_load_objs (GFigObj *gfig, + gint load_count, + FILE *fp) +{ + GfigObject *obj; + gchar load_buf[MAX_LOAD_LINE]; + glong offset; + glong offset2; + Style style; + + while (load_count-- > 0) + { + obj = NULL; + get_line (load_buf, MAX_LOAD_LINE, fp, 0); + + /* kludge */ + offset = ftell (fp); + gfig_skip_style (&style, fp); + + obj = d_load_object (load_buf, fp); + + if (obj) + { + add_to_all_obj (gfig, obj); + offset2 = ftell (fp); + fseek (fp, offset, SEEK_SET); + gfig_load_style (&obj->style, fp); + fseek (fp, offset2, SEEK_SET); + } + else + { + g_message ("Failed to load object, load count = %d", load_count); + } + } +} + +GFigObj * +gfig_load (const gchar *filename, + const gchar *name) +{ + GFigObj *gfig; + FILE *fp; + gchar load_buf[MAX_LOAD_LINE]; + gchar str_buf[MAX_LOAD_LINE]; + gint chk_count; + gint load_count = 0; + gdouble version; + gchar magic1[20]; + gchar magic2[20]; + + g_assert (filename != NULL); + +#ifdef DEBUG + printf ("Loading %s (%s)\n", filename, name); +#endif /* DEBUG */ + + fp = g_fopen (filename, "rb"); + if (!fp) + { + g_message (_("Could not open '%s' for reading: %s"), + gimp_filename_to_utf8 (filename), g_strerror (errno)); + return NULL; + } + + gfig = gfig_new (); + + gfig->name = g_strdup (name); + gfig->filename = g_strdup (filename); + + + /* HEADER + * draw_name + * version + * obj_list + */ + + get_line (load_buf, MAX_LOAD_LINE, fp, 1); + + sscanf (load_buf, "%10s %10s %lf", magic1, magic2, &version); + + if (strcmp (magic1, "GFIG") || strcmp (magic2, "Version")) + { + g_message ("File '%s' is not a gfig file", + gimp_filename_to_utf8 (gfig->filename)); + gfig_free (gfig); + fclose (fp); + return NULL; + } + + get_line (load_buf, MAX_LOAD_LINE, fp, 0); + sscanf (load_buf, "Name: %100s", str_buf); + gfig_name_decode (load_buf, str_buf); + gfig->draw_name = g_strdup (load_buf); + + get_line (load_buf, MAX_LOAD_LINE, fp, 0); + if (strncmp (load_buf, "Version: ", 9) == 0) + gfig->version = g_ascii_strtod (load_buf + 9, NULL); + + get_line (load_buf, MAX_LOAD_LINE, fp, 0); + sscanf (load_buf, "ObjCount: %d", &load_count); + + if (load_options (gfig, fp)) + { + g_message ("File '%s' corrupt file - Line %d Option section incorrect", + gimp_filename_to_utf8 (filename), line_no); + gfig_free (gfig); + fclose (fp); + return NULL; + } + + if (gfig_load_styles (gfig, fp)) + { + g_message ("File '%s' corrupt file - Line %d Option section incorrect", + gimp_filename_to_utf8 (filename), line_no); + gfig_free (gfig); + fclose (fp); + return NULL; + } + + + + gfig_load_objs (gfig, load_count, fp); + + /* Check count ? */ + + chk_count = g_list_length (gfig->obj_list); + + if (chk_count != load_count) + { + g_message ("File '%s' corrupt file - Line %d Object count to small", + gimp_filename_to_utf8 (filename), line_no); + gfig_free (gfig); + fclose (fp); + return NULL; + } + + fclose (fp); + + if (!gfig_context->current_obj) + gfig_context->current_obj = gfig; + + gfig->obj_status = GFIG_OK; + + return gfig; +} + +void +save_options (GString *string) +{ + /* Save options */ + g_string_append_printf (string, "<OPTIONS>\n"); + g_string_append_printf (string, "GridSpacing: %d\n", + selvals.opts.gridspacing); + if (selvals.opts.gridtype == RECT_GRID) + { + g_string_append_printf (string, "GridType: RECT_GRID\n"); + } + else if (selvals.opts.gridtype == POLAR_GRID) + { + g_string_append_printf (string, "GridType: POLAR_GRID\n"); + } + else if (selvals.opts.gridtype == ISO_GRID) + { + g_string_append_printf (string, "GridType: ISO_GRID\n"); + } + else + { + /* default to RECT_GRID */ + g_string_append_printf (string, "GridType: RECT_GRID\n"); + } + + g_string_append_printf (string, "DrawGrid: %s\n", + (selvals.opts.drawgrid) ? "TRUE" : "FALSE"); + g_string_append_printf (string, "Snap2Grid: %s\n", + (selvals.opts.snap2grid) ? "TRUE" : "FALSE"); + g_string_append_printf (string, "LockOnGrid: %s\n", + (selvals.opts.lockongrid) ? "TRUE" : "FALSE"); + g_string_append_printf (string, "ShowControl: %s\n", + (selvals.opts.showcontrol) ? "TRUE" : "FALSE"); + g_string_append_printf (string, "</OPTIONS>\n"); +} + +static void +gfig_save_obj_start (GfigObject *obj, + GString *string) +{ + g_string_append_printf (string, "<%s ", obj->class->name); + gfig_style_save_as_attributes (&obj->style, string); + g_string_append_printf (string, ">\n"); +} + +static void +gfig_save_obj_end (GfigObject *obj, + GString *string) +{ + g_string_append_printf (string, "</%s>\n",obj->class->name); +} + +static gboolean +load_bool (gchar *opt_buf, + gint *toset) +{ + if (!strcmp (opt_buf, "TRUE")) + *toset = 1; + else if (!strcmp (opt_buf, "FALSE")) + *toset = 0; + else + return TRUE; + + return FALSE; +} + +static gint +load_options (GFigObj *gfig, + FILE *fp) +{ + gchar load_buf[MAX_LOAD_LINE]; + gchar str_buf[MAX_LOAD_LINE]; + gchar opt_buf[MAX_LOAD_LINE]; + + get_line (load_buf, MAX_LOAD_LINE, fp, 0); + +#ifdef DEBUG + printf ("load '%s'\n", load_buf); +#endif /* DEBUG */ + + if (strcmp (load_buf, "<OPTIONS>")) + return (-1); + + get_line (load_buf, MAX_LOAD_LINE, fp, 0); + +#ifdef DEBUG + printf ("opt line '%s'\n", load_buf); +#endif /* DEBUG */ + + while (strcmp (load_buf, "</OPTIONS>")) + { + /* Get option name */ +#ifdef DEBUG + printf ("num = %d\n", sscanf (load_buf, "%255s %255s", str_buf, opt_buf)); + + printf ("option %s val %s\n", str_buf, opt_buf); +#else + sscanf (load_buf, "%255s %255s", str_buf, opt_buf); +#endif /* DEBUG */ + + if (!strcmp (str_buf, "GridSpacing:")) + { + /* Value is decimal */ + int sp = 0; + sp = atoi (opt_buf); + if (sp <= 0) + return (-1); + gfig->opts.gridspacing = sp; + } + else if (!strcmp (str_buf, "DrawGrid:")) + { + /* Value is bool */ + if (load_bool (opt_buf, &gfig->opts.drawgrid)) + return (-1); + } + else if (!strcmp (str_buf, "Snap2Grid:")) + { + /* Value is bool */ + if (load_bool (opt_buf, &gfig->opts.snap2grid)) + return (-1); + } + else if (!strcmp (str_buf, "LockOnGrid:")) + { + /* Value is bool */ + if (load_bool (opt_buf, &gfig->opts.lockongrid)) + return (-1); + } + else if (!strcmp (str_buf, "ShowControl:")) + { + /* Value is bool */ + if (load_bool (opt_buf, &gfig->opts.showcontrol)) + return (-1); + } + else if (!strcmp (str_buf, "GridType:")) + { + /* Value is string */ + if (!strcmp (opt_buf, "RECT_GRID")) + gfig->opts.gridtype = RECT_GRID; + else if (!strcmp (opt_buf, "POLAR_GRID")) + gfig->opts.gridtype = POLAR_GRID; + else if (!strcmp (opt_buf, "ISO_GRID")) + gfig->opts.gridtype = ISO_GRID; + else + return (-1); + } + + get_line (load_buf, MAX_LOAD_LINE, fp, 0); + +#ifdef DEBUG + printf ("opt line '%s'\n", load_buf); +#endif /* DEBUG */ + } + return (0); +} + +GString * +gfig_save_as_string (void) +{ + GList *objs; + gint count; + gchar buf[G_ASCII_DTOSTR_BUF_SIZE]; + gchar conv_buf[MAX_LOAD_LINE * 3 + 1]; + GString *string; + + string = g_string_new (GFIG_HEADER); + + gfig_name_encode (conv_buf, gfig_context->current_obj->draw_name); + g_string_append_printf (string, "Name: %s\n", conv_buf); + g_string_append_printf (string, "Version: %s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", + gfig_context->current_obj->version)); + objs = gfig_context->current_obj->obj_list; + + count = g_list_length (objs); + + g_string_append_printf (string, "ObjCount: %d\n", count); + + save_options (string); + + gfig_save_styles (string); + + for (objs = gfig_context->current_obj->obj_list; + objs; + objs = g_list_next (objs)) + { + GfigObject *object = objs->data; + + gfig_save_obj_start (object, string); + + gfig_save_style (&object->style, string); + + if (object->points) + d_save_object (object, string); + + gfig_save_obj_end (object, string); + } + + return string; +} + + +gboolean +gfig_save_as_parasite (void) +{ + GimpParasite *parasite; + GString *string; + + string = gfig_save_as_string (); + + parasite = gimp_parasite_new ("gfig", + GIMP_PARASITE_PERSISTENT | + GIMP_PARASITE_UNDOABLE, + string->len, string->str); + + g_string_free (string, TRUE); + + if (!gimp_item_attach_parasite (gfig_context->drawable_id, parasite)) + { + g_message (_("Error trying to save figure as a parasite: " + "can't attach parasite to drawable.")); + gimp_parasite_free (parasite); + return FALSE; + } + + gimp_parasite_free (parasite); + return TRUE; +} + +GFigObj * +gfig_load_from_parasite (void) +{ + FILE *fp; + gchar *fname; + GimpParasite *parasite; + GFigObj *gfig; + + parasite = gimp_item_get_parasite (gfig_context->drawable_id, "gfig"); + if (! parasite) + return NULL; + + fname = gimp_temp_name ("gfigtmp"); + + fp = g_fopen (fname, "wb"); + if (!fp) + { + g_message (_("Error trying to open temporary file '%s' " + "for parasite loading: %s"), + gimp_filename_to_utf8 (fname), g_strerror (errno)); + return NULL; + } + + fwrite (gimp_parasite_data (parasite), + sizeof (guchar), + gimp_parasite_data_size (parasite), + fp); + fclose (fp); + + gimp_parasite_free (parasite); + + gfig = gfig_load (fname, "(none)"); + + g_unlink (fname); + + g_free (fname); + + return gfig; +} + +void +gfig_save_callbk (void) +{ + FILE *fp; + gchar *savename; + GString *string; + + savename = gfig_context->current_obj->filename; + + fp = g_fopen (savename, "w+b"); + + if (!fp) + { + g_message (_("Could not open '%s' for writing: %s"), + gimp_filename_to_utf8 (savename), g_strerror (errno)); + return; + } + + string = gfig_save_as_string (); + + fwrite (string->str, string->len, 1, fp); + + if (ferror (fp)) + g_message ("Failed to write file."); + else + gfig_context->current_obj->obj_status &= ~(GFIG_MODIFIED | GFIG_READONLY); + + fclose (fp); +} diff --git a/plug-ins/gfig/gfig.h b/plug-ins/gfig/gfig.h new file mode 100644 index 0000000..a2ed727 --- /dev/null +++ b/plug-ins/gfig/gfig.h @@ -0,0 +1,245 @@ +/* + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This is a plug-in for GIMP. + * + * Generates images containing vector type drawings. + * + * Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + +#ifndef __GFIG_H__ +#define __GFIG_H__ + +#include "gfig-types.h" +#include "gfig-style.h" + +#define MAX_UNDO 10 +#define MIN_UNDO 1 + +typedef struct +{ + gint gridspacing; + GridType gridtype; + gboolean drawgrid; + gboolean snap2grid; + gboolean lockongrid; + gboolean showcontrol; + gdouble grid_radius_min; + gdouble grid_radius_interval; + gdouble grid_rotation; + gdouble grid_granularity; + gint grid_sectors_desired; +} GfigOpts; + +typedef struct +{ + SelectionType type; /* ADD etc .. */ + gint antia; /* Boolean for Antia */ + gint feather; /* Feather it ? */ + gdouble feather_radius; /* Radius to feather */ + ArcType as_pie; /* Arc type selection segment/sector */ + FillType fill_type; /* Fill type for selection */ + gdouble fill_opacity; /* You can guess this one */ +} selection_option; + +void object_start (GdkPoint *pnt, gint); +void object_operation (GdkPoint *pnt, gint); +void object_operation_start (GdkPoint *pnt, gint shift_down); +void object_operation_end (GdkPoint *pnt, gint); +void object_end (GdkPoint *pnt, gint shift_down); + +#define MAX_LOAD_LINE 256 +#define SQ_SIZE 8 + +#define PLUG_IN_PROC "plug-in-gfig" +#define PLUG_IN_BINARY "gfig" +#define PLUG_IN_ROLE "gimp-gfig" + +extern gint line_no; +extern gint preview_width, preview_height; +extern gint need_to_scale; +extern gdouble scale_x_factor, scale_y_factor; +extern GdkPixbuf *back_pixbuf; + +extern GtkWidget *pic_preview; +extern gint obj_show_single; + +typedef struct +{ + GfigOpts opts; + gboolean showimage; + gint maxundo; + gboolean showpos; + gdouble brushfade; + gdouble brushgradient; + gdouble airbrushpressure; + DrawonLayers onlayers; + LayersBGType onlayerbg; + PaintType painttype; + gboolean reverselines; + gboolean scaletoimage; + gdouble scaletoimagefp; + BrushType brshtype; + DobjType otype; +} SelectItVals; + +struct _GFigObj +{ + gchar *name; /* Trailing name of file */ + gchar *filename; /* Filename itself */ + gchar *draw_name; /* Name of the drawing */ + gfloat version; /* Version number of data file */ + GfigOpts opts; /* Options enforced when fig saved */ + GList *obj_list; /* Objects that make up this list */ + gint obj_status; /* See above for possible values */ + GtkWidget *list_item; + GtkWidget *label_widget; + GtkWidget *pixmap_widget; +}; + +/* this is temp, should be able to get rid of */ +typedef struct BrushDesc +{ + gchar *name; + gdouble opacity; + gint spacing; + GimpLayerMode paint_mode; + gint width; + gint height; + guchar *pv_buf; /* Buffer where brush placed */ + gint16 x_off; + gint16 y_off; + const gchar *popup; +} BrushDesc; + +typedef struct +{ + gboolean debug_styles; + gboolean show_background; /* show thumbnail of image behind figure */ + gint32 image_id; /* Gimp image id */ + gint32 drawable_id; /* Gimp drawable to paint on */ + GFigObj *current_obj; + GfigObject *selected_obj; + GtkWidget *preview; + Style default_style; + BrushDesc bdesc; + GtkWidget *fg_color_button; + GtkWidget *bg_color_button; + GtkWidget *brush_select; + GtkWidget *pattern_select; + GtkWidget *gradient_select; + GtkWidget *fillstyle_combo; + GtkWidget *paint_type_toggle; + GimpRGB *fg_color; + GimpRGB *bg_color; + gboolean enable_repaint; + gboolean using_new_layer; +} GFigContext; + +extern GFigContext *gfig_context; + +extern selection_option selopt; +extern SelectItVals selvals; + +void add_to_all_obj (GFigObj *fobj, + GfigObject *obj); + +gchar *get_line (gchar *buf, + gint s, + 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); + +void gfig_paint (BrushType brush_type, + gint32 drawable_ID, + gint seg_count, + gdouble line_pnts[]); + +void draw_item (cairo_t *cr, + gboolean fill); +void draw_circle (GdkPoint *p, + gboolean selected, + cairo_t *cr); +void draw_sqr (GdkPoint *p, + gboolean selected, + cairo_t *cr); + +void list_button_update (GFigObj *obj); + +GtkWidget *num_sides_widget (const gchar *d_title, + gint *num_sides, + 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, + GList *nobj); + +void gfig_draw_arc (gint x, + gint y, + gint width, + gint height, + gint angle1, + gint angle2, + cairo_t *cr); + +void gfig_draw_line (gint x0, + gint y0, + gint x1, + gint y1, + cairo_t *cr); + +void gfig_paint_callback (void); +GFigObj *gfig_load (const gchar *filename, + const gchar *name); +void gfig_name_encode (gchar *dest, + gchar *src); +void gfig_name_decode (gchar *dest, + const gchar *src); + +gint gfig_list_pos (GFigObj *gfig); +gint gfig_list_insert (GFigObj *gfig); +void gfig_free (GFigObj *gfig); + +void save_options (GString *string); + +GString *gfig_save_as_string (void); +gboolean gfig_save_as_parasite (void); +GFigObj *gfig_load_from_parasite (void); +GFigObj *gfig_new (void); +void gfig_save_callbk (void); +void paint_layer_fill (gdouble x1, + gdouble y1, + gdouble x2, + gdouble y2); + + + +extern GtkWidget *top_level_dlg; +extern GList *gfig_list; +extern gdouble org_scale_x_factor, org_scale_y_factor; + +#endif /* __GFIG_H__ */ diff --git a/plug-ins/gfig/images/Makefile.am b/plug-ins/gfig/images/Makefile.am new file mode 100644 index 0000000..093fe5c --- /dev/null +++ b/plug-ins/gfig/images/Makefile.am @@ -0,0 +1,35 @@ +## Process this file with automake to produce Makefile.in + +STOCK_IMAGES = \ + stock-bezier.png \ + stock-circle.png \ + stock-copy-object.png \ + stock-curve.png \ + stock-delete-object.png \ + stock-ellipse.png \ + stock-line.png \ + stock-move-object.png \ + stock-move-point.png \ + stock-polygon.png \ + stock-rectangle.png \ + stock-select-object.png \ + stock-show-all.png \ + stock-spiral.png \ + stock-star.png \ + stock-logo.png + +EXTRA_DIST = $(STOCK_IMAGES) + +noinst_DATA = gfig-stock-pixbufs.h +CLEANFILES = $(noinst_DATA) stock-icons.list + +stock-icons.list: $(STOCK_IMAGES) Makefile.am + ( rm -f $@; \ + for image in $(STOCK_IMAGES); do \ + echo $$image | \ + sed -e 's|.*/||' -e 's|-|_|g' -e 's|\.png$$||' >> $@; \ + echo " $(srcdir)/$$image" >> $@; \ + done ) + +$(srcdir)/gfig-stock-pixbufs.h: stock-icons.list + $(GDK_PIXBUF_CSOURCE) --raw --build-list `cat stock-icons.list` > $(@F) diff --git a/plug-ins/gfig/images/Makefile.in b/plug-ins/gfig/images/Makefile.in new file mode 100644 index 0000000..af6efd6 --- /dev/null +++ b/plug-ins/gfig/images/Makefile.in @@ -0,0 +1,781 @@ +# Makefile.in generated by automake 1.16.3 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2020 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = plug-ins/gfig/images +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/m4macros/alsa.m4 \ + $(top_srcdir)/m4macros/ax_compare_version.m4 \ + $(top_srcdir)/m4macros/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4macros/ax_gcc_func_attribute.m4 \ + $(top_srcdir)/m4macros/ax_prog_cc_for_build.m4 \ + $(top_srcdir)/m4macros/ax_prog_perl_version.m4 \ + $(top_srcdir)/m4macros/detectcflags.m4 \ + $(top_srcdir)/m4macros/pythondev.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(noinst_DATA) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +AA_LIBS = @AA_LIBS@ +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +ALL_LINGUAS = @ALL_LINGUAS@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALTIVEC_EXTRA_CFLAGS = @ALTIVEC_EXTRA_CFLAGS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APPSTREAM_UTIL = @APPSTREAM_UTIL@ +AR = @AR@ +AS = @AS@ +ATK_CFLAGS = @ATK_CFLAGS@ +ATK_LIBS = @ATK_LIBS@ +ATK_REQUIRED_VERSION = @ATK_REQUIRED_VERSION@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BABL_CFLAGS = @BABL_CFLAGS@ +BABL_LIBS = @BABL_LIBS@ +BABL_REQUIRED_VERSION = @BABL_REQUIRED_VERSION@ +BUG_REPORT_URL = @BUG_REPORT_URL@ +BUILD_EXEEXT = @BUILD_EXEEXT@ +BUILD_OBJEXT = @BUILD_OBJEXT@ +BZIP2_LIBS = @BZIP2_LIBS@ +CAIRO_CFLAGS = @CAIRO_CFLAGS@ +CAIRO_LIBS = @CAIRO_LIBS@ +CAIRO_PDF_CFLAGS = @CAIRO_PDF_CFLAGS@ +CAIRO_PDF_LIBS = @CAIRO_PDF_LIBS@ +CAIRO_PDF_REQUIRED_VERSION = @CAIRO_PDF_REQUIRED_VERSION@ +CAIRO_REQUIRED_VERSION = @CAIRO_REQUIRED_VERSION@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CC_FOR_BUILD = @CC_FOR_BUILD@ +CC_VERSION = @CC_VERSION@ +CFLAGS = @CFLAGS@ +CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@ +CPP_FOR_BUILD = @CPP_FOR_BUILD@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DESKTOP_DATADIR = @DESKTOP_DATADIR@ +DESKTOP_FILE_VALIDATE = @DESKTOP_FILE_VALIDATE@ +DLLTOOL = @DLLTOOL@ +DOC_SHOOTER = @DOC_SHOOTER@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILE_AA = @FILE_AA@ +FILE_EXR = @FILE_EXR@ +FILE_HEIF = @FILE_HEIF@ +FILE_JP2_LOAD = @FILE_JP2_LOAD@ +FILE_JPEGXL = @FILE_JPEGXL@ +FILE_MNG = @FILE_MNG@ +FILE_PDF_SAVE = @FILE_PDF_SAVE@ +FILE_PS = @FILE_PS@ +FILE_WMF = @FILE_WMF@ +FILE_XMC = @FILE_XMC@ +FILE_XPM = @FILE_XPM@ +FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@ +FONTCONFIG_LIBS = @FONTCONFIG_LIBS@ +FONTCONFIG_REQUIRED_VERSION = @FONTCONFIG_REQUIRED_VERSION@ +FREETYPE2_REQUIRED_VERSION = @FREETYPE2_REQUIRED_VERSION@ +FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ +FREETYPE_LIBS = @FREETYPE_LIBS@ +GDBUS_CODEGEN = @GDBUS_CODEGEN@ +GDK_PIXBUF_CFLAGS = @GDK_PIXBUF_CFLAGS@ +GDK_PIXBUF_CSOURCE = @GDK_PIXBUF_CSOURCE@ +GDK_PIXBUF_LIBS = @GDK_PIXBUF_LIBS@ +GDK_PIXBUF_REQUIRED_VERSION = @GDK_PIXBUF_REQUIRED_VERSION@ +GEGL = @GEGL@ +GEGL_CFLAGS = @GEGL_CFLAGS@ +GEGL_LIBS = @GEGL_LIBS@ +GEGL_MAJOR_MINOR_VERSION = @GEGL_MAJOR_MINOR_VERSION@ +GEGL_REQUIRED_VERSION = @GEGL_REQUIRED_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GEXIV2_CFLAGS = @GEXIV2_CFLAGS@ +GEXIV2_LIBS = @GEXIV2_LIBS@ +GEXIV2_REQUIRED_VERSION = @GEXIV2_REQUIRED_VERSION@ +GIMP_API_VERSION = @GIMP_API_VERSION@ +GIMP_APP_VERSION = @GIMP_APP_VERSION@ +GIMP_BINARY_AGE = @GIMP_BINARY_AGE@ +GIMP_COMMAND = @GIMP_COMMAND@ +GIMP_DATA_VERSION = @GIMP_DATA_VERSION@ +GIMP_FULL_NAME = @GIMP_FULL_NAME@ +GIMP_INTERFACE_AGE = @GIMP_INTERFACE_AGE@ +GIMP_MAJOR_VERSION = @GIMP_MAJOR_VERSION@ +GIMP_MICRO_VERSION = @GIMP_MICRO_VERSION@ +GIMP_MINOR_VERSION = @GIMP_MINOR_VERSION@ +GIMP_MKENUMS = @GIMP_MKENUMS@ +GIMP_MODULES = @GIMP_MODULES@ +GIMP_PACKAGE_REVISION = @GIMP_PACKAGE_REVISION@ +GIMP_PKGCONFIG_VERSION = @GIMP_PKGCONFIG_VERSION@ +GIMP_PLUGINS = @GIMP_PLUGINS@ +GIMP_PLUGIN_VERSION = @GIMP_PLUGIN_VERSION@ +GIMP_REAL_VERSION = @GIMP_REAL_VERSION@ +GIMP_RELEASE = @GIMP_RELEASE@ +GIMP_SYSCONF_VERSION = @GIMP_SYSCONF_VERSION@ +GIMP_TOOL_VERSION = @GIMP_TOOL_VERSION@ +GIMP_UNSTABLE = @GIMP_UNSTABLE@ +GIMP_USER_VERSION = @GIMP_USER_VERSION@ +GIMP_VERSION = @GIMP_VERSION@ +GIO_CFLAGS = @GIO_CFLAGS@ +GIO_LIBS = @GIO_LIBS@ +GIO_UNIX_CFLAGS = @GIO_UNIX_CFLAGS@ +GIO_UNIX_LIBS = @GIO_UNIX_LIBS@ +GIO_WINDOWS_CFLAGS = @GIO_WINDOWS_CFLAGS@ +GIO_WINDOWS_LIBS = @GIO_WINDOWS_LIBS@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_REQUIRED_VERSION = @GLIB_REQUIRED_VERSION@ +GMODULE_NO_EXPORT_CFLAGS = @GMODULE_NO_EXPORT_CFLAGS@ +GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GS_LIBS = @GS_LIBS@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +GTK_MAC_INTEGRATION_CFLAGS = @GTK_MAC_INTEGRATION_CFLAGS@ +GTK_MAC_INTEGRATION_LIBS = @GTK_MAC_INTEGRATION_LIBS@ +GTK_REQUIRED_VERSION = @GTK_REQUIRED_VERSION@ +GTK_UPDATE_ICON_CACHE = @GTK_UPDATE_ICON_CACHE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +HARFBUZZ_CFLAGS = @HARFBUZZ_CFLAGS@ +HARFBUZZ_LIBS = @HARFBUZZ_LIBS@ +HARFBUZZ_REQUIRED_VERSION = @HARFBUZZ_REQUIRED_VERSION@ +HAVE_CXX14 = @HAVE_CXX14@ +HAVE_FINITE = @HAVE_FINITE@ +HAVE_ISFINITE = @HAVE_ISFINITE@ +HAVE_VFORK = @HAVE_VFORK@ +HOST_GLIB_COMPILE_RESOURCES = @HOST_GLIB_COMPILE_RESOURCES@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_REQUIRED_VERSION = @INTLTOOL_REQUIRED_VERSION@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +ISO_CODES_LOCALEDIR = @ISO_CODES_LOCALEDIR@ +ISO_CODES_LOCATION = @ISO_CODES_LOCATION@ +JPEG_LIBS = @JPEG_LIBS@ +JSON_GLIB_CFLAGS = @JSON_GLIB_CFLAGS@ +JSON_GLIB_LIBS = @JSON_GLIB_LIBS@ +JXL_CFLAGS = @JXL_CFLAGS@ +JXL_LIBS = @JXL_LIBS@ +JXL_THREADS_CFLAGS = @JXL_THREADS_CFLAGS@ +JXL_THREADS_LIBS = @JXL_THREADS_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LCMS_REQUIRED_VERSION = @LCMS_REQUIRED_VERSION@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ +LIBBACKTRACE_LIBS = @LIBBACKTRACE_LIBS@ +LIBHEIF_CFLAGS = @LIBHEIF_CFLAGS@ +LIBHEIF_LIBS = @LIBHEIF_LIBS@ +LIBHEIF_REQUIRED_VERSION = @LIBHEIF_REQUIRED_VERSION@ +LIBJXL_REQUIRED_VERSION = @LIBJXL_REQUIRED_VERSION@ +LIBLZMA_REQUIRED_VERSION = @LIBLZMA_REQUIRED_VERSION@ +LIBMYPAINT_CFLAGS = @LIBMYPAINT_CFLAGS@ +LIBMYPAINT_LIBS = @LIBMYPAINT_LIBS@ +LIBMYPAINT_REQUIRED_VERSION = @LIBMYPAINT_REQUIRED_VERSION@ +LIBOBJS = @LIBOBJS@ +LIBPNG_REQUIRED_VERSION = @LIBPNG_REQUIRED_VERSION@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ +LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ +LIBUNWIND_REQUIRED_VERSION = @LIBUNWIND_REQUIRED_VERSION@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_CURRENT_MINUS_AGE = @LT_CURRENT_MINUS_AGE@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LT_VERSION_INFO = @LT_VERSION_INFO@ +LZMA_CFLAGS = @LZMA_CFLAGS@ +LZMA_LIBS = @LZMA_LIBS@ +MAIL = @MAIL@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MIME_INFO_CFLAGS = @MIME_INFO_CFLAGS@ +MIME_INFO_LIBS = @MIME_INFO_LIBS@ +MIME_TYPES = @MIME_TYPES@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MMX_EXTRA_CFLAGS = @MMX_EXTRA_CFLAGS@ +MNG_CFLAGS = @MNG_CFLAGS@ +MNG_LIBS = @MNG_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +MYPAINT_BRUSHES_CFLAGS = @MYPAINT_BRUSHES_CFLAGS@ +MYPAINT_BRUSHES_LIBS = @MYPAINT_BRUSHES_LIBS@ +NATIVE_GLIB_CFLAGS = @NATIVE_GLIB_CFLAGS@ +NATIVE_GLIB_LIBS = @NATIVE_GLIB_LIBS@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENEXR_CFLAGS = @OPENEXR_CFLAGS@ +OPENEXR_LIBS = @OPENEXR_LIBS@ +OPENEXR_REQUIRED_VERSION = @OPENEXR_REQUIRED_VERSION@ +OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@ +OPENJPEG_LIBS = @OPENJPEG_LIBS@ +OPENJPEG_REQUIRED_VERSION = @OPENJPEG_REQUIRED_VERSION@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOCAIRO_CFLAGS = @PANGOCAIRO_CFLAGS@ +PANGOCAIRO_LIBS = @PANGOCAIRO_LIBS@ +PANGOCAIRO_REQUIRED_VERSION = @PANGOCAIRO_REQUIRED_VERSION@ +PATHSEP = @PATHSEP@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_REQUIRED_VERSION = @PERL_REQUIRED_VERSION@ +PERL_VERSION = @PERL_VERSION@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PNG_CFLAGS = @PNG_CFLAGS@ +PNG_LIBS = @PNG_LIBS@ +POFILES = @POFILES@ +POPPLER_CFLAGS = @POPPLER_CFLAGS@ +POPPLER_DATA_CFLAGS = @POPPLER_DATA_CFLAGS@ +POPPLER_DATA_LIBS = @POPPLER_DATA_LIBS@ +POPPLER_DATA_REQUIRED_VERSION = @POPPLER_DATA_REQUIRED_VERSION@ +POPPLER_LIBS = @POPPLER_LIBS@ +POPPLER_REQUIRED_VERSION = @POPPLER_REQUIRED_VERSION@ +POSUB = @POSUB@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +PYBIN_PATH = @PYBIN_PATH@ +PYCAIRO_CFLAGS = @PYCAIRO_CFLAGS@ +PYCAIRO_LIBS = @PYCAIRO_LIBS@ +PYGIMP_EXTRA_CFLAGS = @PYGIMP_EXTRA_CFLAGS@ +PYGTK_CFLAGS = @PYGTK_CFLAGS@ +PYGTK_CODEGEN = @PYGTK_CODEGEN@ +PYGTK_DEFSDIR = @PYGTK_DEFSDIR@ +PYGTK_LIBS = @PYGTK_LIBS@ +PYLINK_LIBS = @PYLINK_LIBS@ +PYTHON = @PYTHON@ +PYTHON2_REQUIRED_VERSION = @PYTHON2_REQUIRED_VERSION@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_INCLUDES = @PYTHON_INCLUDES@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RSVG_REQUIRED_VERSION = @RSVG_REQUIRED_VERSION@ +RT_LIBS = @RT_LIBS@ +SCREENSHOT_LIBS = @SCREENSHOT_LIBS@ +SED = @SED@ +SENDMAIL = @SENDMAIL@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOCKET_LIBS = @SOCKET_LIBS@ +SSE2_EXTRA_CFLAGS = @SSE2_EXTRA_CFLAGS@ +SSE4_1_EXTRA_CFLAGS = @SSE4_1_EXTRA_CFLAGS@ +SSE_EXTRA_CFLAGS = @SSE_EXTRA_CFLAGS@ +STRIP = @STRIP@ +SVG_CFLAGS = @SVG_CFLAGS@ +SVG_LIBS = @SVG_LIBS@ +SYMPREFIX = @SYMPREFIX@ +TIFF_LIBS = @TIFF_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WEBKIT_CFLAGS = @WEBKIT_CFLAGS@ +WEBKIT_LIBS = @WEBKIT_LIBS@ +WEBKIT_REQUIRED_VERSION = @WEBKIT_REQUIRED_VERSION@ +WEBPDEMUX_CFLAGS = @WEBPDEMUX_CFLAGS@ +WEBPDEMUX_LIBS = @WEBPDEMUX_LIBS@ +WEBPMUX_CFLAGS = @WEBPMUX_CFLAGS@ +WEBPMUX_LIBS = @WEBPMUX_LIBS@ +WEBP_CFLAGS = @WEBP_CFLAGS@ +WEBP_LIBS = @WEBP_LIBS@ +WEBP_REQUIRED_VERSION = @WEBP_REQUIRED_VERSION@ +WEB_PAGE = @WEB_PAGE@ +WIN32_LARGE_ADDRESS_AWARE = @WIN32_LARGE_ADDRESS_AWARE@ +WINDRES = @WINDRES@ +WMF_CFLAGS = @WMF_CFLAGS@ +WMF_CONFIG = @WMF_CONFIG@ +WMF_LIBS = @WMF_LIBS@ +WMF_REQUIRED_VERSION = @WMF_REQUIRED_VERSION@ +XDG_EMAIL = @XDG_EMAIL@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_REQUIRED_VERSION = @XGETTEXT_REQUIRED_VERSION@ +XMC_CFLAGS = @XMC_CFLAGS@ +XMC_LIBS = @XMC_LIBS@ +XMKMF = @XMKMF@ +XMLLINT = @XMLLINT@ +XMU_LIBS = @XMU_LIBS@ +XPM_LIBS = @XPM_LIBS@ +XSLTPROC = @XSLTPROC@ +XVFB_RUN = @XVFB_RUN@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Z_LIBS = @Z_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CC_FOR_BUILD = @ac_ct_CC_FOR_BUILD@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gimpdatadir = @gimpdatadir@ +gimpdir = @gimpdir@ +gimplocaledir = @gimplocaledir@ +gimpplugindir = @gimpplugindir@ +gimpsysconfdir = @gimpsysconfdir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +manpage_gimpdir = @manpage_gimpdir@ +mkdir_p = @mkdir_p@ +ms_librarian = @ms_librarian@ +mypaint_brushes_dir = @mypaint_brushes_dir@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +STOCK_IMAGES = \ + stock-bezier.png \ + stock-circle.png \ + stock-copy-object.png \ + stock-curve.png \ + stock-delete-object.png \ + stock-ellipse.png \ + stock-line.png \ + stock-move-object.png \ + stock-move-point.png \ + stock-polygon.png \ + stock-rectangle.png \ + stock-select-object.png \ + stock-show-all.png \ + stock-spiral.png \ + stock-star.png \ + stock-logo.png + +EXTRA_DIST = $(STOCK_IMAGES) +noinst_DATA = gfig-stock-pixbufs.h +CLEANFILES = $(noinst_DATA) stock-icons.list +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plug-ins/gfig/images/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plug-ins/gfig/images/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(DATA) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +stock-icons.list: $(STOCK_IMAGES) Makefile.am + ( rm -f $@; \ + for image in $(STOCK_IMAGES); do \ + echo $$image | \ + sed -e 's|.*/||' -e 's|-|_|g' -e 's|\.png$$||' >> $@; \ + echo " $(srcdir)/$$image" >> $@; \ + done ) + +$(srcdir)/gfig-stock-pixbufs.h: stock-icons.list + $(GDK_PIXBUF_CSOURCE) --raw --build-list `cat stock-icons.list` > $(@F) + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/plug-ins/gfig/images/stock-bezier.png b/plug-ins/gfig/images/stock-bezier.png Binary files differnew file mode 100644 index 0000000..6d4955d --- /dev/null +++ b/plug-ins/gfig/images/stock-bezier.png diff --git a/plug-ins/gfig/images/stock-circle.png b/plug-ins/gfig/images/stock-circle.png Binary files differnew file mode 100644 index 0000000..f926cce --- /dev/null +++ b/plug-ins/gfig/images/stock-circle.png diff --git a/plug-ins/gfig/images/stock-copy-object.png b/plug-ins/gfig/images/stock-copy-object.png Binary files differnew file mode 100644 index 0000000..0608b2d --- /dev/null +++ b/plug-ins/gfig/images/stock-copy-object.png diff --git a/plug-ins/gfig/images/stock-curve.png b/plug-ins/gfig/images/stock-curve.png Binary files differnew file mode 100644 index 0000000..36d58a0 --- /dev/null +++ b/plug-ins/gfig/images/stock-curve.png diff --git a/plug-ins/gfig/images/stock-delete-object.png b/plug-ins/gfig/images/stock-delete-object.png Binary files differnew file mode 100644 index 0000000..cc5cc78 --- /dev/null +++ b/plug-ins/gfig/images/stock-delete-object.png diff --git a/plug-ins/gfig/images/stock-ellipse.png b/plug-ins/gfig/images/stock-ellipse.png Binary files differnew file mode 100644 index 0000000..e5cac4d --- /dev/null +++ b/plug-ins/gfig/images/stock-ellipse.png diff --git a/plug-ins/gfig/images/stock-line.png b/plug-ins/gfig/images/stock-line.png Binary files differnew file mode 100644 index 0000000..071e61e --- /dev/null +++ b/plug-ins/gfig/images/stock-line.png diff --git a/plug-ins/gfig/images/stock-logo.png b/plug-ins/gfig/images/stock-logo.png Binary files differnew file mode 100644 index 0000000..d47a675 --- /dev/null +++ b/plug-ins/gfig/images/stock-logo.png diff --git a/plug-ins/gfig/images/stock-move-object.png b/plug-ins/gfig/images/stock-move-object.png Binary files differnew file mode 100644 index 0000000..f2e502b --- /dev/null +++ b/plug-ins/gfig/images/stock-move-object.png diff --git a/plug-ins/gfig/images/stock-move-point.png b/plug-ins/gfig/images/stock-move-point.png Binary files differnew file mode 100644 index 0000000..a4d9cd9 --- /dev/null +++ b/plug-ins/gfig/images/stock-move-point.png diff --git a/plug-ins/gfig/images/stock-polygon.png b/plug-ins/gfig/images/stock-polygon.png Binary files differnew file mode 100644 index 0000000..cd78f4a --- /dev/null +++ b/plug-ins/gfig/images/stock-polygon.png diff --git a/plug-ins/gfig/images/stock-rectangle.png b/plug-ins/gfig/images/stock-rectangle.png Binary files differnew file mode 100644 index 0000000..8800ac8 --- /dev/null +++ b/plug-ins/gfig/images/stock-rectangle.png diff --git a/plug-ins/gfig/images/stock-select-object.png b/plug-ins/gfig/images/stock-select-object.png Binary files differnew file mode 100644 index 0000000..3ac980b --- /dev/null +++ b/plug-ins/gfig/images/stock-select-object.png diff --git a/plug-ins/gfig/images/stock-show-all.png b/plug-ins/gfig/images/stock-show-all.png Binary files differnew file mode 100644 index 0000000..0a24db1 --- /dev/null +++ b/plug-ins/gfig/images/stock-show-all.png diff --git a/plug-ins/gfig/images/stock-spiral.png b/plug-ins/gfig/images/stock-spiral.png Binary files differnew file mode 100644 index 0000000..4e04807 --- /dev/null +++ b/plug-ins/gfig/images/stock-spiral.png diff --git a/plug-ins/gfig/images/stock-star.png b/plug-ins/gfig/images/stock-star.png Binary files differnew file mode 100644 index 0000000..dfeff33 --- /dev/null +++ b/plug-ins/gfig/images/stock-star.png |